diff --git a/.ci/memcheck.sh b/.ci/memcheck.sh deleted file mode 100755 index f5ce496833..0000000000 --- a/.ci/memcheck.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# -# This file is part of the Zephir. -# -# (c) Phalcon Team -# -# For the full copyright and license information, please view -# the LICENSE file that was distributed with this source code. - -if [ "$(command -v valgrind 2>/dev/null)" = "" ]; then - (>&2 echo "Valgring does not exist. Can not check for memory leaks.") - (>&2 echo "Aborting.") - exit 1 -fi - -# Correctly show the stack frames for extensions compiled as shared libraries -export ZEND_DONT_UNLOAD_MODULES=1 - -# Disable Zend memory manager before running PHP with valgrind -export USE_ZEND_ALLOC=0 - -# Do not stop testing on failures -export PHPUNIT_DONT_EXIT=1 - -if [ "$(php-config --vernum)" -lt "70200" ]; then - test_suite="Extension_Php70" -else - test_suite="Extension_Php72" -fi - -valgrind \ - --read-var-info=yes \ - --error-exitcode=1 \ - --fullpath-after= \ - --track-origins=yes \ - --leak-check=full \ - --num-callers=20 \ - --run-libc-freeres=no \ - php \ - -d "extension=ext/modules/stub.so" \ - "vendor/bin/simple-phpunit" \ - --no-coverage \ - --testsuite "$test_suite" diff --git a/docker/7.4/.bashrc b/.docker/8.0/.bashrc similarity index 100% rename from docker/7.4/.bashrc rename to .docker/8.0/.bashrc diff --git a/docker/8.0/Dockerfile b/.docker/8.0/Dockerfile similarity index 77% rename from docker/8.0/Dockerfile rename to .docker/8.0/Dockerfile index 847ea05e03..97fd99e14e 100644 --- a/docker/8.0/Dockerfile +++ b/.docker/8.0/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:latest as composer +FROM composer:latest AS composer FROM php:8.0-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; @@ -13,10 +13,10 @@ RUN apt update -y && apt install -y \ libicu-dev \ libgmp-dev \ libzip-dev && \ - pecl install psr zephir_parser + pecl install psr xdebug zephir_parser RUN docker-php-ext-install zip gmp intl mysqli && \ - docker-php-ext-enable psr zephir_parser + docker-php-ext-enable psr zephir_parser xdebug COPY --from=composer /usr/bin/composer /usr/local/bin/composer # Bash script with helper aliases diff --git a/docker/8.0/.bashrc b/.docker/8.1/.bashrc similarity index 100% rename from docker/8.0/.bashrc rename to .docker/8.1/.bashrc diff --git a/docker/8.1/Dockerfile b/.docker/8.1/Dockerfile similarity index 77% rename from docker/8.1/Dockerfile rename to .docker/8.1/Dockerfile index 4e001b9f04..2b2852edfa 100644 --- a/docker/8.1/Dockerfile +++ b/.docker/8.1/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:latest as composer +FROM composer:latest AS composer FROM php:8.1-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; @@ -13,10 +13,10 @@ RUN apt update -y && apt install -y \ libicu-dev \ libgmp-dev \ libzip-dev && \ - pecl install psr zephir_parser + pecl install psr xdebug zephir_parser RUN docker-php-ext-install zip gmp intl mysqli && \ - docker-php-ext-enable psr zephir_parser + docker-php-ext-enable psr zephir_parser xdebug COPY --from=composer /usr/bin/composer /usr/local/bin/composer # Bash script with helper aliases diff --git a/docker/8.1/.bashrc b/.docker/8.2/.bashrc similarity index 100% rename from docker/8.1/.bashrc rename to .docker/8.2/.bashrc diff --git a/docker/8.2/Dockerfile b/.docker/8.2/Dockerfile similarity index 77% rename from docker/8.2/Dockerfile rename to .docker/8.2/Dockerfile index 69174c95e8..9dc1208777 100644 --- a/docker/8.2/Dockerfile +++ b/.docker/8.2/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:latest as composer +FROM composer:latest AS composer FROM php:8.2-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; @@ -13,10 +13,10 @@ RUN apt update -y && apt install -y \ libicu-dev \ libgmp-dev \ libzip-dev && \ - pecl install psr zephir_parser + pecl install psr xdebug zephir_parser RUN docker-php-ext-install zip gmp intl mysqli && \ - docker-php-ext-enable psr zephir_parser + docker-php-ext-enable psr zephir_parser xdebug COPY --from=composer /usr/bin/composer /usr/local/bin/composer # Bash script with helper aliases diff --git a/docker/8.2/.bashrc b/.docker/8.3/.bashrc similarity index 100% rename from docker/8.2/.bashrc rename to .docker/8.3/.bashrc diff --git a/docker/7.4/Dockerfile b/.docker/8.3/Dockerfile similarity index 74% rename from docker/7.4/Dockerfile rename to .docker/8.3/Dockerfile index a8e41fe611..9ac24b1927 100644 --- a/docker/7.4/Dockerfile +++ b/.docker/8.3/Dockerfile @@ -1,5 +1,5 @@ -FROM composer:latest as composer -FROM php:7.4-fpm +FROM composer:latest AS composer +FROM php:8.3-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; ENV MAKEFLAGS="-j${CPU_CORES}" @@ -13,10 +13,10 @@ RUN apt update -y && apt install -y \ libicu-dev \ libgmp-dev \ libzip-dev && \ - pecl install psr zephir_parser + pecl install psr zephir_parser xdebug RUN docker-php-ext-install zip gmp intl mysqli && \ - docker-php-ext-enable psr zephir_parser + docker-php-ext-enable psr zephir_parser xdebug COPY --from=composer /usr/bin/composer /usr/local/bin/composer # Bash script with helper aliases diff --git a/.github/workflows/build-macos-ext/action.yml b/.github/workflows/build-macos-ext/action.yml index f379ed0fe8..e603f7e95a 100644 --- a/.github/workflows/build-macos-ext/action.yml +++ b/.github/workflows/build-macos-ext/action.yml @@ -56,4 +56,8 @@ runs: shell: bash run: | cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so" - echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}/conf.d/99-stub.ini + if [ "${{ matrix.ts }}" = "ts" ]; then + echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}-zts/conf.d/99-stub.ini + else + echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}/conf.d/99-stub.ini + fi diff --git a/.github/workflows/build-win-ext/action.yml b/.github/workflows/build-win-ext/action.yml index 113c334a48..6a4db676b6 100644 --- a/.github/workflows/build-win-ext/action.yml +++ b/.github/workflows/build-win-ext/action.yml @@ -33,7 +33,7 @@ runs: using: 'composite' steps: - name: Setup Downloads Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ env.CACHE_DIR }} key: ${{ runner.os }}-downloads-${{ hashFiles('**/.github/workflows/build-win-ext/actions.yml') }} @@ -46,7 +46,6 @@ runs: shell: powershell run: | Write-Output "::group::Install dependencies" - mkdir ${{ env.CACHE_DIR }}\Choco choco install --no-progress -y --cache-location=${{ env.CACHE_DIR }}\Choco re2c Write-Output "::endgroup::" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 213579decb..920330e4db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ on: env: RE2C_VERSION: 2.2 - ZEPHIR_PARSER_VERSION: 1.5.3 + ZEPHIR_PARSER_VERSION: 1.6.1 PSR_VERSION: 1.2.0 CACHE_DIR: .cache @@ -26,17 +26,16 @@ jobs: name: Static Code Analysis runs-on: ubuntu-latest steps: - - name: Checkout Code - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 1 - name: Setup PHP uses: shivammathur/setup-php@v2 env: - PHP_CS_FIXER_VERSION: 3.2.0 + PHP_CS_FIXER_VERSION: 3.37.0 with: - php-version: '7.4' + php-version: '8.0' coverage: none tools: php-cs-fixer:${{ env.PHP_CS_FIXER_VERSION }}, phpcs @@ -45,10 +44,11 @@ jobs: phpcs --version phpcs --runtime-set ignore_warnings_on_exit true - - name: Run PHP CS Fixer - if: always() - run: | - php-cs-fixer fix --diff --dry-run -v --using-cache=no +# Disabling for now until I figure out the rules +# - name: Run PHP CS Fixer +# if: always() +# run: | +# php-cs-fixer fix --diff --dry-run -v --using-cache=no - name: Run Shell Check if: always() @@ -61,7 +61,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '7.4', '8.0' , '8.1', '8.2' ] + php: [ '8.0', '8.1', '8.2', '8.3' ] ts: [ 'ts', 'nts' ] arch: [ 'x64' ] @@ -77,23 +77,21 @@ jobs: # macOS - { name: macos-clang, os: macos-12, compiler: clang } # Windows - - { php: '7.4', ts: 'ts', arch: 'x64', name: 'windows2019-vc15', os: 'windows-2019', compiler: 'vc15' } - - { php: '7.4', ts: 'nts', arch: 'x64', name: 'windows2019-vc15', os: 'windows-2019', compiler: 'vc15' } - { php: '8.0', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } - { php: '8.0', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } - { php: '8.1', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } - { php: '8.1', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } - # Disabled due PSR extension wasn't complied for 8.2 + # Disabled due PSR extension wasn't complied for >=8.2 #- { php: '8.2', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } #- { php: '8.2', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 5 - name: Install PHP ${{ matrix.php }} - uses: shivammathur/setup-php@develop + uses: shivammathur/setup-php@v2 with: php-version: '${{ matrix.php }}' extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-${{ env.PSR_VERSION }}, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} @@ -115,22 +113,8 @@ jobs: phpts: ${{ matrix.ts }} COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# - name: Get composer cache directory -# id: composer-cache -# run: echo "::set-output name=dir::$(composer config cache-files-dir)" - -# - name: Set Up Composer Cache -# uses: actions/cache@v2 -# with: -# path: ${{ steps.composer-cache.outputs.dir }} -# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} -# restore-keys: ${{ runner.os }}-composer- - - name: Install Project Dependencies - run: | - echo "::group::Install composer dependencies" - composer install --prefer-dist --no-interaction --no-ansi --no-progress - echo "::endgroup::" + run: composer install --prefer-dist --no-interaction --no-ansi --no-progress - name: Fast Commands Test run: php zephir --help @@ -177,13 +161,21 @@ jobs: shell: pwsh run: | php vendor/bin/phpunit -c phpunit.ext.xml + env: + XDEBUG_MODE: coverage - name: Unit Tests (Zephir) if: always() - run: php vendor/bin/phpunit --testsuite Zephir + run: php vendor/bin/phpunit --testsuite Zephir --coverage-php ./tests/output/clover.xml env: XDEBUG_MODE: coverage + - name: "Upload coverage file artifact" + uses: "actions/upload-artifact@v3" + with: + name: "unit-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}.coverage" + path: "tests/output/clover.xml" + - name: Black-box Testing if: always() && runner.os != 'Windows' shell: bash @@ -191,17 +183,69 @@ jobs: run: | make -j$(getconf _NPROCESSORS_ONLN) - - name: Upload Code Coverage Report - uses: codecov/codecov-action@v2 + upload-coverage: + permissions: + contents: read + + name: "Upload coverage" + runs-on: "ubuntu-22.04" + needs: + - "build-and-test" + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + +# - name: 'Qodana Scan' +# uses: JetBrains/qodana-action@v2023.2 +# env: +# QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} +# with: +# args: --baseline,./qodana.sarif.json + +# - name: 'Qodana Scan' +# run: | +# docker run \ +# -v $(pwd):/data/project/ \ +# -v $(pwd):/data/base/ \ +# -e QODANA_TOKEN="${{ secrets.CODECOV_TOKEN }}" \ +# jetbrains/qodana-php \ +# --baseline /data/base/qodana.sarif.json + + - name: "Create download folder" + run: | + mkdir -p reports + + - name: "Download coverage files" + uses: "actions/download-artifact@v4.1.7" + with: + path: "reports" + + - name: "Display structure of downloaded files" + run: ls -R + working-directory: reports + + - name: "Upload to Codecov" + uses: "codecov/codecov-action@v3" with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./tests/output/clover.xml - flags: unittests,${{ runner.os }},php-${{ matrix.php }} + directory: reports + fail_ci_if_error: true + verbose: true name: codecov-umbrella + - name: "Upload to Qodana" + run: | + docker run \ + -v $(pwd):/data/project/ \ + -v ./reports/:/data/coverage \ + -e QODANA_TOKEN="${{ secrets.QODANA_TOKEN }}" \ + jetbrains/qodana-php + - name: Upload build artifacts after Failure if: failure() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: debug-PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }} path: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb9ff91f50..d3f466f32a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,8 +14,7 @@ jobs: BOX_VERSION: 4.2.0 steps: - - name: Checkout Code - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 5 @@ -32,7 +31,7 @@ jobs: run: echo ::set-output name=dir::$(composer config cache-files-dir) - name: Setup Composer Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index d65f15480c..6626c7ac51 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,8 +1,6 @@ @@ -11,7 +9,9 @@ * the LICENSE file that was distributed with this source code. */ -if (!file_exists(__DIR__.'/Library')) { +declare(strict_types=1); + +if (!file_exists(__DIR__.'/src')) { exit(0); } @@ -31,7 +31,7 @@ 'ext', 'ide', 'config/class-entries', - 'templates/ZendEngine3', + 'templates/engine', 'templates/Api', 'tests/ext-bootstrap', 'tests/fixtures', @@ -49,7 +49,7 @@ '@Symfony' => true, '@Symfony:risky' => true, '@PHPUnit48Migration:risky' => true, - '@PSR2' => true, + '@PSR12' => true, 'php_unit_no_expectation_annotation' => false, 'array_syntax' => ['syntax' => 'short'], 'fopen_flags' => false, diff --git a/CHANGELOG.md b/CHANGELOG.md index a8c8eeb2b2..5b30620411 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org). ## [Unreleased] +## [0.18.0] - 2024-09-29 +### Added +- Added support of PHP `8.3` [#2407](https://github.com/zephir-lang/zephir/issues/2407) +- Added support of multiple return types in stubs +- Changed `PHP_DEBUG` const usage to `ZEND_DEBUG_BUILD` + +### Changed +- Changed minimal PHP version to `8.0` [#2407](https://github.com/zephir-lang/zephir/issues/2407) + ## [0.17.0] - 2023-02-11 ### Added - Added support of PHP `8.2` [#2255](https://github.com/zephir-lang/zephir/issues/2370) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 3727d09f87..2b121feee2 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -19,7 +19,7 @@ disagree. ## Conflict If ever conflict arises, please bring it to the attention of the maintainers -privately. You can always find us on our [Discord](https://phalcon.link/discord) +privately. You can always find us on our [Discord](https://phalcon.io/discord) server or you can send us an email at team@phalcon.io The core team maintains the final decision on any conflict that may arise. diff --git a/Library/Backends/BackendFactory.php b/Library/Backends/BackendFactory.php deleted file mode 100644 index 837481a1bb..0000000000 --- a/Library/Backends/BackendFactory.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Backends; - -use Symfony\Component\Console\Input\ArgvInput; -use Zephir\BaseBackend; -use Zephir\Config; -use Zephir\Exception\IllegalStateException; - -final class BackendFactory -{ - private Config $config; - private string $kernelsPath; - private string $templatesPath; - - public function __construct(Config $config, string $kernelsPath, string $templatesPath) - { - $this->config = $config; - $this->kernelsPath = $kernelsPath; - $this->templatesPath = $templatesPath; - } - - public function createBackend() - { - $backendClassName = $this->resolveBackendClass(); - - return new $backendClassName( - $this->config, - $this->kernelsPath, - $this->templatesPath - ); - } - - /** - * Resolve backend class. - * - * @throws IllegalStateException - * - * @return string - */ - private function resolveBackendClass(): string - { - $parser = new ArgvInput(); - $backend = $parser->getParameterOption('--backend', null); - - if (null === $backend) { - // Do not use this feature for typical use case. - // Overriding backend using env var provided only for - // testing purposes and may be removed in the future. - // You SHOULD NOT rely on this possibility. - if (getenv('ZEPHIR_BACKEND')) { - $backend = getenv('ZEPHIR_BACKEND'); - } - } - - if (null === $backend) { - $backend = BaseBackend::getActiveBackend(); - } - - $className = "Zephir\\Backends\\{$backend}\\Backend"; - - if (!class_exists($className) || 'ZendEngine2' === $backend) { - throw new IllegalStateException(sprintf('Backend class "%s" does not exist.', $backend)); - } - - return $className; - } -} diff --git a/Library/Backends/ZendEngine2/Backend.php b/Library/Backends/ZendEngine2/Backend.php deleted file mode 100644 index e317542532..0000000000 --- a/Library/Backends/ZendEngine2/Backend.php +++ /dev/null @@ -1,1212 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Backends\ZendEngine2; - -use Zephir\BaseBackend; -use Zephir\ClassMethod; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Compiler; -use Zephir\Exception\CompilerException; -use Zephir\Fcall\FcallManagerInterface; -use Zephir\GlobalConstant; -use Zephir\Variable; - -use function in_array; - -/** - * NOTE: ZendEngine2 backend is no longer supported - * and this class will be removed in the future. - */ -class Backend extends BaseBackend -{ - protected $name = 'ZendEngine2'; - - /** - * {@inheritdoc} - * - * @return bool - */ - public function isZE3() - { - return false; - } - - /** - * {@inheritdoc} - * - * @return FcallManagerInterface - */ - public function getFcallManager() - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function getVariableCodePointer(Variable $variable) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function getVariableCode(Variable $variable): string - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function getBoolCode(Variable $variable, CompilationContext $context, $useCodePrinter = true) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function getStringsManager() - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function getTypeDefinition($type) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function getTypeofCondition( - Variable $variableVariable, - string $operator, - string $value, - CompilationContext $context - ): string { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function onPreInitVar(ClassMethod $method, CompilationContext $context): string - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function onPreCompile(ClassMethod $method, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function onPostCompile(ClassMethod $method, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function initializeVariableDefaults(array $variables, CompilationContext $context): string - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function declareConstant($type, $name, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function declareVariables($method, $typeToVariables, CompilationContext $compilationContext) - { - $varInitCode = []; - $additionalCode = $method ? $this->onPreInitVar($method, $compilationContext) : ''; - - foreach ($typeToVariables as $type => $variables) { - list($pointer, $code) = $this->getTypeDefinition($type); - $code .= ' '; - $groupVariables = []; - - /** - * @var Variable[] - */ - foreach ($variables as $variable) { - $nextCode = $this->generateInitCode($groupVariables, $type, $pointer, $variable); - if ($nextCode && $additionalCode) { - $additionalCode .= PHP_EOL.$nextCode; - } else { - $additionalCode .= $nextCode; - } - } - - $varInitCode[] = $code.implode(', ', $groupVariables).';'; - } - /* Keep order consistent with previous zephir versions (BC-only) */ - $varInitCode = array_reverse($varInitCode); - if ($additionalCode) { - $varInitCode[] = $additionalCode; - } - - return $varInitCode; - } - - public function initVar(Variable $variable, CompilationContext $context, $useCodePrinter = true, $second = false) - { - $macro = !$second ? 'ZEPHIR_INIT_VAR' : 'ZEPHIR_INIT_NVAR'; - $code = $macro.'('.$this->getVariableCode($variable).');'; - if ($useCodePrinter) { - $context->codePrinter->output($code); - } - - return $code; - } - - /** - * {@inheritdoc} - */ - public function getInternalSignature(ClassMethod $method, CompilationContext $context): string - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - * - * @param Variable $variable - * @param string|Variable $value - * @param CompilationContext $context - * @param bool $useCodePrinter - * - * @return string - */ - public function assignString( - Variable $variable, - $value, - CompilationContext $context, - bool $useCodePrinter = true - ): string { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function returnString($value, CompilationContext $context, $useCodePrinter = true, $doCopy = true) - { - return $this->returnHelper('RETURN_MM_STRING', $value, $context, $useCodePrinter, $doCopy); - } - - public function assignLong(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) - { - return $this->assignHelper('ZVAL_LONG', $this->getVariableCode($variable), $value, $context, $useCodePrinter); - } - - public function assignDouble(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) - { - return $this->assignHelper('ZVAL_DOUBLE', $this->getVariableCode($variable), $value, $context, $useCodePrinter); - } - - public function assignBool(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) - { - return $this->assignHelper('ZVAL_BOOL', $this->getVariableCode($variable), $value, $context, $useCodePrinter); - } - - public function assignNull(Variable $variable, CompilationContext $context, $useCodePrinter = true) - { - $output = 'ZVAL_NULL('.$this->getVariableCode($variable).');'; - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - public function assignZval(Variable $variable, $code, CompilationContext $context) - { - $code = $this->resolveValue($code, $context); - $context->codePrinter->output($this->getVariableCode($variable).' = '.$code.';'); - } - - public function concatSelf(Variable $variable, Variable $itemVariable, CompilationContext $context) - { - $variable = $this->getVariableCodePointer($variable); - $itemVariable = $this->getVariableCode($itemVariable); - $context->codePrinter->output('zephir_concat_self('.$variable.', '.$itemVariable.');'); - } - - public function initArray(Variable $variable, CompilationContext $context, int $size = null) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function createClosure(Variable $variable, $classDefinition, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function addArrayEntry(Variable $variable, $key, $value, CompilationContext $context, $statement = null, $useCodePrinter = true) - { - $type = null; - $keyType = 'assoc'; - if (!isset($key)) { - $keyType = 'append'; - } elseif ($key instanceof CompiledExpression) { - $typeKey = $key->getType(); - if ('variable' == $typeKey) { - $var = $context->symbolTable->getVariableForRead($key->getCode(), $context); - $typeKey = $var->getType(); - } - if (in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { - $keyType = 'index'; - } - } - - if ('null' == $value) { - if (!isset($key)) { - $context->codePrinter->output('zephir_array_append('.$this->getVariableCodePointer($variable).', ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "'.Compiler::getShortUserPath($statement['file']).'", '.$statement['line'].');'); - - return; - } - } - switch ($value->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $type = 'long'; - break; - case 'double': - $type = 'double'; - break; - case 'string': - $type = 'stringl'; - break; - case 'variable': - case 'array': - $type = 'zval'; - break; - } - if (!$type) { - throw new CompilerException('Unknown type mapping: '.$value->getType()); - } - - if (isset($key)) { - if ('variable' == $key->getType()) { - $keyStr = 'string' == $typeKey ? 'Z_STRVAL_P('.$this->getVariableCode($var).'), Z_STRLEN_P('.$this->getVariableCode($var).') + 1' : $this->getVariableCode($var); - } else { - $keyStr = 'string' == $key->getType() ? 'SS("'.$key->getCode().'")' : $key->getCode(); - } - } - if ('stringl' == $type) { - if ($value instanceof Variable) { - $valueStr = 'Z_STRVAL_P('.$this->getVariableCode($value).'), Z_STRLEN_P('.$this->getVariableCode($value).')'; - } else { - $valueStr = 'SL("'.$value->getCode().'")'; - } - } elseif ('zval' == $type) { - $valueStr = $this->getVariableCode($value); - } else { - $valueStr = $value->getCode(); - } - $doCopy = 'stringl' == $type ? ', 1' : ''; - - if ('assoc' == $keyType) { - $output = 'add_assoc_'.$type.'_ex('.$this->getVariableCode($variable).', '.$keyStr.', '.$valueStr.$doCopy.');'; - } elseif ('append' == $keyType) { - $output = 'zephir_array_append('.$this->getVariableCodePointer($variable).', '.$this->resolveValue($value, $context).', PH_SEPARATE, "'.Compiler::getShortUserPath($statement['file']).'", '.$statement['line'].');'; - } else { - $output = 'add_index_'.$type.'('.$this->getVariableCode($variable).', '.$keyStr.', '.$valueStr.$doCopy.');'; - } - - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - public function updateArray(Variable $symbolVariable, $key, $value, CompilationContext $compilationContext, $flags = null) - { - $value = $this->resolveValue($value, $compilationContext, true); - if (!isset($flags)) { - $flags = 'PH_COPY'; - } - - if ($key instanceof Variable) { - switch ($key->getType()) { - case 'string': - case 'variable': - $compilationContext->codePrinter->output('zephir_array_update_zval('.$this->getVariableCodePointer($symbolVariable).', '.$this->getVariableCode($key).', '.$value.', '.$flags.');'); - break; - - case 'int': - case 'uint': - case 'long': - $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCodePointer($symbolVariable).', '.$key->getName().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); - break; - - default: - throw new CompilerException('updateArray: Found a variable with unsupported type '.$key->getType()); - } - } elseif ($key instanceof CompiledExpression) { - switch ($key->getType()) { - case 'string': - $compilationContext->codePrinter->output('zephir_array_update_string('.$this->getVariableCodePointer($symbolVariable).', SL("'.$key->getCode().'"), '.$value.', '.$flags.');'); - break; - - case 'int': - $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCodePointer($symbolVariable).', '.$key->getCode().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); - break; - - case 'variable': - $this->updateArray($symbolVariable, $compilationContext->symbolTable->getVariableForRead($key->getCode()), $value, $compilationContext, $flags); - break; - - default: - throw new CompilerException('updateArray: Found an expression with unsupported type '.$key->getType()); - } - } else { - throw new CompilerException('?'); - } - } - - public function initObject(Variable $variable, $ce, CompilationContext $context, $useCodePrinter = true) - { - $variableAccess = $this->getVariableCode($variable); - if (!isset($ce)) { - $output = 'object_init('.$variableAccess.');'; - } else { - $output = 'object_init_ex('.$variableAccess.', '.$ce.');'; - } - - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayAccess, CompilationContext $context, $useCodePrinter = true) - { - $context->headersManager->add('kernel/array'); - $isVariable = $index instanceof Variable; - - switch ($index->getType()) { - case 'int': - case 'uint': - case 'long': - $type = 'long'; - break; - - /* Types which map to the same */ - case 'variable': - case 'mixed': - case 'string': - $type = $index->getType(); - break; - - default: - throw new CompilerException( - sprintf('Variable type: %s cannot be used as array index without cast', $index->getType()), - $arrayAccess['right'] - ); - } - if ($isVariable && in_array($index->getType(), ['variable', 'string', 'mixed'])) { - $output = 'zephir_array_fetch('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; - } else { - if ($isVariable) { - $indexAccess = $this->getVariableCode($index); - } else { - $indexAccess = $index->getCode(); - if ('string' == $type) { - $indexAccess = 'SL("'.$indexAccess.'")'; - } - } - $output = 'zephir_array_fetch_'.$type.'('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$indexAccess.', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; - } - - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - public function arrayIsset(Variable $var, $resolvedExpr, $expression, CompilationContext $context) - { - if (!($resolvedExpr instanceof Variable)) { - if ('string' == $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset_string('.$this->getVariableCode($var).', SS("'.$resolvedExpr->getCode().'"))', $expression); - } else { - return new CompiledExpression('bool', 'zephir_array_isset_long('.$this->getVariableCode($var).', '.$resolvedExpr->getCode().')', $expression); - } - } - - if ('int' == $resolvedExpr->getType() || 'long' == $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset_long('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression); - } elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType() || 'mixed' === $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression); - } - - throw new CompilerException('['.$resolvedExpr->getType().']', $expression); - } - - public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, $flags, $expression, CompilationContext $context) - { - $code = $this->getVariableCodePointer($target).', '.$this->getVariableCode($var); - - if (!($resolvedExpr instanceof Variable)) { - if ('string' === $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset_string_fetch('.$code.', SS("'.$resolvedExpr->getCode().'"), '.$flags.')', $expression); - } elseif (in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { - return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$resolvedExpr->getCode().', '.$flags.')', $expression); - } else { - $resolvedExpr = $context->symbolTable->getVariableForRead($resolvedExpr->getCode(), $context); - } - } - - if (in_array($resolvedExpr->getType(), ['int', 'long'])) { - return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); - } elseif (in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { - return new CompiledExpression('bool', 'zephir_array_isset_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); - } - - throw new CompilerException('arrayIssetFetch ['.$resolvedExpr->getType().']', $expression); - } - - public function propertyIsset(Variable $var, $key, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationContext $context) - { - $context->headersManager->add('kernel/array'); - $variableCode = $this->getVariableCodePointer($variable); - switch ($exprIndex->getType()) { - case 'int': - case 'uint': - case 'long': - $context->codePrinter->output('zephir_array_unset_long('.$variableCode.', '.$exprIndex->getCode().', '.$flags.');'); - break; - - case 'string': - $context->codePrinter->output('zephir_array_unset_string('.$variableCode.', SS("'.$exprIndex->getCode().'"), '.$flags.');'); - break; - - case 'variable': - $variableIndex = $context->symbolTable->getVariableForRead($exprIndex->getCode(), $context, $exprIndex->getOriginal()); - $indexCode = $this->getVariableCode($variableIndex); - switch ($variableIndex->getType()) { - case 'int': - case 'uint': - case 'long': - $context->codePrinter->output('zephir_array_unset_long('.$variableCode.', '.$indexCode.', '.$flags.');'); - break; - - case 'string': - case 'variable': - case 'mixed': - $context->codePrinter->output('zephir_array_unset('.$variableCode.', '.$indexCode.', '.$flags.');'); - break; - - default: - throw new CompilerException('Variable type: '.$variableIndex->getType().' cannot be used as array index without cast'); - } - break; - - default: - throw new CompilerException('Cannot use expression: '.$exprIndex->getType().' as array index without cast'); - } - } - - public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExprs, CompilationContext $compilationContext) - { - list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); - - $symbol = $this->resolveValue($symbolVariable, $compilationContext, true); - $varCode = $this->getVariableCodePointer($variable); - $compilationContext->codePrinter->output( - sprintf( - 'zephir_array_update_multi(%s, %s, SL("%s"), %d, %s);', - $varCode, - $symbol, - $keys, - $numberParams, - implode(', ', $offsetItems) - ) - ); - } - - public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext) - { - list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); - $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); - - $compilationContext->codePrinter->output( - sprintf( - 'zephir_update_property_array_multi(%s, SL("%s"), %s, SL("%s"), %d, %s);', - $variable->getName(), - $propertyName, - $valueVariable, - $keys, - $numberParams, - implode(', ', $offsetItems) - ) - ); - } - - public function assignStaticPropertyArrayMulti($classEntry, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext) - { - list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); - $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); - - $offsetStr = $offsetItems ? ', '.implode(', ', $offsetItems) : ''; - $compilationContext->codePrinter->output( - sprintf( - 'zephir_update_static_property_array_multi_ce(%s, SL("%s"), %s, SL("%s"), %d%s);', - $classEntry, - $propertyName, - $valueVariable, - $keys, - $numberParams, - $offsetStr - ) - ); - } - - public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function fetchClass(Variable $zendClassEntry, $className, $guarded, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function fetchProperty( - Variable $symbolVariable, - Variable $variableVariable, - $property, - $readOnly, - CompilationContext $context - ) { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function fetchStaticProperty( - Variable $symbolVariable, - $classDefinition, - $property, - $readOnly, - CompilationContext $context - ) { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function resolveValue($value, CompilationContext $context, $usePointer = false) - { - if ('null' == $value) { - $value = ($usePointer ? '&' : '').'ZEPHIR_GLOBAL(global_null)'; - } elseif ('true' == $value) { - $value = ($usePointer ? '&' : '').'ZEPHIR_GLOBAL(global_true)'; - } elseif ('false' == $value) { - $value = ($usePointer ? '&' : '').'ZEPHIR_GLOBAL(global_false)'; - } elseif ($value instanceof GlobalConstant) { - return ($usePointer ? '&' : '').$value->getName(); - } elseif ($value instanceof CompiledExpression) { - if ('array' == $value->getType()) { - $var = $context->symbolTable->getVariableForWrite($value->getCode(), $context, null); - $value = $usePointer ? $this->getVariableCodePointer($var) : $this->getVariableCode($var); - } elseif ('variable' == $value->getType()) { - $value = $context->symbolTable->getVariableForWrite($value->getCode(), $context); - } else { - return $value->getCode(); - } - } - if ($value instanceof Variable) { - $value = $usePointer ? $this->getVariableCodePointer($value) : $this->getVariableCode($value); - } - - return $value; - } - - /** - * {@inheritdoc} - * - * @param Variable $variable - * @param string|Variable $property - * @param mixed $value - * @param CompilationContext $context - * - * @return void - */ - public function updateProperty(Variable $variable, $property, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function updateStaticProperty($classEntry, $property, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function addStaticProperty($classEntry, $property, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function subStaticProperty($classEntry, $property, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function assignArrayProperty(Variable $variable, $property, $key, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function checkConstructor(Variable $var, CompilationContext $context) - { - $context->codePrinter->output('if (zephir_has_constructor('.$this->getVariableCode($var).')) {'); - } - - public function callMethod($symbolVariable, Variable $variable, $methodName, $cachePointer, $params, CompilationContext $context) - { - $paramStr = null != $params ? ', '.implode(', ', $params) : ''; - $macro = 'CALL_METHOD'; - if ($methodName instanceof Variable) { - $macro = 'CALL_METHOD_ZVAL'; - $methodName = $this->getVariableCode($methodName); - } else { - $methodName = '"'.$methodName.'"'; - } - if (!isset($symbolVariable)) { - $context->codePrinter->output('ZEPHIR_'.$macro.'(NULL, '.$variable->getName().', '.$methodName.', '.$cachePointer.$paramStr.');'); - } elseif ('return_value' == $symbolVariable->getName()) { - $context->codePrinter->output('ZEPHIR_RETURN_'.$macro.'('.$variable->getName().', '.$methodName.', '.$cachePointer.$paramStr.');'); - } else { - $context->codePrinter->output('ZEPHIR_'.$macro.'(&'.$symbolVariable->getName().', '.$variable->getName().', '.$methodName.', '.$cachePointer.$paramStr.');'); - } - } - - public function callDynamicFunction($symbolVariable, Variable $variable, CompilationContext $context, $params = [], $cache = 'NULL', $cacheSlot = 0) - { - $paramStr = null != $params ? ', '.implode(', ', $params) : ''; - if (!isset($symbolVariable)) { - $context->codePrinter->output('ZEPHIR_CALL_ZVAL_FUNCTION(NULL, '.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); - } elseif ('return_value' == $symbolVariable->getName()) { - $context->codePrinter->output('ZEPHIR_RETURN_CALL_ZVAL_FUNCTION('.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); - } else { - $context->codePrinter->output('ZEPHIR_CALL_ZVAL_FUNCTION('.$this->getVariableCodePointer($symbolVariable).', '.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); - } - } - - public function zvalOperator($zvalOperator, Variable $expected, Variable $variableLeft, Variable $variableRight, CompilationContext $compilationContext) - { - $expected = $this->getVariableCode($expected); - $op1 = $this->getVariableCode($variableLeft); - $op2 = $this->getVariableCode($variableRight); - - $compilationContext->codePrinter->output($zvalOperator.'('.$expected.', '.$op1.', '.$op2.');'); - } - - public function maybeSeparate(Variable $variableTempSeparated, Variable $variable, CompilationContext $context) - { - $context->codePrinter->output($variableTempSeparated->getName().' = zephir_maybe_separate_zval('.$this->getVariableCodePointer($variable).');'); - } - - public function setSymbolIfSeparated(Variable $variableTempSeparated, Variable $variable, CompilationContext $context) - { - $context->codePrinter->output('if ('.$variableTempSeparated->getName().') {'); - $context->codePrinter->output("\t".'ZEND_SET_SYMBOL(&EG(symbol_table), "'.$variable->getName().'", '.$variable->getName().');'); - $context->codePrinter->output('}'); - } - - public function copyOnWrite(Variable $target, $var, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function forStatement(Variable $exprVariable, $keyVariable, $variable, $duplicateKey, $duplicateHash, $statement, $statementBlock, CompilationContext $compilationContext) - { - /* - * Create a hash table and hash pointer temporary variables. - */ - $arrayPointer = $compilationContext->symbolTable->addTemp('HashPosition', $compilationContext); - $arrayHash = $compilationContext->symbolTable->addTemp('HashTable', $compilationContext); - /* - * Create a temporary zval to fetch the items from the hash. - */ - $compilationContext->headersManager->add('kernel/fcall'); - $compilationContext->symbolTable->mustGrownStack(true); - if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_LAST_CALL_STATUS')) { - $callStatus = new Variable('int', 'ZEPHIR_LAST_CALL_STATUS', $compilationContext->branchManager->getCurrentBranch()); - $callStatus->setIsInitialized(true, $compilationContext); - $callStatus->increaseUses(); - $callStatus->setReadOnly(true); - $compilationContext->symbolTable->addRawVariable($callStatus); - } - $tempVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); - $tempVariable->setIsDoublePointer(true); - $tempValidVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); - $tempValidVariable->setMustInitNull(true); - $codePrinter = $compilationContext->codePrinter; - - $codePrinter->output('if (Z_TYPE_P('.$this->getVariableCode($exprVariable).') == IS_ARRAY) {'); - $codePrinter->increaseLevel(); - - $reverse = $statement['reverse'] ? 1 : 0; - - $codePrinter->output('zephir_is_iterable('.$this->getVariableCode($exprVariable).', &'.$arrayHash->getName().', &'.$arrayPointer->getName().', '.$duplicateHash.', '.$reverse.', "'.Compiler::getShortUserPath($statement['file']).'", '.$statement['line'].');'); - - $codePrinter->output('for ('); - $codePrinter->output(' ; zend_hash_get_current_data_ex('.$arrayHash->getName().', (void**) &'.$tempVariable->getName().', &'.$arrayPointer->getName().') == SUCCESS'); - if ($reverse) { - $codePrinter->output(' ; zend_hash_move_backwards_ex('.$arrayHash->getName().', &'.$arrayPointer->getName().')'); - } else { - $codePrinter->output(' ; zend_hash_move_forward_ex('.$arrayHash->getName().', &'.$arrayPointer->getName().')'); - } - $codePrinter->output(') {'); - - if (isset($keyVariable)) { - if ($duplicateKey) { - $compilationContext->symbolTable->mustGrownStack(true); - $codePrinter->output("\t".'ZEPHIR_GET_HMKEY('.$keyVariable->getName().', '.$arrayHash->getName().', '.$arrayPointer->getName().');'); - } else { - $codePrinter->output("\t".'ZEPHIR_GET_HKEY('.$keyVariable->getName().', '.$arrayHash->getName().', '.$arrayPointer->getName().');'); - } - } - - if (isset($variable)) { - $compilationContext->symbolTable->mustGrownStack(true); - $codePrinter->output("\t".'ZEPHIR_GET_HVALUE('.$variable->getName().', '.$tempVariable->getName().');'); - } - - /* - * Compile statements in the 'for' block - */ - if (isset($statement['statements'])) { - $statementBlock->isLoop(true); - if (isset($statement['key'])) { - $statementBlock->getMutateGatherer()->increaseMutations($statement['key']); - } - $statementBlock->getMutateGatherer()->increaseMutations($statement['value']); - $statementBlock->compile($compilationContext); - } - - $codePrinter->output('}'); - /* Make sure to free the duplicated hash table */ - if ($duplicateHash) { - $codePrinter->output('zend_hash_destroy('.$arrayHash->getName().');'); - $codePrinter->output('FREE_HASHTABLE('.$arrayHash->getName().');'); - } - $codePrinter->decreaseLevel(); - - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - - $codePrinter->output('ZEPHIR_CALL_METHOD(NULL, '.$this->getVariableCode($exprVariable).', "rewind", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - - $codePrinter->output('while (1) {'); - $codePrinter->increaseLevel(); - $compilationContext->headersManager->add('kernel/operators'); - - $codePrinter->output('ZEPHIR_CALL_METHOD(&'.$tempValidVariable->getName().', '.$this->getVariableCode($exprVariable).', "valid", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - $codePrinter->output('if (!zephir_is_true('.$tempValidVariable->getName().')) {'); - $codePrinter->increaseLevel(); - $codePrinter->output('break;'); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - - if (isset($keyVariable)) { - $codePrinter->output('ZEPHIR_CALL_METHOD(&'.$this->getVariableCode($keyVariable).', '.$this->getVariableCode($exprVariable).', "key", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - } - - if (isset($variable)) { - $codePrinter->output('ZEPHIR_CALL_METHOD(&'.$this->getVariableCode($variable).', '.$this->getVariableCode($exprVariable).', "current", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - } - - if (isset($statement['statements'])) { - $statementBlock->isLoop(true); - if (isset($statement['key'])) { - $statementBlock->getMutateGatherer()->increaseMutations($statement['key']); - } - $statementBlock->getMutateGatherer()->increaseMutations($statement['value']); - $statementBlock->compile($compilationContext); - } - - $codePrinter->output('ZEPHIR_CALL_METHOD(NULL, '.$this->getVariableCode($exprVariable).', "next", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - } - - public function forStatementIterator(Variable $iteratorVariable, Variable $targetVariable, CompilationContext $compilationContext) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function destroyIterator(Variable $iteratorVariable, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function ifVariableValueUndefined(Variable $var, CompilationContext $context, $onlyBody = false, $useCodePrinter = true) - { - $body = '!'.$var->getName(); - $output = 'if ('.$body.') {'; - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $onlyBody ? $body : $output; - } - - public function checkStrictType($type, $var, CompilationContext $context) - { - $codePrinter = $context->codePrinter; - $conditions = []; - - $inputParamVariable = $context->symbolTable->getVariableForWrite($var['name'], $context); - $inputParamCode = $this->getVariableCode($inputParamVariable); - $cond = 'Z_TYPE_P('.$inputParamCode.') != '; - if ($context->symbolTable->hasVariable($var['name'].'_param')) { - $parameterVariable = $context->symbolTable->getVariableForWrite($var['name'].'_param', $context); - $parameterCode = $context->backend->getVariableCode($parameterVariable); - $cond = 'Z_TYPE_P('.$parameterCode.') != '; - } - - switch ($type) { - case 'int': - case 'uint': - case 'long': - $conditions[] = $cond.'IS_LONG'; - break; - case 'bool': - if (!$this->isZE3()) { - $conditions[] = $cond.'IS_BOOL'; - } else { - $conditions[] = $cond.'IS_TRUE'; - $conditions[] = $cond.'IS_FALSE'; - } - break; - case 'double': - $conditions[] = $cond.'IS_DOUBLE'; - break; - case 'string': - case 'ulong': - $conditions[] = $cond.'IS_STRING'; - $conditions[] = $cond.'IS_NULL'; - break; - case 'array': - break; - case 'object': - case 'resource': - $conditions[] = $cond.'IS_'.strtoupper($type); - break; - case 'callable': - $conditions[] = 'zephir_is_callable('.$inputParamCode.') != 1'; - break; - default: - throw new CompilerException('Unknown type '.$type); - } - - /* Generate verification code */ - if (\count($conditions)) { - $codePrinter->output('if (UNEXPECTED('.implode(' && ', $conditions).')) {'); - $codePrinter->increaseLevel(); - - $exceptionMessage = sprintf('SL("Parameter \'%s\' must be of the type %s")', $var['name'], $type); - $codePrinter->output( - sprintf( - 'zephir_throw_exception_string(spl_ce_InvalidArgumentException, %s);', - $exceptionMessage - ) - ); - - $codePrinter->output('RETURN_MM_NULL();'); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - } - - /* Assign param */ - switch ($type) { - case 'int': - case 'long': - $codePrinter->output($var['name'].' = Z_LVAL_P('.$parameterCode.');'); - break; - case 'uint': - $codePrinter->output($var['name'].' = ZEND_ABS(Z_LVAL_P('.$parameterCode.'));'); - break; - case 'bool': - $codePrinter->output($var['name'].' = '.$this->getBoolCode($parameterVariable, $context, false).';'); - break; - case 'double': - $codePrinter->output($var['name'].' = Z_DVAL_P('.$parameterCode.');'); - break; - case 'string': - case 'ulong': - $context->headersManager->add('kernel/operators'); - $context->symbolTable->mustGrownStack(true); - $codePrinter->output('if (EXPECTED(Z_TYPE_P('.$parameterCode.') == IS_STRING)) {'); - $codePrinter->increaseLevel(); - $targetVar = $var['name']; - if ($this->isZE3()) { - $targetVar = '&'.$targetVar; - } - $codePrinter->output('zephir_get_strval('.$targetVar.', '.$var['name'].'_param);'); - $codePrinter->decreaseLevel(); - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - $this->initVar($inputParamVariable, $context); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - break; - case 'array': - $context->backend->assignZval($inputParamVariable, $parameterVariable, $context); - break; - case 'object': - case 'resource': - case 'callable': - case 'mixed': - break; - default: - throw new CompilerException('Unknown type: '.$type); - } - } - - public function fetchClassEntry($str) - { - return 'zephir_get_internal_ce(SS("'.$str.'"))'; - } - - public function getScalarTempVariable( - string $type, - CompilationContext $compilationContext, - $isLocal = false - ): Variable { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * Assign value to variable helper. - * - * @param string $macro - * @param string $variableName - * @param string|Variable|null $value - * @param CompilationContext $context - * @param bool $useCodePrinter - * - * @return string - */ - protected function assignHelper( - string $macro, - string $variableName, - $value, - CompilationContext $context, - bool $useCodePrinter - ): string { - if ($value === null && $macro === 'ZVAL_STRING') { - return ''; - } - - if ($value instanceof Variable) { - $value = $value->getName(); - } else { - $value = 'ZVAL_STRING' === $macro ? '"'.$value.'"' : $value; - } - - $output = $macro.'('.$variableName.', '.$value.');'; - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - protected function returnHelper(string $macro, $value, CompilationContext $context, $useCodePrinter, $doCopy = null): string - { - if ($value instanceof Variable) { - $value = $value->getName(); - } elseif ($macro === 'RETURN_MM_STRING' && !preg_match('/^ZEPHIR_GLOBAL/', $value)) { - $value = '"'.$value.'"'; - } - - $copyStr = ''; - if (true === $doCopy) { - $copyStr = ', 1'; - } elseif (false === $doCopy) { - $copyStr = ', 0'; - } elseif (isset($doCopy)) { - $copyStr = ', '.$doCopy; - } - - $output = $macro.'('.$value.$copyStr.');'; - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - /** - * Resolve expressions. - * - * @param CompiledExpression[]|string[] $offsetExprs - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * - * @return array - */ - private function resolveOffsetExprs($offsetExprs, CompilationContext $compilationContext) - { - $keys = ''; - $offsetItems = []; - $numberParams = 0; - - foreach ($offsetExprs as $offsetExpr) { - if ('a' == $offsetExpr) { - $keys .= 'a'; - ++$numberParams; - continue; - } - switch ($offsetExpr->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $keys .= 'l'; - $offsetItems[] = $offsetExpr->getCode(); - ++$numberParams; - break; - - case 'string': - $keys .= 's'; - $offsetItems[] = 'SL("'.$offsetExpr->getCode().'")'; - $numberParams += 2; - break; - - case 'variable': - $variableIndex = $compilationContext->symbolTable->getVariableForRead( - $offsetExpr->getCode(), - $compilationContext, - null - ); - - switch ($variableIndex->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $keys .= 'l'; - $offsetItems[] = $this->getVariableCode($variableIndex); - ++$numberParams; - break; - case 'string': - case 'variable': - $keys .= 'z'; - $offsetItems[] = $this->getVariableCode($variableIndex); - ++$numberParams; - break; - default: - throw new CompilerException( - sprintf('Variable: %s cannot be used as array index', $variableIndex->getType()), - $offsetExpr->getOriginal() - ); - } - break; - - default: - throw new CompilerException( - sprintf('Value: %s cannot be used as array index', $offsetExpr->getType()), - $offsetExpr->getOriginal() - ); - } - } - - return [$keys, $offsetItems, $numberParams]; - } -} diff --git a/Library/Backends/ZendEngine3/Backend.php b/Library/Backends/ZendEngine3/Backend.php deleted file mode 100644 index 61c53b8cea..0000000000 --- a/Library/Backends/ZendEngine3/Backend.php +++ /dev/null @@ -1,1212 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Backends\ZendEngine3; - -use Zephir\Backends\ZendEngine2\Backend as BackendZendEngine2; -use Zephir\ClassDefinition; -use Zephir\ClassMethod; -use Zephir\CodePrinter; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Compiler; -use Zephir\Exception\CompilerException; -use Zephir\Fcall\FcallManagerInterface; -use Zephir\FunctionDefinition; -use Zephir\GlobalConstant; -use Zephir\Variable; -use Zephir\Variable\Globals; - -use function Zephir\add_slashes; - -class Backend extends BackendZendEngine2 -{ - protected $name = 'ZendEngine3'; - - /** - * {@inheritdoc} - * - * @return bool - */ - public function isZE3() - { - return true; - } - - /** - * {@inheritdoc} - * - * @return FcallManagerInterface - */ - public function getFcallManager() - { - if (!$this->fcallManager) { - $this->setFcallManager(new FcallManager()); - } - - return $this->fcallManager; - } - - /** - * {@inheritdoc} - */ - public function getVariableCode(Variable $variable): string - { - if ($variable->isDoublePointer() || - \in_array($variable->getName(), ['this_ptr', 'return_value']) || - \in_array($variable->getType(), ['int', 'long'])) { - return $variable->getName(); - } - - return '&'.$variable->getName(); - } - - /** - * {@inheritdoc} - * - * TODO: Do we need this method at all? - */ - public function getVariableCodePointer(Variable $variable) - { - return $this->getVariableCode($variable); - } - - /** - * {@inheritdoc} - */ - public function getBoolCode(Variable $variable, CompilationContext $context, $useCodePrinter = true) - { - $code = '(Z_TYPE_P('.$this->getVariableCode($variable).') == IS_TRUE)'; - if ($useCodePrinter) { - $context->codePrinter->output($code); - } - - return $code; - } - - /** - * {@inheritdoc} - */ - public function getStringsManager() - { - return new StringsManager(); - } - - /** - * {@inheritdoc} - */ - public function getTypeDefinition($type): array - { - switch ($type) { - case 'zend_ulong': - return ['', 'zend_ulong']; - - case 'zend_string': - return ['*', 'zend_string']; - } - - $pointer = null; - switch ($type) { - case 'int': - $code = 'zend_long'; - break; - - case 'uint': - $code = 'zend_ulong'; - break; - - case 'char': - $code = 'char'; - break; - - case 'uchar': - $code = 'unsigned char'; - break; - - case 'long': - $code = 'long'; - break; - - case 'ulong': - $code = 'unsigned long'; - break; - - case 'bool': - case 'zephir_ce_guard': - $code = 'zend_bool'; - break; - - case 'double': - $code = 'double'; - break; - - case 'string': - case 'variable': - case 'array': - case 'null': - case 'mixed': - $pointer = '*'; - $code = 'zval'; - break; - - case 'HashTable': - $pointer = '*'; - $code = 'HashTable'; - break; - - case 'HashPosition': - $code = 'HashPosition'; - break; - - case 'zend_class_entry': - case 'static_zend_class_entry': - $pointer = '*'; - $code = 'zend_class_entry'; - break; - - case 'zend_function': - $pointer = '*'; - $code = 'zend_function'; - break; - - case 'zend_object_iterator': - $pointer = '*'; - $code = 'zend_object_iterator'; - break; - - case 'zend_property_info': - $pointer = '*'; - $code = 'zend_property_info'; - break; - - case 'zephir_fcall_cache_entry': - case 'static_zephir_fcall_cache_entry': - $pointer = '*'; - $code = 'zephir_fcall_cache_entry'; - break; - - case 'zephir_method_globals': - $pointer = '*'; - $code = 'zephir_method_globals'; - break; - - default: - throw new CompilerException('Unsupported type in declare: '.$type); - } - - return [$pointer, $code]; - } - - /** - * {@inheritdoc} - * - * @param Variable $variableVariable - * @param string $operator - * @param string $value - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return string - */ - public function getTypeofCondition( - Variable $variableVariable, - string $operator, - string $value, - CompilationContext $context - ): string { - $variableName = $this->getVariableCode($variableVariable); - - switch ($value) { - case 'array': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_ARRAY'; - break; - - case 'object': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_OBJECT'; - break; - - case 'null': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_NULL'; - break; - - case 'string': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_STRING'; - break; - - case 'int': - case 'long': - case 'integer': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_LONG'; - break; - - case 'double': - case 'float': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_DOUBLE'; - break; - - case 'boolean': - case 'bool': - $condition = '((Z_TYPE_P('.$variableName.') == IS_TRUE || Z_TYPE_P('.$variableName.') == IS_FALSE) '.$operator.' 1)'; - break; - - case 'resource': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_RESOURCE'; - break; - - case 'callable': - $condition = 'zephir_is_callable('.$variableName.') '.$operator.' 1'; - break; - - default: - throw new CompilerException(sprintf('Unknown type: "%s" in typeof comparison', $value)); - } - - return $condition; - } - - /** - * {@inheritdoc} - */ - public function onPreInitVar(ClassMethod $method, CompilationContext $context): string - { - if (!$method instanceof FunctionDefinition && !$method->isInternal()) { - return "zval *this_ptr = getThis();\n"; //TODO: think about a better way to solve this. - } - - return ''; - } - - public function onPreCompile(ClassMethod $method, CompilationContext $context) - { - $codePrinter = $context->codePrinter; - /* - * Initialize the properties within create_object, handler code - */ - if (preg_match('/^zephir_init_properties/', $method->getName())) { - $codePrinter->increaseLevel(); - $codePrinter->output('{'); - $codePrinter->increaseLevel(); - $codePrinter->output('zval local_this_ptr, *this_ptr = &local_this_ptr;'); - $codePrinter->output('ZEPHIR_CREATE_OBJECT(this_ptr, class_type);'); - $codePrinter->decreaseLevel(); - } - } - - public function onPostCompile(ClassMethod $method, CompilationContext $context) - { - $codePrinter = $context->codePrinter; - if (preg_match('/^zephir_init_properties/', $method->getName())) { - $codePrinter->increaseLevel(); - $codePrinter->output('return Z_OBJ_P(this_ptr);'); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - $codePrinter->decreaseLevel(); - } - } - - public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable) - { - $isComplex = \in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); - - if ($isComplex && !$variable->isDoublePointer()) { /* && $variable->mustInitNull() */ - $groupVariables[] = $variable->getName(); - switch ($variable->getRealname()) { - case '__$null': - return "\t".'ZVAL_NULL(&'.$variable->getName().');'; - case '__$true': - return "\t".'ZVAL_BOOL(&'.$variable->getName().', 1);'; - case '__$false': - return "\t".'ZVAL_BOOL(&'.$variable->getName().', 0);'; - default: - return "\t".'ZVAL_UNDEF(&'.$variable->getName().');'; - } - } - - if ($variable->isLocalOnly()) { - $groupVariables[] = $variable->getName(); - - return; - } - - if ($variable->isSuperGlobal()) { - $groupVariables[] = $variable->getName(); - - return; - } - - if ($variable->isDoublePointer()) { - /* Double pointers for ZE3 are used as zval * */ - $ptr = $isComplex ? $pointer : $pointer.$pointer; - if ($variable->mustInitNull()) { - $groupVariables[] = $ptr.$variable->getName().' = NULL'; - } else { - $groupVariables[] = $ptr.$variable->getName(); - } - - return; - } - - $defaultValue = $variable->getDefaultInitValue(); - if (null !== $defaultValue) { - switch ($type) { - case 'variable': - case 'string': - case 'array': - case 'resource': - case 'callable': - case 'object': - case 'mixed': - $groupVariables[] = $pointer.$variable->getName(); - break; - - case 'char': - if (\strlen($defaultValue) > 4) { - if (\strlen($defaultValue) > 10) { - throw new CompilerException("Invalid char literal: '".substr($defaultValue, 0, 10)."...'", $variable->getOriginal()); - } else { - throw new CompilerException("Invalid char literal: '".$defaultValue."'", $variable->getOriginal()); - } - } - /* no break */ - - default: - $groupVariables[] = $pointer.$variable->getName().' = '.$defaultValue; - break; - } - - return; - } - - if ($variable->mustInitNull() && $pointer) { - $groupVariables[] = $pointer.$variable->getName().' = NULL'; - - return; - } - - $groupVariables[] = $pointer.$variable->getName(); - } - - /** - * {@inheritdoc} - * - * @param Variable[] $variables - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return string - */ - public function initializeVariableDefaults(array $variables, CompilationContext $context): string - { - $codePrinter = new CodePrinter(); - $codePrinter->increaseLevel(); - - $oldCodePrinter = $context->codePrinter; - $context->codePrinter = $codePrinter; - - $variablesManager = new VariablesManager(); - - /* Initialize default values in dynamic variables */ - foreach ($variables as $variable) { - /* Do not initialize unused variable */ - if ($variable->getNumberUses() < 1) { - continue; - } - - /* The default init value to be used bellow. - Actually this value should be in array form and - provide 'type' and 'value' keys. */ - $value = $variable->getDefaultInitValue(); - if (!\is_array($value)) { - continue; - } - - $variablesManager->initializeDefaults($variable, $value, $context); - } - - $context->codePrinter = $oldCodePrinter; - - return $codePrinter->getOutput(); - } - - public function declareConstant($type, $name, $value, CompilationContext $context) - { - $ce = $context->classDefinition->getClassEntry($context); - - $dType = null; - switch ($type) { - case 'bool': - $value = 'false' == $value ? '0' : 1; - break; - - case 'long': - case 'int': - $dType = 'long'; - break; - - case 'double': - break; - - case 'string': - case 'char': - if ('string' == $type || 'char' == $type) { - $value = '"'.add_slashes($value).'"'; - } - $dType = 'string'; - break; - } - - if (!isset($dType)) { - $dType = $type; - } - - if ('null' == $dType) { - $context->codePrinter->output('zephir_declare_class_constant_null('.$ce.', SL("'.$name.'"));'); - } else { - $context->codePrinter->output('zephir_declare_class_constant_'.$dType.'('.$ce.', SL("'.$name.'"), '.$value.');'); - } - } - - /** - * {@inheritdoc} - * - * @param ClassMethod $method - * @param CompilationContext $context - * - * @return string - */ - public function getInternalSignature(ClassMethod $method, CompilationContext $context): string - { - if ($method->isInitializer() && !$method->isStatic()) { - return 'zend_object *'.$method->getName().'(zend_class_entry *class_type)'; - } - - if ($method->isInitializer() && $method->isStatic()) { - return 'void '.$method->getName().'()'; - } - - $signatureParameters = []; - $parameters = $method->getParameters(); - if (\is_object($parameters)) { - foreach ($parameters->getParameters() as $parameter) { - switch ($parameter['data-type']) { - case 'int': - case 'uint': - case 'long': - case 'double': - case 'bool': - case 'char': - case 'uchar': - case 'string': - case 'array': - $signatureParameters[] = 'zval *'.$parameter['name'].'_param_ext'; - break; - - default: - $signatureParameters[] = 'zval *'.$parameter['name'].'_ext '; - break; - } - } - } - - $signaturePattern = - 'int ht, zend_execute_data *execute_data, zval *return_value, zval *this_ptr, int return_value_used'; - - if (\count($signatureParameters)) { - $signaturePattern = sprintf('%s, %s', $signaturePattern, implode(', ', $signatureParameters)); - } - - return "void {$method->getInternalName()}({$signaturePattern})"; - } - - /** - * {@inheritdoc} - * - * @param Variable $variable - * @param string|Variable|null $value - * @param CompilationContext $context - * @param bool $useCodePrinter - * - * @return string - */ - public function assignString( - Variable $variable, - $value, - CompilationContext $context, - bool $useCodePrinter = true - ): string { - return $this->assignHelper( - 'ZVAL_STRING', - $this->getVariableCode($variable), - $value, - $context, - $useCodePrinter - ); - } - - /** - * Assigns a zval to another. - * - * @param Variable $variable - * @param string $code - * @param CompilationContext $context - */ - public function assignZval(Variable $variable, $code, CompilationContext $context) - { - $code = $this->resolveValue($code, $context); - if (!$variable->isDoublePointer()) { - $context->symbolTable->mustGrownStack(true); - $symbolVariable = $this->getVariableCode($variable); - $context->codePrinter->output('ZEPHIR_OBS_COPY_OR_DUP('.$symbolVariable.', '.$code.');'); - } else { - $context->codePrinter->output($variable->getName().' = '.$code.';'); - } - } - - public function returnString($value, CompilationContext $context, $useCodePrinter = true, $doCopy = true) - { - return $this->returnHelper('RETURN_MM_STRING', $value, $context, $useCodePrinter); - } - - public function createClosure(Variable $variable, $classDefinition, CompilationContext $context) - { - $symbol = $this->getVariableCode($variable); - $context->codePrinter->output( - 'zephir_create_closure_ex('.$symbol.', NULL, '.$classDefinition->getClassEntry().', SL("__invoke"));' - ); - } - - public function addArrayEntry(Variable $variable, $key, $value, CompilationContext $context, $statement = null, $useCodePrinter = true) - { - $type = null; - $keyType = 'assoc'; - - if (!isset($key)) { - $keyType = 'append'; - } elseif ($key instanceof CompiledExpression) { - $typeKey = $key->getType(); - if ('variable' === $typeKey || 'mixed' === $typeKey) { - $var = $context->symbolTable->getVariableForRead($key->getCode(), $context); - $typeKey = $var->getType(); - } - if (\in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { - $keyType = 'index'; - } - } - if ('null' == $value) { - if (!isset($key)) { - $value = $this->resolveValue('null', $context); - $context->codePrinter->output('zephir_array_append('.$this->getVariableCode($variable).', '.$value.', PH_SEPARATE, "'.Compiler::getShortUserPath($statement['file']).'", '.$statement['line'].');'); - - return; - } - } - - switch ($value->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $type = 'long'; - break; - - case 'double': - $type = 'double'; - break; - - case 'string': - $type = 'stringl'; - break; - - case 'variable': - case 'array': - case 'mixed': - $type = 'zval'; - break; - } - - if (null === $type) { - throw new CompilerException('Unknown type mapping: '.$value->getType()); - } - - if (isset($key)) { - if ('variable' == $key->getType()) { - $var = $context->symbolTable->getVariableForRead($key->getCode(), $context); - $keyStr = 'string' == $typeKey ? 'Z_STRVAL_P('.$this->getVariableCode($var).'), Z_STRLEN_P('.$this->getVariableCode($var).')' : $this->getVariableCode($var); - } else { - $keyStr = 'string' == $key->getType() ? 'SL("'.$key->getCode().'")' : $key->getCode(); - } - } - - if ('stringl' == $type) { - if ($value instanceof Variable) { - $valueStr = 'Z_STRVAL_P('.$this->getVariableCode($value).'), Z_STRLEN_P('.$this->getVariableCode($value).')'; - } else { - $valueStr = 'SL("'.$value->getCode().'")'; - } - } elseif ('zval' == $type) { - $valueStr = $this->getVariableCode($value); - } else { - $valueStr = $value->getCode(); - } - - if ('assoc' == $keyType) { - $output = 'add_assoc_'.$type.'_ex('.$this->getVariableCode($variable).', '.$keyStr.', '.$valueStr.');'; - } elseif ('append' == $keyType) { - $output = 'zephir_array_append('.$this->getVariableCode($variable).', '.$this->resolveValue($value, $context).', PH_SEPARATE, "'.Compiler::getShortUserPath($statement['file']).'", '.$statement['line'].');'; - } else { - $output = 'add_index_'.$type.'('.$this->getVariableCode($variable).', '.$keyStr.', '.$valueStr.');'; - } - - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - public function arrayIsset(Variable $var, $resolvedExpr, $expression, CompilationContext $context) - { - if (!($resolvedExpr instanceof Variable)) { - if ('string' == $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset_string('.$this->getVariableCode($var).', SL("'.$resolvedExpr->getCode().'"))', $expression); - } - } - - return parent::arrayIsset($var, $resolvedExpr, $expression, $context); - } - - public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, $flags, $expression, CompilationContext $context) - { - if (!($resolvedExpr instanceof Variable)) { - $code = $this->getVariableCode($target).', '.$this->getVariableCode($var); - if ('string' == $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset_string_fetch('.$code.', SL("'.$resolvedExpr->getCode().'"), '.$flags.')', $expression); - } - } - - return parent::arrayIssetFetch($target, $var, $resolvedExpr, $flags, $expression, $context); - } - - public function propertyIsset(Variable $var, $key, CompilationContext $context) - { - return new CompiledExpression('bool', 'zephir_isset_property('.$this->getVariableCode($var).', SL("'.$key.'"))', null); - } - - public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationContext $context) - { - $context->headersManager->add('kernel/array'); - $variableCode = $this->getVariableCodePointer($variable); - if ('string' == $exprIndex->getType()) { - $context->codePrinter->output('zephir_array_unset_string('.$variableCode.', SL("'.$exprIndex->getCode().'"), '.$flags.');'); - - return; - } - - parent::arrayUnset($variable, $exprIndex, $flags, $context); - } - - public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true) - { - $name = $globalVar->getName(); - $output = strtr('zephir_get_global(&:name, SL(":name"));', [':name' => $name]); - - if ($useCodePrinter) { - $compilationContext->codePrinter->output($output); - } - - return $output; - } - - public function fetchClass(Variable $zendClassEntry, $className, $guarded, CompilationContext $context) - { - $context->headersManager->add('kernel/object'); - if ($guarded) { - $context->codePrinter->output('if (!'.$zendClassEntry->getName().') {'); - } - $context->codePrinter->output($zendClassEntry->getName().' = zephir_fetch_class_str_ex('.$className.', ZEND_FETCH_CLASS_AUTO);'); - if ($guarded) { - $context->codePrinter->output('}'); - } - } - - /** - * {@inheritdoc} - * - * @param Variable $symbolVariable - * @param Variable $variableVariable - * @param Variable|string $property - * @param bool $readOnly - * @param CompilationContext $context - * - * @return void - */ - public function fetchProperty( - Variable $symbolVariable, - Variable $variableVariable, - $property, - $readOnly, - CompilationContext $context - ) { - $flags = 'PH_NOISY_CC'; - if ($readOnly) { - $flags .= ' | PH_READONLY'; - } - - $variableCode = $this->getVariableCode($variableVariable); - $symbol = $this->getVariableCode($symbolVariable); - - if ($property instanceof Variable) { - $context->codePrinter->output( - sprintf( - 'zephir_read_property_zval(%s, %s, %s, %s);', - $symbol, - $variableCode, - $this->getVariableCode($property), - $flags - ) - ); - - return; - } - - $template = 'zephir_read_property(%s, %s, ZEND_STRL("%s"), %s);'; - /* Are we going to init default object property value? */ - if ($context->currentMethod && $context->currentMethod->isInitializer()) { - $template = 'zephir_read_property_ex(%s, %s, ZEND_STRL("%s"), %s);'; - } - - $context->codePrinter->output( - sprintf($template, $symbol, $variableCode, $property, $flags) - ); - } - - /** - * @param Variable $symbolVariable - * @param ClassDefinition $classDefinition - * @param $property - * @param bool $readOnly - * @param CompilationContext $context - */ - public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, $property, $readOnly, CompilationContext $context) - { - // TODO: maybe optimizations as well as above - $context->codePrinter->output( - sprintf( - 'zephir_read_static_property_ce(%s%s, %s, SL("%s"), PH_NOISY_CC%s);', - $symbolVariable->isDoublePointer() ? '' : '&', - $symbolVariable->getName(), - $classDefinition->getClassEntry(), - $property, - $readOnly ? ' | PH_READONLY' : '' - ) - ); - } - - /** - * @param $value - * @param CompilationContext $context - * @param bool $usePointer - * - * @throws CompilerException - * - * @return bool|string|Variable - */ - public function resolveValue($value, CompilationContext $context, $usePointer = false) - { - if ($value instanceof GlobalConstant) { - switch ($value->getName()) { - case 'ZEPHIR_GLOBAL(global_null)': - $value = 'null'; - break; - case 'ZEPHIR_GLOBAL(global_true)': - $value = 'true'; - break; - case 'ZEPHIR_GLOBAL(global_false)': - $value = 'false'; - break; - default: - throw new CompilerException( - $this->name.': Unknown constant '.$value->getName() - ); - } - } - - if ('null' == $value || 'true' == $value || 'false' == $value) { - $varName = '__$'.$value; - if (!$context->symbolTable->hasVariable($varName)) { - $tempVariable = new Variable('variable', $varName, $context->branchManager->getCurrentBranch()); - $context->symbolTable->addRawVariable($tempVariable); - } - - $tempVariable = $context->symbolTable->getVariableForWrite($varName, $context); - $tempVariable->increaseUses(); - $tempVariable->setUsed(true); - - if ('null' == $value) { - $tempVariable->setDynamicTypes('null'); - } else { - $tempVariable->setDynamicTypes('bool'); - } - - $value = $this->getVariableCode($tempVariable); - } else { - if ($value instanceof CompiledExpression) { - if (in_array($value->getType(), ['array', 'variable', 'mixed'])) { - $value = $context->symbolTable->getVariableForWrite($value->getCode(), $context); - } else { - return $value->getCode(); - } - } - } - - if ($value instanceof Variable) { - $value = $this->getVariableCode($value); - } - - return $value; - } - - /** - * {@inheritdoc} - * - * @param Variable $variable - * @param string|Variable $property - * @param mixed $value - * @param CompilationContext $context - * - * @return void - */ - public function updateProperty(Variable $variable, $property, $value, CompilationContext $context) - { - $value = $this->resolveValue($value, $context); - - if ($property instanceof Variable) { - $context->codePrinter->output( - sprintf( - 'zephir_update_property_zval_zval(%s, %s, %s);', - $this->getVariableCode($variable), - $this->getVariableCode($property), - $value - ) - ); - - return; - } - - $template = 'zephir_update_property_zval(%s, ZEND_STRL("%s"), %s);'; - /* Are we going to init default object property value? */ - if ($context->currentMethod && $context->currentMethod->isInitializer()) { - $template = 'zephir_update_property_zval_ex(%s, ZEND_STRL("%s"), %s);'; - } - - $context->codePrinter->output( - sprintf($template, $this->getVariableCode($variable), $property, $value) - ); - } - - public function updateStaticProperty($classEntry, $property, $value, CompilationContext $context) - { - // TODO(serghei): Sort out as well as above - $value = $this->resolveValue($value, $context); - $context->codePrinter->output('zephir_update_static_property_ce('.$classEntry.', ZEND_STRL("'.$property.'"), '.$value.');'); - } - - public function addStaticProperty($classEntry, $property, $value, CompilationContext $context) - { - $value = $this->resolveValue($value, $context); - $context->codePrinter->output('zephir_add_static_property_ce('.$classEntry.', ZEND_STRL("'.$property.'"), '.$value.');'); - } - - public function subStaticProperty($classEntry, $property, $value, CompilationContext $context) - { - $value = $this->resolveValue($value, $context); - $context->codePrinter->output('zephir_sub_static_property_ce('.$classEntry.', ZEND_STRL("'.$property.'"), '.$value.');'); - } - - public function assignArrayProperty(Variable $variable, $property, $key, $value, CompilationContext $context) - { - $resolveValue = $this->resolveValue($value, $context); - if (isset($key)) { - $context->codePrinter->output('zephir_update_property_array('.$this->getVariableCode($variable).', SL("'.$property.'"), '.$this->getVariableCode($key).', '.$resolveValue.');'); - } else { - $context->codePrinter->output('zephir_update_property_array_append('.$this->getVariableCode($variable).', SL("'.$property.'"), '.$resolveValue.');'); - } - } - - public function callMethod($symbolVariable, Variable $variable, $methodName, $cachePointer, $params, CompilationContext $context) - { - $paramStr = null != $params ? ', '.implode(', ', $params) : ''; - $macro = 'CALL_METHOD'; - if ($methodName instanceof Variable) { - $macro = 'CALL_METHOD_ZVAL'; - $methodName = $this->getVariableCode($methodName); - } else { - $methodName = '"'.$methodName.'"'; - } - if (!isset($symbolVariable)) { - $context->codePrinter->output('ZEPHIR_'.$macro.'(NULL, '.$this->getVariableCode($variable).', '.$methodName.', '.$cachePointer.$paramStr.');'); - } elseif ('return_value' == $symbolVariable->getName()) { - $context->codePrinter->output('ZEPHIR_RETURN_'.$macro.'('.$this->getVariableCode($variable).', '.$methodName.', '.$cachePointer.$paramStr.');'); - } else { - $symbol = $this->getVariableCode($symbolVariable); - $context->codePrinter->output('ZEPHIR_'.$macro.'('.$symbol.', '.$this->getVariableCode($variable).', '.$methodName.', '.$cachePointer.$paramStr.');'); - } - } - - public function setSymbolIfSeparated(Variable $variableTempSeparated, Variable $variable, CompilationContext $context) - { - $context->codePrinter->output('if ('.$variableTempSeparated->getName().') {'); - $context->codePrinter->output("\t".'ZEPHIR_SET_SYMBOL(&EG(symbol_table), "'.$variable->getName().'", &'.$variable->getName().');'); - $context->codePrinter->output('}'); - } - - public function copyOnWrite(Variable $target, $var, CompilationContext $context) - { - if ('EG(exception)' == $var) { - $context->codePrinter->output('ZVAL_OBJ('.$this->getVariableCode($target).', EG(exception));'); - $context->codePrinter->output('Z_ADDREF_P('.$this->getVariableCode($target).');'); - - return; - } - - $globalsManager = new Globals(); - - if ($globalsManager->isSuperGlobal($target->getName())) { - $context->codePrinter->output(sprintf( - 'ZEPHIR_HASH_COPY(%s, %s);', - $this->getVariableCode($target), - $this->resolveValue($var, $context) - )); - } else { - $context->codePrinter->output(sprintf( - 'ZEPHIR_CPY_WRT(%s, %s);', - $this->getVariableCode($target), - $this->resolveValue($var, $context) - )); - } - } - - public function forStatement(Variable $exprVariable, $keyVariable, $variable, $duplicateKey, $duplicateHash, $statement, $statementBlock, CompilationContext $compilationContext) - { - /** - * Create a temporary zval to fetch the items from the hash. - */ - $compilationContext->headersManager->add('kernel/fcall'); - $compilationContext->symbolTable->mustGrownStack(true); - if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_LAST_CALL_STATUS')) { - $callStatus = new Variable('int', 'ZEPHIR_LAST_CALL_STATUS', $compilationContext->branchManager->getCurrentBranch()); - $callStatus->setIsInitialized(true, $compilationContext); - $callStatus->increaseUses(); - $callStatus->setReadOnly(true); - $compilationContext->symbolTable->addRawVariable($callStatus); - } - $tempVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); - $tempVariable->setIsDoublePointer(true); - $tempValidVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); - $codePrinter = $compilationContext->codePrinter; - - $codePrinter->output('zephir_is_iterable('.$this->getVariableCode($exprVariable).', '.$duplicateHash.', "'.Compiler::getShortUserPath($statement['file']).'", '.$statement['line'].');'); - - $codePrinter->output('if (Z_TYPE_P('.$this->getVariableCode($exprVariable).') == IS_ARRAY) {'); - $codePrinter->increaseLevel(); - - $reverse = $statement['reverse'] ? 'REVERSE_' : ''; - - if (isset($keyVariable)) { - $arrayNumKey = $compilationContext->symbolTable->addTemp('zend_ulong', $compilationContext); - $arrayStrKey = $compilationContext->symbolTable->addTemp('zend_string', $compilationContext); - } - - if (isset($keyVariable) && isset($variable)) { - $macro = 'ZEND_HASH_'.$reverse.'FOREACH_KEY_VAL'; - $codePrinter->output($macro.'(Z_ARRVAL_P('.$this->getVariableCode($exprVariable).'), '.$arrayNumKey->getName().', '.$arrayStrKey->getName().', '.$tempVariable->getName().')'); - } elseif (isset($keyVariable)) { - $macro = 'ZEND_HASH_'.$reverse.'FOREACH_KEY'; - $codePrinter->output($macro.'(Z_ARRVAL_P('.$this->getVariableCode($exprVariable).'), '.$arrayNumKey->getName().', '.$arrayStrKey->getName().')'); - } else { - $macro = 'ZEND_HASH_'.$reverse.'FOREACH_VAL'; - $codePrinter->output($macro.'(Z_ARRVAL_P('.$this->getVariableCode($exprVariable).'), '.$tempVariable->getName().')'); - } - - $codePrinter->output('{'); - - if (isset($keyVariable)) { - $codePrinter->increaseLevel(); - if ($duplicateKey) { - $compilationContext->symbolTable->mustGrownStack(true); - $keyVariable->initVariant($compilationContext); - } - $codePrinter->output('if ('.$arrayStrKey->getName().' != NULL) { '); - $codePrinter->increaseLevel(); - if ($duplicateKey) { - $codePrinter->output('ZVAL_STR_COPY('.$this->getVariableCode($keyVariable).', '.$arrayStrKey->getName().');'); - } else { - $codePrinter->output('ZVAL_STR('.$this->getVariableCode($keyVariable).', '.$arrayStrKey->getName().');'); - } - $codePrinter->decreaseLevel(); - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - $codePrinter->output('ZVAL_LONG('.$this->getVariableCode($keyVariable).', '.$arrayNumKey->getName().');'); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - $codePrinter->decreaseLevel(); - } - - if (isset($variable)) { - $compilationContext->symbolTable->mustGrownStack(true); - $codePrinter->increaseLevel(); - $variable->initVariant($compilationContext); - $codePrinter->output('ZVAL_COPY('.$this->getVariableCode($variable).', '.$this->getVariableCode($tempVariable).');'); - $codePrinter->decreaseLevel(); - } - - /** - * Compile statements in the 'for' block - */ - if (isset($statement['statements'])) { - $statementBlock->isLoop(true); - if (isset($statement['key'])) { - $statementBlock->getMutateGatherer()->increaseMutations($statement['key']); - } - $statementBlock->getMutateGatherer()->increaseMutations($statement['value']); - $statementBlock->compile($compilationContext); - } - - $codePrinter->output('} ZEND_HASH_FOREACH_END();'); - $codePrinter->decreaseLevel(); - - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - - $codePrinter->output('ZEPHIR_CALL_METHOD(NULL, '.$this->getVariableCode($exprVariable).', "rewind", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - - $codePrinter->output('while (1) {'); - $codePrinter->increaseLevel(); - - $codePrinter->output('ZEPHIR_CALL_METHOD(&'.$tempValidVariable->getName().', '.$this->getVariableCode($exprVariable).', "valid", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - $codePrinter->output('if (!zend_is_true(&'.$tempValidVariable->getName().')) {'); - $codePrinter->increaseLevel(); - $codePrinter->output('break;'); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - - if (isset($keyVariable)) { - $codePrinter->output('ZEPHIR_CALL_METHOD('.$this->getVariableCode($keyVariable).', '.$this->getVariableCode($exprVariable).', "key", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - } - - if (isset($variable)) { - $codePrinter->output('ZEPHIR_CALL_METHOD('.$this->getVariableCode($variable).', '.$this->getVariableCode($exprVariable).', "current", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - } - - if (isset($statement['statements'])) { - $statementBlock->isLoop(true); - if (isset($statement['key'])) { - $statementBlock->getMutateGatherer()->increaseMutations($statement['key']); - } - $statementBlock->getMutateGatherer()->increaseMutations($statement['value']); - $statementBlock->compile($compilationContext); - } - - $codePrinter->output('ZEPHIR_CALL_METHOD(NULL, '.$this->getVariableCode($exprVariable).', "next", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - - /* Since we do not observe, still do cleanup */ - if (isset($variable)) { - $variable->initVariant($compilationContext); - } - if (isset($keyVariable)) { - $keyVariable->initVariant($compilationContext); - } - } - - public function forStatementIterator(Variable $iteratorVariable, Variable $targetVariable, CompilationContext $compilationContext) - { - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->codePrinter->output('ZEPHIR_ITERATOR_COPY('.$this->getVariableCode($targetVariable).', '.$iteratorVariable->getName().');'); - } - - public function destroyIterator(Variable $iteratorVariable, CompilationContext $context) - { - $context->codePrinter->output('zend_iterator_dtor('.$iteratorVariable->getName().');'); - } - - public function ifVariableValueUndefined(Variable $var, CompilationContext $context, $useBody = false, $useCodePrinter = true) - { - if ($var->isDoublePointer()) { - return parent::ifVariableValueUndefined($var, $context, $useBody, $useCodePrinter); - } - $body = 'ZEPHIR_IS_EMPTY('.$this->getVariableCode($var).')'; - $output = 'if ('.$body.') {'; - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $useBody ? $body : $output; - } - - public function fetchClassEntry($str) - { - return 'zephir_get_internal_ce(SL("'.$str.'"))'; - } - - /** - * {@inheritdoc} - * - * @param string $type - * @param CompilationContext $compilationContext - * @param bool $isLocal - * - * @return Variable - */ - public function getScalarTempVariable( - string $type, - CompilationContext $compilationContext, - $isLocal = true - ): Variable { - return $compilationContext->symbolTable->getTempNonTrackedVariable($type, $compilationContext); - } - - /** - * Initialize array - * - * Init empty array or specific size array. - * - * @param Variable $variable - * @param CompilationContext $context - * @param int|null $size - * - * @return void - */ - public function initArray(Variable $variable, CompilationContext $context, ?int $size = null): void - { - $code = $this->getVariableCode($variable); - - if (null === $size) { - $output = "array_init({$code});"; - } else { - $output = "zephir_create_array({$code}, {$size}, 0);"; - } - - $context->codePrinter->output($output); - } -} diff --git a/Library/Backends/ZendEngine3/StringsManager.php b/Library/Backends/ZendEngine3/StringsManager.php deleted file mode 100644 index a1e19c70ea..0000000000 --- a/Library/Backends/ZendEngine3/StringsManager.php +++ /dev/null @@ -1,199 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Backends\ZendEngine3; - -use Zephir\StringsManager as BaseStringsManager; - -use function Zephir\file_put_contents_ex; - -/** - * Manages the concatenation keys for the extension and the interned strings - */ -class StringsManager extends BaseStringsManager -{ - /** - * Adds a concatenation combination to the manager. - * - * @param string $key - */ - public function addConcatKey($key) - { - $this->concatKeys[$key] = true; - } - - /** - * Generates the concatenation code. - */ - public function genConcatCode(): void - { - $code = ' -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include -#include "php_ext.h" -#include -#include "ext.h" -#include "kernel/main.h" -#include "kernel/memory.h" -#include "kernel/concat.h"'.PHP_EOL.PHP_EOL; - $pcodeh = ' -#ifndef ZEPHIR_KERNEL_CONCAT_H -#define ZEPHIR_KERNEL_CONCAT_H -#include -#include -#include "kernel/main.h" -'; - $codeh = ''; - - $macros = []; - ksort($this->concatKeys, SORT_STRING); - foreach ($this->concatKeys as $key => $one) { - $len = \strlen($key); - $params = []; - $zvalCopy = []; - $useCopy = []; - $avars = []; - $zvars = []; - $svars = []; - $lengths = []; - $sparams = []; - $lparams = []; - for ($i = 0; $i < $len; ++$i) { - $n = $i + 1; - $t = substr($key, $i, 1); - $sparams[] = 'op'.$n; - if ('s' == $t) { - $params[] = 'const char *op'.$n.', uint32_t op'.$n.'_len'; - $lparams[] = 'op'.$n.', sizeof(op'.$n.')-1'; - $lengths[] = 'op'.$n.'_len'; - $svars[] = $n; - $avars[$n] = 's'; - } else { - $params[] = 'zval *op'.$n; - $lparams[] = 'op'.$n; - $zvalCopy[] = 'op'.$n.'_copy'; - $useCopy[] = 'use_copy'.$n.' = 0'; - $lengths[] = 'Z_STRLEN_P(op'.$n.')'; - $zvars[] = $n; - $avars[$n] = 'v'; - } - } - - $macros[] = '#define ZEPHIR_CONCAT_'.strtoupper($key).'(result, '.implode(', ', $sparams).') \\'.PHP_EOL."\t".' zephir_concat_'.$key.'(result, '.implode(', ', $lparams).', 0);'; - $macros[] = '#define ZEPHIR_SCONCAT_'.strtoupper($key).'(result, '.implode(', ', $sparams).') \\'.PHP_EOL."\t".' zephir_concat_'.$key.'(result, '.implode(', ', $lparams).', 1);'; - $macros[] = ''; - - $proto = 'void zephir_concat_'.$key.'(zval *result, '.implode(', ', $params).', int self_var)'; - - $codeh .= ''.$proto.';'.PHP_EOL; - - $code .= $proto.'{'.PHP_EOL.PHP_EOL; - - if (\count($zvalCopy)) { - $code .= "\t".'zval result_copy, '.implode(', ', $zvalCopy).';'.PHP_EOL; - $code .= "\t".'int use_copy = 0, '.implode(', ', $useCopy).';'.PHP_EOL; - } else { - $code .= "\t".'zval result_copy;'.PHP_EOL; - $code .= "\t".'int use_copy = 0;'.PHP_EOL; - } - $code .= "\t".'size_t offset = 0, length;'.PHP_EOL.PHP_EOL; - - foreach ($zvars as $zvar) { - $code .= "\t".'if (Z_TYPE_P(op'.$zvar.') != IS_STRING) {'.PHP_EOL; - $code .= "\t".' use_copy'.$zvar.' = zend_make_printable_zval(op'.$zvar.', &op'.$zvar.'_copy);'.PHP_EOL; - $code .= "\t".' if (use_copy'.$zvar.') {'.PHP_EOL; - $code .= "\t".' op'.$zvar.' = &op'.$zvar.'_copy;'.PHP_EOL; - $code .= "\t".' }'.PHP_EOL; - $code .= "\t".'}'.PHP_EOL.PHP_EOL; - } - - $code .= "\t".'length = '.implode(' + ', $lengths).';'.PHP_EOL; - $code .= "\t".'if (self_var) {'.PHP_EOL; - $code .= ''.PHP_EOL; - $code .= "\t\t".'if (Z_TYPE_P(result) != IS_STRING) {'.PHP_EOL; - $code .= "\t\t\t".'use_copy = zend_make_printable_zval(result, &result_copy);'.PHP_EOL; - $code .= "\t\t\t".'if (use_copy) {'.PHP_EOL; - $code .= "\t\t\t\t".'ZEPHIR_CPY_WRT_CTOR(result, (&result_copy));'.PHP_EOL; - $code .= "\t\t\t".'}'.PHP_EOL; - $code .= "\t\t".'}'.PHP_EOL.PHP_EOL; - $code .= "\t\t".'offset = Z_STRLEN_P(result);'.PHP_EOL; - $code .= "\t\t".'length += offset;'.PHP_EOL; - $code .= "\t\t".'Z_STR_P(result) = zend_string_realloc(Z_STR_P(result), length, 0);'.PHP_EOL; - $code .= ''.PHP_EOL; - $code .= "\t".'} else {'.PHP_EOL; - $code .= "\t\t".'ZVAL_STR(result, zend_string_alloc(length, 0));'.PHP_EOL; - $code .= "\t".'}'.PHP_EOL.PHP_EOL; - - $position = ''; - foreach ($avars as $n => $type) { - if ('s' == $type) { - $code .= "\t".'memcpy(Z_STRVAL_P(result) + offset'.$position.', op'.$n.', op'.$n.'_len);'.PHP_EOL; - $position .= ' + op'.$n.'_len'; - } else { - $code .= "\t".'memcpy(Z_STRVAL_P(result) + offset'.$position.', Z_STRVAL_P(op'.$n.'), Z_STRLEN_P(op'.$n.'));'.PHP_EOL; - $position .= ' + Z_STRLEN_P(op'.$n.')'; - } - } - - $code .= "\t".'Z_STRVAL_P(result)[length] = 0;'.PHP_EOL; - $code .= "\t".'zend_string_forget_hash_val(Z_STR_P(result));'.PHP_EOL; - - foreach ($zvars as $zvar) { - $code .= "\t".'if (use_copy'.$zvar.') {'.PHP_EOL; - $code .= "\t".' zval_dtor(op'.$zvar.');'.PHP_EOL; - $code .= "\t".'}'.PHP_EOL.PHP_EOL; - } - - $code .= "\t".'if (use_copy) {'.PHP_EOL; - $code .= "\t".' zval_dtor(&result_copy);'.PHP_EOL; - $code .= "\t".'}'.PHP_EOL.PHP_EOL; - - $code .= '}'.PHP_EOL.PHP_EOL; - } - - $code .= << - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -use Zephir\Fcall\FcallAwareInterface; -use Zephir\Fcall\FcallManagerInterface; - -abstract class BaseBackend implements FcallAwareInterface -{ - /** @var Config */ - protected $config; - - /** - * The name of the backend (e.g. ZendEngine2). - * - * @var string - */ - protected $name; - - /** @var FcallManagerInterface */ - protected $fcallManager; - - /** @var string */ - protected $kernelsPath; - - /** @var string */ - protected $templatesPath; - - /** - * BaseBackend constructor. - * - * @param Config $config - * @param string $kernelsPath - * @param string $templatesPath - */ - public function __construct(Config $config, $kernelsPath, $templatesPath) - { - $this->config = $config; - $this->kernelsPath = $kernelsPath; - $this->templatesPath = $templatesPath; - } - - /** - * TODO: This should not be used, temporary (until its completely refactored). - * - * @return bool - */ - abstract public function isZE3(); - - public function getName() - { - return $this->name; - } - - /** - * Resolves the path to the source kernel files of the backend. - * - * @return string - */ - public function getInternalKernelPath(): string - { - return "$this->kernelsPath/{$this->name}"; - } - - /** - * Resolves the path to the source template files of the backend. - * - * @return string - */ - public function getInternalTemplatePath(): string - { - return "$this->templatesPath/{$this->name}"; - } - - /** - * Resolves the path to the source template file of the backend. - * - * @param string $filename - * - * @return string - */ - public function getTemplateFileContents(string $filename): string - { - $templatePath = rtrim((string) $this->config->get('templatepath', 'backend'), '\\/'); - if (empty($templatepath)) { - $templatePath = $this->templatesPath; - } - - return file_get_contents("{$templatePath}/{$this->name}/{$filename}"); - } - - /** - * @return StringsManager - */ - abstract public function getStringsManager(); - - abstract public function getTypeDefinition($type); - - /** - * Checks the type of a variable using the ZendEngine constants. - * - * @param Variable $variableVariable - * @param string $operator - * @param string $value - * @param CompilationContext $context - * - * @return string - */ - abstract public function getTypeofCondition( - Variable $variableVariable, - string $operator, - string $value, - CompilationContext $context - ): string; - - /** - * Initialize variable defaults. - * - * @param Variable[] $variables - * @param CompilationContext $context - * - * @return string - */ - abstract public function initializeVariableDefaults(array $variables, CompilationContext $context): string; - - abstract public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable); - - /** - * Returns the signature of an internal method. - * - * @param ClassMethod $method - * @param CompilationContext $context - * - * @return string - */ - abstract public function getInternalSignature(ClassMethod $method, CompilationContext $context): string; - - abstract public function checkStrictType($type, $var, CompilationContext $context); - - abstract public function getBoolCode(Variable $variable, CompilationContext $context, $useCodePrinter = true); - - /** - * Creates a temporary variable to be used to point to a heap variable. - * - * @param string $type - * @param CompilationContext $compilationContext - * @param bool $isLocal - * - * @return Variable - */ - abstract public function getScalarTempVariable( - string $type, - CompilationContext $compilationContext, - $isLocal = true - ): Variable; - - abstract public function declareConstant($type, $name, $value, CompilationContext $context); - - /** - * Assign value to variable. - * - * @param Variable $variable - * @param string|Variable|null $value - * @param CompilationContext $context - * @param bool $useCodePrinter - * - * @return string - */ - abstract public function assignString( - Variable $variable, - $value, - CompilationContext $context, - bool $useCodePrinter = true - ): string; - - abstract public function assignLong(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true); - - abstract public function assignDouble(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true); - - abstract public function assignBool(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true); - - abstract public function assignNull(Variable $variable, CompilationContext $context, $useCodePrinter = true); - - abstract public function assignZval(Variable $variable, $code, CompilationContext $context); - - abstract public function concatSelf(Variable $variable, Variable $itemVariable, CompilationContext $context); - - abstract public function returnString($value, CompilationContext $context, $useCodePrinter = true); - - /** - * Generate the code to initialize array typed variable. - * - * @param Variable $variable - * @param CompilationContext $context - * @param int $size - * - * @return void - */ - abstract public function initArray(Variable $variable, CompilationContext $context, int $size = null); - - abstract public function createClosure(Variable $variable, $classDefinition, CompilationContext $context); - - abstract public function addArrayEntry(Variable $variable, $key, $value, CompilationContext $context, $statement = null, $useCodePrinter = true); - - abstract public function updateArray(Variable $symbolVariable, $key, $value, CompilationContext $compilationContext, $flags = null); - - abstract public function initObject(Variable $variable, $ce, CompilationContext $context, $useCodePrinter = true); - - abstract public function initVar(Variable $variable, CompilationContext $context, $useCodePrinter = true, $second = false); - - abstract public function zvalOperator($zvalOperator, Variable $expected, Variable $variableLeft, Variable $variableRight, CompilationContext $compilationContext); - - abstract public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true); - - abstract public function fetchClass(Variable $var, $name, $guarded, CompilationContext $context); - - /** - * Fetch object's property. - * - * @param Variable $symbolVariable - * @param Variable $variableVariable - * @param Variable|string $property - * @param bool $readOnly - * @param CompilationContext $context - */ - abstract public function fetchProperty( - Variable $symbolVariable, - Variable $variableVariable, - $property, - $readOnly, - CompilationContext $context - ); - - abstract public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, $property, $readOnly, CompilationContext $context); - - /** - * Update object property. - * - * object->property = value - * - * @param Variable $variable - * @param string|Variable $property - * @param mixed $value - * @param CompilationContext $context - * - * @return void - */ - abstract public function updateProperty(Variable $variable, $property, $value, CompilationContext $context); - - abstract public function updateStaticProperty($classEntry, $property, $value, CompilationContext $context); - - abstract public function addStaticProperty($classEntry, $property, $value, CompilationContext $context); - - abstract public function subStaticProperty($classEntry, $property, $value, CompilationContext $context); - - abstract public function assignArrayProperty(Variable $variable, $property, $key, $value, CompilationContext $context); - - abstract public function checkConstructor(Variable $var, CompilationContext $context); - - /* Method calling */ - abstract public function callDynamicFunction($symbolVariable, Variable $variable, CompilationContext $compilationContext, $params = [], $cache = 'NULL', $cacheSlot = 0); - - abstract public function callMethod($symbolVariable, Variable $variable, $methodName, $cachePointer, $params, CompilationContext $context); - - /* Read from array */ - abstract public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayAccess, CompilationContext $context, $useCodePrinter = true); - - abstract public function arrayIsset(Variable $var, $resolvedExpr, $expression, CompilationContext $context); - - abstract public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, $flags, $expression, CompilationContext $context); - - abstract public function propertyIsset(Variable $var, $key, CompilationContext $context); - - /* Unset array */ - abstract public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationContext $context); - - /* Array update multi */ - abstract public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExprs, CompilationContext $context); - - abstract public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $propertyName, $offsetExprs, CompilationContext $context); - - abstract public function assignStaticPropertyArrayMulti($classEntry, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext); - - abstract public function maybeSeparate(Variable $variableTempSeparated, Variable $variable, CompilationContext $context); - - abstract public function setSymbolIfSeparated(Variable $variableTempSeparated, Variable $variable, CompilationContext $context); - - abstract public function fetchClassEntry($str); - - abstract public function copyOnWrite(Variable $target, $var, CompilationContext $context); - - abstract public function ifVariableValueUndefined(Variable $var, CompilationContext $context, $onlyBody = false, $useCodePrinter = true); - - /* For statement */ - abstract public function forStatement(Variable $exprVariable, $keyVariable, $variable, $duplicateKey, $duplicateHash, $statement, $statementBlock, CompilationContext $context); - - abstract public function forStatementIterator(Variable $iteratorVariable, Variable $targetVariable, CompilationContext $compilationContext); - - abstract public function destroyIterator(Variable $iteratorVariable, CompilationContext $context); - - abstract public function onPreInitVar(ClassMethod $method, CompilationContext $context): string; - - abstract public function onPreCompile(ClassMethod $method, CompilationContext $context); - - abstract public function onPostCompile(ClassMethod $method, CompilationContext $context); - - /** - * @param Variable $variable - * - * @return string - */ - abstract public function getVariableCode(Variable $variable): string; - - /** - * Get a double pointer to the variable. - * - * @param Variable $variable - * - * @return string - */ - abstract public function getVariableCodePointer(Variable $variable); - - abstract public function resolveValue($value, CompilationContext $context, $usePointer = false); - - public static function getActiveBackend() - { - if (version_compare(PHP_VERSION, '7.0', '>=')) { - return 'ZendEngine3'; - } - - return 'ZendEngine2'; - } - - /** - * {@inheritdoc} - * - * @param FcallManagerInterface $fcallManager - */ - public function setFcallManager(FcallManagerInterface $fcallManager) - { - $this->fcallManager = $fcallManager; - } -} diff --git a/Library/BranchGraph.php b/Library/BranchGraph.php deleted file mode 100644 index 5c765f7338..0000000000 --- a/Library/BranchGraph.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir; - -/** - * Represents a group of branch nodes - */ -class BranchGraph -{ - protected ?BranchGraphNode $root = null; - - protected array $branchMap = []; - - /** - * Adds a leaf to the branch tree. - * - * @param Branch $branch - */ - public function addLeaf(Branch $branch): void - { - $branchNode = $this->branchMap[$branch->getUniqueId()] ?? new BranchGraphNode($branch); - $branchNode->increase(); - - $tempBranch = $branch->getParentBranch(); - while ($tempBranch) { - if (isset($this->branchMap[$tempBranch->getUniqueId()])) { - $parentBranchNode = $this->branchMap[$tempBranch->getUniqueId()]; - } else { - $parentBranchNode = new BranchGraphNode($tempBranch); - $this->branchMap[$tempBranch->getUniqueId()] = $parentBranchNode; - } - - $parentBranchNode->insert($branchNode); - $branchNode = $parentBranchNode; - $tempBranch = $tempBranch->getParentBranch(); - if (!$tempBranch) { - $this->root = $parentBranchNode; - } - } - } - - /** - * Returns the tree's root node. - * - * @return BranchGraphNode - */ - public function getRoot(): BranchGraphNode - { - return $this->root; - } -} diff --git a/Library/BranchGraphNode.php b/Library/BranchGraphNode.php deleted file mode 100644 index f206c8f07c..0000000000 --- a/Library/BranchGraphNode.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir; - -use function count; -use function in_array; - -/** - * Allows visualizing assignments for a specific variable in every branch used. - */ -class BranchGraphNode -{ - /** - * @var int - */ - protected int $increase = 0; - - /** - * @var Branch[] - */ - protected array $branches = []; - - /** - * @var Branch - */ - protected Branch $branch; - - /** - * @param Branch $branch - */ - public function __construct(Branch $branch) - { - $this->branch = $branch; - } - - /** - * Inserts a node in the branch graph. - * - * @param BranchGraphNode $branch - */ - public function insert(self $branch): void - { - if (!in_array($branch, $this->branches)) { - $this->branches[] = $branch; - } - } - - /** - * Increases the branch graph level. - */ - public function increase(): void - { - ++$this->increase; - } - - /** - * Generates an ASCII visualization of the branch. - * - * @param int $padding - */ - public function show(int $padding = 0): void - { - echo str_repeat(' ', $padding), $this->branch->getUniqueId(), ':' , $this->increase; - - if (count($this->branches) > 0) { - echo ':', PHP_EOL; - /** @var BranchGraphNode $node */ - foreach ($this->branches as $node) { - $node->show($padding + 1); - } - } else { - echo PHP_EOL; - } - } -} diff --git a/Library/Builder/FunctionCallBuilder.php b/Library/Builder/FunctionCallBuilder.php deleted file mode 100644 index a06def7b3a..0000000000 --- a/Library/Builder/FunctionCallBuilder.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Builder; - -/** - * Allows to manually build a function call AST node - */ -class FunctionCallBuilder -{ - protected string $name; - - protected array $parameters; - - protected int $type; - - protected ?string $file; - - protected int $line = 0; - - protected int $char = 0; - - /** - * @param string $name - * @param array $parameters - * @param int $type - * @param string|null $file - * @param int $line - * @param int $char - */ - public function __construct(string $name, array $parameters, int $type = 1, ?string $file = null, int $line = 0, int $char = 0) - { - $this->name = $name; - $this->parameters = $parameters; - $this->type = $type; - $this->file = $file; - $this->line = $line; - $this->char = $char; - } - - /** - * @return array - */ - public function get(): array - { - return [ - 'type' => 'fcall', - 'name' => $this->name, - 'call-type' => $this->type, - 'parameters' => $this->parameters, - 'file' => $this->file, - 'line' => $this->line, - 'char' => $this->char, - ]; - } -} diff --git a/Library/Builder/Operators/CastOperatorBuilder.php b/Library/Builder/Operators/CastOperatorBuilder.php deleted file mode 100644 index 714d089497..0000000000 --- a/Library/Builder/Operators/CastOperatorBuilder.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Builder\Operators; - -use Zephir\Builder\FunctionCallBuilder; - -/** - * Allows to manually build a 'cast' operator AST node - */ -class CastOperatorBuilder extends AbstractOperatorBuilder -{ - protected string $leftOperand; - - protected FunctionCallBuilder $rightOperand; - - /** - * @param string $left - * @param FunctionCallBuilder $right - * @param string|null $file - * @param int $line - * @param int $char - */ - public function __construct(string $left, FunctionCallBuilder $right, ?string $file = null, int $line = 0, int $char = 0) - { - $this->leftOperand = $left; - $this->rightOperand = $right; - $this->file = $file; - $this->line = $line; - $this->char = $char; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get(): array - { - return [ - 'type' => 'cast', - 'left' => $this->leftOperand, - 'right' => $this->rightOperand->get(), - 'file' => $this->file, - 'line' => $this->line, - 'char' => $this->char, - ]; - } -} diff --git a/Library/Code/Builder/Struct.php b/Library/Code/Builder/Struct.php deleted file mode 100644 index 1d5c9472a1..0000000000 --- a/Library/Code/Builder/Struct.php +++ /dev/null @@ -1,224 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Code\Builder; - -use Zephir\Exception\InvalidArgumentException; -use Zephir\Exception\RuntimeException; - -use function is_string; - -/** - * Represents an internal extension global structure - */ -class Struct -{ - /** - * Struct name - * - * @var string - */ - protected string $name; - - /** - * Struct simple name - * - * @var string - */ - protected string $simpleName; - - /** - * Struct members definition - * - * ```c - * struct Name { - * key value; - * } - * ``` - * - * @var array - */ - protected array $properties = []; - - /** - * @param string $name - * @param string $simpleName - * - * @throws InvalidArgumentException - */ - public function __construct(string $name, string $simpleName) - { - if (empty($name)) { - throw new InvalidArgumentException('Struct name must not be empty'); - } - - $this->name = $name; - $this->simpleName = $simpleName; - } - - /** - * @return string - */ - public function __toString(): string - { - $code = 'typedef struct '.$this->name.' { '.PHP_EOL; - - foreach ($this->properties as $name => $type) { - $code .= sprintf("\t%s %s;%s", $type, $name, PHP_EOL); - } - - return $code.'} '.substr($this->name, 1).';'.PHP_EOL; - } - - /** - * @param string $field - * @param array $global - * - * @throws InvalidArgumentException - */ - public function addProperty(string $field, array $global) - { - if (!isset($global['type']) || !is_string($global['type'])) { - throw new InvalidArgumentException('Property type must be string'); - } - - if (isset($this->properties[$field])) { - throw new InvalidArgumentException('Property was defined more than once'); - } - - $this->properties[$field] = $this->convertToCType($global['type']); - } - - /** - * Returns the C code that initializes the extension global. - * - * @param string $name - * @param array $global - * @param string $namespace - * - * @throws RuntimeException - * @throws InvalidArgumentException - * - * @return string - */ - public function getCDefault(string $name, array $global, string $namespace): string - { - if (!isset($global['default'])) { - throw new RuntimeException('Field "'.$name.'" does not have a default value'); - } - - switch ($global['type']) { - case 'boolean': - case 'bool': - return ''; - - case 'string': - return "\t".$namespace.'_globals->'.$this->simpleName.'.'.$name.' = ZSTR_VAL(zend_string_init(ZEND_STRL("'.$global['default'].'"), 0));'; - - case 'int': - case 'uint': - case 'long': - case 'double': - case 'hash': - return "\t".$namespace.'_globals->'.$this->simpleName.'.'.$name.' = '.$global['default'].';'; - - default: - throw new InvalidArgumentException('Unknown global type: '.$global['type']); - } - } - - /** - * Process Globals for phpinfo() page. - * - * @see https://docs.zephir-lang.com/latest/en/globals - * - * @param string $name - global-name - * @param array $global - global structure (type, default...) - * @param string $namespace - global namespace - * - * @return string - */ - public function getInitEntry(string $name, array $global, string $namespace): string - { - $structName = $this->simpleName.'.'.$name; - $iniEntry = $global['ini-entry'] ?? []; - $iniName = $iniEntry['name'] ?? $namespace.'.'.$structName; - $scope = $iniEntry['scope'] ?? 'PHP_INI_ALL'; - - switch ($global['type']) { - case 'boolean': - case 'bool': - return - 'STD_PHP_INI_BOOLEAN("'. - $iniName. - '", "'. - (int) (true === $global['default']). - '", '. - $scope. - ', OnUpdateBool, '. - $structName. - ', zend_'. - $namespace. - '_globals, '. - $namespace.'_globals)'; - - case 'string': - return sprintf( - 'STD_PHP_INI_ENTRY(%s, %s, %s, NULL, %s, %s, %s)', - '"'.$iniName.'"', - '"'.$global['default'].'"', - $scope, - $structName, - 'zend_'.$namespace.'_globals', - $namespace.'_globals', - ); - } - - return ''; - } - - /** - * Generates the internal c-type according to the php's type. - * - * @param string $type - * - * @throws InvalidArgumentException - * - * @return string - */ - protected function convertToCType(string $type): string - { - switch ($type) { - case 'boolean': - case 'bool': - return 'zend_bool'; - - case 'hash': - return 'HashTable* '; - - case 'string': - return 'zend_string* '; - - case 'int': - case 'uint': - case 'long': - case 'char': - case 'uchar': - case 'double': - return $type; - - default: - throw new InvalidArgumentException('Unknown global type: '.$type); - } - } -} diff --git a/Library/Documentation/NamespaceHelper.php b/Library/Documentation/NamespaceHelper.php deleted file mode 100644 index 37544591bd..0000000000 --- a/Library/Documentation/NamespaceHelper.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Documentation; - -use Zephir\CompilerFile; - -class NamespaceHelper -{ - protected $fullNamespace; - - protected $endNamespace; - protected $parentName; - - protected $classes = []; - protected $namespaces = []; - - public function __construct($fullNamespace) - { - $this->fullNamespace = $fullNamespace; - - $ex = explode('\\', $fullNamespace); - $this->endNamespace = $ex[\count($ex) - 1]; - - array_pop($ex); - - $this->parentName = implode('\\', $ex); - } - - public function addClass(CompilerFile $c) - { - $this->classes[] = $c; - } - - public function addNamespace(self $n) - { - if (!isset($this->namespaces[$n->getFullNamespace()])) { - $this->namespaces[$n->getFullNamespace()] = $n; - } - } - - public function getFullNamespace() - { - return $this->fullNamespace; - } - - /** - * @return string - */ - public function getShortName() - { - return $this->endNamespace; - } - - /** - * @return string - */ - public function getParentName() - { - return $this->parentName; - } - - /** - * @return CompilerFile[] - */ - public function getClasses() - { - return $this->classes; - } - - /** - * @return NamespaceHelper[] - */ - public function getNamespaces() - { - return $this->namespaces; - } -} diff --git a/Library/EventsManager.php b/Library/EventsManager.php deleted file mode 100644 index 6db0dff1e4..0000000000 --- a/Library/EventsManager.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -/** - * Class EventsManager. - */ -class EventsManager -{ - /** - * @var array - */ - private $listeners = []; - - /** - * Attaches a listener to a specific event type. - * - * @param $event - * @param $callback - */ - public function listen($event, $callback) - { - if (!isset($this->listeners[$event])) { - $this->listeners[$event] = []; - } - - $this->listeners[$event][] = $callback; - } - - /** - * Triggers an event for the specified event type. - * - * @param $event - * @param array $param - */ - public function dispatch($event, array $param = []) - { - foreach ($this->listeners[$event] as $listener) { - \call_user_func_array($listener, $param); - } - } -} diff --git a/Library/Exception/CompilerException.php b/Library/Exception/CompilerException.php deleted file mode 100644 index f2209fda04..0000000000 --- a/Library/Exception/CompilerException.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -/** - * Zephir\Exception\CompilerException. - * - * Exceptions generated by the compiler - */ -class CompilerException extends RuntimeException -{ - /** - * CompilerException constructor. - * - * @param string $message the Exception message to throw [optional] - * @param array|null $extra extra info [optional] - * @param int $code the Exception code [optional] - * @param \Exception|\Throwable $previous the previous throwable used for the exception chaining [optional] - */ - public function __construct($message = '', $extra = null, $code = 0, $previous = null) - { - if (\is_array($extra) && isset($extra['file'])) { - $message .= ' in '.$extra['file'].' on line '.$extra['line']; - } - - $this->extra = $extra; - - parent::__construct($message, $code, $previous); - } - - public static function illegalOperationTypeOnStaticVariable( - string $operator, - string $dataType, - array $statement - ): self { - return new self( - "Operator '{$operator}' isn't supported for static variables and {$dataType} typed expressions", - $statement - ); - } -} diff --git a/Library/Exception/InvalidCallException.php b/Library/Exception/InvalidCallException.php deleted file mode 100644 index d8b07680f2..0000000000 --- a/Library/Exception/InvalidCallException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -/** - * Zephir\Exception\InvalidCallException. - */ -class InvalidCallException extends LogicException -{ -} diff --git a/Library/Exception/OutOfBoundsException.php b/Library/Exception/OutOfBoundsException.php deleted file mode 100644 index 29338b14aa..0000000000 --- a/Library/Exception/OutOfBoundsException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -/** - * Zephir\Exception\OutOfBoundsException. - */ -class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface -{ - use ExceptionExtraAwareTrait; -} diff --git a/Library/Exception/ParseException.php b/Library/Exception/ParseException.php deleted file mode 100644 index aabd21e535..0000000000 --- a/Library/Exception/ParseException.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -/** - * Zephir\Exception\ParseException. - * - * Exceptions generated by parsing actions - */ -class ParseException extends RuntimeException -{ - /** - * ParseException constructor. - * - * @param string $message the Exception message to throw [optional] - * @param array|null $extra extra info [optional] - * @param int $code the Exception code [optional] - * @param \Exception|\Throwable $previous the previous throwable used for the exception chaining [optional] - */ - public function __construct($message = '', $extra = null, $code = 0, $previous = null) - { - if (\is_array($extra) && isset($extra['file'])) { - $message .= ' in '.$extra['file'].' on line '.$extra['line']; - } - - $this->extra = $extra; - - parent::__construct($message, $code, $previous); - } -} diff --git a/Library/Exception/UnknownPropertyException.php b/Library/Exception/UnknownPropertyException.php deleted file mode 100644 index a6790ce85c..0000000000 --- a/Library/Exception/UnknownPropertyException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -/** - * Zephir\Exception\UnknownPropertyException. - */ -class UnknownPropertyException extends LogicException -{ -} diff --git a/Library/Exception/ValidationException.php b/Library/Exception/ValidationException.php deleted file mode 100644 index e2b0876685..0000000000 --- a/Library/Exception/ValidationException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -/** - * Zephir\Exception\ValidationException. - */ -class ValidationException extends InvalidArgumentException -{ -} diff --git a/Library/Expression/Builder/Operators/AssignPropertyOperator.php b/Library/Expression/Builder/Operators/AssignPropertyOperator.php deleted file mode 100644 index b921870749..0000000000 --- a/Library/Expression/Builder/Operators/AssignPropertyOperator.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Expression\Builder\Operators; - -use Zephir\Expression\Builder\AbstractBuilder; - -/** - * Class AssignPropertyOperator. - */ -class AssignPropertyOperator extends AssignVariableOperator -{ - // a -> property = expr - const TYPE_ASSIGN_OBJECT_PROPERTY = 'object-property'; - - // a :: property = expr - const TYPE_ASSIGN_STATIC_PROPERTY = 'static-property'; - - private $property; - private $type = self::TYPE_ASSIGN_OBJECT_PROPERTY; - - /** - * @param null $variable - * @param null $property - * @param AbstractBuilder|null $expression - */ - public function __construct($variable = null, $property = null, AbstractBuilder $expression = null) - { - parent::__construct($variable, $expression); - - if (null !== $property) { - $this->setProperty($property); - } - } - - /** - * @return string - */ - public function getProperty() - { - return $this->property; - } - - /** - * @param string $property - * - * @return $this - */ - public function setProperty($property) - { - $this->property = $property; - - return $this; - } - - /** - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * @param string $type - * - * @return AssignPropertyOperator - */ - public function setType($type) - { - $this->type = $type; - - return $this; - } - - /** - * {@inheritdoc} - */ - protected function preBuild() - { - $expression = parent::preBuild(); - $expression['assign-type'] = $this->getType(); - $expression['property'] = $this->getProperty(); - - return $expression; - } -} diff --git a/Library/Expression/NativeArray.php b/Library/Expression/NativeArray.php deleted file mode 100644 index 72c87e03f7..0000000000 --- a/Library/Expression/NativeArray.php +++ /dev/null @@ -1,450 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Expression; - -use ReflectionException; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\GlobalConstant; -use Zephir\Variable; - -use function count; -use function function_exists; - -/** - * Resolves expressions that create arrays - */ -class NativeArray -{ - protected bool $expecting = true; - - protected bool $readOnly = false; - - protected bool $noisy = true; - - protected ?Variable $expectingVariable = null; - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable - */ - public function setExpectReturn(bool $expecting, Variable $expectingVariable = null) - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly - */ - public function setReadOnly(bool $readOnly): void - { - $this->readOnly = $readOnly; - } - - /** - * Sets whether the expression must be resolved in "noisy" mode. - * - * @param bool $noisy - */ - public function setNoisy(bool $noisy): void - { - $this->noisy = $noisy; - } - - /** - * Resolves an item to be added in an array. - * - * @param CompiledExpression $exprCompiled - * @param CompilationContext $compilationContext - * - * @return Variable - */ - public function getArrayValue(CompiledExpression $exprCompiled, CompilationContext $compilationContext) - { - switch ($exprCompiled->getType()) { - case 'int': - case 'uint': - case 'long': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVar, $exprCompiled->getCode(), $compilationContext); - - return $tempVar; - - case 'char': - case 'uchar': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVar, '\''.$exprCompiled->getCode().'\'', $compilationContext); - - return $tempVar; - - case 'double': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignDouble($tempVar, $exprCompiled->getCode(), $compilationContext); - - return $tempVar; - - case 'bool': - if ('true' === $exprCompiled->getCode()) { - return new GlobalConstant('ZEPHIR_GLOBAL(global_true)'); - } - - if ('false' === $exprCompiled->getCode()) { - return new GlobalConstant('ZEPHIR_GLOBAL(global_false)'); - } - - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignBool($tempVar, $exprCompiled->getCode(), $compilationContext); - - return $tempVar; - - case 'null': - return new GlobalConstant('ZEPHIR_GLOBAL(global_null)'); - - case 'string': - case 'ulong': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignString($tempVar, $exprCompiled->getCode(), $compilationContext); - - return $tempVar; - - case 'array': - return $compilationContext->symbolTable->getVariableForRead($exprCompiled->getCode(), $compilationContext, $exprCompiled->getOriginal()); - - case 'variable': - $itemVariable = $compilationContext->symbolTable->getVariableForRead($exprCompiled->getCode(), $compilationContext, $exprCompiled->getOriginal()); - switch ($itemVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVar, $itemVariable, $compilationContext); - - return $tempVar; - - case 'double': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignDouble($tempVar, $itemVariable, $compilationContext); - - return $tempVar; - - case 'bool': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignBool($tempVar, $itemVariable, $compilationContext); - - return $tempVar; - - case 'string': - case 'variable': - case 'array': - case 'mixed': - return $itemVariable; - - default: - throw new CompilerException('Unknown '.$itemVariable->getType(), $itemVariable); - } - break; - - default: - throw new CompilerException('Unknown', $exprCompiled); - } - } - - /** - * Compiles an array initialization. - * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - * - * @throws ReflectionException - * @throws Exception - */ - public function compile(array $expression, CompilationContext $compilationContext) - { - /** - * Resolves the symbol that expects the value - */ - if ($this->expecting) { - if ($this->expectingVariable) { - $symbolVariable = $this->expectingVariable; - if ('variable' != $symbolVariable->getType() && 'array' != $symbolVariable->getType()) { - throw new CompilerException('Cannot use variable type: '.$symbolVariable->getType().' as an array', $expression); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('array', $compilationContext, $expression); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('array', $compilationContext, $expression); - } - - if (!isset($expression['left'])) { - if ($this->expectingVariable) { - $symbolVariable->initVariant($compilationContext); - } - - /** - * Mark the variable as an array - */ - $symbolVariable->setDynamicTypes('array'); - - return new CompiledExpression('array', $symbolVariable->getRealName(), $expression); - } - - $codePrinter = $compilationContext->codePrinter; - $compilationContext->headersManager->add('kernel/array'); - - /** - * This calculates a prime number bigger than the current array size to possibly - * reduce hash collisions when adding new members to the array. - */ - $arrayLength = count($expression['left']); - if ($arrayLength >= 33 && function_exists('gmp_nextprime')) { - $arrayLength = (int) gmp_strval(gmp_nextprime($arrayLength - 1)); - } - - if ($this->expectingVariable && $symbolVariable->getVariantInits() >= 1) { - $symbolVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->initArray($symbolVariable, $compilationContext, $arrayLength > 0 ? $arrayLength : null); - $symbolVariable->setDynamicTypes('array'); - } else { - if ($this->expectingVariable) { - $symbolVariable->initVariant($compilationContext); - } - - /** - * Mark the variable as an array - */ - $symbolVariable->setDynamicTypes('array'); - $compilationContext->backend->initArray($symbolVariable, $compilationContext, $arrayLength > 0 ? $arrayLength : null); - } - foreach ($expression['left'] as $item) { - if (!isset($item['key'])) { - $expr = new Expression($item['value']); - $resolvedExpr = $expr->compile($compilationContext); - $itemVariable = $this->getArrayValue($resolvedExpr, $compilationContext); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); - $item = $compilationContext->backend->resolveValue($itemVariable, $compilationContext); - $codePrinter->output('zephir_array_fast_append('.$symbol.', '.$item.');'); - if ($itemVariable->isTemporal()) { - $itemVariable->setIdle(true); - } - - continue; - } - - $exprKey = new Expression($item['key']); - $resolvedExprKey = $exprKey->compile($compilationContext); - - switch ($resolvedExprKey->getType()) { - case 'string': - $expr = new Expression($item['value']); - $resolvedExpr = $expr->compile($compilationContext); - switch ($resolvedExpr->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'string': - case 'double': - $compilationContext->backend->addArrayEntry($symbolVariable, $resolvedExprKey, $resolvedExpr, $compilationContext); - break; - - case 'bool': - $compilationContext->headersManager->add('kernel/array'); - if ('true' == $resolvedExpr->getCode()) { - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, 'true', $compilationContext, 'PH_COPY | PH_SEPARATE'); - } else { - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, 'false', $compilationContext, 'PH_COPY | PH_SEPARATE'); - } - break; - - case 'null': - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, 'null', $compilationContext, 'PH_COPY | PH_SEPARATE'); - break; - - case 'array': - case 'variable': - $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, $valueVariable, $compilationContext, 'PH_COPY | PH_SEPARATE'); - if ($valueVariable->isTemporal()) { - $valueVariable->setIdle(true); - } - break; - - default: - throw new CompilerException('Invalid value type: '.$resolvedExpr->getType(), $item['value']); - } - break; - - case 'int': - case 'uint': - case 'long': - case 'ulong': - $expr = new Expression($item['value']); - $resolvedExpr = $expr->compile($compilationContext); - switch ($resolvedExpr->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - case 'string': - $compilationContext->backend->addArrayEntry($symbolVariable, $resolvedExprKey, $resolvedExpr, $compilationContext); - break; - - case 'bool': - if ('true' == $resolvedExpr->getCode()) { - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, 'true', $compilationContext, 'PH_COPY'); - } else { - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, 'false', $compilationContext, 'PH_COPY'); - } - break; - - case 'null': - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, 'null', $compilationContext, 'PH_COPY'); - break; - - case 'array': - case 'variable': - $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, $valueVariable, $compilationContext, 'PH_COPY'); - if ($valueVariable->isTemporal()) { - $valueVariable->setIdle(true); - } - break; - - default: - throw new CompilerException('Invalid value type: '.$item['value']['type'], $item['value']); - } - break; - - case 'variable': - $variableVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExprKey->getCode(), $compilationContext, $item['key']); - switch ($variableVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $expr = new Expression($item['value']); - $resolvedExpr = $expr->compile($compilationContext); - switch ($resolvedExpr->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - case 'double': - case 'null': - case 'string': - $compilationContext->backend->addArrayEntry($symbolVariable, $resolvedExprKey, $resolvedExpr, $compilationContext); - break; - - case 'variable': - $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, $valueVariable, $compilationContext, 'PH_COPY'); - if ($valueVariable->isTemporal()) { - $valueVariable->setIdle(true); - } - break; - - default: - throw new CompilerException('Invalid value type: '.$item['value']['type'], $item['value']); - } - break; - - case 'string': - $expr = new Expression($item['value']); - $resolvedExpr = $expr->compile($compilationContext); - switch ($resolvedExpr->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $codePrinter->output('add_assoc_long_ex('.$symbolVariable->getName().', Z_STRVAL_P('.$resolvedExprKey->getCode().'), Z_STRLEN_P('.$item['key']['value'].'), '.$resolvedExpr->getCode().');'); - break; - - case 'double': - $codePrinter->output('add_assoc_double_ex('.$symbolVariable->getName().', Z_STRVAL_P('.$resolvedExprKey->getCode().'), Z_STRLEN_P('.$item['key']['value'].'), '.$resolvedExpr->getCode().');'); - break; - - case 'bool': - $codePrinter->output('add_assoc_bool_ex('.$symbolVariable->getName().', Z_STRVAL_P('.$resolvedExprKey->getCode().'), Z_STRLEN_P('.$item['key']['value'].'), '.$resolvedExpr->getBooleanCode().');'); - break; - - case 'string': - $compilationContext->backend->addArrayEntry($symbolVariable, $resolvedExprKey, $resolvedExpr, $compilationContext); - break; - - case 'null': - $codePrinter->output('add_assoc_null_ex('.$symbolVariable->getName().', Z_STRVAL_P('.$resolvedExprKey->getCode().'), Z_STRLEN_P('.$item['key']['value'].') + 1);'); - break; - - case 'variable': - $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); - $compilationContext->backend->updateArray($symbolVariable, $resolvedExprKey, $resolvedExpr, $compilationContext); - if ($valueVariable->isTemporal()) { - $valueVariable->setIdle(true); - } - break; - - default: - throw new CompilerException('Invalid value type: '.$resolvedExpr->getType(), $item['value']); - } - break; - - case 'variable': - $expr = new Expression($item['value']); - $resolvedExpr = $expr->compile($compilationContext); - switch ($resolvedExpr->getType()) { - case 'null': - case 'variable': - case 'bool': - $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); - $compilationContext->backend->updateArray($symbolVariable, $variableVariable, $valueVariable, $compilationContext); - - if ($valueVariable->isTemporal()) { - $valueVariable->setIdle(true); - } - break; - - default: - throw new CompilerException('Invalid value type: '.$item['value']['type'], $item['value']); - } - break; - - default: - throw new CompilerException('Cannot use variable type: '.$variableVariable->getType().' as array index', $item['key']); - } - break; - - default: - throw new CompilerException('Invalid key type: '.$resolvedExprKey->getType(), $item['key']); - } - } - - return new CompiledExpression('array', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Expression/Reference.php b/Library/Expression/Reference.php deleted file mode 100644 index cf5a23425e..0000000000 --- a/Library/Expression/Reference.php +++ /dev/null @@ -1,232 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Expression; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\GlobalConstant; -use Zephir\Variable; - -/** - * Expression Reference - * - * Resolves expressions that create arrays. - */ -class Reference -{ - /** - * Expecting the value - * - * @var bool - */ - protected bool $expecting = true; - - /** - * Result of the evaluated expression is read only or not - * - * @var bool - */ - protected bool $readOnly = false; - - /** - * Expecting variable - * - * @var Variable|null - */ - protected ?Variable $expectingVariable = null; - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable - */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null) - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly - */ - public function setReadOnly(bool $readOnly): void - { - $this->readOnly = $readOnly; - } - - /** - * Resolves an item to be added in an array. - * - * @param CompiledExpression $exprCompiled - * @param CompilationContext $compilationContext - * - * @return GlobalConstant|Variable - * - * @throws Exception - */ - public function getArrayValue(CompiledExpression $exprCompiled, CompilationContext $compilationContext) - { - $codePrinter = $compilationContext->codePrinter; - - switch ($exprCompiled->getType()) { - case 'int': - case 'uint': - case 'long': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_LONG('.$tempVar->getName().', '.$exprCompiled->getCode().');'); - - return $tempVar; - - case 'char': - case 'uchar': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_LONG('.$tempVar->getName().', \''.$exprCompiled->getCode().'\');'); - - return $tempVar; - - case 'double': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_DOUBLE('.$tempVar->getName().', '.$exprCompiled->getCode().');'); - - return $tempVar; - - case 'bool': - if ('true' === $exprCompiled->getCode()) { - return new GlobalConstant('ZEPHIR_GLOBAL(global_true)'); - } - - if ('false' === $exprCompiled->getCode()) { - return new GlobalConstant('ZEPHIR_GLOBAL(global_false)'); - } - - throw new Exception('?'); - break; - - case 'null': - return new GlobalConstant('ZEPHIR_GLOBAL(global_null)'); - - case 'string': - case 'ulong': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_STRING('.$tempVar->getName().', "'.$exprCompiled->getCode().'", 1);'); - - return $tempVar; - - case 'array': - return $compilationContext->symbolTable->getVariableForRead($exprCompiled->getCode(), $compilationContext, $exprCompiled->getOriginal()); - - case 'variable': - $itemVariable = $compilationContext->symbolTable->getVariableForRead($exprCompiled->getCode(), $compilationContext, $exprCompiled->getOriginal()); - switch ($itemVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_LONG('.$tempVar->getName().', '.$itemVariable->getName().');'); - - return $tempVar; - - case 'double': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_DOUBLE('.$tempVar->getName().', '.$itemVariable->getName().');'); - - return $tempVar; - - case 'bool': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_BOOL('.$tempVar->getName().', '.$itemVariable->getName().');'); - - return $tempVar; - - case 'string': - case 'variable': - case 'array': - return $itemVariable; - - default: - throw new CompilerException('Unknown '.$itemVariable->getType(), $itemVariable); - } - break; - - default: - throw new CompilerException('Unknown', $exprCompiled); - } - } - - /** - * Compiles a reference to a value. - * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - * - * @throws Exception - */ - public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression - { - /** - * Resolves the symbol that expects the value - */ - if ($this->expecting) { - if ($this->expectingVariable) { - $symbolVariable = $this->expectingVariable; - if ('variable' !== $symbolVariable->getType()) { - throw new CompilerException('Cannot use variable type: '.$symbolVariable->getType().' to store a reference', $expression); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly($this->readOnly); - $left = $leftExpr->compile($compilationContext); - - $validTypes = [ - 'variable', - 'string', - 'object', - 'array', - 'callable', - ]; - - if (!in_array($left->getType(), $validTypes)) { - throw new CompilerException('Cannot obtain a reference from type: '.$left->getType(), $expression); - } - - $leftVariable = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression); - if (!in_array($leftVariable->getType(), $validTypes)) { - throw new CompilerException('Cannot obtain reference from variable type: '.$leftVariable->getType(), $expression); - } - - $symbolVariable->setMustInitNull(true); - $compilationContext->symbolTable->mustGrownStack(true); - - $symbolVariable->increaseVariantIfNull(); - $compilationContext->codePrinter->output('ZEPHIR_MAKE_REFERENCE('.$symbolVariable->getName().', '.$leftVariable->getName().');'); - - return new CompiledExpression('reference', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Expression/StaticPropertyAccess.php b/Library/Expression/StaticPropertyAccess.php deleted file mode 100644 index 56970fee8e..0000000000 --- a/Library/Expression/StaticPropertyAccess.php +++ /dev/null @@ -1,161 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Expression; - -use Zephir\ClassProperty; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Variable; - -/** - * Zephir\Expression\StaticPropertyAccess. - * - * Resolves class static properties - */ -class StaticPropertyAccess -{ - protected $expecting = true; - - protected $readOnly = false; - - /** @var Variable|null */ - protected $expectingVariable; - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable - */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly - */ - public function setReadOnly($readOnly) - { - $this->readOnly = $readOnly; - } - - /** - * Access a static property. - * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - */ - public function compile($expression, CompilationContext $compilationContext) - { - $className = $expression['left']['value']; - $compiler = $compilationContext->compiler; - $property = $expression['right']['value']; - - /* - * Fetch the class definition according to the class where the constant - * is supposed to be declared - */ - if (!\in_array($className, ['self', 'static', 'parent'])) { - $className = $compilationContext->getFullName($className); - if ($compiler->isClass($className)) { - $classDefinition = $compiler->getClassDefinition($className); - } else { - if ($compiler->isBundledClass($className)) { - $classDefinition = $compiler->getInternalClassDefinition($className); - } else { - throw new CompilerException("Cannot locate class '".$className."'", $expression['left']); - } - } - } else { - if (\in_array($className, ['self', 'static'])) { - $classDefinition = $compilationContext->classDefinition; - } else { - if ('parent' == $className) { - $classDefinition = $compilationContext->classDefinition; - $extendsClass = $classDefinition->getExtendsClass(); - if (!$extendsClass) { - throw new CompilerException('Cannot access static property "'.$property.'" on parent because class '.$classDefinition->getCompleteName().' does not extend any class', $expression); - } else { - $classDefinition = $classDefinition->getExtendsClassDefinition(); - } - } - } - } - - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $expression); - } - - /** @var ClassProperty $propertyDefinition */ - $propertyDefinition = $classDefinition->getProperty($property); - if (!$propertyDefinition->isStatic()) { - throw new CompilerException("Cannot access non-static property '".$classDefinition->getCompleteName().'::'.$property."'", $expression); - } - - if ($propertyDefinition->isPrivate()) { - if ($classDefinition != $compilationContext->classDefinition) { - throw new CompilerException("Cannot access private static property '".$classDefinition->getCompleteName().'::'.$property."' out of its declaring context", $expression); - } - } - - if ($propertyDefinition->isProtected()) { - if ($classDefinition != $compilationContext->classDefinition && $classDefinition != $compilationContext->classDefinition->getExtendsClassDefinition()) { - throw new CompilerException("Cannot access protected static property '".$classDefinition->getCompleteName().'::'.$property."' out of its declaring context", $expression); - } - } - - /* - * Resolves the symbol that expects the value - */ - if ($this->expecting) { - if ($this->expectingVariable) { - $symbolVariable = $this->expectingVariable; - if ('return_value' == $symbolVariable->getName()) { - $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext); - } - - /* - * Variable that receives property accesses must be polymorphic - */ - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Cannot use variable: '.$symbolVariable->getType().' to assign class constants', $expression); - } - - $symbolVariable->setDynamicTypes('undefined'); - - $compilationContext->headersManager->add('kernel/object'); - - $readOnly = $this->readOnly; - if (!$readOnly) { - if ('return_value' != $symbolVariable->getName()) { - $symbolVariable->observeVariant($compilationContext); - } - } - $compilationContext->backend->fetchStaticProperty($symbolVariable, $classDefinition, $property, $this->readOnly, $compilationContext); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Fcall/FcallAwareInterface.php b/Library/Fcall/FcallAwareInterface.php deleted file mode 100644 index 307a754048..0000000000 --- a/Library/Fcall/FcallAwareInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Fcall; - -/** - * Zephir\Fcall\FcallAwareInterface. - */ -interface FcallAwareInterface -{ - /** - * Sets the FcallManager. - * - * @param FcallManagerInterface $fcallManager - */ - public function setFcallManager(FcallManagerInterface $fcallManager); - - /** - * Returns currently used FcallManager. - * - * @return FcallManagerInterface - */ - public function getFcallManager(); -} diff --git a/Library/FunctionLike/ReturnType/CastHint.php b/Library/FunctionLike/ReturnType/CastHint.php deleted file mode 100644 index a321b3e823..0000000000 --- a/Library/FunctionLike/ReturnType/CastHint.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -final class CastHint implements TypeInterface -{ - /** - * @var string - */ - private $dataType; - - /** - * @var string - */ - private $value; - - /** - * @var string - */ - private $type; - - /** - * @var bool - */ - private $collection; - - /** - * Real return type constructor. - * - * @param string $dataType - * @param string|null $value - * @param string|null $type - * @param int|bool $collection - */ - public function __construct($dataType, $value, $type = null, $collection = false) - { - $this->dataType = $dataType; - $this->value = $value; - $this->type = $type ?: TypeInterface::TYPE_PARAMETER; - $this->collection = (bool) $collection; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getDataType() - { - return $this->dataType; - } - - /** - * {@inheritdoc} - * - * @return string|null - */ - public function getValue() - { - return $this->value; - } - - /** - * {@inheritdoc} - * - * The cast hint is always not mandatory. - * - * @return mixed - */ - public function isMandatory() - { - return false; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function isCollection() - { - return $this->collection; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function isRealType() - { - return false; - } -} diff --git a/Library/FunctionLike/ReturnType/Collection.php b/Library/FunctionLike/ReturnType/Collection.php deleted file mode 100644 index b1198d1e6e..0000000000 --- a/Library/FunctionLike/ReturnType/Collection.php +++ /dev/null @@ -1,322 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\FunctionLike\ReturnType; - -use SplObjectStorage; -use Zephir\Exception\InvalidArgumentException; - -use function count; - -final class Collection extends SplObjectStorage -{ - /** - * {@inheritdoc} - * - * @param TypeInterface $returnType - * - * @return string - */ - #[\ReturnTypeWillChange] - public function getHash($returnType) - { - return $returnType->getDataType(); - } - - /** - * {@inheritdoc} - * - * @param TypeInterface $returnType The return type instance - * @param array $definition The definition to associate with the return type instance - * - * @return $this - * - * @throws InvalidArgumentException - */ - #[\ReturnTypeWillChange] - public function attach($returnType, $definition = null) - { - if (!$returnType instanceof TypeInterface) { - $wrong = \is_object($returnType) ? 'instance of '.\get_class($returnType) : \gettype($returnType); - - throw new InvalidArgumentException( - sprintf('Expecting an instance of %s, got %s', TypeInterface::class, $wrong) - ); - } - - parent::attach($returnType, $definition); - - return $this; - } - - /** - * Checks if the collection has return-type or cast hints. - * - * @return bool - */ - public function hasReturnTypes(): bool - { - if (0 === $this->count() || $this->onlyVoid()) { - return false; - } - - return true; - } - - /** - * Gets all return types satisfied by specification. - * - * @param SpecificationInterface $spec - * - * @return TypeInterface[] - */ - public function getTypesBySpecification(SpecificationInterface $spec): array - { - $types = []; - - foreach ($this as $type) { - /** @var TypeInterface $type */ - if ($spec->isSatisfiedBy($type)) { - $types[] = $type; - } - } - - return $types; - } - - /** - * Checks whether at least one return type hint is null compatible. - * - * @return bool - */ - public function areReturnTypesNullCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\IsNull()); - } - - /** - * Checks whether at least one return type hint is integer compatible. - * - * @return bool - */ - public function areReturnTypesIntCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\IntCompatible()); - } - - /** - * Checks whether at least one return type hint is double compatible. - * - * @return bool - */ - public function areReturnTypesDoubleCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\IsDouble()); - } - - /** - * Checks whether at least one return type hint is bool compatible. - * - * @return bool - */ - public function areReturnTypesBoolCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\IsBool()); - } - - /** - * Checks whether at least one return type hint is string compatible. - * - * @return bool - */ - public function areReturnTypesStringCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\StringCompatible()); - } - - /** - * Checks whether at least one return type hint is string compatible. - * - * @return bool - */ - public function areReturnTypesArrayCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\ArrayCompatible()); - } - - /** - * Checks whether at least one return type hint is object compatible. - * - * @return bool - */ - public function areReturnTypesObjectCompatible(): bool - { - return count($this->getObjectLikeReturnTypes()) > 0; - } - - /** - * Get object like return types. - * - * @return TypeInterface[] - */ - public function getObjectLikeReturnTypes() - { - return $this->getTypesBySpecification(new Specification\ObjectLike()); - } - - /** - * Checks if the collection has only void. - */ - public function onlyVoid() - { - return $this->isSatisfiedByTypeSpec(new Specification\IsVoid()) && 1 == $this->count(); - } - - /** - * Checks if the collection has only special types. - */ - public function onlySpecial() - { - if (0 == $this->count()) { - return false; - } - - $found = $this->getTypesBySpecification(new Specification\IsSpecial()); - - return count($found) == $this->count(); - } - - /** - * Checks whether all return types hint are well known. - * - * @return bool - */ - public function areReturnTypesWellKnown(): bool - { - if (0 === $this->count() || $this->isSatisfiedByTypeSpec(new Specification\IsSpecial())) { - return false; - } - - $spec = - (new Specification\ObjectLike()) - ->either(new Specification\ArrayCompatible()) - ->either(new Specification\IntCompatible()) - ->either(new Specification\StringCompatible()) - ->either(new Specification\IsBool()) - ->either(new Specification\IsDouble()) - ->either(new Specification\IsNull()) - // TODO: Please double check this - ->either(new Specification\IsVoid()); - - $found = $this->getTypesBySpecification($spec); - - return count($found) == $this->count(); - } - - /** - * Checks if the collection have compatible return types. - * - * @return bool - */ - public function areReturnTypesCompatible(): bool - { - $numberOfReturnTypes = $this->count(); - - if (0 == $numberOfReturnTypes || 1 == $numberOfReturnTypes) { - return true; - } - - // | | ... | - $classes = $this->getObjectLikeReturnTypes(); - - // | | | ... | - $collections = $this->getTypesBySpecification(new Specification\IsCollection()); - if (count($collections) > 0 && $this->areReturnTypesObjectCompatible()) { - return false; - } - - $summ = - // array | | | ... | - (int) $this->areReturnTypesArrayCompatible() + - - // char | uchar | int | uint | long | ulong - (int) $this->areReturnTypesIntCompatible() + - - // bool - (int) $this->areReturnTypesBoolCompatible() + - - // istring | string - (int) $this->areReturnTypesStringCompatible() + - - // double - (int) $this->areReturnTypesDoubleCompatible(); - - // T1 | T2 | ... | Tn - if ($summ > 1) { - return false; - } - - // | - if ($this->areReturnTypesObjectCompatible() && $summ > 0) { - return false; - } - - // null - $null = (int) $this->areReturnTypesNullCompatible(); - - // | null - // | null - // | null - if (1 == $null && 2 == $this->count()) { - return true; - } - - // T1 | T2 | ... | Tn | null - if (1 == $null && $null + $summ != $this->count()) { - return false; - } - - return 1 == $summ; - } - - /** - * Returns an array of cast hinted return types (if any). - * - * @return TypeInterface[] - */ - public function getCastHintedReturnTypes(): array - { - return $this->getTypesBySpecification(new Not(new Specification\IsReal())); - } - - /** - * Returns an array of real return types (if any). - * - * @return TypeInterface[] - */ - public function getRealReturnTypes(): array - { - return $this->getTypesBySpecification(new Specification\IsReal()); - } - - private function isSatisfiedByTypeSpec(SpecificationInterface $spec): bool - { - if (0 === $this->count()) { - return false; - } - - $found = $this->getTypesBySpecification($spec); - - return count($found) > 0; - } -} diff --git a/Library/FunctionLike/ReturnType/CompositeSpecification.php b/Library/FunctionLike/ReturnType/CompositeSpecification.php deleted file mode 100644 index f25434a76f..0000000000 --- a/Library/FunctionLike/ReturnType/CompositeSpecification.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -abstract class CompositeSpecification implements SpecificationInterface -{ - /** - * Creates a new logical OR composite specification. - * - * @param SpecificationInterface $spec - * - * @return Either - */ - public function either(SpecificationInterface $spec) - { - return new Either($this, $spec); - } - - /** - * Creates a new logical AND specification. - * - * @param SpecificationInterface $spec - * - * @return Plus - */ - public function plus(SpecificationInterface $spec) - { - return new Plus($this, $spec); - } - - /** - * Creates a new logical NOT specification. - * - * @return Not - */ - public function not() - { - return new Not($this); - } - - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - abstract public function isSatisfiedBy(ReturnType\TypeInterface $type); -} diff --git a/Library/FunctionLike/ReturnType/Either.php b/Library/FunctionLike/ReturnType/Either.php deleted file mode 100644 index 6dae122968..0000000000 --- a/Library/FunctionLike/ReturnType/Either.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -final class Either extends CompositeSpecification -{ - /** - * Left Specification. - * - * @var SpecificationInterface - */ - protected $left; - - /** - * Right Specification. - * - * @var SpecificationInterface - */ - protected $right; - - /** - * A composite wrapper of two specifications. - * - * @param SpecificationInterface $left - * @param SpecificationInterface $right - */ - public function __construct(SpecificationInterface $left, SpecificationInterface $right) - { - $this->left = $left; - $this->right = $right; - } - - /** - * Returns the evaluation of both wrapped specifications as a logical OR. - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $this->left->isSatisfiedBy($type) || $this->right->isSatisfiedBy($type); - } -} diff --git a/Library/FunctionLike/ReturnType/Factory.php b/Library/FunctionLike/ReturnType/Factory.php deleted file mode 100644 index 951aa7793a..0000000000 --- a/Library/FunctionLike/ReturnType/Factory.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\Types; - -final class Factory -{ - /** - * @param array $ir - * - * @return TypeInterface - */ - public function create(array $ir) - { - if (!isset($ir['cast'])) { - return $this->createRealType( - isset($ir['data-type']) ? $ir['data-type'] : Types::T_UNDEFINED, - $ir - ); - } - - return $this->createCastHint( - isset($ir['cast']['type']) ? $ir['cast']['type'] : Types::T_UNDEFINED, - $ir - ); - } - - /** - * @param array $ir - * - * @return TypeInterface - */ - public function createVoid(array $ir) - { - return $this->createRealType(Types::T_VOID, $ir); - } - - /** - * @param string $dataType - * @param array $ir - * - * @return TypeInterface|RealType - */ - protected function createRealType($dataType, array $ir) - { - return new RealType( - $dataType, - isset($ir['mandatory']) && $ir['mandatory'], - isset($ir['type']) ? $ir['type'] : null - ); - } - - /** - * @param string $dataType - * @param array $ir - * - * @return TypeInterface|CastHint - */ - protected function createCastHint($dataType, array $ir) - { - return new CastHint( - $dataType, - isset($ir['cast']['value']) ? $ir['cast']['value'] : null, - isset($ir['type']) ? $ir['type'] : null, - isset($ir['collection']) && $ir['collection'] - ); - } -} diff --git a/Library/FunctionLike/ReturnType/Not.php b/Library/FunctionLike/ReturnType/Not.php deleted file mode 100644 index da10763237..0000000000 --- a/Library/FunctionLike/ReturnType/Not.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -final class Not extends CompositeSpecification -{ - /** - * @var SpecificationInterface - */ - protected $spec; - - /** - * Creates a new specification wrapping another. - * - * @param SpecificationInterface $spec - */ - public function __construct(SpecificationInterface $spec) - { - $this->spec = $spec; - } - - /** - * Returns the negated result of the wrapped specification. - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return false == $this->spec->isSatisfiedBy($type); - } -} diff --git a/Library/FunctionLike/ReturnType/Plus.php b/Library/FunctionLike/ReturnType/Plus.php deleted file mode 100644 index f3bd0be1d1..0000000000 --- a/Library/FunctionLike/ReturnType/Plus.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -final class Plus extends CompositeSpecification -{ - /** - * Left Specification. - * - * @var SpecificationInterface - */ - protected $left; - - /** - * Right Specification. - * - * @var SpecificationInterface - */ - protected $right; - - /** - * A composite wrapper of two specifications. - * - * @param SpecificationInterface $left - * @param SpecificationInterface $right - */ - public function __construct(SpecificationInterface $left, SpecificationInterface $right) - { - $this->left = $left; - $this->right = $right; - } - - /** - * Checks if the composite AND of specifications passes. - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $this->left->isSatisfiedBy($type) && $this->right->isSatisfiedBy($type); - } -} diff --git a/Library/FunctionLike/ReturnType/RealType.php b/Library/FunctionLike/ReturnType/RealType.php deleted file mode 100644 index d4337ed164..0000000000 --- a/Library/FunctionLike/ReturnType/RealType.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -final class RealType implements TypeInterface -{ - /** - * @var string - */ - private $dataType; - - /** - * @var bool - */ - private $mandatory; - - /** - * @var string - */ - private $type; - - /** - * Real return type constructor. - * - * @param string $dataType - * @param bool $mandatory - * @param string|null $type - */ - public function __construct($dataType, $mandatory = false, $type = null) - { - $this->dataType = $dataType; - $this->mandatory = (bool) $mandatory; - $this->type = $type ?: TypeInterface::TYPE_PARAMETER; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getDataType() - { - return $this->dataType; - } - - /** - * {@inheritdoc} - * - * Getting values for a real data types is not supported. - */ - public function getValue() - { - return null; - } - - /** - * {@inheritdoc} - * - * @return mixed - */ - public function isMandatory() - { - return $this->mandatory; - } - - /** - * {@inheritdoc} - * - * Checking, whether the return type is the collection for a real data types is not supported. - * - * @return bool - */ - public function isCollection() - { - return false; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function isRealType() - { - return true; - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php b/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php deleted file mode 100644 index 8ddf7435f2..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class ArrayCompatible extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - if ($type->isRealType()) { - return Types::T_ARRAY == $type->getDataType(); - } - - return $type->isCollection(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IntCompatible.php b/Library/FunctionLike/ReturnType/Specification/IntCompatible.php deleted file mode 100644 index 2828284c74..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IntCompatible.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IntCompatible extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - if (false == $type->isRealType()) { - return false; - } - - switch ($type->getDataType()) { - case Types::T_INT: - case Types::T_UINT: - case Types::T_CHAR: - case Types::T_UCHAR: - case Types::T_LONG: - case Types::T_ULONG: - return true; - default: - return false; - } - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsAnnotated.php b/Library/FunctionLike/ReturnType/Specification/IsAnnotated.php deleted file mode 100644 index 5ba517b7e5..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsAnnotated.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; - -final class IsAnnotated extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return ReturnType\TypeInterface::TYPE_ANNOTATION == $type->getType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsBool.php b/Library/FunctionLike/ReturnType/Specification/IsBool.php deleted file mode 100644 index a37ff78434..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsBool.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IsBool extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType() && Types::T_BOOL == $type->getDataType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsCollection.php b/Library/FunctionLike/ReturnType/Specification/IsCollection.php deleted file mode 100644 index 270f1f20ea..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsCollection.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; - -final class IsCollection extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return false == $type->isRealType() && true == $type->isCollection(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsDouble.php b/Library/FunctionLike/ReturnType/Specification/IsDouble.php deleted file mode 100644 index 4082a07c58..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsDouble.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IsDouble extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType() && Types::T_DOUBLE == $type->getDataType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsNull.php b/Library/FunctionLike/ReturnType/Specification/IsNull.php deleted file mode 100644 index 03ebd96473..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsNull.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IsNull extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType() && Types::T_NULL == $type->getDataType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsReal.php b/Library/FunctionLike/ReturnType/Specification/IsReal.php deleted file mode 100644 index 61ef53fc41..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsReal.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; - -final class IsReal extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsSpecial.php b/Library/FunctionLike/ReturnType/Specification/IsSpecial.php deleted file mode 100644 index 64e35344d7..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsSpecial.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -/** - * Special types specification. - * - * Used only for type hinting. - */ -final class IsSpecial extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - switch ($type->getDataType()) { - case Types::T_NUMBER: - case Types::T_RESOURCE: - case Types::T_VARIABLE: - case Types::T_CALLABLE: - case Types::T_ITERABLE: - return true; - default: - return false; - } - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsVoid.php b/Library/FunctionLike/ReturnType/Specification/IsVoid.php deleted file mode 100644 index 16b9bb1432..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsVoid.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IsVoid extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType() && Types::T_VOID == $type->getDataType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/ObjectLike.php b/Library/FunctionLike/ReturnType/Specification/ObjectLike.php deleted file mode 100644 index c4a9456a22..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/ObjectLike.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class ObjectLike extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - if (true == $type->isRealType()) { - return false; - } - - return Types::T_OBJECT == $type->getDataType() && false === $type->isCollection(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/StringCompatible.php b/Library/FunctionLike/ReturnType/Specification/StringCompatible.php deleted file mode 100644 index bdc81dfce5..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/StringCompatible.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class StringCompatible extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - if (false == $type->isRealType()) { - return false; - } - - switch ($type->getDataType()) { - case Types::T_STRING: - case Types::T_ISTRING: - return true; - default: - return false; - } - } -} diff --git a/Library/FunctionLike/ReturnType/SpecificationInterface.php b/Library/FunctionLike/ReturnType/SpecificationInterface.php deleted file mode 100644 index cd5eabbc66..0000000000 --- a/Library/FunctionLike/ReturnType/SpecificationInterface.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -interface SpecificationInterface -{ - /** - * Checks if given type meets all criteria. - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type); -} diff --git a/Library/FunctionLike/ReturnType/TypeInterface.php b/Library/FunctionLike/ReturnType/TypeInterface.php deleted file mode 100644 index a4c849247b..0000000000 --- a/Library/FunctionLike/ReturnType/TypeInterface.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -interface TypeInterface -{ - const TYPE_PARAMETER = 'return-type-parameter'; - const TYPE_ANNOTATION = 'return-type-annotation'; - - /** - * Gets the intermediate type. - * - * In most cases this will be a "return-type-parameter" - * string except for some rare cases. - * - * @return string - */ - public function getType(); - - /** - * Gets return data type name. - * - * @return string - */ - public function getDataType(); - - /** - * Gets casted return type. - * - * @return string|null - */ - public function getValue(); - - /** - * Is return type mandatory. - * - * @return mixed - */ - public function isMandatory(); - - /** - * Is the return value a collection. - * - * @return bool - */ - public function isCollection(); - - /** - * Is the return type a real type or it is just a cast hint. - * - * @return bool - */ - public function isRealType(); -} diff --git a/Library/MethodCallWarmUp.php b/Library/MethodCallWarmUp.php deleted file mode 100644 index 46d4d8223c..0000000000 --- a/Library/MethodCallWarmUp.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -/** - * MethodCallWarmUp. - * - * List of methods that require warm up - */ -class MethodCallWarmUp -{ - private $warmUps = []; - - /** - * @param ClassDefinition $classDefinition - * @param ClassMethod $method - */ - public function add(ClassDefinition $classDefinition, ClassMethod $method) - { - $this->warmUps[] = [ - $classDefinition, - $method, - ]; - } - - public function get() - { - } -} diff --git a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php deleted file mode 100644 index c490503d83..0000000000 --- a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php +++ /dev/null @@ -1,549 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Operators\Arithmetical; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Operators\AbstractOperator; -use Zephir\Variable; - -/** - * This is the base operator for commutative, associative and distributive - * arithmetic operators - */ -class ArithmeticalBaseOperator extends AbstractOperator -{ - protected bool $literalOnly = true; - - /** - * This tries to perform arithmetical operations. - * - * Probably gcc/clang will optimize them without this optimization - * - * @see https://en.wikipedia.org/wiki/Constant_folding - * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return bool|CompiledExpression - */ - public function optimizeConstantFolding(array $expression, CompilationContext $compilationContext) - { - if ('int' != $expression['left']['type'] && 'double' != $expression['left']['type']) { - return false; - } - - if ($compilationContext->config->get('constant-folding', 'optimizations')) { - if ('int' == $expression['left']['type'] && 'int' == $expression['right']['type']) { - switch ($this->operator) { - case '+': - return new CompiledExpression('int', $expression['left']['value'] + $expression['right']['value'], $expression); - - case '-': - return new CompiledExpression('int', $expression['left']['value'] - $expression['right']['value'], $expression); - - case '*': - return new CompiledExpression('int', $expression['left']['value'] * $expression['right']['value'], $expression); - } - } - - if (('double' == $expression['left']['type'] && 'double' == $expression['right']['type']) || ('double' == $expression['left']['type'] && 'int' == $expression['right']['type']) || ('int' == $expression['left']['type'] && 'double' == $expression['right']['type'])) { - switch ($this->operator) { - case '+': - return new CompiledExpression('double', $expression['left']['value'] + $expression['right']['value'], $expression); - - case '-': - return new CompiledExpression('double', $expression['left']['value'] - $expression['right']['value'], $expression); - - case '*': - return new CompiledExpression('double', $expression['left']['value'] * $expression['right']['value'], $expression); - } - } - } - - return false; - } - - /** - * Compiles the arithmetical operation. - * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @throws Exception - * @throws CompilerException - * - * @return CompiledExpression - */ - public function compile($expression, CompilationContext $compilationContext) - { - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression', $expression); - } - - if (!isset($expression['right'])) { - throw new CompilerException('Missing right part of the expression', $expression); - } - - // Check for constant folding optimizations - if ($optimized = $this->optimizeConstantFolding($expression, $compilationContext)) { - return $optimized; - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly(true); - $left = $leftExpr->compile($compilationContext); - - $rightExpr = new Expression($expression['right']); - $rightExpr->setReadOnly(true); - $right = $rightExpr->compile($compilationContext); - - switch ($left->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('double', '((double) '.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', '(double) ('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableRight = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' zephir_get_numberval('.$variableRight.'))', $expression); - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'int' with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('long', '('.$left->getBooleanCode().' + '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - default: - throw new CompilerException("Cannot operate 'bool' with '".$right->getType()."'", $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', '('.$left->getCode().' '.$this->operator.' (double) ('.$right->getCode().'))', $expression); - - case 'double': - return new CompiledExpression('double', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('double', '('.$left->getCode().' '.$this->operator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - return new CompiledExpression('double', '('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', '(double) ('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableRight = $compilationContext->backend->getVariableCode($variableRight, $compilationContext); - - return new CompiledExpression('double', '('.$left->getCode().' '.$this->operator.' zephir_get_numberval('.$variableRight.'))', $expression); - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'double' with '".$right->getType()."'", $expression); - } - break; - - case 'string': - switch ($right->getType()) { - default: - throw new CompilerException('Operation is not supported between strings', $expression); - } - break; - - case 'variable': - $variableLeft = $compilationContext->symbolTable->getVariableForRead($left->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableLeft->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', '((double) '.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableRight = $compilationContext->backend->getVariableCode($variableRight, $compilationContext); - - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' zephir_get_numberval('.$variableRight.'))', $expression); - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'char': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableRight = $compilationContext->backend->getVariableCode($variableRight, $compilationContext); - - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' zephir_get_numberval('.$variableRight.'))', $expression); - - default: - throw new CompilerException("Cannot operate variable('char') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('char') with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableRight = $compilationContext->backend->getVariableCode($variableRight, $compilationContext); - - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' zephir_get_numberval('.$variableRight.'))', $expression); - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', '('.$left->getCode().' '.$this->operator.' (double) '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('double', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', '('.$variableLeft->getName().' '.$this->operator.' (double) '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableRight = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' zephir_get_numberval('.$variableRight.'))', $expression); - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'string': - throw new CompilerException("Cannot operate string variables'", $expression); - case 'array': - switch ($right->getType()) { - /* a(var) + a(x) */ - case 'array': - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableRight->getType()) { - /* a(var) + a(var) */ - case 'array': - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - - $expected = $this->getExpected($compilationContext, $expression); - $compilationContext->backend->zvalOperator($this->zvalOperator, $expected, $variableLeft, $variableRight, $compilationContext); - - if ($variableLeft->isTemporal()) { - $variableLeft->setIdle(true); - } - if ($variableRight->isTemporal()) { - $variableRight->setIdle(true); - } - - $expected->setDynamicTypes($this->getDynamicTypes($variableLeft, $variableRight)); - - return new CompiledExpression('variable', $expected->getName(), $expression); - - default: - throw new CompilerException("Cannot operate 'array with variable ('".$variableRight->getType()."')", $expression); - } - break; - } - break; - - case 'variable': - switch ($right->getType()) { - /* a + 1 */ - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - $compilationContext->headersManager->add('kernel/operators'); - $op = $this->operator; - - $op1 = $compilationContext->backend->getVariableCode($variableLeft); - $op2 = $right->getCode(); - if ('double' == $right->getType()) { - return new CompiledExpression('double', '(zephir_get_numberval('.$op1.') '.$op.' '.$op2.')', $expression); - } else { - return new CompiledExpression('int', '(zephir_get_numberval('.$op1.') '.$op.' '.$op2.')', $expression); - } - break; - - /* a(var) + a(x) */ - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableRight->getType()) { - /* a(var) + a(int) */ - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - $compilationContext->headersManager->add('kernel/operators'); - $variableLeft = $compilationContext->backend->getVariableCode($variableLeft); - - return new CompiledExpression( - 'double' == $variableRight->getType() ? 'double' : 'int', - sprintf( - '(zephir_get_numberval(%s) %s %s)', - $variableLeft, - $this->operator, - $variableRight->getName() - ), - $expression - ); - break; - - /* a(var) + a(bool) */ - case 'bool': - $compilationContext->headersManager->add('kernel/operators'); - $variableLeft = $compilationContext->backend->getVariableCode($variableLeft); - - return new CompiledExpression('int', '(zephir_get_numberval('.$variableLeft.') '.$this->operator.' '.$variableRight->getName().')', $expression); - break; - - /* a(var) + a(var) */ - case 'variable': - case 'array': - $compilationContext->headersManager->add('kernel/operators'); - - $expected = $this->getExpected($compilationContext, $expression); - $compilationContext->backend->zvalOperator($this->zvalOperator, $expected, $variableLeft, $variableRight, $compilationContext); - - if ($variableLeft->isTemporal()) { - $variableLeft->setIdle(true); - } - if ($variableRight->isTemporal()) { - $variableRight->setIdle(true); - } - - $expected->setDynamicTypes($this->getDynamicTypes($variableLeft, $variableRight)); - - return new CompiledExpression('variable', $expected->getName(), $expression); - - default: - throw new CompilerException("Cannot operate 'variable' with variable ('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'variable' with '".$right->getType()."'", $expression); - } - break; - - default: - throw new CompilerException("Unknown '".$variableLeft->getType()."'", $expression); - } - break; - - default: - throw new CompilerException('Unsupported type: '.$left->getType(), $expression); - } - } - - /** - * Returns proper dynamic types. - * - * @param Variable $left - * @param Variable $right - * - * @return string - */ - private function getDynamicTypes(Variable $left, Variable $right) - { - if ('/' == $this->operator) { - return 'double'; - } - - switch ($left->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return 'int'; - } - break; - } - - return 'double'; - } -} diff --git a/Library/Operators/Arithmetical/DivOperator.php b/Library/Operators/Arithmetical/DivOperator.php deleted file mode 100644 index bdb56058f6..0000000000 --- a/Library/Operators/Arithmetical/DivOperator.php +++ /dev/null @@ -1,450 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Operators\Arithmetical; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Expression; - -/** - * Generates an arithmetical operation according to the operands - */ -class DivOperator extends ArithmeticalBaseOperator -{ - protected string $operator = '/'; - - protected string $bitOperator = '-'; - - protected string $zvalOperator = 'div_function'; - - /** - * Compiles the arithmetical division operation. - * - * @param array $expression - * @param CompilationContext $compilationContext - */ - public function compile($expression, CompilationContext $compilationContext) - { - if (!isset($expression['left'])) { - throw new \Exception('Missing left part of the expression'); - } - - if (!isset($expression['right'])) { - throw new \Exception('Missing right part of the expression'); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly(true); - $left = $leftExpr->compile($compilationContext); - - $rightExpr = new Expression($expression['right']); - $rightExpr->setReadOnly(true); - $right = $rightExpr->compile($compilationContext); - - $compilationContext->headersManager->add('kernel/operators'); - - switch ($left->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_div_long_long('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_long_double((double) '.$left->getCode().', '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getCode().' - '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - return new CompiledExpression('double', 'zephir_safe_div_long_long('.$left->getCode().', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_long_double('.$left->getCode().', '.$variableRight->getName().')', $expression); - - case 'variable': - $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('double', 'zephir_safe_div_long_zval('.$left->getCode().', '.$variableRightCode.')', $expression); - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'int' with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('long', '('.$left->getBooleanCode().' - '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - default: - throw new CompilerException("Cannot operate 'bool' with '".$right->getType()."'", $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_div_double_long('.$left->getCode().', (double) ('.$right->getCode().'))', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_double_long('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('double', 'zephir_safe_div_double_long('.$left->getCode().', '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - return new CompiledExpression('double', 'zephir_safe_div_double_long('.$left->getCode().', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_double_double('.$left->getCode().', '.$variableRight->getName().')', $expression); - - case 'variable': - $symbolRight = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('double', 'zephir_safe_div_double_zval('.$left->getCode().', '.$symbolRight.')', $expression); - break; - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'double' with '".$right->getType()."'", $expression); - } - break; - - case 'string': - case 'array': - switch ($right->getType()) { - default: - throw new CompilerException('Operation is not supported between '.$right->getType(), $expression); - } - break; - - case 'variable': - $variableLeft = $compilationContext->symbolTable->getVariableForRead($left->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableLeft->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_div_long_long('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_long_double('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - return new CompiledExpression('double', 'zephir_safe_div_long_long('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_long_double('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - if ($variableRight->isLocalOnly()) { - return new CompiledExpression('double', 'zephir_safe_div_long_zval('.$variableLeft->getName().', &'.$variableRight->getName().')', $expression); - } else { - $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('double', 'zephir_safe_div_long_zval('.$variableLeft->getName().', '.$variableRightCode.')', $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('bool', '('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_div_long_long('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_long_double('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('double', 'zephir_safe_div_long_long('.$variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - if ($variableRight->isLocalOnly()) { - return new CompiledExpression('double', 'zephir_safe_div_long_zval('.$variableLeft->getName().', &'.$variableRight->getName().')', $expression); - } else { - $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('double', 'zephir_safe_div_long_zval('.$variableLeft->getName().', '.$variableRightCode.')', $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_double_long('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_div_double_long('.$variableLeft->getName().', (double) '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_double_long('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $symbolRight = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('double', 'zephir_safe_div_double_zval('.$variableLeft->getName().', '.$symbolRight.')', $expression); - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'string': - throw new CompilerException("Cannot operate string variables'", $expression); - case 'array': - throw new CompilerException("Cannot operate array variables'", $expression); - case 'variable': - $op1 = $compilationContext->backend->getVariableCode($variableLeft); - switch ($right->getType()) { - /* a + 1 */ - case 'int': - case 'uint': - case 'long': - case 'ulong': - $op2 = $right->getCode(); - - return new CompiledExpression('double', 'zephir_safe_div_zval_long('.$op1.', '.$op2.')', $expression); - - case 'double': - $op2 = $right->getCode(); - - return new CompiledExpression('double', 'zephir_safe_div_zval_double('.$op1.', '.$op2.')', $expression); - - /* a(var) + a(x) */ - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableRight->getType()) { - /* a(var) + a(int) */ - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_div_zval_long('.$op1.', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_zval_double('.$op1.', '.$variableRight->getName().')', $expression); - - /* a(var) + a(bool) */ - case 'bool': - return new CompiledExpression('int', 'zephir_safe_div_zval_long('.$op1.', '.$variableRight->getName().')', $expression); - - /* a(var) + a(var) */ - case 'variable': - $op2 = $compilationContext->backend->getVariableCode($variableRight); - - $expected = $this->getExpected($compilationContext, $expression); - $expectedCode = $compilationContext->backend->getVariableCode($expected); - $compilationContext->codePrinter->output($this->zvalOperator.'('.$expectedCode.', '.$op1.', '.$op2.');'); - - if ($variableLeft->isTemporal()) { - $variableLeft->setIdle(true); - } - if ($variableRight->isTemporal()) { - $variableRight->setIdle(true); - } - - return new CompiledExpression('variable', $expected->getName(), $expression); - - default: - throw new CompilerException("Cannot operate 'variable' with variable ('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'variable' with '".$right->getType()."'", $expression); - } - break; - - case 'variable': - $op1 = $compilationContext->backend->getVariableCode($variableLeft); - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $op2 = $right->getCode(); - - return new CompiledExpression('double', 'zephir_safe_div_zval_long('.$op1.', '.$op2.')', $expression); - - case 'double': - $op2 = $right->getCode(); - - return new CompiledExpression('double', 'zephir_safe_div_zval_double('.$op1.', '.$op2.')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - return new CompiledExpression('double', 'zephir_safe_div_zval_long('.$op1.', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_zval_double('.$op1.', '.$variableRight->getName().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($variableRight->getCode(), $compilationContext, $expression); - $op2 = $compilationContext->backend->getVariableCode($variableRight); - switch ($variableRight->getType()) { - case 'int': - return new CompiledExpression('double', 'zephir_safe_div_zval_long('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_div_zval_double('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('bool', $variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName(), $expression); - - case 'variable': - $expected = $this->getExpected($compilationContext, $expression); - $expectedCode = $compilationContext->backend->getVariableCode($expected); - $compilationContext->codePrinter->output($this->zvalOperator.'('.$expectedCode.', '.$op1.', '.$op2.');'); - - return new CompiledExpression('variable', $expected->getName(), $expression); - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'variable' with variable ('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'variable' with '".$right->getType()."'", $expression); - } - break; - - default: - throw new CompilerException("Unknown '".$variableLeft->getType()."'", $expression); - } - break; - - default: - throw new CompilerException('Unsupported type: '.$left->getType(), $expression); - } - } -} diff --git a/Library/Operators/Arithmetical/ModOperator.php b/Library/Operators/Arithmetical/ModOperator.php deleted file mode 100644 index a82bb4718a..0000000000 --- a/Library/Operators/Arithmetical/ModOperator.php +++ /dev/null @@ -1,455 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Operators\Arithmetical; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Expression; - -/** - * Generates an arithmetical operation according to the operands - */ -class ModOperator extends ArithmeticalBaseOperator -{ - protected string $operator = '%'; - - protected string $bitOperator = '-'; - - protected string $zvalOperator = 'mod_function'; - - /** - * Compiles the arithmetical modulus operation. - * - * @param array $expression - * @param CompilationContext $compilationContext - */ - public function compile($expression, CompilationContext $compilationContext) - { - if (!isset($expression['left'])) { - throw new \Exception('Missing left part of the expression'); - } - - if (!isset($expression['right'])) { - throw new \Exception('Missing right part of the expression'); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly(true); - $left = $leftExpr->compile($compilationContext); - - $rightExpr = new Expression($expression['right']); - $rightExpr->setReadOnly(true); - $right = $rightExpr->compile($compilationContext); - - $compilationContext->headersManager->add('kernel/operators'); - - switch ($left->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_mod_long_long('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_long_double((double) '.$left->getCode().', '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getCode().' - '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - return new CompiledExpression('double', 'zephir_safe_mod_long_long('.$left->getCode().', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_long_double('.$left->getCode().', '.$variableRight->getName().')', $expression); - - case 'variable': - if ($variableRight->isLocalOnly()) { - return new CompiledExpression('double', 'zephir_safe_mod_long_zval('.$left->getCode().', &'.$variableRight->getName().')', $expression); - } else { - return new CompiledExpression('double', 'zephir_safe_mod_long_zval('.$left->getCode().', '.$variableRight->getName().')', $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'int' with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('long', '('.$left->getBooleanCode().' - '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - default: - throw new CompilerException("Cannot operate 'bool' with '".$right->getType()."'", $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_mod_double_long('.$left->getCode().', (double) ('.$right->getCode().'))', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_double_long('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('double', 'zephir_safe_mod_double_long('.$left->getCode().', '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - return new CompiledExpression('double', 'zephir_safe_mod_double_long('.$left->getCode().', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_double_double('.$left->getCode().', '.$variableRight->getName().')', $expression); - - case 'variable': - if ($variableRight->isLocalOnly()) { - return new CompiledExpression('double', 'zephir_safe_mod_double_zval('.$left->getCode().', &'.$variableRight->getName().')', $expression); - } else { - return new CompiledExpression('double', 'zephir_safe_mod_double_zval('.$left->getCode().', '.$variableRight->getName().')', $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'double' with '".$right->getType()."'", $expression); - } - break; - - case 'string': - case 'array': - switch ($right->getType()) { - default: - throw new CompilerException('Operation is not supported between '.$right->getType(), $expression); - } - break; - - case 'variable': - $variableLeft = $compilationContext->symbolTable->getVariableForRead($left->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableLeft->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_mod_long_long('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_long_double('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - return new CompiledExpression('double', 'zephir_safe_mod_long_long('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_long_double('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'variable': - if ($variableRight->isLocalOnly()) { - return new CompiledExpression('double', 'zephir_safe_mod_long_zval('.$variableLeft->getName().', &'.$variableRight->getName().')', $expression); - } else { - return new CompiledExpression('double', 'zephir_safe_mod_long_zval('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('bool', '('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_mod_long_long('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_long_double('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('double', 'zephir_safe_mod_long_long('.$variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - if ($variableRight->isLocalOnly()) { - return new CompiledExpression('double', 'zephir_safe_mod_long_zval('.$variableLeft->getName().', &'.$variableRight->getName().')', $expression); - } else { - return new CompiledExpression('double', 'zephir_safe_mod_long_zval('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_double_long('.$left->getCode().', '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_mod_double_long('.$variableLeft->getName().', (double) '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_double_long('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - if ($variableRight->isLocalOnly()) { - return new CompiledExpression('double', 'zephir_safe_mod_double_zval('.$variableLeft->getName().', &'.$variableRight->getName().')', $expression); - } else { - return new CompiledExpression('double', 'zephir_safe_mod_double_zval('.$variableLeft->getName().', '.$variableRight->getName().')', $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'string': - case 'array': - throw new CompilerException('Cannot operate '.$variableLeft->getType()." variables'", $expression); - case 'variable': - $op1 = $compilationContext->backend->getVariableCode($variableLeft); - switch ($right->getType()) { - /* a + 1 */ - case 'int': - case 'uint': - case 'long': - case 'ulong': - $op2 = $right->getCode(); - - return new CompiledExpression('double', 'zephir_safe_mod_zval_long('.$op1.', '.$op2.')', $expression); - break; - - case 'double': - $op2 = $right->getCode(); - - return new CompiledExpression('double', 'zephir_safe_mod_zval_double('.$op1.', '.$op2.')', $expression); - break; - - /* a(var) + a(x) */ - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableRight->getType()) { - /* a(var) + a(int) */ - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('double', 'zephir_safe_mod_zval_long('.$op1.', '.$variableRight->getName().')', $expression); - break; - - /* a(var) + a(bool) */ - case 'bool': - return new CompiledExpression('int', 'zephir_safe_mod_zval_long('.$op1.', '.$variableRight->getName().')', $expression); - break; - - /* a(var) + a(var) */ - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $op2 = $compilationContext->backend->getVariableCode($variableRight); - - $expected = $this->getExpected($compilationContext, $expression); - $symbol = $compilationContext->backend->getVariableCode($expected); - $compilationContext->codePrinter->output($this->zvalOperator.'('.$symbol.', '.$op1.', '.$op2.');'); - - if ($variableLeft->isTemporal()) { - $variableLeft->setIdle(true); - } - if ($variableRight->isTemporal()) { - $variableRight->setIdle(true); - } - - return new CompiledExpression('variable', $expected->getName(), $expression); - - default: - throw new CompilerException("Cannot operate 'variable' with variable ('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'variable' with '".$right->getType()."'", $expression); - } - break; - - case 'variable': - $op1 = $compilationContext->backend->getVariableCode($variableLeft); - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $op2 = $right->getCode(); - - return new CompiledExpression('double', 'zephir_safe_mod_zval_long('.$op1.', '.$op2.')', $expression); - - case 'double': - $op2 = $right->getCode(); - - return new CompiledExpression('double', 'zephir_safe_mod_zval_double('.$op1.', '.$op2.')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('double', 'zephir_safe_mod_zval_long('.$op1.', '.$variableRight->getName().')', $expression); - break; - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($variableRight->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - return new CompiledExpression('double', 'zephir_safe_mod_zval_long('.$op1.', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('double', 'zephir_safe_mod_zval_double('.$op1.', '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('bool', $op1.' '.$this->bitOperator.' '.$variableRight->getName(), $expression); - - case 'variable': - $op2 = $compilationContext->backend->getVariableCode($variableRight); - - $expected = $this->getExpected($compilationContext, $expression); - $symbol = $compilationContext->backend->getVariableCode($expected); - $compilationContext->codePrinter->output($this->zvalOperator.'('.$symbol.', '.$op1.', '.$op2.');'); - - return new CompiledExpression('variable', $expected->getName(), $expression); - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'variable' with variable ('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'variable' with '".$right->getType()."'", $expression); - } - break; - - default: - throw new CompilerException("Unknown '".$variableLeft->getType()."'", $expression); - } - break; - - default: - throw new CompilerException('Unsupported type: '.$left->getType(), $expression); - } - } -} diff --git a/Library/Operators/Bitwise/BitwiseBaseOperator.php b/Library/Operators/Bitwise/BitwiseBaseOperator.php deleted file mode 100644 index 3d27040aee..0000000000 --- a/Library/Operators/Bitwise/BitwiseBaseOperator.php +++ /dev/null @@ -1,501 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Operators\Bitwise; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Operators\AbstractOperator; - -/** - * This is the base operator for commutative, associative and distributive - * arithmetic operators - */ -class BitwiseBaseOperator extends AbstractOperator -{ - protected bool $literalOnly = true; - - /** - * This tries to perform arithmetical operations - * Probably gcc/clang will optimize them without this optimization. - * - * @see https://en.wikipedia.org/wiki/Constant_folding - * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return bool|CompiledExpression - */ - public function optimizeConstantFolding(array $expression, CompilationContext $compilationContext) - { - if (!$compilationContext->config->get('constant-folding', 'optimizations')) { - return false; - } - - switch ($expression['left']['type']) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - //continue to next switch - break; - default: - return false; - break; - } - - switch ($expression['right']['type']) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - //continue to operator switch - break; - default: - return false; - break; - } - - /* - * Return value will be always int - */ - switch ($this->operator) { - case '&': - return new CompiledExpression('int', $expression['left']['value'] & $expression['right']['value'], $expression); - - case '|': - return new CompiledExpression('int', $expression['left']['value'] | $expression['right']['value'], $expression); - - case '^': - return new CompiledExpression('int', $expression['left']['value'] ^ $expression['right']['value'], $expression); - - case '<<': - return new CompiledExpression('int', $expression['left']['value'] << $expression['right']['value'], $expression); - - case '>>': - return new CompiledExpression('int', $expression['left']['value'] >> $expression['right']['value'], $expression); - } - - return false; - } - - /** - * {@inheritdoc} - * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return bool|CompiledExpression - */ - public function compile($expression, CompilationContext $compilationContext) - { - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression', $expression); - } - - if (!isset($expression['right'])) { - throw new CompilerException('Missing right part of the expression', $expression); - } - - /** - * Check for constant folding optimizations. - */ - $optimized = $this->optimizeConstantFolding($expression, $compilationContext); - if ($optimized) { - return $optimized; - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly(true); - $left = $leftExpr->compile($compilationContext); - - $rightExpr = new Expression($expression['right']); - $rightExpr->setReadOnly(true); - $right = $rightExpr->compile($compilationContext); - - switch ($left->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' (int) ('.$right->getCode().'))', $expression); - - case 'bool': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' (int) ('.$variableRight->getName().'))', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $symbol = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' zephir_get_numberval('.$symbol.'))', $expression); - break; - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - default: - throw new CompilerException("Cannot operate 'int' with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('int', '('.$left->getBooleanCode().' '.$this->bitOperator.'(('.$right->getCode().') ? 1 : 0))', $expression); - - case 'bool': - return new CompiledExpression('int', '('.$left->getBooleanCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($expression['right']['value'], $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '((int) ('.$left->getBooleanCode().') '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('int', '((int) ('.$left->getBooleanCode().') '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('int', '((int) ('.$left->getBooleanCode().') '.$this->operator.' (int) ('.$variableRight->getName().'))', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $symbol = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('int', '((int) ('.$left->getBooleanCode().') '.$this->operator.' zephir_get_numberval('.$symbol.'))', $expression); - break; - - default: - throw new CompilerException("Cannot operate ('bool') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'bool' with '".$right->getType()."'", $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' (int) ('.$right->getCode().'))', $expression); - - case 'bool': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($expression['right']['value'], $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' (int) ('.$variableRight->getName().'))', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $symbol = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' zephir_get_numberval('.$symbol.'))', $expression); - break; - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'double' with '".$right->getType()."'", $expression); - } - break; - - case 'string': - switch ($right->getType()) { - default: - throw new CompilerException('Operation is not supported between strings', $expression); - } - break; - - case 'variable': - $variableLeft = $compilationContext->symbolTable->getVariableForRead($left->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableLeft->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - case 'char': - case 'uchar': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' (int) ('.$variableRight->getName().'))', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $symbol = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' (int) (zephir_get_numberval('.$symbol.')))', $expression); - break; - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' (int) ('.$variableRight->getName().'))', $expression); - - case 'bool': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $symbol = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' zephir_get_numberval('.$symbol.'))', $expression); - break; - - default: - throw new CompilerException("Cannot operate variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' (int) ('.$right->getCode().'))', $expression); - - case 'bool': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($expression['right']['value'], $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('int', '((int) ('.$variableLeft->getName().') '.$this->operator.' '.$variableRight->getName().')', $expression); - case 'double': - return new CompiledExpression('int', '((int) ('.$variableLeft->getName().') '.$this->operator.' (int) ('.$variableRight->getName().'))', $expression); - - case 'bool': - return new CompiledExpression('int', '((int) ('.$variableLeft->getName().') '.$this->bitOperator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $symbol = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('int', '((int) ('.$variableLeft->getName().') '.$this->operator.' (int) (zephir_get_numberval('.$symbol.')))', $expression); - - break; - - default: - throw new CompilerException("Cannot operate variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'string': - throw new CompilerException("Cannot operate string variables'", $expression); - case 'variable': - switch ($right->getType()) { - /* a + 1 */ - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - $compilationContext->headersManager->add('kernel/operators'); - $op = $this->operator; - $op1 = $compilationContext->backend->getVariableCode($variableLeft); - $op2 = $right->getCode(); - if ('double' == $right->getType()) { - return new CompiledExpression('int', '((int) (zephir_get_numberval('.$op1.')) '.$op.' (int) ('.$op2.'))', $expression); - } else { - return new CompiledExpression('int', '((int) (zephir_get_numberval('.$op1.')) '.$op.' '.$op2.')', $expression); - } - break; - - /* a(var) + a(x) */ - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); - $symbol = $compilationContext->backend->getVariableCode($variableLeft); - switch ($variableRight->getType()) { - /* a(var) + a(int) */ - case 'int': - case 'uint': - case 'long': - case 'ulong': - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('int', '((int) (zephir_get_numberval('.$symbol.')) '.$this->operator.' '.$variableRight->getName().')', $expression); - break; - - /* a(var) + a(bool) */ - case 'bool': - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('int', '((int) (zephir_get_numberval('.$symbol.')) '.$this->operator.' '.$variableRight->getName().')', $expression); - break; - - /* a(var) + a(var) */ - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $op1 = $symbol; - $op2 = $compilationContext->backend->getVariableCode($variableRight); - - $expected = $this->getExpected($compilationContext, $expression); - $expectedSymbol = $compilationContext->backend->getVariableCode($expected); - $compilationContext->codePrinter->output($this->zvalOperator.'('.$expectedSymbol.', '.$op1.', '.$op2.');'); - - if ($variableLeft->isTemporal()) { - $variableLeft->setIdle(true); - } - if ($variableRight->isTemporal()) { - $variableRight->setIdle(true); - } - - return new CompiledExpression('variable', $expected->getName(), $expression); - - default: - throw new CompilerException("Cannot operate 'variable' with variable ('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot operate 'variable' with '".$right->getType()."'", $expression); - } - break; - - default: - throw new CompilerException("Unknown '".$variableLeft->getType()."'", $expression); - } - break; - - default: - throw new CompilerException('Unsupported type: '.$left->getType(), $expression); - } - } -} diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/Library/Operators/Comparison/ComparisonBaseOperator.php deleted file mode 100644 index d9c49f3113..0000000000 --- a/Library/Operators/Comparison/ComparisonBaseOperator.php +++ /dev/null @@ -1,663 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Operators\Comparison; - -use ReflectionException; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Operators\AbstractOperator; - -/** - * This is the base operator for comparison operators - */ -class ComparisonBaseOperator extends AbstractOperator -{ - protected bool $commutative = false; - - /** - * @param array $expr - * @param CompilationContext $compilationContext - * - * @return CompiledExpression|null - * - * @throws Exception - * @throws ReflectionException - */ - public function optimizeTypeOf(array $expr, CompilationContext $compilationContext): ?CompiledExpression - { - if (!isset($expr['left'])) { - return null; - } - - if (!isset($expr['right']) && !isset($expr['right']['value'])) { - return null; - } - - if ('typeof' !== $expr['left']['type']) { - return null; - } - - if ('string' !== $expr['right']['type']) { - $compilationContext->logger->warning( - "Possible invalid comparison for 'typeof' operator with non-string", - ['invalid-typeof-comparison', $expr['right']] - ); - - return null; - } - - switch ($expr['type']) { - case 'identical': - case 'equals': - $operator = '=='; - break; - - case 'not-identical': - case 'not-equals': - $operator = '!='; - break; - - default: - return null; - } - - $code = (new Expression($expr['left']['left']))->compile($compilationContext)->getCode(); - $variableVariable = $compilationContext->symbolTable->getVariableForRead($code, $compilationContext, $expr); - - if ('string' !== $expr['right']['type']) { - throw new CompilerException('Right expression of typeof operator must be "string" type', $expr['right']); - } - - $value = strtolower($expr['right']['value']); - - switch ($variableVariable->getType()) { - case 'double': - switch ($value) { - case 'double': - case 'float': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'int': - case 'integer': - case 'long': - switch ($value) { - case 'int': - case 'integer': - case 'long': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'bool': - switch ($value) { - case 'bool': - case 'boolean': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'array': - switch ($value) { - case 'array': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'string': - switch ($value) { - case 'string': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'variable': - $condition = $compilationContext->backend->getTypeofCondition($variableVariable, $operator, $value, $compilationContext); - break; - - default: - return null; - } - - return new CompiledExpression('bool', $condition, $expr); - } - - /** - * Compile the expression. - * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - * - * @throws ReflectionException - * @throws Exception - */ - public function compile(array $expression, CompilationContext $compilationContext) - { - $conditions = $this->optimizeTypeOf($expression, $compilationContext); - if (null !== $conditions) { - return $conditions; - } - - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression', $expression); - } - - if (!isset($expression['right'])) { - throw new CompilerException('Missing right part of the expression', $expression); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly(true); - $left = $leftExpr->compile($compilationContext); - - $rightExpr = new Expression($expression['right']); - $rightExpr->setReadOnly(true); - $right = $rightExpr->compile($compilationContext); - - switch ($left->getType()) { - case 'null': - switch ($right->getType()) { - case 'null': - return new CompiledExpression('bool', '(0 '.$this->operator.' 0)', $expression); - - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('bool', '(0 '.$this->operator.' '.$right->getCode().')', $expression); - - case 'char': - case 'uchar': - return new CompiledExpression('bool', '(\'\\0\' '.$this->operator.' \''.$right->getCode().'\')', $expression); - - case 'double': - return new CompiledExpression('bool', '(0 '.$this->operator.' (int) '.$right->getCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('bool', '0 '.$this->operator.' '.$variableRight->getName(), $expression); - - case 'variable': - case 'mixed': - case 'string': - $compilationContext->headersManager->add('kernel/operators'); - $condition = $compilationContext->backend->getTypeofCondition($variableRight, $this->operator, 'null', $compilationContext); - - return new CompiledExpression('bool', $condition, $expression); - - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Unknown type: '.$right->getType(), $expression); - } - break; - - case 'int': - case 'uint': - case 'long': - case 'double': - case 'ulong': - case 'char': - case 'uchar': - switch ($right->getType()) { - case 'null': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator, $expression); - - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' '.$right->getCode(), $expression); - - case 'char': - case 'uchar': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' \''.$right->getCode().'\'', $expression); - - case 'double': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' (int) '.$right->getCode(), $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' '.$variableRight->getName(), $expression); - - case 'variable': - case 'mixed': - $compilationContext->headersManager->add('kernel/operators'); - $variableCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', $this->zvalLongNegOperator.'('.$variableCode.', '.$left->getCode().')', $expression); - - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Cannot compare '.$left->getType().' with '.$right->getType(), $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'null': - return new CompiledExpression('bool', $left->getBooleanCode().' '.$this->operator.' 0', $expression); - - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('bool', $left->getBooleanCode().' '.$this->operator.' '.$right->getCode(), $expression); - - case 'char': - case 'uchar': - return new CompiledExpression('bool', $left->getBooleanCode().' '.$this->operator.' \''.$right->getCode().'\'', $expression); - - case 'double': - return new CompiledExpression('bool', $left->getBooleanCode().' '.$this->operator.' (int) '.$right->getCode(), $expression); - - case 'bool': - return new CompiledExpression('bool', $left->getBooleanCode().' '.$this->operator.' '.$right->getBooleanCode(), $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('bool', $left->getBooleanCode().' '.$this->operator.' '.$variableRight->getName(), $expression); - - case 'variable': - case 'mixed': - $compilationContext->headersManager->add('kernel/operators'); - $boolOperator = '1' == $left->getBooleanCode() ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; - $variableRight = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', $boolOperator.'('.$variableRight.')', $expression); - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Cannot compare '.$left->getType().' with '.$right->getType(), $expression); - } - break; - - case 'string': - $variableLeft = $compilationContext->symbolTable->getTempLocalVariableForWrite('variable', $compilationContext); - $variableLeftCode = $compilationContext->backend->getVariableCode($variableLeft); - $compilationContext->backend->assignString( - $variableLeft, - $left->getCode(), - $compilationContext, - true - ); - switch ($right->getType()) { - case 'null': - return new CompiledExpression('bool', $this->zvalNullOperator.'('.$variableLeftCode.')', $expression['left']); - break; - - case 'string': - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('bool', $this->zvalStringOperator.'('.$variableLeftCode.', "'.$right->getCode().'")', $expression['left']); - break; - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - switch ($variableRight->getType()) { - case 'string': - case 'variable': - case 'mixed': - $compilationContext->headersManager->add('kernel/operators'); - $variableRight = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', $this->zvalOperator.'('.$variableLeftCode.', '.$variableRight.')', $expression); - break; - - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Unknown type: '.$right->getType(), $expression['left']); - } - break; - - case 'variable': - $variable = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression['left']); - $variableCode = $compilationContext->backend->getVariableCode($variable); - switch ($variable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' '.$right->getCode(), $expression); - - case 'char': - case 'uchar': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' \''.$right->getCode().'\'', $expression); - - case 'bool': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' '.$right->getBooleanCode(), $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - case 'double': - return new CompiledExpression('bool', $variable->getName().' '.$this->operator.' '.$variableRight->getName(), $expression); - - case 'variable': - case 'mixed': - $compilationContext->headersManager->add('kernel/operators'); - $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); - $variableCode = $compilationContext->backend->getVariableCode($variable); - - return new CompiledExpression('bool', $this->zvalLongNegOperator.'('.$variableRightCode.', '.$variableCode.')', $expression); - break; - - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Cannot compare variable: '.$variable->getType().' with: '.$right->getType(), $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' '.$right->getCode(), $expression); - - case 'bool': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' '.$right->getBooleanCode(), $expression); - - case 'char': - case 'uchar': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' \''.$right->getCode().'\'', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('bool', $variable->getName().' '.$this->operator.' '.$variableRight->getName(), $expression); - - case 'variable': - case 'mixed': - $compilationContext->headersManager->add('kernel/operators'); - $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); - $variableCode = $compilationContext->backend->getVariableCode($variable); - - return new CompiledExpression('bool', $this->zvalDoubleNegOperator.'('.$variableRightCode.', '.$variableCode.')', $expression); - - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Cannot compare variable: '.$variable->getType().' with: '.$right->getType(), $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' '.$right->getCode(), $expression['left']); - - case 'bool': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' '.$right->getBooleanCode(), $expression['left']); - - case 'null': - return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' 0', $expression['left']); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - case 'double': - return new CompiledExpression('bool', $variable->getName().' '.$this->operator.' '.$variableRight->getName(), $expression); - - case 'variable': - case 'mixed': - $compilationContext->headersManager->add('kernel/operators'); - $boolOperator = '1' == $left->getBooleanCode() ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; - $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', $boolOperator.'('.$variableRightCode.')', $expression); - - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Cannot compare variable: '.$variable->getType().' with: '.$right->getType(), $expression); - } - break; - - case 'array': - switch ($right->getType()) { - case 'null': - return new CompiledExpression('bool', $this->zvalNullOperator.'('.$variableCode.')', $expression['left']); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - switch ($variableRight->getType()) { - case 'string': - case 'variable': - case 'mixed': - case 'array': - $compilationContext->headersManager->add('kernel/operators'); - $variableRight = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', $this->zvalOperator.'('.$variableCode.', '.$variableRight.')', $expression); - - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Unknown type: '.$right->getType(), $expression['left']); - } - break; - - case 'string': - $compilationContext->headersManager->add('kernel/operators'); - - switch ($right->getType()) { - case 'null': - return new CompiledExpression('bool', $this->zvalNullOperator.'('.$variableCode.')', $expression['left']); - - case 'string': - return new CompiledExpression('bool', $this->zvalStringOperator.'('.$variableCode.', "'.$right->getCode().'")', $expression['left']); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - - switch ($variableRight->getType()) { - case 'string': - case 'variable': - case 'mixed': - $variableRight = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', $this->zvalOperator.'('.$variableCode.', '.$variableRight.')', $expression); - - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Unknown type: '.$right->getType(), $expression['left']); - } - break; - - case 'variable': - case 'mixed': - $compilationContext->headersManager->add('kernel/operators'); - - switch ($right->getType()) { - case 'null': - $condition = $compilationContext->backend->getTypeofCondition($variable, $this->operator, 'null', $compilationContext); - - return new CompiledExpression('bool', $condition, $expression['left']); - - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression('bool', $this->zvalLongOperator.'('.$variableCode.', '.$right->getCode().')', $expression['left']); - - case 'char': - case 'uchar': - return new CompiledExpression('bool', $this->zvalLongOperator.'('.$variableCode.', \''.$right->getCode().'\')', $expression['left']); - - case 'bool': - $zvalBoolOperator = 'true' === $right->getCode() ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; - - return new CompiledExpression('bool', $zvalBoolOperator.'('.$variableCode.')', $expression['left']); - - case 'string': - return new CompiledExpression('bool', $this->zvalStringOperator.'('.$variableCode.', "'.$right->getCode().'")', $expression['left']); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); - switch ($variableRight->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return new CompiledExpression('bool', $this->zvalLongOperator.'('.$variableCode.', '.$variableRight->getName().')', $expression); - - case 'double': - return new CompiledExpression('bool', $this->zvalDoubleOperator.'('.$variableCode.', '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('bool', $this->zvalBoolOperator.'('.$variableCode.', '.$variableRight->getName().')', $expression); - - case 'string': - case 'variable': - case 'mixed': - case 'array': - $variableRight = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', $this->zvalOperator.'('.$variableCode.', '.$variableRight.')', $expression); - - default: - throw new CompilerException('Unknown type: '.$variableRight->getType(), $expression['right']); - } - break; - - default: - throw new CompilerException('Unknown type: '.$right->getType(), $expression['left']); - } - break; - - default: - throw new CompilerException('Unknown type: '.$variable->getType(), $expression); - } - break; - - default: - throw new CompilerException('Unknown type: '.$left->getType(), $expression); - } - } -} diff --git a/Library/Operators/Comparison/EqualsOperator.php b/Library/Operators/Comparison/EqualsOperator.php deleted file mode 100644 index 0f9cf22d98..0000000000 --- a/Library/Operators/Comparison/EqualsOperator.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Operators\Comparison; - -class EqualsOperator extends ComparisonBaseOperator -{ - protected bool $commutative = true; - - protected string $operator = '=='; - - protected string $bitOperator = '=='; - - protected string $zvalOperator = 'ZEPHIR_IS_EQUAL'; - - protected string $zvalLongOperator = 'ZEPHIR_IS_LONG'; - - protected string $zvalLongNegOperator = 'ZEPHIR_IS_LONG'; - - protected string $zvalStringOperator = 'ZEPHIR_IS_STRING'; - - protected string $zvalBoolOperator = 'ZEPHIR_IS_BOOL_VALUE'; - - protected string $zvalBoolTrueOperator = 'ZEPHIR_IS_TRUE'; - - protected string $zvalBoolFalseOperator = 'ZEPHIR_IS_FALSE'; - - protected string $zvalNullOperator = 'ZEPHIR_IS_NULL'; -} diff --git a/Library/Operators/Comparison/IdenticalOperator.php b/Library/Operators/Comparison/IdenticalOperator.php deleted file mode 100644 index 263a14ee31..0000000000 --- a/Library/Operators/Comparison/IdenticalOperator.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Operators\Comparison; - -class IdenticalOperator extends ComparisonBaseOperator -{ - protected bool $commutative = true; - - protected string $operator = '=='; - - protected string $bitOperator = '=='; - - protected string $zvalOperator = 'ZEPHIR_IS_IDENTICAL'; - - protected string $zvalLongOperator = 'ZEPHIR_IS_LONG_IDENTICAL'; - - protected string $zvalLongNegOperator = 'ZEPHIR_IS_LONG_IDENTICAL'; - - protected string $zvalStringOperator = 'ZEPHIR_IS_STRING_IDENTICAL'; - - protected string $zvalBoolOperator = 'ZEPHIR_IS_BOOL_IDENTICAL'; - - protected string $zvalBoolTrueOperator = 'ZEPHIR_IS_TRUE_IDENTICAL'; - - protected string $zvalBoolFalseOperator = 'ZEPHIR_IS_FALSE_IDENTICAL'; - - protected string $zvalNullOperator = 'ZEPHIR_IS_NULL'; -} diff --git a/Library/Operators/Comparison/NotEqualsOperator.php b/Library/Operators/Comparison/NotEqualsOperator.php deleted file mode 100644 index 77f6a3db0a..0000000000 --- a/Library/Operators/Comparison/NotEqualsOperator.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Operators\Comparison; - -class NotEqualsOperator extends ComparisonBaseOperator -{ - protected bool $commutative = true; - - protected bool $inverse = true; - - protected string $operator = '!='; - - protected string $bitOperator = '!='; - - protected string $zvalOperator = '!ZEPHIR_IS_EQUAL'; - - protected string $zvalLongOperator = '!ZEPHIR_IS_LONG'; - - protected string $zvalLongNegOperator = '!ZEPHIR_IS_LONG'; - - protected string $zvalDoubleOperator = '!ZEPHIR_IS_DOUBLE'; - - protected string $zvalStringOperator = '!ZEPHIR_IS_STRING'; - - protected string $zvalBoolOperator = '!ZEPHIR_IS_BOOL_VALUE'; - - protected string $zvalBoolTrueOperator = '!ZEPHIR_IS_TRUE'; - - protected string $zvalBoolFalseOperator = '!ZEPHIR_IS_FALSE'; - - protected string $zvalNullOperator = '!ZEPHIR_IS_NULL'; -} diff --git a/Library/Operators/Comparison/NotIdenticalOperator.php b/Library/Operators/Comparison/NotIdenticalOperator.php deleted file mode 100644 index 4339b3c641..0000000000 --- a/Library/Operators/Comparison/NotIdenticalOperator.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Operators\Comparison; - -class NotIdenticalOperator extends ComparisonBaseOperator -{ - protected bool $commutative = true; - - protected bool $inverse = true; - - protected string $operator = '!='; - - protected string $bitOperator = '!='; - - protected string $zvalOperator = '!ZEPHIR_IS_IDENTICAL'; - - protected string $zvalLongOperator = '!ZEPHIR_IS_LONG_IDENTICAL'; - - protected string $zvalLongNegOperator = '!ZEPHIR_IS_LONG_IDENTICAL'; - - protected string $zvalStringOperator = '!ZEPHIR_IS_STRING_IDENTICAL'; - - protected string $zvalBoolOperator = '!ZEPHIR_IS_BOOL_IDENTICAL'; - - protected string $zvalBoolTrueOperator = '!ZEPHIR_IS_TRUE_IDENTICAL'; - - protected string $zvalBoolFalseOperator = '!ZEPHIR_IS_FALSE_IDENTICAL'; - - protected string $zvalNullOperator = '!ZEPHIR_IS_NULL'; -} diff --git a/Library/Operators/Logical/AndOperator.php b/Library/Operators/Logical/AndOperator.php deleted file mode 100644 index 29b4e55040..0000000000 --- a/Library/Operators/Logical/AndOperator.php +++ /dev/null @@ -1,166 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Operators\Logical; - -use Exception; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Statements\LetStatement; - -class AndOperator extends LogicalBaseOperator -{ - protected string $operator = '&&'; - - protected string $bitOperator = '&&'; - - /** - * @param $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - * - * @throws \Zephir\Exception - */ - public function compile($expression, CompilationContext $compilationContext): CompiledExpression - { - if (!isset($expression['left'])) { - throw new Exception('Missing left part of the expression'); - } - - if (!isset($expression['right'])) { - throw new Exception('Missing right part of the expression'); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly($this->readOnly); - $left = $leftExpr->compile($compilationContext); - - /** - * This variable is used to check if the compound and expression is evaluated as true or false. - */ - $flagVariable = $compilationContext->symbolTable->getTempVariableForWrite('bool', $compilationContext); - - switch ($left->getType()) { - case 'int': - case 'bool': - case 'char': - case 'double': - case 'uint': - case 'uchar': - $assignExprLeft = [ - 'type' => $left->getType(), - 'value' => $left->getCode(), - ]; - break; - case 'variable': - $assignExprLeft = [ - 'type' => 'variable', - 'value' => $left->getCode(), - ]; - break; - case 'null': - $assignExprLeft = [ - 'type' => 'null', - 'value' => null, - ]; - break; - } - - if (!isset($assignExprLeft)) { - throw new CompilerException($left->getType(), $expression['left']); - } - - /** - * Create an implicit 'let' operation to update the evaluated left operator. - */ - $statement = new LetStatement([ - 'type' => 'let', - 'assignments' => [ - [ - 'assign-type' => 'variable', - 'variable' => $flagVariable->getName(), - 'operator' => 'assign', - 'expr' => $assignExprLeft, - 'file' => $expression['left']['file'], - 'line' => $expression['left']['line'], - 'char' => $expression['left']['char'], - ], - ], - ]); - $statement->compile($compilationContext); - - $compilationContext->codePrinter->output('if ('.$flagVariable->getName().') {'); - $compilationContext->codePrinter->increaseLevel(); - - $rightExpr = new Expression($expression['right']); - $rightExpr->setReadOnly($this->readOnly); - $right = $rightExpr->compile($compilationContext); - - switch ($right->getType()) { - case 'int': - case 'bool': - case 'char': - case 'double': - case 'uint': - case 'uchar': - $assignExprRight = [ - 'type' => $right->getType(), - 'value' => $right->getCode(), - ]; - break; - case 'variable': - $assignExprRight = [ - 'type' => 'variable', - 'value' => $right->getCode(), - ]; - break; - case 'null': - $assignExprRight = [ - 'type' => 'null', - 'value' => null, - ]; - break; - } - - if (!isset($assignExprRight)) { - throw new CompilerException($right->getType(), $expression['right']); - } - - /** - * Create an implicit 'let' operation to update the evaluated right operator. - */ - $statement = new LetStatement([ - 'type' => 'let', - 'assignments' => [ - [ - 'assign-type' => 'variable', - 'variable' => $flagVariable->getName(), - 'operator' => 'assign', - 'expr' => $assignExprRight, - 'file' => $expression['right']['file'], - 'line' => $expression['right']['line'], - 'char' => $expression['right']['char'], - ], - ], - ]); - $statement->compile($compilationContext); - - $compilationContext->codePrinter->decreaseLevel(); - $compilationContext->codePrinter->output('}'); - - return new CompiledExpression('bool', $flagVariable->getName(), $expression); - } -} diff --git a/Library/Operators/Logical/LogicalBaseOperator.php b/Library/Operators/Logical/LogicalBaseOperator.php deleted file mode 100644 index b6d91e9879..0000000000 --- a/Library/Operators/Logical/LogicalBaseOperator.php +++ /dev/null @@ -1,335 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Operators\Logical; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Operators\AbstractOperator; - -/** - * This is the base operator for logical operators - */ -class LogicalBaseOperator extends AbstractOperator -{ - public function compile($expression, CompilationContext $compilationContext): CompiledExpression - { - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression', $expression); - } - - if (!isset($expression['right'])) { - throw new CompilerException('Missing right part of the expression', $expression); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly($this->readOnly); - $left = $leftExpr->compile($compilationContext); - - $rightExpr = new Expression($expression['right']); - $rightExpr->setReadOnly($this->readOnly); - $right = $rightExpr->compile($compilationContext); - - switch ($left->getType()) { - case 'int': - switch ($right->getType()) { - case 'int': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'double': - return new CompiledExpression('double', '((double) '.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'bool': - case 'double': - case 'int': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->operator.' zephir_is_true('.$variableCode.'))', $expression); - - default: - throw new CompilerException("Cannot compare variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot compare 'int' with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - case 'double': - return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$this->bitOperator.' (('.$right->getCode().') ? 1 : 0))', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); - switch ($variableRight->getType()) { - case 'bool': - case 'double': - case 'int': - return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $variableCode = $compilationContext->backend->getVariableCode($variableRight); - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$this->operator.' zephir_is_true('.$variableCode.'))', $expression); - - default: - throw new CompilerException("Cannot add variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot compare 'bool' with '".$right->getType()."'", $expression); - } - break; - case 'double': - switch ($right->getType()) { - case 'double': - case 'int': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$left->getCode().' '.$this->operator.' '.$right->getBooleanCode().')', $expression); - - default: - throw new CompilerException("Cannot compare 'double' with '".$right->getType()."'", $expression); - } - break; - - case 'string': - throw new CompilerException('Operation is not supported between strings', $expression); - break; - - case 'variable': - $variableLeft = $compilationContext->symbolTable->getVariableForRead($left->resolve(null, $compilationContext), $compilationContext, $expression); - switch ($variableLeft->getType()) { - case 'int': - switch ($right->getType()) { - case 'int': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'bool': - case 'double': - case 'int': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' zephir_is_true('.$variableCode.'))', $expression); - - default: - throw new CompilerException("Cannot compare variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot compare variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'bool': - switch ($right->getType()) { - case 'int': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->operator.' '.$right->getCode().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName().')', $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->operator.' zephir_is_true('.$variableCode.'))', $expression); - - default: - throw new CompilerException("Cannot compare variable('int') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot compare variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'double': - switch ($right->getType()) { - case 'double': - case 'int': - return new CompiledExpression('bool', $variableLeft->getName().' '.$this->operator.' '.$right->getCode(), $expression); - - case 'bool': - return new CompiledExpression('bool', $variableLeft->getName().' '.$this->bitOperator.''.$right->getBooleanCode(), $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - return new CompiledExpression('bool', $variableLeft->getName().' '.$this->operator.' (double) '.$variableRight->getName(), $expression); - - case 'double': - return new CompiledExpression('bool', $variableLeft->getName().' '.$this->operator.' '.$variableRight->getName(), $expression); - - case 'bool': - return new CompiledExpression('bool', $variableLeft->getName().' '.$this->bitOperator.''.$variableRight->getName(), $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', $variableLeft->getName().' '.$this->operator.' zephir_is_true('.$variableCode.')', $expression); - - default: - throw new CompilerException("Cannot compare variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot compare variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'string': - switch ($right->getType()) { - case 'double': - case 'int': - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->operator.' '.$right->getCode(), $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->bitOperator.''.$right->getBooleanCode(), $expression); - - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); - switch ($variableRight->getType()) { - case 'int': - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->operator.' '.$variableRight->getName(), $expression); - - case 'double': - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->operator.' '.$variableRight->getName(), $expression); - - case 'string': - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->operator.' ('.$variableRight->getName().' && Z_STRLEN_P('.$variableRight->getName().'))', $expression); - - case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->bitOperator.' '.$variableRight->getName(), $expression); - - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $variableCode = $compilationContext->backend->getVariableCode($variableRight); - - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.' '.$this->operator.' zephir_is_true('.$variableCode.')', $expression); - - default: - throw new CompilerException("Cannot compare variable('double') with variable('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot compare variable('int') with '".$right->getType()."'", $expression); - } - break; - - case 'variable': - $variableLeftCode = $compilationContext->backend->getVariableCode($variableLeft); - switch ($right->getType()) { - /* a && 1 */ - case 'int': - case 'bool': - case 'double': - $compilationContext->headersManager->add('kernel/operators'); - $op = $this->operator; - $op1 = $variableLeftCode; - $op2 = $right->getCode(); - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('bool', 'zephir_is_true('.$op1.') '.$op.' '.$op2, $expression); - - /* a(var) && a(x) */ - case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); - $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); - switch ($variableRight->getType()) { - /* a(var) && a(int) */ - /* a(var) && a(bool) */ - case 'bool': - case 'int': - $compilationContext->headersManager->add('kernel/operators'); - - return new CompiledExpression('bool', 'zephir_is_true('.$variableLeftCode.') '.$this->operator.' '.$variableRightCode, $expression); - - /* a(var) && a(var) */ - case 'variable': - $compilationContext->headersManager->add('kernel/operators'); - $op1 = $variableLeftCode; - $op2 = $variableRightCode; - - $expected = $this->getExpected($compilationContext, $expression); - if ($expected->isLocalOnly()) { - $compilationContext->codePrinter->output('add_function(&'.$expected->getName().', '.$op1.', '.$op2.');'); - } else { - $compilationContext->codePrinter->output('add_function('.$expected->getName().', '.$op1.', '.$op2.');'); - } - - return new CompiledExpression('variable', $expected->getName(), $expression); - - default: - throw new CompilerException("Cannot compare 'variable' with variable ('".$variableRight->getType()."')", $expression); - } - break; - - default: - throw new CompilerException("Cannot compare 'variable' with '".$right->getType()."'", $expression); - } - break; - - default: - throw new CompilerException("Unknown '".$variableLeft->getType()."'", $expression); - } - break; - - default: - throw new CompilerException('Unsupported type: '.$left->getType(), $expression); - } - } -} diff --git a/Library/Operators/Logical/OrOperator.php b/Library/Operators/Logical/OrOperator.php deleted file mode 100644 index 6e8588e8f1..0000000000 --- a/Library/Operators/Logical/OrOperator.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Operators\Logical; - -use Exception; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Statements\LetStatement; - -class OrOperator extends LogicalBaseOperator -{ - protected string $operator = '||'; - - protected string $bitOperator = '||'; - - public function compile($expression, CompilationContext $compilationContext): CompiledExpression - { - if (!isset($expression['left'])) { - throw new Exception('Missing left part of the expression'); - } - - if (!isset($expression['right'])) { - throw new Exception('Missing right part of the expression'); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly($this->readOnly); - $left = $leftExpr->compile($compilationContext); - - /** - * This variable is used to check if the compound and expression is evaluated as true or false. - */ - $flagVariable = $compilationContext->symbolTable->getTempVariableForWrite('bool', $compilationContext); - - switch ($left->getType()) { - case 'int': - case 'bool': - case 'char': - case 'double': - case 'uint': - case 'uchar': - $assignExprLeft = [ - 'type' => $left->getType(), - 'value' => $left->getCode(), - ]; - break; - case 'variable': - $assignExprLeft = [ - 'type' => 'variable', - 'value' => $left->getCode(), - ]; - break; - case 'null': - $assignExprLeft = [ - 'type' => 'null', - 'value' => null, - ]; - break; - } - - if (!isset($assignExprLeft)) { - throw new CompilerException($left->getType(), $expression['left']); - } - - /** - * Create an implicit 'let' operation to update the evaluated left operator. - */ - $statement = new LetStatement([ - 'type' => 'let', - 'assignments' => [ - [ - 'assign-type' => 'variable', - 'variable' => $flagVariable->getName(), - 'operator' => 'assign', - 'expr' => $assignExprLeft, - 'file' => $expression['left']['file'], - 'line' => $expression['left']['line'], - 'char' => $expression['left']['char'], - ], - ], - ]); - $statement->compile($compilationContext); - - $compilationContext->codePrinter->output('if (!('.$flagVariable->getName().')) {'); - $compilationContext->codePrinter->increaseLevel(); - - $rightExpr = new Expression($expression['right']); - $rightExpr->setReadOnly($this->readOnly); - $right = $rightExpr->compile($compilationContext); - - switch ($right->getType()) { - case 'int': - case 'bool': - case 'char': - case 'double': - case 'uint': - case 'uchar': - $assignExprRight = [ - 'type' => $right->getType(), - 'value' => $right->getCode(), - ]; - break; - case 'variable': - $assignExprRight = [ - 'type' => 'variable', - 'value' => $right->getCode(), - ]; - break; - case 'null': - $assignExprRight = [ - 'type' => 'null', - 'value' => null, - ]; - break; - } - - if (!isset($assignExprRight)) { - throw new CompilerException($right->getType(), $expression['right']); - } - - /** - * Create an implicit 'let' operation to update the evaluated right operator. - */ - $statement = new LetStatement([ - 'type' => 'let', - 'assignments' => [ - [ - 'assign-type' => 'variable', - 'variable' => $flagVariable->getName(), - 'operator' => 'assign', - 'expr' => $assignExprRight, - 'file' => $expression['right']['file'], - 'line' => $expression['right']['line'], - 'char' => $expression['right']['char'], - ], - ], - ]); - $statement->compile($compilationContext); - - $compilationContext->codePrinter->decreaseLevel(); - $compilationContext->codePrinter->output('}'); - - return new CompiledExpression('bool', $flagVariable->getName(), $expression); - } -} diff --git a/Library/Operators/Other/LikelyOperator.php b/Library/Operators/Other/LikelyOperator.php deleted file mode 100644 index 25412ecc13..0000000000 --- a/Library/Operators/Other/LikelyOperator.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Operators\Other; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Operators\AbstractOperator; - -/** - * Adds a branch prediction hint when evaluating an expression - */ -class LikelyOperator extends AbstractOperator -{ - /** - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - * - * @throws Exception - */ - public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression - { - if (!isset($expression['left'])) { - throw new CompilerException("Invalid 'left' operand for 'likely' expression", $expression['left']); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly(true); - $left = $leftExpr->compile($compilationContext); - - if ('bool' === $left->getType()) { - return new CompiledExpression('bool', 'EXPECTED('.$left->getCode().')', $expression); - } - - if ('variable' === $left->getType()) { - $variable = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression['left']); - switch ($variable->getType()) { - case 'bool': - return new CompiledExpression('bool', 'EXPECTED('.$variable->getName().')', $expression); - - default: - $compilationContext->headersManager->add('kernel/operators'); - $symbol = $compilationContext->backend->getVariableCode($variable); - - return new CompiledExpression('bool', 'UNEXPECTED(zephir_is_true('.$symbol.'))', $expression); - } - } - - throw new CompilerException("Cannot use expression type: '".$left->getType()."' in 'likely' operator", $expression['left']); - } -} diff --git a/Library/Operators/Other/RequireOnceOperator.php b/Library/Operators/Other/RequireOnceOperator.php deleted file mode 100644 index d68f38b7d2..0000000000 --- a/Library/Operators/Other/RequireOnceOperator.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Operators\Other; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Expression; -use Zephir\Operators\AbstractOperator; - -/** - * Includes once a plain PHP file - */ -class RequireOnceOperator extends AbstractOperator -{ - /** - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - * - * @throws Exception - */ - public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression - { - $expr = new Expression($expression['left']); - $expr->setReadOnly(true); - $expr->setExpectReturn(true); - - $exprPath = $expr->compile($compilationContext); - if ('variable' === $exprPath->getType()) { - $exprVariable = $compilationContext->symbolTable->getVariableForRead($exprPath->getCode(), $compilationContext, $expression); - $exprVar = $compilationContext->backend->getVariableCode($exprVariable); - if ('variable' === $exprVariable->getType()) { - if ($exprVariable->hasDifferentDynamicType(['undefined', 'string'])) { - $compilationContext->logger->warning( - 'Possible attempt to use invalid type as path in "require_once" operator', - ['non-valid-require-once', $expression] - ); - } - } - } else { - $exprVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - $compilationContext->backend->assignString($exprVar, $exprPath->getCode(), $compilationContext); - $exprVar = $compilationContext->backend->getVariableCode($exprVar); - } - - $symbolVariable = false; - if ($this->isExpecting()) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext); - } - - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->headersManager->add('kernel/require'); - - $codePrinter = $compilationContext->codePrinter; - - if ($symbolVariable) { - $codePrinter->output('ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&'.$symbolVariable->getName().');'); - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); - $codePrinter->output('if (zephir_require_once_zval_ret('.$symbol.', '.$exprVar.') == FAILURE) {'); - } else { - $codePrinter->output('if (zephir_require_once_zval('.$exprVar.') == FAILURE) {'); - } - $codePrinter->output("\t".'RETURN_MM_NULL();'); - $codePrinter->output('}'); - - if ($symbolVariable) { - return new CompiledExpression('variable', $symbolVariable->getName(), $expression); - } - - return new CompiledExpression('null', null, $expression); - } -} diff --git a/Library/Operators/Unary/PlusOperator.php b/Library/Operators/Unary/PlusOperator.php deleted file mode 100644 index 134d058e9e..0000000000 --- a/Library/Operators/Unary/PlusOperator.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Operators\Unary; - -use ReflectionException; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Operators\AbstractOperator; - -class PlusOperator extends AbstractOperator -{ - /** - * Compile expression. - * - * @param $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - * - * @throws Exception - * @throws ReflectionException - */ - public function compile($expression, CompilationContext $compilationContext): CompiledExpression - { - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression'); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly($this->readOnly); - $left = $leftExpr->compile($compilationContext); - - switch ($left->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression($left->getType(), '+'.$left->getCode(), $expression); - - case 'variable': - $variable = $compilationContext->symbolTable->getVariable($left->getCode()); - switch ($variable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression($variable->getType(), '+'.$variable->getName(), $expression); - - case 'variable': - return new CompiledExpression('variable', $variable->getName(), $expression); - - default: - throw new CompilerException("Cannot operate plus with variable of '".$left->getType()."' type"); - } - break; - - default: - throw new CompilerException("Cannot operate plus with '".$left->getType()."' type"); - } - } -} diff --git a/Library/Optimizers/FunctionCall/AddslashesOptimizer.php b/Library/Optimizers/FunctionCall/AddslashesOptimizer.php deleted file mode 100644 index 27ed82adc8..0000000000 --- a/Library/Optimizers/FunctionCall/AddslashesOptimizer.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * AddslashesOptimizer. - * - * Optimizes calls to 'addslashes' using internal function - */ -class AddslashesOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (\count($expression['parameters']) > 1) { - return false; - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/string'); - - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_addslashes('.$symbol.', '.$resolvedParams[0].');'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/ArrayMergeOptimizer.php b/Library/Optimizers/FunctionCall/ArrayMergeOptimizer.php deleted file mode 100644 index 8135036d7d..0000000000 --- a/Library/Optimizers/FunctionCall/ArrayMergeOptimizer.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * ArrayMergeOptimizer. - * - * Optimizes calls to 'array_merge' using internal function - */ -class ArrayMergeOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (2 != \count($expression['parameters'])) { - return false; - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - - if (!$symbolVariable->isVariable()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } - - $context->headersManager->add('kernel/array'); - - $symbolVariable->setDynamicTypes('array'); - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - - $context->codePrinter->output( - sprintf( - 'zephir_fast_array_merge(%s, %s, %s);', - $symbol, - $resolvedParams[0], - $resolvedParams[1] - ) - ); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php b/Library/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php deleted file mode 100644 index 039d731e40..0000000000 --- a/Library/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * CallUserFuncArrayOptimizer. - * - * Optimizer for 'call_user_func_array' - */ -class CallUserFuncArrayOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (2 != \count($expression['parameters'])) { - return false; - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable) { - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - } else { - $symbolVariable = $context->symbolTable->addTemp('variable', $context); - $symbolVariable->initVariant($context); - } - - /* - * Add the last call status to the current symbol table - */ - $call->addCallStatusFlag($context); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - $context->headersManager->add('kernel/fcall'); - - /* - * Add the last call status to the current symbol table - */ - $call->addCallStatusFlag($context); - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('ZEPHIR_CALL_USER_FUNC_ARRAY('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].');'); - $call->addCallStatusOrJump($context); - - return new CompiledExpression('variable', $symbolVariable->getName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/CamelizeOptimizer.php b/Library/Optimizers/FunctionCall/CamelizeOptimizer.php deleted file mode 100644 index 136235a192..0000000000 --- a/Library/Optimizers/FunctionCall/CamelizeOptimizer.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * CamelizeOptimizer. - * - * Optimizes calls to 'camelize' using internal function - */ -class CamelizeOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (\count($expression['parameters']) < 1 || \count($expression['parameters']) > 2) { - throw new CompilerException("'camelize' only accepts one or two parameters"); - } - - $delimiter = 'NULL '; - if (2 == \count($expression['parameters'])) { - if ('null' == $expression['parameters'][1]['parameter']['type']) { - unset($expression['parameters'][1]); - } - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $context->headersManager->add('kernel/string'); - - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if (isset($resolvedParams[1])) { - $delimiter = $resolvedParams[1]; - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_camelize('.$symbol.', '.$resolvedParams[0].', '.$delimiter.' );'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/Crc32Optimizer.php b/Library/Optimizers/FunctionCall/Crc32Optimizer.php deleted file mode 100644 index 71139b435c..0000000000 --- a/Library/Optimizers/FunctionCall/Crc32Optimizer.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * Crc32Optimizer. - * - * Optimizes calls to 'crc32' using internal function - */ -class Crc32Optimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (1 != \count($expression['parameters'])) { - return false; - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/string'); - $symbolVariable->setDynamicTypes('long'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_crc32('.$symbol.', '.$resolvedParams[0].');'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php b/Library/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php deleted file mode 100644 index 01940662a2..0000000000 --- a/Library/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * CreateInstanceParamsOptimizer. - * - * Built-in function that creates new instances of objects from its class name passing parameters as an array - */ -class CreateInstanceParamsOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - throw new CompilerException('This function requires parameters', $expression); - } - - if (2 != \count($expression['parameters'])) { - throw new CompilerException('This function only requires two parameter', $expression); - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - /* - * Add the last call status to the current symbol table - */ - $call->addCallStatusFlag($context); - - $context->headersManager->add('kernel/object'); - - $symbolVariable->setDynamicTypes('object'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - /* - * Add the last call status to the current symbol table - */ - $call->addCallStatusFlag($context); - - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].');'); - - $call->addCallStatusOrJump($context); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/FilemtimeOptimizer.php b/Library/Optimizers/FunctionCall/FilemtimeOptimizer.php deleted file mode 100644 index b14e3e7b73..0000000000 --- a/Library/Optimizers/FunctionCall/FilemtimeOptimizer.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * FilemtimeOptimizer. - * - * Optimizes calls to 'filemtime' using internal function - */ -class FilemtimeOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (1 != \count($expression['parameters'])) { - return false; - } - - $context->headersManager->add('kernel/file'); - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable) { - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - } - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - - $context->codePrinter->output('zephir_filemtime('.$symbol.', '.$resolvedParams[0].');'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/GetClassLowerOptimizer.php b/Library/Optimizers/FunctionCall/GetClassLowerOptimizer.php deleted file mode 100644 index 10595eb489..0000000000 --- a/Library/Optimizers/FunctionCall/GetClassLowerOptimizer.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * GetClassLowerOptimizer. - * - * Optimizes calls to 'get_class_lower' using internal function - */ -class GetClassLowerOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - $numberParameters = \count($expression['parameters']); - if (1 != $numberParameters) { - throw new CompilerException("'get_class_lower' only accepts one parameters", $expression); - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/object'); - - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - - $context->codePrinter->output('zephir_get_class('.$symbol.', '.$resolvedParams[0].', 1);'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/GetClassNsOptimizer.php b/Library/Optimizers/FunctionCall/GetClassNsOptimizer.php deleted file mode 100644 index d00fce6168..0000000000 --- a/Library/Optimizers/FunctionCall/GetClassNsOptimizer.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * GetClassNsOptimizer. - * - * Optimizes calls to 'get_class_ns' using internal function - */ -class GetClassNsOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - $numberParameters = \count($expression['parameters']); - if (1 != $numberParameters && 2 != $numberParameters) { - throw new CompilerException("'get_class_ns' only accepts one or two parameters", $expression); - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/object'); - - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - if (!isset($resolvedParams[1])) { - $context->codePrinter->output('zephir_get_class_ns('.$symbol.', '.$resolvedParams[0].', 0);'); - } else { - $context->codePrinter->output('zephir_get_class_ns('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].');'); - } - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/Md5Optimizer.php b/Library/Optimizers/FunctionCall/Md5Optimizer.php deleted file mode 100644 index 75e276c446..0000000000 --- a/Library/Optimizers/FunctionCall/Md5Optimizer.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * MD5Optimizer. - * - * Optimizes calls to 'md5' using internal function - */ -class Md5Optimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (1 != \count($expression['parameters'])) { - return false; - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/string'); - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_md5('.$symbol.', '.$resolvedParams[0].');'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/PowOptimizer.php b/Library/Optimizers/FunctionCall/PowOptimizer.php deleted file mode 100644 index 3382d28818..0000000000 --- a/Library/Optimizers/FunctionCall/PowOptimizer.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * PowOptimizer. - * - * Optimizes calls to 'pow' using internal function - */ -class PowOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (2 != \count($expression['parameters'])) { - return false; - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/operators'); - $symbolVariable->setDynamicTypes('variable'); - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_pow_function('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].');'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/StartsWithOptimizer.php b/Library/Optimizers/FunctionCall/StartsWithOptimizer.php deleted file mode 100644 index dea46b33c2..0000000000 --- a/Library/Optimizers/FunctionCall/StartsWithOptimizer.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * StartsWithOptimizer. - * - * Checks if a string starts with another - */ -class StartsWithOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (2 != \count($expression['parameters']) && 3 != \count($expression['parameters'])) { - return false; - } - - if ('string' == $expression['parameters'][1]['parameter']['type']) { - $str = $expression['parameters'][1]['parameter']['value']; - unset($expression['parameters'][1]); - } - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - $context->headersManager->add('kernel/string'); - - if (isset($str)) { - return new CompiledExpression('bool', 'zephir_start_with_str('.$resolvedParams[0].', SL("'.$str.'"))', $expression); - } - - if (2 == \count($expression['parameters'])) { - return new CompiledExpression('bool', 'zephir_start_with('.$resolvedParams[0].', '.$resolvedParams[1].', NULL)', $expression); - } else { - return new CompiledExpression('bool', 'zephir_start_with('.$resolvedParams[0].', '.$resolvedParams[1].', '.$resolvedParams[2].')', $expression); - } - } -} diff --git a/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php b/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php deleted file mode 100644 index e1031cf49a..0000000000 --- a/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * StripcslashesOptimizer. - * - * Optimizes calls to 'stripcslashes' using internal function - */ -class StripcslashesOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (\count($expression['parameters']) > 1) { - return false; - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/string'); - - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - if ('ZendEngine2' == $context->backend->getName()) { - $context->codePrinter->output('zephir_stripcslashes('.$symbol.', '.$resolvedParams[0].');'); - } else { - $context->codePrinter->output('zephir_stripcslashes('.$symbol.', '.$resolvedParams[0].');'); - } - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/StrtolowerOptimizer.php b/Library/Optimizers/FunctionCall/StrtolowerOptimizer.php deleted file mode 100644 index 9543ac7f7f..0000000000 --- a/Library/Optimizers/FunctionCall/StrtolowerOptimizer.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * StrtolowerOptimizer. - * - * Optimizes calls to 'strtolower' using internal function - */ -class StrtolowerOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (1 != \count($expression['parameters'])) { - return false; - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/string'); - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_fast_strtolower('.$symbol.', '.$resolvedParams[0].');'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/TrimOptimizer.php b/Library/Optimizers/FunctionCall/TrimOptimizer.php deleted file mode 100644 index b0f8377dd5..0000000000 --- a/Library/Optimizers/FunctionCall/TrimOptimizer.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * TrimOptimizer. - * - * Optimizes calls to 'trim' using internal function - */ -class TrimOptimizer extends OptimizerAbstract -{ - protected static $TRIM_WHERE = 'ZEPHIR_TRIM_BOTH'; - - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - $charlist = 'NULL '; - if (2 == \count($expression['parameters'])) { - if ('null' == $expression['parameters'][1]['parameter']['type']) { - unset($expression['parameters'][1]); - } - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/string'); - - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if (isset($resolvedParams[1])) { - $charlist = $resolvedParams[1]; - } - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_fast_trim('.$symbol.', '.$resolvedParams[0].', '.$charlist.', '.static::$TRIM_WHERE.');'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/UcfirstOptimizer.php b/Library/Optimizers/FunctionCall/UcfirstOptimizer.php deleted file mode 100644 index 0d2b49ddfb..0000000000 --- a/Library/Optimizers/FunctionCall/UcfirstOptimizer.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * UcfirstOptimizer. - * - * Optimizes calls to 'ucfirst' using internal function - */ -class UcfirstOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (1 != \count($expression['parameters'])) { - return false; - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/string'); - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_ucfirst('.$symbol.', '.$resolvedParams[0].');'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/FunctionCall/UncamelizeOptimizer.php b/Library/Optimizers/FunctionCall/UncamelizeOptimizer.php deleted file mode 100644 index 68036a8429..0000000000 --- a/Library/Optimizers/FunctionCall/UncamelizeOptimizer.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Optimizers\FunctionCall; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; - -/** - * UncamelizeOptimizer. - * - * Optimizes calls to 'uncamelize' using internal function - */ -class UncamelizeOptimizer extends OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed - */ - public function optimize(array $expression, Call $call, CompilationContext $context) - { - if (!isset($expression['parameters'])) { - return false; - } - - if (\count($expression['parameters']) < 1 || \count($expression['parameters']) > 2) { - throw new CompilerException("'uncamelize' only accepts one or two parameters"); - } - - $delimiter = 'NULL '; - if (2 == \count($expression['parameters'])) { - if ('null' == $expression['parameters'][1]['parameter']['type']) { - unset($expression['parameters'][1]); - } - } - - /* - * Process the expected symbol to be returned - */ - $call->processExpectedReturn($context); - - $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/string'); - - $symbolVariable->setDynamicTypes('string'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if (isset($resolvedParams[1])) { - $delimiter = $resolvedParams[1]; - } - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } - - $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_uncamelize('.$symbol.', '.$resolvedParams[0].', '.$delimiter.' );'); - - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); - } -} diff --git a/Library/Optimizers/OptimizerAbstract.php b/Library/Optimizers/OptimizerAbstract.php deleted file mode 100644 index 2a8ef25745..0000000000 --- a/Library/Optimizers/OptimizerAbstract.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Optimizers; - -use Zephir\Call; -use Zephir\CompilationContext; - -abstract class OptimizerAbstract -{ - /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @return mixed - */ - abstract public function optimize(array $expression, Call $call, CompilationContext $context); -} diff --git a/Library/Statements/Let/Decr.php b/Library/Statements/Let/Decr.php deleted file mode 100644 index 0c7e0bb0bb..0000000000 --- a/Library/Statements/Let/Decr.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; - -/** - * Decr. - * - * Decrements a variable - */ -class Decr -{ - /** - * Compiles x--. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - */ - public function assign($variable, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - if ($symbolVariable->isReadOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is read only", $statement); - } - - $codePrinter = $compilationContext->codePrinter; - - switch ($symbolVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - case 'char': - case 'uchar': - $codePrinter->output($variable.'--;'); - break; - - case 'variable': - /* - * Variable is probably not initialized here - */ - if ($symbolVariable->hasAnyDynamicType('unknown')) { - throw new CompilerException('Attempt to decrement uninitialized variable', $statement); - } - - /* - * Decrement non-numeric variables could be expensive - */ - if (!$symbolVariable->hasAnyDynamicType(['undefined', 'int', 'long', 'double', 'uint'])) { - $compilationContext->logger->warning( - 'Possible attempt to decrement non-numeric dynamic variable', - ['non-valid-decrement', $statement] - ); - } - - $compilationContext->headersManager->add('kernel/operators'); - if (!$symbolVariable->isLocalOnly()) { - $symbolVariable->separate($compilationContext); - } - $codePrinter->output('zephir_decrement('.$compilationContext->backend->getVariableCode($symbolVariable).');'); - break; - - default: - throw new CompilerException('Cannot decrement variable: '.$symbolVariable->getType(), $statement); - } - } -} diff --git a/Library/Statements/Let/ExportSymbol.php b/Library/Statements/Let/ExportSymbol.php deleted file mode 100644 index a8940d6c71..0000000000 --- a/Library/Statements/Let/ExportSymbol.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Statements\LetStatement; -use Zephir\Variable as ZephirVariable; - -/** - * ExportSymbol. - * - * Exports a symbol to the current PHP symbol table using a variable as parameter - */ -class ExportSymbol -{ - /** - * Compiles {var} = {expr}. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext, - * @param array $statement - */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) - { - $codePrinter = $compilationContext->codePrinter; - - $variable = $compilationContext->symbolTable->getTempVariable('variable', $compilationContext, $statement); - $variable->setMustInitNull(true); - - $letStatement = new LetStatement([ - 'type' => 'let', - 'assignments' => [ - [ - 'assign-type' => 'variable', - 'variable' => $variable->getName(), - 'operator' => 'assign', - 'expr' => [ - 'type' => $resolvedExpr->getType(), - 'value' => $resolvedExpr->getCode(), - 'file' => $statement['file'], - 'line' => $statement['line'], - 'char' => $statement['char'], - ], - 'file' => $statement['file'], - 'line' => $statement['line'], - 'char' => $statement['char'], - ], - ], - ]); - $letStatement->compile($compilationContext); - - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); - $variable = $compilationContext->backend->getVariableCode($variable); - - $codePrinter->output('if (zephir_set_symbol('.$symbol.', '.$variable.') == FAILURE) {'); - $codePrinter->output("\t".'return;'); - $codePrinter->output('}'); - } -} diff --git a/Library/Statements/Let/ExportSymbolString.php b/Library/Statements/Let/ExportSymbolString.php deleted file mode 100644 index 6097b23922..0000000000 --- a/Library/Statements/Let/ExportSymbolString.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Statements\LetStatement; -use Zephir\Variable as ZephirVariable; - -/** - * ExportSymbolString. - * - * Exports a symbol to the current PHP symbol table using a variable as parameter - */ -class ExportSymbolString -{ - /** - * Compiles {"var"} = {expr}. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext, - * @param array $statement - */ - public function assign($variable, ZephirVariable $symbolVariable = null, CompiledExpression $resolvedExpr = null, CompilationContext $compilationContext = null, $statement = null) - { - $codePrinter = $compilationContext->codePrinter; - - $variable = $compilationContext->symbolTable->getTempVariable('variable', $compilationContext, $statement); - $variable->setMustInitNull(true); - - $letStatement = new LetStatement([ - 'type' => 'let', - 'assignments' => [ - [ - 'assign-type' => 'variable', - 'variable' => $variable->getName(), - 'operator' => 'assign', - 'expr' => [ - 'type' => $resolvedExpr->getType(), - 'value' => $resolvedExpr->getCode(), - 'file' => $statement['file'], - 'line' => $statement['line'], - 'char' => $statement['char'], - ], - 'file' => $statement['file'], - 'line' => $statement['line'], - 'char' => $statement['char'], - ], - ], - ]); - $letStatement->compile($compilationContext); - - $symbol = $compilationContext->backend->getVariableCode($variable); - $codePrinter->output('if (zephir_set_symbol_str(SS("'.$statement['variable'].'"), '.$symbol.') == FAILURE) {'); - $codePrinter->output(' return;'); - $codePrinter->output('}'); - } -} diff --git a/Library/Statements/Let/Incr.php b/Library/Statements/Let/Incr.php deleted file mode 100644 index 974808f70c..0000000000 --- a/Library/Statements/Let/Incr.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; - -/** - * Incr. - * - * Increments a variable - */ -class Incr -{ - /** - * Compiles x++. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - */ - public function assign($variable, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - if ($symbolVariable->isReadOnly()) { - /* - * TODO: implement increment of objects members - */ - throw new CompilerException("Cannot mutate variable '".$variable."' because it is read only", $statement); - } - - $codePrinter = &$compilationContext->codePrinter; - - switch ($symbolVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - case 'char': - case 'uchar': - $codePrinter->output($variable.'++;'); - break; - - case 'variable': - /* - * Update non-numeric dynamic variables could be expensive - */ - if (!$symbolVariable->hasAnyDynamicType(['undefined', 'long', 'double'])) { - $compilationContext->logger->warning( - 'Possible attempt to increment non-numeric dynamic variable', - ['non-valid-increment', $statement] - ); - } - - $compilationContext->headersManager->add('kernel/operators'); - if (!$symbolVariable->isLocalOnly()) { - $symbolVariable->separate($compilationContext); - } - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); - $codePrinter->output('zephir_increment('.$symbol.');'); - break; - - default: - throw new CompilerException('Cannot increment: '.$symbolVariable->getType(), $statement); - } - } -} diff --git a/Library/Statements/Let/ObjectDynamicProperty.php b/Library/Statements/Let/ObjectDynamicProperty.php deleted file mode 100644 index b691089380..0000000000 --- a/Library/Statements/Let/ObjectDynamicProperty.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Statements\Let; - -use Exception; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; - -/** - * Updates object properties dynamically - */ -class ObjectDynamicProperty -{ - /** - * Compiles foo->{x} = {expr}. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - * @throws Exception - */ - public function assign(string $variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - if (!$symbolVariable->isVariable()) { - throw new CompilerException("Variable type '".$symbolVariable->getType()."' cannot be used as object", $statement); - } - - $propertyName = $statement['property']; - - $propertyVariable = $compilationContext->symbolTable->getVariableForRead($propertyName, $compilationContext, $statement); - if ($propertyVariable->isNotVariableAndMixedAndString()) { - throw new CompilerException("Cannot use variable type '".$propertyVariable->getType()."' to update object property", $statement); - } - - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate static property '".$compilationContext->classDefinition->getCompleteName().'::'.$propertyName."' because it is not initialized", $statement); - } - - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Cannot use variable type: '.$symbolVariable->getType().' as an object', $statement); - } - - if ($symbolVariable->hasAnyDynamicType('unknown')) { - throw new CompilerException('Cannot use non-initialized variable as an object', $statement); - } - - /** - * Trying to use a non-object dynamic variable as object - */ - if ($symbolVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { - $compilationContext->logger->warning( - 'Possible attempt to update property on non-object dynamic property', - ['non-valid-objectupdate', $statement] - ); - } - - $codePrinter = $compilationContext->codePrinter; - $compilationContext->headersManager->add('kernel/object'); - - $propertyVariableName = $compilationContext->symbolTable->getVariable($propertyName); - - switch ($resolvedExpr->getType()) { - case 'null': - $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, 'null', $compilationContext); - break; - - case 'int': - case 'long': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $tempVariable, $compilationContext); - break; - - case 'string': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignString($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $tempVariable, $compilationContext); - break; - - case 'bool': - if ('1' == $resolvedExpr->getBooleanCode()) { - $value = 'true'; - } elseif ('0' == $resolvedExpr->getBooleanCode()) { - $value = 'false'; - } else { - throw new Exception('?'); - } - - $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $value, $compilationContext); - break; - - case 'empty-array': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('array_init('.$tempVariable->getName().');'); - $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $tempVariable, $compilationContext); - break; - - case 'array': - $variableVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $variableVariable, $compilationContext); - break; - - case 'variable': - $variableVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - switch ($variableVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $tempVariable, $compilationContext); - break; - - case 'bool': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignBool($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $tempVariable, $compilationContext); - break; - - case 'string': - case 'variable': - case 'array': - case 'mixed': - $compilationContext->backend->updateProperty($symbolVariable, $propertyVariable, $resolvedExpr, $compilationContext); - if ($symbolVariable->isTemporal()) { - $symbolVariable->setIdle(true); - } - break; - - default: - throw new CompilerException('Unknown type '.$variableVariable->getType(), $statement); - } - break; - - default: - throw new CompilerException('Unknown type '.$resolvedExpr->getType(), $statement); - } - } -} diff --git a/Library/Statements/Let/ObjectDynamicStringProperty.php b/Library/Statements/Let/ObjectDynamicStringProperty.php deleted file mode 100644 index 7d54d71dcb..0000000000 --- a/Library/Statements/Let/ObjectDynamicStringProperty.php +++ /dev/null @@ -1,156 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; - -/** - * Updates object properties dynamically - */ -class ObjectDynamicStringProperty -{ - /** - * Compiles foo->{"x"} = {expr}. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - * @throws \Exception - */ - public function assign(string $variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - if ('variable' !== $symbolVariable->getType()) { - throw new CompilerException("Variable type '".$symbolVariable->getType()."' cannot be used as object", $statement); - } - - $propertyName = $statement['property']; - - if (!\is_string($propertyName)) { - throw new CompilerException('Expected string to update object property, '.\gettype($propertyName).' received', $statement); - } - - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate static property '".$compilationContext->classDefinition->getCompleteName().'::'.$propertyName."' because it is not initialized", $statement); - } - - if ('variable' != $symbolVariable->getType()) { - throw new CompilerException('Cannot use variable type: '.$symbolVariable->getType().' as an object', $statement); - } - - if ($symbolVariable->hasAnyDynamicType('unknown')) { - throw new CompilerException('Cannot use non-initialized variable as an object', $statement); - } - - /** - * Trying to use a non-object dynamic variable as object - */ - if ($symbolVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { - $compilationContext->logger->warning( - 'Possible attempt to update property on non-object dynamic property', - ['non-valid-objectupdate', $statement] - ); - } - - $compilationContext->headersManager->add('kernel/object'); - - switch ($resolvedExpr->getType()) { - case 'null': - $compilationContext->backend->updateProperty($symbolVariable, $propertyName, 'null', $compilationContext); - break; - - case 'int': - case 'long': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->updateProperty($symbolVariable, $propertyName, $tempVariable, $compilationContext); - break; - - case 'string': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignString($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->updateProperty($symbolVariable, $propertyName, $tempVariable, $compilationContext); - break; - - case 'bool': - if ('1' == $resolvedExpr->getBooleanCode()) { - $value = 'true'; - } elseif ('0' == $resolvedExpr->getBooleanCode()) { - $value = 'false'; - } else { - throw new \Exception('?'); - } - $compilationContext->backend->updateProperty($symbolVariable, $propertyName, $value, $compilationContext); - break; - - case 'empty-array': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->initArray($tempVariable, $compilationContext); - $compilationContext->backend->updateProperty($symbolVariable, $propertyName, $tempVariable, $compilationContext); - break; - - case 'array': - $variableVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - $compilationContext->backend->updateProperty($symbolVariable, $propertyName, $variableVariable, $compilationContext); - break; - - case 'variable': - $variableVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - switch ($variableVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->updateProperty($symbolVariable, $propertyName, $tempVariable, $compilationContext); - break; - - case 'bool': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignBool($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->updateProperty($symbolVariable, $propertyName, $tempVariable, $compilationContext); - break; - - case 'string': - case 'variable': - case 'array': - $compilationContext->backend->updateProperty($symbolVariable, $propertyName, $resolvedExpr, $compilationContext); - if ($symbolVariable->isTemporal()) { - $symbolVariable->setIdle(true); - } - break; - - default: - throw new CompilerException('Unknown type '.$variableVariable->getType(), $statement); - } - break; - - default: - throw new CompilerException('Unknown type '.$resolvedExpr->getType(), $statement); - } - } -} diff --git a/Library/Statements/Let/ObjectPropertyAppend.php b/Library/Statements/Let/ObjectPropertyAppend.php deleted file mode 100644 index 8c11838ee2..0000000000 --- a/Library/Statements/Let/ObjectPropertyAppend.php +++ /dev/null @@ -1,198 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; - -/** - * ObjectPropertyAppend. - * - * Appends a value to a property - */ -class ObjectPropertyAppend -{ - /** - * Compiles x->y[] = foo. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Attempt to use variable type: '.$symbolVariable->getType().' as object', $statement); - } - - $codePrinter = $compilationContext->codePrinter; - - $property = $statement['property']; - - $compilationContext->headersManager->add('kernel/object'); - - /* - * Check if the variable to update is defined - */ - if ('this' == $symbolVariable->getRealName()) { - $classDefinition = $compilationContext->classDefinition; - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); - } - } else { - /* - * If we know the class related to a variable we could check if the property - * is defined on that class - */ - if ($symbolVariable->hasAnyDynamicType('object')) { - $classType = current($symbolVariable->getClassTypes()); - $compiler = $compilationContext->compiler; - - if ($compiler->isClass($classType)) { - $classDefinition = $compiler->getClassDefinition($classType); - if (!$classDefinition) { - throw new CompilerException('Cannot locate class definition for class: '.$classType, $statement); - } - - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classType."' does not have a property called: '".$property."'", $statement); - } - } - } - } - - switch ($resolvedExpr->getType()) { - case 'null': - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, 'null', $compilationContext); - break; - - case 'bool': - $codePrinter->output('if ('.$resolvedExpr->getBooleanCode().') {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, 'true', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, 'false', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - break; - - case 'char': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($tempVariable, '\''.$resolvedExpr->getCode().'\'', $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'int': - case 'long': - case 'uint': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignDouble($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'string': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $tempVariable->initVariant($compilationContext); - $compilationContext->backend->assignString($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'array': - $variableExpr = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, $variableExpr, $compilationContext); - break; - - case 'variable': - $variableExpr = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - switch ($variableExpr->getType()) { - case 'int': - case 'long': - case 'uint': - case 'char': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($tempVariable, $variableExpr, $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignDouble($tempVariable, $variableExpr, $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'bool': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignBool($tempVariable, $variableExpr, $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'variable': - case 'mixed': - case 'string': - case 'array': - case 'resource': - case 'object': - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, null, $variableExpr, $compilationContext); - if ($variableExpr->isTemporal()) { - $variableExpr->setIdle(true); - } - break; - - default: - throw new CompilerException('Variable: '.$variableExpr->getType().' cannot be appended to array property', $statement); - } - break; - - default: - throw new CompilerException('Expression: '.$resolvedExpr->getType().' cannot be appended to array property', $statement); - } - } -} diff --git a/Library/Statements/Let/ObjectPropertyArrayIndex.php b/Library/Statements/Let/ObjectPropertyArrayIndex.php deleted file mode 100644 index 9c221543b1..0000000000 --- a/Library/Statements/Let/ObjectPropertyArrayIndex.php +++ /dev/null @@ -1,317 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Variable as ZephirVariable; - -/** - * ObjectPropertyArrayIndex. - * - * Updates object properties dynamically - */ -class ObjectPropertyArrayIndex extends ArrayIndex -{ - /** - * Compiles x->y[z] = foo. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext, - * @param array $statement - * - * @throws CompilerException - */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Attempt to use variable type: '.$symbolVariable->getType().' as object', $statement); - } - - /* - * Update the property according to the number of array-offsets - */ - if (1 == \count($statement['index-expr'])) { - $this->_assignPropertyArraySingleIndex($variable, $symbolVariable, $resolvedExpr, $compilationContext, $statement); - } else { - $this->_assignPropertyArrayMultipleIndex($variable, $symbolVariable, $resolvedExpr, $compilationContext, $statement); - } - } - - /** - * Compiles x->y[z] = {expr} (single offset assignment). - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - */ - protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) - { - $property = $statement['property']; - $compilationContext->headersManager->add('kernel/object'); - - /** - * Only string/variable/int. - */ - $indexExpression = new Expression($statement['index-expr'][0]); - $resolvedIndex = $indexExpression->compile($compilationContext); - - switch ($resolvedIndex->getType()) { - case 'string': - case 'int': - case 'uint': - case 'ulong': - case 'long': - case 'variable': - break; - default: - throw new CompilerException('Expression: '.$resolvedIndex->getType().' cannot be used as index without cast', $statement); - } - - if ('variable' == $resolvedIndex->getType()) { - $indexVariable = $compilationContext->symbolTable->getVariableForRead($resolvedIndex->getCode(), $compilationContext, $statement); - switch ($indexVariable->getType()) { - case 'string': - case 'int': - case 'uint': - case 'ulong': - case 'long': - case 'variable': - case 'mixed': - break; - default: - throw new CompilerException('Variable: '.$indexVariable->getType().' cannot be used as index without cast', $statement); - } - - if ('variable' == $indexVariable->getType()) { - if ($indexVariable->hasDifferentDynamicType(['undefined', 'int', 'string'])) { - $compilationContext->logger->warning( - 'Possible attempt to use non string/long dynamic variable as array index', - ['invalid-array-offset', $statement] - ); - } - } - } - - switch ($resolvedIndex->getType()) { - case 'int': - case 'uint': - case 'long': - $indexVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignLong($indexVariable, $resolvedIndex->getCode(), $compilationContext); - break; - - case 'string': - $indexVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignString($indexVariable, $resolvedIndex->getCode(), $compilationContext); - break; - - case 'variable': - $variableIndex = $compilationContext->symbolTable->getVariableForRead($resolvedIndex->getCode(), $compilationContext, $statement['index-expr']); - switch ($variableIndex->getType()) { - case 'int': - case 'uint': - case 'long': - $indexVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignLong($indexVariable, $variableIndex, $compilationContext); - break; - } - break; - } - - /* - * Check if the variable to update is defined - */ - if ('this' == $symbolVariable->getRealName()) { - $classDefinition = $compilationContext->classDefinition; - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); - } - } else { - /* - * If we know the class related to a variable we could check if the property - * is defined on that class - */ - if ($symbolVariable->hasAnyDynamicType('object')) { - $classType = current($symbolVariable->getClassTypes()); - $compiler = $compilationContext->compiler; - - if ($compiler->isClass($classType)) { - $classDefinition = $compiler->getClassDefinition($classType); - if (!$classDefinition) { - throw new CompilerException('Cannot locate class definition for class: '.$classType, $statement); - } - - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classType."' does not have a property called: '".$property."'", $statement); - } - } - } - } - - switch ($indexVariable->getType()) { - case 'variable': - case 'mixed': - case 'string': - switch ($resolvedExpr->getType()) { - case 'null': - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, 'null', $compilationContext); - break; - - case 'bool': - $booleanCode = $resolvedExpr->getBooleanCode(); - if ('1' == $booleanCode) { - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, 'true', $compilationContext); - } elseif ('0' == $booleanCode) { - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, 'false', $compilationContext); - } else { - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignBool($tempVariable, $booleanCode, $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $tempVariable, $compilationContext); - } - break; - - case 'int': - case 'long': - case 'uint': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $tempVariable, $compilationContext); - break; - - case 'char': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVariable, '\''.$resolvedExpr->getCode().'\'', $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $tempVariable, $compilationContext); - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignDouble($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $tempVariable, $compilationContext); - break; - - case 'string': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignString($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $tempVariable, $compilationContext); - break; - - case 'array': - $variableExpr = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement['index-expr']); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $variableExpr, $compilationContext); - break; - - case 'variable': - $variableExpr = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement['index-expr']); - switch ($variableExpr->getType()) { - case 'bool': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignBool($tempVariable, $variableExpr, $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $tempVariable, $compilationContext); - break; - - case 'int': - case 'long': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVariable, $variableExpr, $compilationContext); - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $tempVariable, $compilationContext); - break; - - case 'variable': - case 'mixed': - case 'string': - case 'array': - $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $variableExpr, $compilationContext); - if ($variableExpr->isTemporal()) { - $variableExpr->setIdle(true); - } - break; - - default: - throw new CompilerException('Cannot update variable type: '.$variableExpr->getType(), $statement); - } - break; - - default: - throw new CompilerException('Variable index: '.$indexVariable->getType().' cannot be updated into array property', $statement); - } - break; - - default: - throw new CompilerException('Index: '.$resolvedIndex->getType().' cannot be updated into array property', $statement); - } - } - - /** - * Compiles x->y[a][b] = {expr} (multiple offset assignment). - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - */ - protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) - { - $property = $statement['property']; - $compilationContext->headersManager->add('kernel/object'); - - /** - * Create a temporal zval (if needed). - */ - $variableExpr = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); - - /** - * Only string/variable/int. - */ - $offsetExprs = []; - foreach ($statement['index-expr'] as $indexExpr) { - $indexExpression = new Expression($indexExpr); - - $resolvedIndex = $indexExpression->compile($compilationContext); - switch ($resolvedIndex->getType()) { - case 'string': - case 'int': - case 'uint': - case 'ulong': - case 'long': - case 'variable': - break; - default: - throw new CompilerException('Expression: '.$resolvedIndex->getType().' cannot be used as index without cast', $statement['index-expr']); - } - - $offsetExprs[] = $resolvedIndex; - } - - $compilationContext->backend->assignPropertyArrayMulti($symbolVariable, $variableExpr, $property, $offsetExprs, $compilationContext); - - if ($variableExpr->isTemporal()) { - $variableExpr->setIdle(true); - } - } -} diff --git a/Library/Statements/Let/ObjectPropertyDecr.php b/Library/Statements/Let/ObjectPropertyDecr.php deleted file mode 100644 index 768963a298..0000000000 --- a/Library/Statements/Let/ObjectPropertyDecr.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; - -/** - * ObjectPropertyDecr. - * - * Decrements an object property - */ -class ObjectPropertyDecr -{ - /** - * Compiles obj->x--. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompilationContext $compilationContext - * @param array $statement - * @param mixed $property - */ - public function assign($variable, $property, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - /* - * Arrays must be stored in the HEAP - */ - if ($symbolVariable->isLocalOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is local only", $statement); - } - - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - /* - * Only dynamic variables can be used as arrays - */ - if (!$symbolVariable->isVariable()) { - throw new CompilerException("Cannot use variable type: '".$symbolVariable->getType()."' as array", $statement); - } - - if ($symbolVariable->hasAnyDynamicType('unknown')) { - throw new CompilerException('Cannot use non-initialized variable as an object', $statement); - } - - /* - * Trying to use a non-object dynamic variable as object - */ - if ($symbolVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { - $compilationContext->logger->warning( - 'Possible attempt to increment non-object dynamic variable', - ['non-object-update', $statement] - ); - } - - /* - * Check if the variable to update is defined - */ - if ('this' == $symbolVariable->getRealName()) { - $classDefinition = $compilationContext->classDefinition; - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); - } - } else { - /* - * If we know the class related to a variable we could check if the property - * is defined on that class - */ - if ($symbolVariable->hasAnyDynamicType('object')) { - $classType = current($symbolVariable->getClassTypes()); - $compiler = $compilationContext->compiler; - - if ($compiler->isClass($classType)) { - $classDefinition = $compiler->getClassDefinition($classType); - if (!$classDefinition) { - throw new CompilerException('Cannot locate class definition for class: '.$classType, $statement); - } - - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classType."' does not have a property called: '".$property."'", $statement); - } - } - } - } - - $compilationContext->headersManager->add('kernel/object'); - $compilationContext->codePrinter->output('RETURN_ON_FAILURE(zephir_property_decr('.$symbolVariable->getName().', SL("'.$property.'")));'); - } -} diff --git a/Library/Statements/Let/ObjectPropertyIncr.php b/Library/Statements/Let/ObjectPropertyIncr.php deleted file mode 100644 index 8ac0a698b4..0000000000 --- a/Library/Statements/Let/ObjectPropertyIncr.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; - -/** - * ObjectPropertyIncr. - * - * Increments an object property - */ -class ObjectPropertyIncr -{ - /** - * Compiles obj->x++. - * - * @param string $variable - * @param string $property - * @param ZephirVariable $symbolVariable - * @param CompilationContext $compilationContext - * @param array $statement - */ - public function assign($variable, $property, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - /* - * Arrays must be stored in the HEAP - */ - if ($symbolVariable->isLocalOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is local only", $statement); - } - - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - /* - * Only dynamic variables can be used as arrays - */ - if (!$symbolVariable->isVariable()) { - throw new CompilerException("Cannot use variable type: '".$symbolVariable->getType()."' as array", $statement); - } - - if ($symbolVariable->hasAnyDynamicType('unknown')) { - throw new CompilerException('Cannot use non-initialized variable as an object', $statement); - } - - /* - * Trying to use a non-object dynamic variable as object - */ - if ($symbolVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { - $compilationContext->logger->warning( - 'Possible attempt to increment non-object dynamic variable', - ['non-object-update', $statement] - ); - } - - /* - * Check if the variable to update is defined - */ - if ('this' == $symbolVariable->getRealName()) { - $classDefinition = $compilationContext->classDefinition; - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); - } - } else { - /* - * If we know the class related to a variable we could check if the property - * is defined on that class - */ - if ($symbolVariable->hasAnyDynamicType('object')) { - $classType = current($symbolVariable->getClassTypes()); - $compiler = $compilationContext->compiler; - - if ($compiler->isClass($classType)) { - $classDefinition = $compiler->getClassDefinition($classType); - if (!$classDefinition) { - throw new CompilerException('Cannot locate class definition for class: '.$classType, $statement); - } - - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classType."' does not have a property called: '".$property."'", $statement); - } - } - } - } - - $compilationContext->headersManager->add('kernel/object'); - $compilationContext->codePrinter->output('RETURN_ON_FAILURE(zephir_property_incr('.$symbolVariable->getName().', SL("'.$property.'")));'); - } -} diff --git a/Library/Statements/Let/StaticProperty.php b/Library/Statements/Let/StaticProperty.php deleted file mode 100644 index 0e0dc83bbe..0000000000 --- a/Library/Statements/Let/StaticProperty.php +++ /dev/null @@ -1,318 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Exception\IllegalOperationException; -use Zephir\Expression; - -/** - * StaticProperty. - * - * Updates static properties - */ -class StaticProperty -{ - /** - * Compiles ClassName::foo = {expr}. - * - * @param string $className - * @param string $property - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - * @throws IllegalOperationException - */ - public function assignStatic( - string $className, - string $property, - CompiledExpression $resolvedExpr, - CompilationContext $compilationContext, - array $statement - ) { - $classDefinition = $compilationContext->classLookup($className); - - if (!$propertyDefinition = $classDefinition->getProperty($property)) { - throw new CompilerException( - sprintf( - "Class '%s' does not have a property called: '%s", - $classDefinition->getCompleteName(), - $property - ), - $statement - ); - } - - if (!$propertyDefinition->isStatic()) { - throw new CompilerException( - sprintf( - "Cannot access non-static property '%s::%s", - $classDefinition->getCompleteName(), - $property - ), - $statement - ); - } - - if ($propertyDefinition->isPrivate()) { - if ($classDefinition->getCompleteName() != $compilationContext->classDefinition->getCompleteName()) { - throw new CompilerException( - sprintf( - "Cannot access private static property '%s::%s out of its declaring context", - $classDefinition->getCompleteName(), - $property - ), - $statement - ); - } - } - - $codePrinter = $compilationContext->codePrinter; - $compilationContext->headersManager->add('kernel/object'); - - try { - $classEntry = $classDefinition->getClassEntry($compilationContext); - } catch (Exception $e) { - throw new CompilerException($e->getMessage(), $statement, $e->getCode(), $e); - } - - switch ($resolvedExpr->getType()) { - case 'null': - $compilationContext->backend->updateStaticProperty($classEntry, $property, 'null', $compilationContext); - break; - - case 'int': - case 'uint': - case 'long': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getBooleanCode(), $compilationContext); - $compilationContext->backend->updateStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'char': - case 'uchar': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($tempVariable, '\''.$resolvedExpr->getCode().'\'', $compilationContext); - $compilationContext->backend->updateStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignDouble($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->updateStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'string': - // TODO: add-assign - if ('assign' !== $statement['operator']) { - throw CompilerException::illegalOperationTypeOnStaticVariable( - $statement['operator'], - $resolvedExpr->getType(), - $statement - ); - } - - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $tempVariable->initVariant($compilationContext); - - if ($resolvedExpr->getCode()) { - $compilationContext->backend->assignString($tempVariable, $resolvedExpr->getCode(), $compilationContext); - } else { - $codePrinter->output('ZVAL_EMPTY_STRING('.$tempVariable->getName().');'); - } - - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - - $compilationContext->backend->updateStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - break; - - case 'bool': - if ('1' == $resolvedExpr->getBooleanCode()) { - $compilationContext->backend->updateStaticProperty($classEntry, $property, 'true', $compilationContext); - } else { - if ('0' == $resolvedExpr->getBooleanCode()) { - $compilationContext->backend->updateStaticProperty($classEntry, $property, 'false', $compilationContext); - } else { - $codePrinter->output('if ('.$resolvedExpr->getBooleanCode().') {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->updateStaticProperty($classEntry, $property, 'true', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->updateStaticProperty($classEntry, $property, 'false', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - } - } - break; - - case 'empty-array': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->initArray($tempVariable, $compilationContext); - $compilationContext->backend->updateStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'array': - $compilationContext->backend->updateStaticProperty($classEntry, $property, $resolvedExpr, $compilationContext); - break; - - case 'variable': - $variableVariable = $compilationContext->symbolTable->getVariableForRead( - $resolvedExpr->getCode(), - $compilationContext, - $statement - ); - - switch ($variableVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - // TODO: mul-assign, div-assign, sub-assign, add-assign - if ('assign' !== $statement['operator']) { - throw CompilerException::illegalOperationTypeOnStaticVariable( - $statement['operator'], - $variableVariable->getType(), - $statement - ); - } - - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( - 'variable', - $compilationContext, - true - ); - - $compilationContext->backend->assignLong($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->updateStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'double': - // TODO: mul-assign, div-assign, sub-assign, add-assign - if ('assign' !== $statement['operator']) { - throw CompilerException::illegalOperationTypeOnStaticVariable( - $statement['operator'], - $variableVariable->getType(), - $statement - ); - } - - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( - 'variable', - $compilationContext, - true - ); - - $compilationContext->backend->assignDouble($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->updateStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'bool': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignBool($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->updateStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'string': - switch ($statement['operator']) { - /* @noinspection PhpMissingBreakStatementInspection */ - case 'concat-assign': - $tempVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( - 'variable', - $compilationContext - ); - $expression = new Expression([ - 'type' => 'static-property-access', - 'left' => [ - 'value' => $statement['variable'], - ], - 'right' => [ - 'value' => $statement['property'], - ], - ]); - $expression->setExpectReturn(true, $tempVariable); - - try { - $expression->compile($compilationContext); - } catch (Exception $e) { - throw new CompilerException($e->getMessage(), $statement, $e->getCode(), $e); - } - - $variableVariableCode = $compilationContext->backend->getVariableCode($variableVariable); - $tempVariableCode = $compilationContext->backend->getVariableCode($tempVariable); - $compilationContext->codePrinter->output('SEPARATE_ZVAL('.$variableVariableCode.');'); - $compilationContext->codePrinter->output('zephir_concat_function('.$variableVariableCode.', '.$tempVariableCode.', '.$variableVariableCode.');'); - // no break - case 'assign': - $compilationContext->backend->updateStaticProperty($classEntry, $property, $variableVariable, $compilationContext); - if ($variableVariable->isTemporal()) { - $variableVariable->setIdle(true); - } - break; - default: - throw CompilerException::illegalOperationTypeOnStaticVariable( - $statement['operator'], - $variableVariable->getType(), - $statement - ); - } - break; - case 'variable': - case 'array': - $compilationContext->backend->updateStaticProperty($classEntry, $property, $variableVariable, $compilationContext); - if ($variableVariable->isTemporal()) { - $variableVariable->setIdle(true); - } - break; - - default: - throw new CompilerException('Unknown type '.$variableVariable->getType(), $statement); - } - break; - - default: - throw new CompilerException('Unknown type '.$resolvedExpr->getType(), $statement); - } - } -} diff --git a/Library/Statements/Let/StaticPropertyAdd.php b/Library/Statements/Let/StaticPropertyAdd.php deleted file mode 100644 index dd47747f4f..0000000000 --- a/Library/Statements/Let/StaticPropertyAdd.php +++ /dev/null @@ -1,242 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Exception\IllegalOperationException; - -/** - * StaticPropertyAdd. - * - * Updates static properties - */ -class StaticPropertyAdd -{ - /** - * Compiles ClassName::foo = {expr}. - * - * @param string $className - * @param string $property - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - * @throws IllegalOperationException - */ - public function assignStatic( - string $className, - string $property, - CompiledExpression $resolvedExpr, - CompilationContext $compilationContext, - array $statement - ) { - $classDefinition = $compilationContext->classLookup($className); - - if (!$propertyDefinition = $classDefinition->getProperty($property)) { - throw new CompilerException( - sprintf( - "Class '%s' does not have a property called: '%s", - $classDefinition->getCompleteName(), - $property - ), - $statement - ); - } - - if (!$propertyDefinition->isStatic()) { - throw new CompilerException( - sprintf( - "Cannot access non-static property '%s::%s", - $classDefinition->getCompleteName(), - $property - ), - $statement - ); - } - - if ($propertyDefinition->isPrivate()) { - if ($classDefinition->getCompleteName() != $compilationContext->classDefinition->getCompleteName()) { - throw new CompilerException( - sprintf( - "Cannot access private static property '%s::%s out of its declaring context", - $classDefinition->getCompleteName(), - $property - ), - $statement - ); - } - } - - $codePrinter = $compilationContext->codePrinter; - $compilationContext->headersManager->add('kernel/object'); - - try { - $classEntry = $classDefinition->getClassEntry($compilationContext); - } catch (Exception $e) { - throw new CompilerException($e->getMessage(), $statement, $e->getCode(), $e); - } - - switch ($resolvedExpr->getType()) { - case 'null': - $compilationContext->backend->updateStaticProperty($classEntry, $property, 'null', $compilationContext); - break; - - case 'int': - case 'uint': - case 'long': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getBooleanCode(), $compilationContext); - $compilationContext->backend->addStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'char': - case 'uchar': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($tempVariable, '\''.$resolvedExpr->getCode().'\'', $compilationContext); - $compilationContext->backend->addStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignDouble($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->addStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'string': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, true); - $tempVariable->initVariant($compilationContext); - - if ($resolvedExpr->getCode()) { - $compilationContext->backend->assignString($tempVariable, $resolvedExpr->getCode(), $compilationContext); - } else { - $codePrinter->output('ZVAL_EMPTY_STRING('.$tempVariable->getName().');'); - } - - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - - $compilationContext->backend->addStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - break; - - case 'bool': - if ('1' == $resolvedExpr->getBooleanCode()) { - $compilationContext->backend->addStaticProperty($classEntry, $property, 'true', $compilationContext); - } else { - if ('0' == $resolvedExpr->getBooleanCode()) { - $compilationContext->backend->addStaticProperty($classEntry, $property, 'false', $compilationContext); - } else { - $codePrinter->output('if ('.$resolvedExpr->getBooleanCode().') {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->addStaticProperty($classEntry, $property, 'true', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->addStaticProperty($classEntry, $property, 'false', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - } - } - break; - - case 'empty-array': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->initArray($tempVariable, $compilationContext); - $compilationContext->backend->addStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'array': - $compilationContext->backend->addStaticProperty($classEntry, $property, $resolvedExpr, $compilationContext); - break; - - case 'variable': - $variableVariable = $compilationContext->symbolTable->getVariableForRead( - $resolvedExpr->getCode(), - $compilationContext, - $statement - ); - - switch ($variableVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( - 'variable', - $compilationContext, - true - ); - - $compilationContext->backend->assignLong($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->addStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( - 'variable', - $compilationContext, - true - ); - - $compilationContext->backend->assignDouble($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->addStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'bool': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignBool($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->addStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - default: - $compilationContext->backend->addStaticProperty($classEntry, $property, $variableVariable, $compilationContext); - if ($variableVariable->isTemporal()) { - $variableVariable->setIdle(true); - } - break; - } - - break; - - default: - throw new CompilerException('Unknown type '.$resolvedExpr->getType(), $statement); - } - } -} diff --git a/Library/Statements/Let/StaticPropertyArrayIndex.php b/Library/Statements/Let/StaticPropertyArrayIndex.php deleted file mode 100644 index 688524cd17..0000000000 --- a/Library/Statements/Let/StaticPropertyArrayIndex.php +++ /dev/null @@ -1,161 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\ClassProperty; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Expression; - -/** - * Zephir\Statements\Let\StaticPropertyArrayIndex. - * - * Updates object properties dynamically. - */ -class StaticPropertyArrayIndex extends ArrayIndex -{ - /** - * Compiles ClassName::foo[index] = {expr}. - * - * @param string $className - * @param string $property - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws Exception - * @throws CompilerException - */ - public function assignStatic( - $className, - $property, - CompiledExpression $resolvedExpr, - CompilationContext $compilationContext, - array $statement - ) { - $compiler = $compilationContext->compiler; - if (!\in_array($className, ['self', 'static', 'parent'])) { - $className = $compilationContext->getFullName($className); - if ($compiler->isClass($className)) { - $classDefinition = $compiler->getClassDefinition($className); - } else { - if ($compiler->isBundledClass($className)) { - $classDefinition = $compiler->getInternalClassDefinition($className); - } else { - throw new CompilerException("Cannot locate class '".$className."'", $statement); - } - } - } else { - if (\in_array($className, ['self', 'static'])) { - $classDefinition = $compilationContext->classDefinition; - } else { - if ('parent' == $className) { - $classDefinition = $compilationContext->classDefinition; - $extendsClass = $classDefinition->getExtendsClass(); - if (!$extendsClass) { - throw new CompilerException('Cannot assign static property "'.$property.'" on parent because class '.$classDefinition->getCompleteName().' does not extend any class', $statement); - } else { - $classDefinition = $classDefinition->getExtendsClassDefinition(); - } - } - } - } - - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); - } - - /** @var ClassProperty $propertyDefinition */ - $propertyDefinition = $classDefinition->getProperty($property); - if (!$propertyDefinition->isStatic()) { - throw new CompilerException("Cannot access non-static property '".$classDefinition->getCompleteName().'::'.$property."'", $statement); - } - - if ($propertyDefinition->isPrivate()) { - if ($classDefinition != $compilationContext->classDefinition) { - throw new CompilerException("Cannot access private static property '".$classDefinition->getCompleteName().'::'.$property."' out of its declaring context", $statement); - } - } - - $compilationContext->headersManager->add('kernel/object'); - $classEntry = $classDefinition->getClassEntry($compilationContext); - $this->_assignStaticPropertyArrayMultipleIndex($classEntry, $property, $resolvedExpr, $compilationContext, $statement); - } - - /** - * Compiles x::y[a][b] = {expr} (multiple offset assignment). - * - * @param string $classEntry - * @param string $property - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext, - * @param array $statement - * - * @throws Exception - * @throws CompilerException - */ - protected function _assignStaticPropertyArrayMultipleIndex( - $classEntry, - $property, - CompiledExpression $resolvedExpr, - CompilationContext $compilationContext, - $statement - ) { - $property = $statement['property']; - $compilationContext->headersManager->add('kernel/object'); - - /** - * Create a temporal zval (if needed). - */ - $variableExpr = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); - - /** - * Only string/variable/int. - */ - $offsetExpressions = []; - foreach ($statement['index-expr'] as $indexExpr) { - $indexExpression = new Expression($indexExpr); - - $resolvedIndex = $indexExpression->compile($compilationContext); - switch ($resolvedIndex->getType()) { - case 'string': - case 'int': - case 'uint': - case 'ulong': - case 'long': - case 'variable': - break; - default: - throw new CompilerException( - sprintf('Expression: %s cannot be used as index without cast', $resolvedIndex->getType()), - $statement['index-expr'] - ); - } - - $offsetExpressions[] = $resolvedIndex; - } - - $compilationContext->backend->assignStaticPropertyArrayMulti( - $classEntry, - $variableExpr, - $property, - $offsetExpressions, - $compilationContext - ); - - if ($variableExpr->isTemporal()) { - $variableExpr->setIdle(true); - } - } -} diff --git a/Library/Statements/Let/StaticPropertyArrayIndexAppend.php b/Library/Statements/Let/StaticPropertyArrayIndexAppend.php deleted file mode 100644 index 14e76feaec..0000000000 --- a/Library/Statements/Let/StaticPropertyArrayIndexAppend.php +++ /dev/null @@ -1,161 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\ClassProperty; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Expression; - -/** - * StaticPropertyArrayIndexAppend. - * - * Updates object properties dynamically - */ -class StaticPropertyArrayIndexAppend extends ArrayIndex -{ - /** - * Compiles ClassName::foo[index] = {expr}. - * - * @param string $className - * @param string $property - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws Exception - * @throws CompilerException - */ - public function assignStatic( - $className, - $property, - CompiledExpression $resolvedExpr, - CompilationContext $compilationContext, - array $statement - ) { - $compiler = $compilationContext->compiler; - if (!\in_array($className, ['self', 'static', 'parent'])) { - $className = $compilationContext->getFullName($className); - if ($compiler->isClass($className)) { - $classDefinition = $compiler->getClassDefinition($className); - } else { - if ($compiler->isBundledClass($className)) { - $classDefinition = $compiler->getInternalClassDefinition($className); - } else { - throw new CompilerException("Cannot locate class '".$className."'", $statement); - } - } - } else { - if (\in_array($className, ['self', 'static'])) { - $classDefinition = $compilationContext->classDefinition; - } else { - if ('parent' == $className) { - $classDefinition = $compilationContext->classDefinition; - $extendsClass = $classDefinition->getExtendsClass(); - if (!$extendsClass) { - throw new CompilerException('Cannot assign static property "'.$property.'" on parent because class '.$classDefinition->getCompleteName().' does not extend any class', $statement); - } else { - $classDefinition = $classDefinition->getExtendsClassDefinition(); - } - } - } - } - - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); - } - - /** @var ClassProperty $propertyDefinition */ - $propertyDefinition = $classDefinition->getProperty($property); - if (!$propertyDefinition->isStatic()) { - throw new CompilerException("Cannot access non-static property '".$classDefinition->getCompleteName().'::'.$property."'", $statement); - } - - if ($propertyDefinition->isPrivate()) { - if ($classDefinition != $compilationContext->classDefinition) { - throw new CompilerException("Cannot access private static property '".$classDefinition->getCompleteName().'::'.$property."' out of its declaring context", $statement); - } - } - - $compilationContext->headersManager->add('kernel/object'); - $classEntry = $classDefinition->getClassEntry($compilationContext); - $this->_assignStaticPropertyArrayMultipleIndex($classEntry, $property, $resolvedExpr, $compilationContext, $statement); - } - - /** - * Compiles x::y[a][b][] = {expr} (multiple offset assignment). - * - * @param string $classEntry - * @param string $property - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext, - * @param array $statement - * - * @throws Exception - */ - protected function _assignStaticPropertyArrayMultipleIndex( - $classEntry, - $property, - CompiledExpression $resolvedExpr, - CompilationContext $compilationContext, - $statement - ) { - $property = $statement['property']; - $compilationContext->headersManager->add('kernel/object'); - - /** - * Create a temporal zval (if needed). - */ - $variableExpr = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); - - /** - * Only string/variable/int. - */ - $offsetExpressions = []; - foreach ($statement['index-expr'] as $indexExpr) { - $indexExpression = new Expression($indexExpr); - - $resolvedIndex = $indexExpression->compile($compilationContext); - switch ($resolvedIndex->getType()) { - case 'string': - case 'int': - case 'uint': - case 'ulong': - case 'long': - case 'variable': - break; - default: - throw new CompilerException( - sprintf('Expression: %s cannot be used as index without cast', $resolvedIndex->getType()), - $statement['index-expr'] - ); - } - - $offsetExpressions[] = $resolvedIndex; - } - - $offsetExpressions[] = 'a'; - $compilationContext->backend->assignStaticPropertyArrayMulti( - $classEntry, - $variableExpr, - $property, - $offsetExpressions, - $compilationContext - ); - - if ($variableExpr->isTemporal()) { - $variableExpr->setIdle(true); - } - } -} diff --git a/Library/Statements/Let/StaticPropertySub.php b/Library/Statements/Let/StaticPropertySub.php deleted file mode 100644 index a365978c7c..0000000000 --- a/Library/Statements/Let/StaticPropertySub.php +++ /dev/null @@ -1,242 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Exception\IllegalOperationException; - -/** - * StaticPropertySub. - * - * Updates static properties - */ -class StaticPropertySub -{ - /** - * Compiles ClassName::foo = {expr}. - * - * @param string $className - * @param string $property - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - * @throws IllegalOperationException - */ - public function assignStatic( - string $className, - string $property, - CompiledExpression $resolvedExpr, - CompilationContext $compilationContext, - array $statement - ) { - $classDefinition = $compilationContext->classLookup($className); - - if (!$propertyDefinition = $classDefinition->getProperty($property)) { - throw new CompilerException( - sprintf( - "Class '%s' does not have a property called: '%s", - $classDefinition->getCompleteName(), - $property - ), - $statement - ); - } - - if (!$propertyDefinition->isStatic()) { - throw new CompilerException( - sprintf( - "Cannot access non-static property '%s::%s", - $classDefinition->getCompleteName(), - $property - ), - $statement - ); - } - - if ($propertyDefinition->isPrivate()) { - if ($classDefinition->getCompleteName() != $compilationContext->classDefinition->getCompleteName()) { - throw new CompilerException( - sprintf( - "Cannot access private static property '%s::%s out of its declaring context", - $classDefinition->getCompleteName(), - $property - ), - $statement - ); - } - } - - $codePrinter = $compilationContext->codePrinter; - $compilationContext->headersManager->add('kernel/object'); - - try { - $classEntry = $classDefinition->getClassEntry($compilationContext); - } catch (Exception $e) { - throw new CompilerException($e->getMessage(), $statement, $e->getCode(), $e); - } - - switch ($resolvedExpr->getType()) { - case 'null': - $compilationContext->backend->updateStaticProperty($classEntry, $property, 'null', $compilationContext); - break; - - case 'int': - case 'uint': - case 'long': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getBooleanCode(), $compilationContext); - $compilationContext->backend->subStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'char': - case 'uchar': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($tempVariable, '\''.$resolvedExpr->getCode().'\'', $compilationContext); - $compilationContext->backend->subStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignDouble($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->subStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'string': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, true); - $tempVariable->initVariant($compilationContext); - - if ($resolvedExpr->getCode()) { - $compilationContext->backend->assignString($tempVariable, $resolvedExpr->getCode(), $compilationContext); - } else { - $codePrinter->output('ZVAL_EMPTY_STRING('.$tempVariable->getName().');'); - } - - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - - $compilationContext->backend->subStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - break; - - case 'bool': - if ('1' == $resolvedExpr->getBooleanCode()) { - $compilationContext->backend->subStaticProperty($classEntry, $property, 'true', $compilationContext); - } else { - if ('0' == $resolvedExpr->getBooleanCode()) { - $compilationContext->backend->subStaticProperty($classEntry, $property, 'false', $compilationContext); - } else { - $codePrinter->output('if ('.$resolvedExpr->getBooleanCode().') {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->subStaticProperty($classEntry, $property, 'true', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->subStaticProperty($classEntry, $property, 'false', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - } - } - break; - - case 'empty-array': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->initArray($tempVariable, $compilationContext); - $compilationContext->backend->subStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'array': - $compilationContext->backend->subStaticProperty($classEntry, $property, $resolvedExpr, $compilationContext); - break; - - case 'variable': - $variableVariable = $compilationContext->symbolTable->getVariableForRead( - $resolvedExpr->getCode(), - $compilationContext, - $statement - ); - - switch ($variableVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( - 'variable', - $compilationContext, - true - ); - - $compilationContext->backend->assignLong($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->subStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( - 'variable', - $compilationContext, - true - ); - - $compilationContext->backend->assignDouble($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->subStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - - case 'bool': - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); - $compilationContext->backend->assignBool($tempVariable, $variableVariable, $compilationContext); - $compilationContext->backend->subStaticProperty($classEntry, $property, $tempVariable, $compilationContext); - if ($tempVariable->isTemporal()) { - $tempVariable->setIdle(true); - } - break; - default: - $compilationContext->backend->subStaticProperty($classEntry, $property, $variableVariable, $compilationContext); - if ($variableVariable->isTemporal()) { - $variableVariable->setIdle(true); - } - break; - } - - break; - - default: - throw new CompilerException('Unknown type '.$resolvedExpr->getType(), $statement); - } - } -} diff --git a/Library/Statements/Let/Variable.php b/Library/Statements/Let/Variable.php deleted file mode 100644 index 479446029f..0000000000 --- a/Library/Statements/Let/Variable.php +++ /dev/null @@ -1,1304 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CodePrinter; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Detectors\ReadDetector; -use Zephir\Exception\CompilerException; -use Zephir\Exception\IllegalOperationException; -use Zephir\Variable as ZephirVariable; - -use function Zephir\add_slashes; - -/** - * Zephir\Statements\Let\Variable. - * - * Assign a value to a variable. - */ -class Variable -{ - /** - * Compiles foo = {expr} - * Changes the value of a mutable variable. - * - * @param string $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param ReadDetector $readDetector - * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException - */ - public function assign( - string $variable, - ZephirVariable $symbolVariable, - CompiledExpression $resolvedExpr, - ReadDetector $readDetector, - CompilationContext $compilationContext, - array $statement - ) { - if ($symbolVariable->isReadOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is read only", $statement); - } - - $codePrinter = $compilationContext->codePrinter; - - /* - * Only initialize variables if it's direct assignment - */ - if ('assign' == $statement['operator']) { - $symbolVariable->setIsInitialized(true, $compilationContext); - } else { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - } - - /* - * Set the assigned value to the variable as a CompiledExpression - * We could use this expression for further analysis - */ - $symbolVariable->setPossibleValue($resolvedExpr, $compilationContext); - - $type = $symbolVariable->getType(); - switch ($type) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - $this->doNumericAssignment($codePrinter, $resolvedExpr, $variable, $statement, $compilationContext); - break; - - case 'double': - $this->doDoubleAssignment($codePrinter, $resolvedExpr, $variable, $statement, $compilationContext); - break; - - case 'array': - $this->doArrayAssignment($codePrinter, $resolvedExpr, $symbolVariable, $variable, $statement, $compilationContext); - break; - - case 'string': - $this->doStringAssignment($codePrinter, $resolvedExpr, $symbolVariable, $variable, $statement, $compilationContext); - break; - - case 'bool': - $this->doBoolAssignment($codePrinter, $resolvedExpr, $variable, $statement, $compilationContext); - break; - - case 'variable': - case 'mixed': - $this->doVariableAssignment($codePrinter, $resolvedExpr, $symbolVariable, $variable, $statement, $compilationContext, $readDetector); - break; - - default: - throw new CompilerException('Unknown type: '.$type, $statement); - } - } - - /** - * Performs numeric assignment. - * - * @param CodePrinter $codePrinter - * @param CompiledExpression $resolvedExpr - * @param string $variable - * @param array $statement - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * @throws \Zephir\Exception\IllegalOperationException - */ - private function doNumericAssignment( - CodePrinter $codePrinter, - CompiledExpression $resolvedExpr, - string $variable, - array $statement, - CompilationContext $compilationContext - ) { - switch ($resolvedExpr->getType()) { - case 'null': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = 0;'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += 0;'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= 0;'); - break; - - case 'mul-assign': - $codePrinter->output($variable.' *= 0;'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = '.$resolvedExpr->getCode().';'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += '.$resolvedExpr->getCode().';'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= '.$resolvedExpr->getCode().';'); - break; - - case 'mul-assign': - $codePrinter->output($variable.' *= '.$resolvedExpr->getCode().';'); - break; - - case 'div-assign': - $codePrinter->output($variable.' /= '.$resolvedExpr->getCode().';'); - break; - - case 'mod-assign': - $codePrinter->output($variable.' %= '.$resolvedExpr->getCode().';'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'char': - case 'uchar': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = \''.$resolvedExpr->getCode().'\';'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += \''.$resolvedExpr->getCode().'\';'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= \''.$resolvedExpr->getCode().'\';'); - break; - - case 'mul-assign': - $codePrinter->output($variable.' *= \''.$resolvedExpr->getCode().'\';'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'double': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = (long) ('.$resolvedExpr->getCode().');'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += (long) ('.$resolvedExpr->getCode().');'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= (long) ('.$resolvedExpr->getCode().');'); - break; - - case 'mul-assign': - $codePrinter->output($variable.' *= (long) ('.$resolvedExpr->getCode().');'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'bool': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = '.$resolvedExpr->getBooleanCode().';'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += '.$resolvedExpr->getBooleanCode().';'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= '.$resolvedExpr->getBooleanCode().';'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'variable': - $itemVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - switch ($itemVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - case 'char': - case 'uchar': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = '.$itemVariable->getName().';'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += '.$itemVariable->getName().';'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= '.$itemVariable->getName().';'); - break; - - case 'mul-assign': - $codePrinter->output($variable.' *= '.$itemVariable->getName().';'); - break; - - case 'div-assign': - $codePrinter->output($variable.' /= '.$itemVariable->getName().';'); - break; - - case 'mod-assign': - $codePrinter->output($variable.' %= '.$itemVariable->getName().';'); - break; - - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'double': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = (long) '.$itemVariable->getName().';'); - break; - case 'add-assign': - $codePrinter->output($variable.' += (long) '.$itemVariable->getName().';'); - break; - case 'sub-assign': - $codePrinter->output($variable.' -= (long) '.$itemVariable->getName().';'); - break; - case 'mul-assign': - $codePrinter->output($variable.' *= (long) '.$itemVariable->getName().';'); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'variable': - case 'mixed': - $compilationContext->headersManager->add('kernel/operators'); - $exprVariable = $compilationContext->symbolTable->getVariableForWrite($resolvedExpr->resolve(null, $compilationContext), $compilationContext); - $exprVariableCode = $compilationContext->backend->getVariableCode($exprVariable); - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = zephir_get_numberval('.$exprVariableCode.');'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += zephir_get_numberval('.$exprVariableCode.');'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= zephir_get_numberval('.$exprVariableCode.');'); - break; - - case 'mul-assign': - $codePrinter->output($variable.' *= zephir_get_numberval('.$exprVariableCode.');'); - break; - - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - default: - throw new CompilerException('Unknown type: '.$itemVariable->getType(), $statement); - } - break; - default: - throw new CompilerException("Value type '".$resolvedExpr->getType()."' cannot be assigned to variable: int", $statement); - } - } - - /** - * Performs double assignment. - * - * @param CodePrinter $codePrinter - * @param CompiledExpression $resolvedExpr - * @param string $variable - * @param array $statement - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * @throws IllegalOperationException - */ - private function doDoubleAssignment( - CodePrinter $codePrinter, - CompiledExpression $resolvedExpr, - string $variable, - array $statement, - CompilationContext $compilationContext - ) { - switch ($resolvedExpr->getType()) { - case 'null': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = 0.0;'); - break; - case 'add-assign': - $codePrinter->output($variable.' += 0.0;'); - break; - case 'sub-assign': - $codePrinter->output($variable.' -= 0.0;'); - break; - case 'mul-assign': - $codePrinter->output($variable.' *= 0.0;'); - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = (double) ('.$resolvedExpr->getCode().');'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += (double) ('.$resolvedExpr->getCode().');'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= (double) ('.$resolvedExpr->getCode().');'); - break; - - case 'mul-assign': - $codePrinter->output($variable.' *= (double) ('.$resolvedExpr->getCode().');'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'double': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = '.$resolvedExpr->getCode().';'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += '.$resolvedExpr->getCode().';'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= '.$resolvedExpr->getCode().';'); - break; - - case 'mul-assign': - $codePrinter->output($variable.' *= '.$resolvedExpr->getCode().';'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'bool': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = '.$resolvedExpr->getBooleanCode().';'); - break; - - case 'add-assign': - $codePrinter->output($variable.' += '.$resolvedExpr->getBooleanCode().';'); - break; - - case 'sub-assign': - $codePrinter->output($variable.' -= '.$resolvedExpr->getBooleanCode().';'); - break; - - case 'mul-assign': - $codePrinter->output($variable.' *= '.$resolvedExpr->getBooleanCode().';'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'variable': - $itemVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - switch ($itemVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'bool': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = (double) '.$itemVariable->getName().';'); - break; - case 'add-assign': - $codePrinter->output($variable.' += (double) '.$itemVariable->getName().';'); - break; - case 'sub-assign': - $codePrinter->output($variable.' -= (double) '.$itemVariable->getName().';'); - break; - case 'mul-assign': - $codePrinter->output($variable.' *= (double) '.$itemVariable->getName().';'); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'double': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = '.$itemVariable->getName().';'); - break; - case 'add-assign': - $codePrinter->output($variable.' += '.$itemVariable->getName().';'); - break; - case 'sub-assign': - $codePrinter->output($variable.' -= '.$itemVariable->getName().';'); - break; - case 'mul-assign': - $codePrinter->output($variable.' *= '.$itemVariable->getName().';'); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'variable': - case 'mixed': - $compilationContext->headersManager->add('kernel/operators'); - $exprVariableCode = $compilationContext->backend->getVariableCode($itemVariable); - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = zephir_get_numberval('.$exprVariableCode.');'); - break; - case 'add-assign': - $codePrinter->output($variable.' += zephir_get_numberval('.$exprVariableCode.');'); - break; - case 'sub-assign': - $codePrinter->output($variable.' -= zephir_get_numberval('.$exprVariableCode.');'); - break; - case 'mul-assign': - $codePrinter->output($variable.' *= zephir_get_numberval('.$exprVariableCode.');'); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - default: - throw new CompilerException('Unknown type: '.$itemVariable->getType(), $statement); - } - break; - default: - throw new CompilerException('Unknown type '.$resolvedExpr->getType(), $statement); - } - } - - /** - * Performs string assignment. - * - * @param CodePrinter $codePrinter - * @param CompiledExpression $resolvedExpr - * @param ZephirVariable $symbolVariable - * @param string $variable - * @param array $statement - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * @throws \Zephir\Exception\IllegalOperationException - */ - private function doStringAssignment( - CodePrinter $codePrinter, - CompiledExpression $resolvedExpr, - ZephirVariable $symbolVariable, - string $variable, - array $statement, - CompilationContext $compilationContext - ) { - switch ($resolvedExpr->getType()) { - case 'null': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignString($symbolVariable, null, $compilationContext); - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignString($symbolVariable, $resolvedExpr->getCode(), $compilationContext); - break; - case 'concat-assign': - $codePrinter->output('zephir_concat_self_str(&'.$variable.', "'.$resolvedExpr->getCode().'", sizeof("'.$resolvedExpr->getCode().'") - 1);'); - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'string': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - if ($resolvedExpr->getCode()) { - $compilationContext->backend->assignString($symbolVariable, $resolvedExpr->getCode(), $compilationContext); - } else { - $compilationContext->backend->assignString($symbolVariable, null, $compilationContext); - } - break; - case 'concat-assign': - $codePrinter->output('zephir_concat_self_str(&'.$variable.', "'.$resolvedExpr->getCode().'", sizeof("'.$resolvedExpr->getCode().'") - 1);'); - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'char': - case 'uchar': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - if ($resolvedExpr->getCode()) { - $compilationContext->backend->assignString($symbolVariable, $resolvedExpr->getCode(), $compilationContext); - } else { - $compilationContext->backend->assignString($symbolVariable, null, $compilationContext); - } - break; - - case 'concat-assign': - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output('zephir_concat_self_str(&'.$variable.', "'.$resolvedExpr->getCode().'", sizeof("'.$resolvedExpr->getCode().'") - 1);'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'variable': - $itemVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - switch ($itemVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - $compilationContext->headersManager->add('kernel/string'); - // FIXME: Most likely this code is outdated and no longer works. - $codePrinter->output('Z_STRLEN_P('.$variable.') = zephir_spprintf(&Z_STRVAL_P('.$variable.'), 0, "%ld", '.$itemVariable->getName().');'); - $codePrinter->output('Z_TYPE_P('.$variable.') = IS_STRING;'); - break; - - case 'concat-assign': - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output('zephir_concat_self_long(&'.$variable.', '.$itemVariable->getName().');'); - break; - - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'char': - case 'uchar': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - $compilationContext->headersManager->add('kernel/string'); - // FIXME: Most likely this code is outdated and no longer works. - $codePrinter->output('Z_STRLEN_P('.$variable.') = zephir_spprintf(&Z_STRVAL_P('.$variable.'), 0, "%c", '.$itemVariable->getName().');'); - $codePrinter->output('Z_TYPE_P('.$variable.') = IS_STRING;'); - break; - - case 'concat-assign': - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output('zephir_concat_self_char(&'.$variable.', '.$itemVariable->getName().');'); - break; - - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'string': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->setMustInitNull(true); - $symbolVariable->increaseVariantIfNull(); - $compilationContext->symbolTable->mustGrownStack(true); - if ($variable != $itemVariable->getName()) { - $compilationContext->backend->copyOnWrite($symbolVariable, $itemVariable, $compilationContext); - } - break; - - case 'concat-assign': - $compilationContext->headersManager->add('kernel/operators'); - $compilationContext->backend->concatSelf($symbolVariable, $itemVariable, $compilationContext); - break; - - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'variable': - case 'mixed': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->setMustInitNull(true); - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output('zephir_get_strval('.$compilationContext->backend->getVariableCode($symbolVariable).', '.$compilationContext->backend->getVariableCode($itemVariable).');'); - break; - - case 'concat-assign': - $compilationContext->headersManager->add('kernel/operators'); - $compilationContext->backend->concatSelf($symbolVariable, $itemVariable, $compilationContext); - break; - - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - default: - throw new CompilerException('Unknown type: '.$itemVariable->getType(), $statement); - } - break; - - default: - throw new CompilerException('Unknown type '.$resolvedExpr->getType(), $statement); - } - } - - /** - * Performs array assignment. - * - * @param CodePrinter $codePrinter - * @param CompiledExpression $resolvedExpr - * @param ZephirVariable $symbolVariable - * @param string $variable - * @param array $statement - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * @throws IllegalOperationException - */ - private function doArrayAssignment( - CodePrinter $codePrinter, - CompiledExpression $resolvedExpr, - ZephirVariable $symbolVariable, - string $variable, - array $statement, - CompilationContext $compilationContext - ) { - switch ($resolvedExpr->getType()) { - case 'variable': - case 'array': - switch ($statement['operator']) { - case 'assign': - if ($variable != $resolvedExpr->getCode()) { - $symbolVariable->setMustInitNull(true); - $compilationContext->symbolTable->mustGrownStack(true); - - /* Inherit the dynamic type data from the assigned value */ - $symbolVariable->setDynamicTypes('array'); - $symbolVariable->increaseVariantIfNull(); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); - - $codePrinter->output('ZEPHIR_CPY_WRT('.$symbol.', '.$compilationContext->backend->resolveValue($resolvedExpr, $compilationContext).');'); - } - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); - } - break; - - default: - throw new CompilerException("Cannot '".$statement['operator']."' ".$resolvedExpr->getType().' for array type', $resolvedExpr->getOriginal()); - } - } - - /** - * Performs boolean assignment. - * - * @param CodePrinter $codePrinter - * @param CompiledExpression $resolvedExpr - * @param string $variable - * @param array $statement - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * @throws IllegalOperationException - */ - private function doBoolAssignment( - CodePrinter $codePrinter, - CompiledExpression $resolvedExpr, - string $variable, - array $statement, - CompilationContext $compilationContext - ) { - switch ($resolvedExpr->getType()) { - case 'null': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = 0;'); - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = (('.$resolvedExpr->getCode().') ? 1 : 0);'); - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'double': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = (('.$resolvedExpr->getCode().' != 0.0) ? 1 : 0);'); - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'char': - case 'uchar': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = ((\''.$resolvedExpr->getCode().'\') ? 1 : 0);'); - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'bool': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = '.$resolvedExpr->getBooleanCode().';'); - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr); - } - break; - - case 'variable': - $itemVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - switch ($itemVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = (('.$itemVariable->getName().') ? 1 : 0);'); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'double': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = (('.$itemVariable->getName().' != 0.0) ? 1 : 0);'); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'bool': - switch ($statement['operator']) { - case 'assign': - $codePrinter->output($variable.' = '.$itemVariable->getName().';'); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'variable': - case 'mixed': - case 'string': - case 'array': - switch ($statement['operator']) { - case 'assign': - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output($variable.' = zephir_is_true('.$compilationContext->backend->getVariableCode($itemVariable).');'); - break; - - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - default: - throw new CompilerException('Cannot assign variable: '.$itemVariable->getType(), $statement); - } - break; - - default: - throw new CompilerException('Unknown type: '.$resolvedExpr->getType(), $statement); - } - } - - /** - * Performs variable assignment. - * - * @param CodePrinter $codePrinter - * @param CompiledExpression $resolvedExpr - * @param ZephirVariable $symbolVariable - * @param string $variable - * @param array $statement - * @param CompilationContext $compilationContext - * @param ReadDetector $readDetector - * - * @throws CompilerException - * @throws IllegalOperationException - */ - private function doVariableAssignment( - CodePrinter $codePrinter, - CompiledExpression $resolvedExpr, - ZephirVariable $symbolVariable, - string $variable, - array $statement, - CompilationContext $compilationContext, - ReadDetector $readDetector - ) { - switch ($resolvedExpr->getType()) { - case 'null': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - $symbolVariable->setDynamicTypes('null'); - - $compilationContext->backend->assignNull($symbolVariable, $compilationContext); - break; - } - break; - - case 'int': - case 'uint': - case 'long': - case 'ulong': - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); - - switch ($statement['operator']) { - case 'mul-assign': - case 'sub-assign': - case 'add-assign': - switch ($statement['operator']) { - case 'mul-assign': - $functionName = 'ZEPHIR_MUL_ASSIGN'; - break; - - case 'sub-assign': - $functionName = 'ZEPHIR_SUB_ASSIGN'; - break; - - case 'add-assign': - $functionName = 'ZEPHIR_ADD_ASSIGN'; - break; - } - - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getCode(), $compilationContext); - - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output($functionName.'('.$symbol.', '.$compilationContext->backend->getVariableCode($tempVariable).');'); - break; - - case 'assign': - $symbolVariable->setDynamicTypes('long'); - if ($readDetector->detect($variable, $resolvedExpr->getOriginal())) { - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('int', $compilationContext); - $codePrinter->output($tempVariable->getName().' = '.$resolvedExpr->getCode().';'); - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignLong($symbolVariable, $tempVariable, $compilationContext); - } else { - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignLong($symbolVariable, $resolvedExpr->getCode(), $compilationContext); - } - break; - - case 'div-assign': - $symbolVariable->setDynamicTypes('double'); - if ($readDetector->detect($variable, $resolvedExpr->getOriginal())) { - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('double', $compilationContext); - $codePrinter->output($tempVariable->getName().' = '.$resolvedExpr->getCode().';'); - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignDouble($symbolVariable, $tempVariable, $compilationContext); - } else { - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignDouble($symbolVariable, $resolvedExpr->getCode(), $compilationContext); - } - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); - } - break; - - case 'char': - case 'uchar': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->setDynamicTypes('long'); - if ($readDetector->detect($variable, $resolvedExpr->getOriginal())) { - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('char', $compilationContext); - $codePrinter->output($tempVariable->getName().' = '.$resolvedExpr->getCode().';'); - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignLong($symbolVariable, $tempVariable, $compilationContext); - } else { - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignLong($symbolVariable, '\''.$resolvedExpr->getCode().'\'', $compilationContext); - } - - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); - } - break; - - case 'double': - switch ($statement['operator']) { - case 'mul-assign': - case 'sub-assign': - case 'add-assign': - switch ($statement['operator']) { - case 'mul-assign': - $functionName = 'ZEPHIR_MUL_ASSIGN'; - break; - - case 'sub-assign': - $functionName = 'ZEPHIR_SUB_ASSIGN'; - break; - - case 'add-assign': - $functionName = 'ZEPHIR_ADD_ASSIGN'; - break; - } - - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $tempVariable->setDynamicTypes('double'); - $compilationContext->backend->assignDouble($tempVariable, $resolvedExpr->getCode(), $compilationContext); - - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output($functionName.'('.$compilationContext->backend->getVariableCode($symbolVariable).', '.$compilationContext->backend->getVariableCode($tempVariable).');'); - break; - - case 'assign': - $symbolVariable->setDynamicTypes('double'); - if ($readDetector->detect($variable, $resolvedExpr->getOriginal())) { - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('double', $compilationContext); - $codePrinter->output($tempVariable->getName().' = '.$resolvedExpr->getCode().';'); - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignDouble($symbolVariable, $tempVariable, $compilationContext); - } else { - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignDouble($symbolVariable, $resolvedExpr->getCode(), $compilationContext); - } - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); - } - break; - - case 'bool': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->setDynamicTypes('bool'); - if ('true' == $resolvedExpr->getCode()) { - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignBool($symbolVariable, '1', $compilationContext); - } else { - if ('false' == $resolvedExpr->getCode()) { - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignBool($symbolVariable, '0', $compilationContext); - } else { - if ($readDetector->detect($variable, $resolvedExpr->getOriginal())) { - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('double', $compilationContext); - $codePrinter->output($tempVariable->getName().' = '.$resolvedExpr->getBooleanCode().';'); - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignBool($symbolVariable, $tempVariable, $compilationContext); - } else { - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->assignBool($symbolVariable, $resolvedExpr->getBooleanCode(), $compilationContext); - } - } - } - break; - default: - throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); - } - break; - - case 'string': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - $symbolVariable->setDynamicTypes('string'); - $compilationContext->backend->assignString($symbolVariable, add_slashes($resolvedExpr->getCode()), $compilationContext); - break; - - case 'concat-assign': - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output('zephir_concat_self_str(&'.$variable.', SL("'.$resolvedExpr->getCode().'"));'); - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); - } - break; - - case 'array': - switch ($statement['operator']) { - case 'assign': - if ($variable != $resolvedExpr->getCode()) { - $symbolVariable->setMustInitNull(true); - $compilationContext->symbolTable->mustGrownStack(true); - - /* Inherit the dynamic type data from the assigned value */ - $symbolVariable->setDynamicTypes('array'); - $symbolVariable->increaseVariantIfNull(); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); - - $codePrinter->output('ZEPHIR_CPY_WRT('.$symbol.', '.$compilationContext->backend->resolveValue($resolvedExpr, $compilationContext).');'); - } - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); - } - break; - - case 'variable': - $itemVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $resolvedExpr->getOriginal()); - switch ($itemVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'char': - case 'uchar': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - $symbolVariable->setDynamicTypes('long'); - $compilationContext->backend->assignLong($symbolVariable, $itemVariable, $compilationContext); - break; - - case 'add-assign': - $compilationContext->headersManager->add('kernel/operators'); - $symbolVariable->initVariant($compilationContext); - $symbolVariable->setDynamicTypes('long'); - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite($itemVariable->getType(), $compilationContext); - $codePrinter->output($tempVariable->getName().' = zephir_get_numberval('.$compilationContext->backend->getVariableCode($symbolVariable).') + '.$itemVariable->getName().';'); - $compilationContext->backend->assignLong($symbolVariable, $tempVariable, $compilationContext); - break; - - case 'sub-assign': - $compilationContext->headersManager->add('kernel/operators'); - $symbolVariable->initVariant($compilationContext); - $symbolVariable->setDynamicTypes('long'); - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite($itemVariable->getType(), $compilationContext); - $codePrinter->output($tempVariable->getName().' = zephir_get_numberval('.$compilationContext->backend->getVariableCode($symbolVariable).');'); - $compilationContext->backend->assignLong($symbolVariable, $tempVariable->getName().' - '.$itemVariable->getName(), $compilationContext); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'double': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - $symbolVariable->setDynamicTypes('double'); - $compilationContext->backend->assignDouble($symbolVariable, $itemVariable, $compilationContext); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'bool': - switch ($statement['operator']) { - case 'assign': - $symbolVariable->initVariant($compilationContext); - $symbolVariable->setDynamicTypes('bool'); - $compilationContext->backend->assignBool($symbolVariable, $itemVariable, $compilationContext); - break; - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'array': - switch ($statement['operator']) { - case 'assign': - if ($variable != $resolvedExpr->getCode()) { - $symbolVariable->setMustInitNull(true); - $compilationContext->symbolTable->mustGrownStack(true); - - /* Inherit the dynamic type data from the assigned value */ - $symbolVariable->setDynamicTypes('array'); - $symbolVariable->increaseVariantIfNull(); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); - - $codePrinter->output('ZEPHIR_CPY_WRT('.$symbol.', '.$compilationContext->backend->resolveValue($resolvedExpr, $compilationContext).');'); - } - break; - - default: - throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); - } - break; - - case 'variable': - switch ($statement['operator']) { - case 'assign': - if ($itemVariable->getName() != $variable) { - $symbolVariable->setMustInitNull(true); - $compilationContext->symbolTable->mustGrownStack(true); - - /* Inherit the dynamic type data from the assigned value */ - $symbolVariable->setDynamicTypes(array_keys($itemVariable->getDynamicTypes())); - - $symbolVariable->setClassTypes($itemVariable->getClassTypes()); - $symbolVariable->increaseVariantIfNull(); - - $compilationContext->backend->copyOnWrite($symbolVariable, $itemVariable, $compilationContext); - if ($itemVariable->isTemporal()) { - $itemVariable->setIdle(true); - } - } - break; - - case 'concat-assign': - $compilationContext->headersManager->add('kernel/operators'); - $compilationContext->backend->concatSelf($symbolVariable, $itemVariable, $compilationContext); - break; - - case 'add-assign': - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output('ZEPHIR_ADD_ASSIGN('.$compilationContext->backend->getVariableCode($symbolVariable).', '.$compilationContext->backend->getVariableCode($itemVariable).');'); - break; - - case 'sub-assign': - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output('ZEPHIR_SUB_ASSIGN('.$compilationContext->backend->getVariableCode($symbolVariable).', '.$compilationContext->backend->getVariableCode($itemVariable).');'); - break; - - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - case 'string': - switch ($statement['operator']) { - case 'assign': - if ($itemVariable->getName() != $variable) { - $symbolVariable->setMustInitNull(true); - $compilationContext->symbolTable->mustGrownStack(true); - - /* Inherit the dynamic type data from the assigned value */ - $symbolVariable->setDynamicTypes(array_keys($itemVariable->getDynamicTypes())); - $symbolVariable->setClassTypes($itemVariable->getClassTypes()); - $symbolVariable->increaseVariantIfNull(); - - $compilationContext->backend->copyOnWrite($symbolVariable, $itemVariable, $compilationContext); - if ($itemVariable->isTemporal()) { - $itemVariable->setIdle(true); - } - } - break; - - case 'concat-assign': - $compilationContext->headersManager->add('kernel/operators'); - $compilationContext->backend->concatSelf($symbolVariable, $itemVariable, $compilationContext); - break; - - default: - throw new IllegalOperationException($statement, $itemVariable); - } - break; - - default: - throw new CompilerException('Unknown type: '.$itemVariable->getType(), $resolvedExpr->getOriginal()); - } - break; - - default: - throw new CompilerException('Unknown type: '.$resolvedExpr->getType(), $resolvedExpr->getOriginal()); - } - } -} diff --git a/Library/Statements/Let/VariableAppend.php b/Library/Statements/Let/VariableAppend.php deleted file mode 100644 index 42595d41c7..0000000000 --- a/Library/Statements/Let/VariableAppend.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements\Let; - -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; - -/** - * VariableAppend. - * - * Append a value to a variable - */ -class VariableAppend -{ - /** - * Compiles foo[] = {expr}. - * - * @param $variable - * @param ZephirVariable $symbolVariable - * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext - * @param $statement - * - * @throws CompilerException - */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - if ($symbolVariable->isReadOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is read only", $statement); - } - - if ($symbolVariable->isLocalOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is local only", $statement); - } - - /* - * Only dynamic variables and arrays can be used as arrays - */ - if ($symbolVariable->isNotVariableAndArray()) { - throw new CompilerException("Cannot use variable type: '".$symbolVariable->getType()."' as an array", $statement); - } - - if ('variable' == $symbolVariable->getType()) { - if ($symbolVariable->hasDifferentDynamicType(['undefined', 'array'])) { - $compilationContext->logger->warning( - 'Possible attempt to append elements on a non-array dynamic variable', - ['non-array-append', $statement] - ); - } - } - - $compilationContext->headersManager->add('kernel/array'); - - $type = $symbolVariable->getType(); - switch ($type) { - case 'array': - case 'variable': - case 'mixed': - switch ($resolvedExpr->getType()) { - case 'null': - $compilationContext->backend->addArrayEntry($symbolVariable, null, 'null', $compilationContext, $statement); - break; - - case 'int': - case 'uint': - case 'long': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->addArrayEntry($symbolVariable, null, $tempVariable, $compilationContext, $statement); - $tempVariable->setIdle(true); - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignDouble($tempVariable, $resolvedExpr->getCode(), $compilationContext); - $compilationContext->backend->addArrayEntry($symbolVariable, null, $tempVariable, $compilationContext, $statement); - $tempVariable->setIdle(true); - break; - - case 'bool': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignBool($tempVariable, $resolvedExpr->getBooleanCode(), $compilationContext); - $compilationContext->backend->addArrayEntry($symbolVariable, null, $tempVariable, $compilationContext, $statement); - $tempVariable->setIdle(true); - break; - - case 'ulong': - case 'string': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignString($tempVariable, $resolvedExpr->getBooleanCode(), $compilationContext); - $compilationContext->backend->addArrayEntry($symbolVariable, null, $tempVariable, $compilationContext, $statement); - $tempVariable->setIdle(true); - break; - - case 'array': - $exprVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - $compilationContext->backend->addArrayEntry($symbolVariable, null, $exprVariable, $compilationContext, $statement); - break; - - case 'variable': - case 'mixed': - $exprVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); - switch ($exprVariable->getType()) { - case 'int': - case 'uint': - case 'long': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignLong($tempVariable, $exprVariable, $compilationContext); - $compilationContext->backend->addArrayEntry($symbolVariable, null, $tempVariable, $compilationContext, $statement); - $tempVariable->setIdle(true); - break; - - case 'double': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignDouble($tempVariable, $exprVariable, $compilationContext); - $compilationContext->backend->addArrayEntry($symbolVariable, null, $tempVariable, $compilationContext, $statement); - $tempVariable->setIdle(true); - break; - - case 'bool': - $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $statement); - $compilationContext->backend->assignBool($tempVariable, $exprVariable, $compilationContext); - $compilationContext->backend->addArrayEntry($symbolVariable, null, $tempVariable, $compilationContext, $statement); - $tempVariable->setIdle(true); - break; - - case 'variable': - case 'mixed': - case 'string': - case 'array': - $compilationContext->backend->addArrayEntry($symbolVariable, null, $exprVariable, $compilationContext, $statement); - break; - - default: - throw new CompilerException('Unknown type: '.$exprVariable->getType(), $statement); - } - break; - - default: - throw new CompilerException('Unknown type: '.$resolvedExpr->getType(), $statement); - } - break; - - default: - throw new CompilerException('Unknown type: '.$type, $statement); - } - } -} diff --git a/Library/Statements/RequireOnceStatement.php b/Library/Statements/RequireOnceStatement.php deleted file mode 100644 index b6046c3555..0000000000 --- a/Library/Statements/RequireOnceStatement.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Statements; - -use Zephir\CompilationContext; -use Zephir\Exception; -use Zephir\Expression; - -/** - * RequireOnceStatement. - * - * Require once statement is used to execute PHP scripts in a given path - */ -class RequireOnceStatement extends StatementAbstract -{ - /** - * @param CompilationContext $compilationContext - * - * @throws Exception - */ - public function compile(CompilationContext $compilationContext) - { - $expression = [ - 'type' => 'require_once', - 'left' => $this->statement['expr'], - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], - ]; - - $expr = new Expression($expression); - $expr->setExpectReturn(false, null); - $expr->compile($compilationContext); - } -} diff --git a/Library/Statements/StatementAbstract.php b/Library/Statements/StatementAbstract.php deleted file mode 100644 index 96f75c5954..0000000000 --- a/Library/Statements/StatementAbstract.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Statements; - -use Zephir\CompilationContext; -use Zephir\Optimizers\EvalExpression; - -/** - * Zephir\Statements\StatementAbstract. - */ -abstract class StatementAbstract -{ - protected $statement; - - protected $uniqueId; - - /** @var EvalExpression|null */ - protected $evalExpression; - - protected static $uniqueGenerator; - - /** - * StatementAbstract construct. - * - * @param array $statement - */ - public function __construct(array $statement) - { - $this->statement = $statement; - } - - /** - * Generates a uniqueId for those instructions that need it. - * - * @return int - */ - public function getUniqueId() - { - if (!$this->uniqueId) { - $this->uniqueId = self::$uniqueGenerator++; - } - - return $this->uniqueId; - } - - /** - * @return EvalExpression|null - */ - public function getEvalExpression() - { - return $this->evalExpression; - } - - /** - * Compiles the statement. - * - * @param CompilationContext $compilationContext - */ - abstract public function compile(CompilationContext $compilationContext); -} diff --git a/Library/Support/PropertyAccessor.php b/Library/Support/PropertyAccessor.php deleted file mode 100644 index fa4a0c208b..0000000000 --- a/Library/Support/PropertyAccessor.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Support; - -use Zephir\Exception\InvalidCallException; -use Zephir\Exception\UnknownPropertyException; - -/** - * Zephir\Support\PropertyAccessor. - */ -trait PropertyAccessor -{ - /** - * Gets the internal Object's property. - * - * Do not call this method directly as it is a PHP magic method that - * will be implicitly called when executing `$value = $object->property;`. - * - * @param string $name - * - * @throws InvalidCallException - * @throws UnknownPropertyException - * - * @return mixed - */ - public function __get($name) - { - $getter = 'get'.ucfirst($name); - $setter = 'set'.ucfirst($name); - - if (method_exists($this, $getter)) { - return $this->$getter(); - } elseif (method_exists($this, $setter)) { - throw new InvalidCallException( - sprintf('Getting write-only property: %s::%s', static::class, $name) - ); - } - - throw new UnknownPropertyException( - sprintf('Getting unknown property: %s::%s', static::class, $name) - ); - } -} diff --git a/Library/Types/ArrayType.php b/Library/Types/ArrayType.php deleted file mode 100644 index 4b2882bff8..0000000000 --- a/Library/Types/ArrayType.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Types; - -use Zephir\Call; -use Zephir\CompilationContext; -use Zephir\Expression; -use Zephir\Expression\Builder\BuilderFactory; -use Zephir\Types; - -/** - * Defines methods of the built-in array type - */ -class ArrayType extends AbstractType -{ - /** - * {@inheritdoc} - */ - public $methodMap = [ - 'join' => 'join', - 'reversed' => 'array_reverse', - 'rev' => 'array_reverse', - 'diff' => 'array_diff', - 'flip' => 'array_flip', - 'fill' => 'array_fill', - 'walk' => 'array_walk', - 'haskey' => 'array_key_exists', - 'keys' => 'array_keys', - 'values' => 'array_values', - 'split' => 'array_chunk', - 'combine' => 'array_combine', - 'intersect' => 'array_intersect', - 'merge' => 'array_merge', - 'mergerecursive' => 'array_merge_recursive', - 'pad' => 'array_pad', - 'pop' => 'array_pop', - 'push' => 'array_push', - 'rand' => 'array_rand', - 'replace' => 'array_replace', - 'map' => 'array_map', - 'replacerecursive' => 'array_replace_recursive', - 'shift' => 'array_shift', - 'slice' => 'array_slice', - 'splice' => 'array_splice', - 'sum' => 'array_sum', - 'unique' => 'array_unique', - 'prepend' => 'array_unshift', - 'count' => 'count', - 'current' => 'current', - 'each' => 'each', - 'end' => 'end', - 'key' => 'key', - 'next' => 'next', - 'prev' => 'prev', - 'reset' => 'reset', - 'sort' => 'sort', - 'sortbykey' => 'ksort', - 'reversesort' => 'rsort', - 'reversesortbykey' => 'krsort', - 'shuffle' => 'shuffle', - 'tojson' => 'json_encode', - 'reduce' => 'array_reduce', - ]; - - /** - * {@inheritdoc} - */ - public function getTypeName() - { - return Types::T_ARRAY; - } - - /** - * Transforms calls to method "join" to function calls to "join". - * - * @param object $caller - * @param CompilationContext $compilationContext - * @param Call $call - * @param array $expression - * - * @return bool|\Zephir\CompiledExpression - */ - public function join($caller, CompilationContext $compilationContext, Call $call, array $expression) - { - $functionCall = BuilderFactory::getInstance()->statements() - ->functionCall('join', $expression['parameters']) - ->addArgument($caller) - ->setFile($expression['file']) - ->setLine($expression['line']) - ->setChar($expression['char']); - - $expression = new Expression($functionCall->build()); - - return $expression->compile($compilationContext); - } - - /** - * {@inheritdoc} - */ - protected function getNumberParam($methodName) - { - if ('map' == $methodName) { - return 1; - } - - return 0; - } -} diff --git a/Library/Types/DoubleType.php b/Library/Types/DoubleType.php deleted file mode 100644 index b9c0003027..0000000000 --- a/Library/Types/DoubleType.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Types; - -use Zephir\Types; - -/** - * Defines methods of the built-in double type - */ -class DoubleType extends AbstractType -{ - /** - * {@inheritdoc} - */ - public $methodMap = [ - 'abs' => 'abs', - 'tobinary' => 'decbin', - 'tohex' => 'dechex', - 'tooctal' => 'decoct', - 'pow' => 'pow', - 'sqrt' => 'sqrt', - 'exp' => 'exp', - 'sin' => 'sin', - 'cos' => 'cos', - 'tan' => 'tan', - 'asin' => 'asin', - 'acos' => 'acos', - 'atan' => 'atan', - 'log' => 'log', - ]; - - /** - * {@inheritdoc} - */ - public function getTypeName() - { - return Types::T_DOUBLE; - } -} diff --git a/Library/Types/IntType.php b/Library/Types/IntType.php deleted file mode 100644 index 6feb53d059..0000000000 --- a/Library/Types/IntType.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Types; - -use Zephir\Types; - -/** - * Defines methods of the built-in int type - */ -class IntType extends AbstractType -{ - /** - * {@inheritdoc} - */ - public $methodMap = [ - 'abs' => 'abs', - 'tobinary' => 'decbin', - 'tohex' => 'dechex', - 'tooctal' => 'decoct', - 'pow' => 'pow', - 'sqrt' => 'sqrt', - 'exp' => 'exp', - 'sin' => 'sin', - 'cos' => 'cos', - 'tan' => 'tan', - 'asin' => 'asin', - 'acos' => 'acos', - 'atan' => 'atan', - 'log' => 'log', - ]; - - /** - * {@inheritdoc} - */ - public function getTypeName() - { - return Types::T_INT; - } -} diff --git a/Library/Types/StringType.php b/Library/Types/StringType.php deleted file mode 100644 index b18a7d5539..0000000000 --- a/Library/Types/StringType.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Types; - -use Zephir\Types; - -/** - * Encapsulates built-in methods for the "string" type - * - * TODO: explode, join, replace - */ -class StringType extends AbstractType -{ - /** - * {@inheritdoc} - */ - public $methodMap = [ - 'index' => 'strpos', - 'trim' => 'trim', - 'trimleft' => 'ltrim', - 'trimright' => 'rtrim', - 'length' => 'strlen', - 'lower' => 'strtolower', - 'upper' => 'strtoupper', - 'lowerfirst' => 'lcfirst', - 'upperfirst' => 'ucfirst', - 'format' => 'sprintf', - 'md5' => 'md5', - 'sha1' => 'sha1', - 'nl2br' => 'nl2br', - 'parsecsv' => 'str_getcsv', - 'parsejson' => 'json_decode', - 'tojson' => 'json_encode', - 'repeat' => 'str_repeat', - 'shuffle' => 'str_shuffle', - 'split' => 'str_split', - 'compare' => 'strcmp', - 'comparelocale' => 'strcoll', - 'rev' => 'strrev', - 'htmlspecialchars' => 'htmlspecialchars', - 'camelize' => 'camelize', - 'uncamelize' => 'uncamelize', - ]; - - /** - * {@inheritdoc} - */ - public function getTypeName() - { - return Types::T_STRING; - } -} diff --git a/Library/Variable/Globals.php b/Library/Variable/Globals.php deleted file mode 100644 index 22b2a4669f..0000000000 --- a/Library/Variable/Globals.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Variable; - -/** - * Zephir\Variable\Globals. - * - * Represents a central knowledge base on global variables. - */ -class Globals -{ - /** - * The variables passed to the current script via the URL parameters. - */ - const GET = '_GET'; - - /** - * The variables passed to the current script via the HTTP POST method. - */ - const POST = '_POST'; - - /** - * An array in which the environment variable names are element keys, - * and the environment variable value strings are element values. - */ - const ENV = '_ENV'; - - /** - * The variables passed to the current script via HTTP Cookies. - */ - const COOKIE = '_COOKIE'; - - /** - * Server and execution environment information, such as headers, paths, and script locations. - */ - const SERVER = '_SERVER'; - - /** - * The session variables available to the current script. - */ - const SESSION = '_SESSION'; - - /** - * By default contains the contents of $_COOKIE, $_GET, and $_POST. - */ - const REQUEST = '_REQUEST'; - - /** - * The items uploaded to the current script via the HTTP POST method. - */ - const FILES = '_FILES'; - - /** - * Names of superglobal variables. - * - * @var array - */ - protected $superglobals = [ - self::GET => 1, - self::POST => 1, - self::ENV => 1, - self::COOKIE => 1, - self::SERVER => 1, - self::SESSION => 1, - self::REQUEST => 1, - self::FILES => 1, - ]; - - /** - * Checks if a variable is a superglobal. - * - * @param string $name - * - * @return bool - */ - public function isSuperGlobal($name) - { - return isset($this->superglobals[$name]); - } -} diff --git a/Library/functions.php b/Library/functions.php deleted file mode 100644 index 910128f3e3..0000000000 --- a/Library/functions.php +++ /dev/null @@ -1,271 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -use Zephir\Exception\InvalidArgumentException; -use const INFO_GENERAL; -use const PHP_INT_SIZE; -use const PHP_OS; -use const PHP_ZTS; -use const SCANDIR_SORT_ASCENDING; - -/** - * Attempts to remove recursively the directory with all subdirectories and files. - * - * A E_WARNING level error will be generated on failure. - * - * @param string $path - */ -function unlink_recursive($path) -{ - if (is_dir($path)) { - $objects = array_diff(scandir($path, SCANDIR_SORT_ASCENDING), ['.', '..']); - - foreach ($objects as $object) { - if (is_dir("{$path}/{$object}")) { - unlink_recursive("{$path}/{$object}"); - } else { - unlink("{$path}/{$object}"); - } - } - - rmdir($path); - } -} - -/** - * Camelize a string. - * - * @param string $string - * - * @return string - */ -function camelize($string) -{ - return str_replace(' ', '', ucwords(str_replace('_', ' ', $string))); -} - -/** - * Prepares a class name to be used as a C-string. - * - * @param string $className - * - * @return string - */ -function escape_class($className) -{ - return str_replace('\\', '\\\\', $className); -} - -/** - * Prepares a string to be used as a C-string. - * - * Should NOT escape next `escape sequences`: - * Escape sequence | ASCII hex value | Char represented - * --------------- | --------------- | ---------------- - * \a | 07 | Audible bell (Alert, Beep) - * \b | 08 | Backspace - * \e | 1B | Escape character - * \f | 0C | Formed page brake - * \n | 0A | Newline (Line Feed) - * \r | 0D | Carriage Return - * \t | 09 | Horizontal Tab - * \v | 0B | Vertical Tab - * \\ | 5C | Backslash - * \' | 27 | Apostrophe or single quotation mark - * \" | 22 | Double quotation mark - * \? | 3F | Question mark (used to avoid trigraphs) - * \nnn | any | The byte whose numerical value is given by nnn interpreted as an octal number - * \xhh… | any | The byte whose numerical value is given by hh… interpreted as a hexadecimal number - * - * @param string $string - * - * @return string - */ -function add_slashes(string $string): string -{ - $escape = '\\'; - $controlChar = [ - 'a', 'b', 'e', 'f', 'n', 'r', 't', 'v', '\\', '\'', '"', '?', 'x', - ]; - - $newstr = ''; - $after = null; - $last = \strlen($string) - 1; - - for ($i = 0, $next = 1; $i <= $last; ++$i, ++$next) { - $ch = $string[$i]; - - if ($i !== $last) { - $after = $string[$next]; - } else { - $after = null; - } - - if ($ch === $escape) { - if (\in_array($after, $controlChar, true) || is_numeric($after)) { - // should not escape native C control chars - $newstr .= $ch.$after; - ++$i; - ++$next; - continue; - } - $newstr .= $escape.$ch; - continue; - } - - if ('"' === $ch) { - $newstr .= $escape.$ch; - continue; - } - - $newstr .= $ch; - } - - return $newstr; -} - -/** - * Transform class/interface name to FQN format. - * - * @param string $className - * @param string $currentNamespace - * @param AliasManager $aliasManager - * - * @return string - */ -function fqcn($className, $currentNamespace, AliasManager $aliasManager = null) -{ - if (!\is_string($className)) { - throw new InvalidArgumentException('Class name must be a string, got '.\gettype($className)); - } - - // Absolute class/interface name - if ('\\' === $className[0]) { - return substr($className, 1); - } - - // If class/interface name not begin with \ maybe a alias or a sub-namespace - $firstSepPos = strpos($className, '\\'); - if (false !== $firstSepPos) { - $baseName = substr($className, 0, $firstSepPos); - if ($aliasManager && $aliasManager->isAlias($baseName)) { - return $aliasManager->getAlias($baseName).'\\'.substr($className, $firstSepPos + 1); - } - } elseif ($aliasManager && $aliasManager->isAlias($className)) { - return $aliasManager->getAlias($className); - } - - // Relative class/interface name - if ($currentNamespace) { - return $currentNamespace.'\\'.$className; - } - - return $className; -} - -/** - * Checks if the content of the file on the disk is the same as the content. - * - * @param string $content - * @param string $path - * - * @return int|bool - */ -function file_put_contents_ex($content, $path) -{ - if (file_exists($path)) { - $contentMd5 = md5($content); - $existingMd5 = md5_file($path); - - if ($contentMd5 !== $existingMd5) { - return file_put_contents($path, $content); - } - } else { - return file_put_contents($path, $content); - } - - return false; -} - -/** - * Checks if currently running under MS Windows. - * - * @return bool - */ -function is_windows() -{ - return 0 === stripos(PHP_OS, 'WIN'); -} - -/** - * Checks if currently running under macOs. - * - * @return bool - */ -function is_macos() -{ - return 0 === stripos(PHP_OS, 'DARWIN'); -} - -/** - * Checks if current PHP is thread safe. - * - * @return bool - */ -function is_zts() -{ - if (\defined('PHP_ZTS') && PHP_ZTS === 1) { - return true; - } - - ob_start(); - phpinfo(INFO_GENERAL); - - return (bool) preg_match('/Thread\s*Safety\s*enabled/i', strip_tags(ob_get_clean())); -} - -/** - * Resolves Windows release folder. - * - * @return string - */ -function windows_release_dir() -{ - if (is_zts()) { - if (PHP_INT_SIZE === 4) { - // 32-bit version of PHP - return 'ext\\Release_TS'; - } - - if (PHP_INT_SIZE === 8) { - // 64-bit version of PHP - return 'ext\\x64\\Release_TS'; - } - - // fallback - return 'ext\\Release_TS'; - } - - if (PHP_INT_SIZE === 4) { - // 32-bit version of PHP - return 'ext\\Release'; - } - - if (PHP_INT_SIZE === 8) { - // 64-bit version of PHP - return 'ext\\x64\\Release'; - } - - // fallback - return 'ext\\Release'; -} diff --git a/README.md b/README.md index 267f5cf880..d31ca75cad 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # [![Zephir][zephir logo]][web site] +[![Discord][discord-badge]](https://phalcon.io/discord) [![Build on Linux|macOS|Windows][actions main]][actions link] -[![Nightly Builds on Linux][actions nightly]][actions link] [![Latest Stable Version][version badge]][packagist link] +[![PHP from Packagist][packagist ver]][packagist link] +[![Packagist][packagist dd]][packagist stats] [![MIT License][license badge]](./LICENSE) [Zephir][web site] - is a high level programming language that eases the creation and maintainability of extensions for PHP. @@ -16,7 +18,7 @@ Functionality is exposed to the PHP language. ## Community * Follow us on [GitHub][zephir] and [Facebook][facebook] -* Get Zephir support on [Discord][discord] and [Github discussions][discussions] +* Get Zephir support on [Discord][discord] and [GitHub discussions][discussions] * Read our [Code of Conduct](./CODE_OF_CONDUCT.md) ## Contributing @@ -26,7 +28,7 @@ for details about contributions to this repository. ## Sponsors -Become a sponsor and get your logo on our README on Github with a link to your site. +Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/phalcon#sponsor)] @@ -49,15 +51,18 @@ Zephir licensed under the MIT License. See the [LICENSE](./LICENSE) file for mor [docs]: https://docs.zephir-lang.com [zephir]: https://github.com/zephir-lang/zephir [facebook]: https://www.facebook.com/groups/zephir.language -[discord]: https://phalcon.link/discord +[discord]: https://phalcon.io/discord [discussions]: https://github.com/zephir-lang/zephir/discussions [zephir logo]: https://assets.phalconphp.com/zephir/zephir_logo-105x36.svg [web site]: https://zephir-lang.com [actions link]: https://github.com/zephir-lang/zephir/actions [actions main]: https://github.com/zephir-lang/zephir/actions/workflows/main.yml/badge.svg -[actions nightly]: https://github.com/zephir-lang/zephir/actions/workflows/nightly.yml/badge.svg [version badge]: https://poser.pugx.org/phalcon/zephir/v/stable.svg [packagist link]: https://packagist.org/packages/phalcon/zephir +[packagist dd]: https://img.shields.io/packagist/dd/phalcon/zephir +[packagist stats]: https://packagist.org/packages/phalcon/zephir/stats +[packagist ver]: https://img.shields.io/packagist/php-v/phalcon/migrations [license badge]: https://poser.pugx.org/phalcon/zephir/license.svg +[discord-badge]: https://img.shields.io/discord/310910488152375297?label=Discord&logo=discord&style=flat-square diff --git a/box.json.dist b/box.json.dist index 7696ef76a0..aa659e1d2b 100644 --- a/box.json.dist +++ b/box.json.dist @@ -8,8 +8,8 @@ "the LICENSE file that was distributed with this source code." ], "directories": [ - "kernels", - "Library", + "kernel", + "src", "prototypes", "templates", "vendor" @@ -28,11 +28,11 @@ "name": "*.*" }, { - "in": "kernels", + "in": "kernel", "name": "*.*" }, { - "in": "Library", + "in": "src", "name": "*.*" }, { diff --git a/composer.json b/composer.json index 974932b774..2f4548bfe7 100644 --- a/composer.json +++ b/composer.json @@ -21,10 +21,9 @@ } ], "require": { - "php": ">=7.4.1", + "php": ">=8.0", "ext-ctype": "*", "ext-hash": "*", - "ext-json": "*", "ext-mbstring": "*", "ext-pcre": "*", "ext-xml": "*", @@ -39,7 +38,8 @@ "ext-pdo_sqlite": "*", "ext-zip": "*", "phpunit/phpunit": "9.5.28", - "psr/log": "1.1.*" + "psr/log": "1.1.*", + "squizlabs/php_codesniffer": "^3.7" }, "config": { "optimize-autoloader": true, @@ -49,11 +49,8 @@ }, "autoload": { "psr-4": { - "Zephir\\": "Library" - }, - "files": [ - "Library/functions.php" - ] + "Zephir\\": "src/" + } }, "autoload-dev": { "psr-4": { @@ -74,5 +71,19 @@ "source": "https://github.com/zephir-lang/zephir", "irc": "irc://irc.freenode.net/zephir", "docs": "https://docs.zephir-lang.com" - } + }, + "scripts": { + "cs": "./vendor/bin/phpcs --standard=phpcs.xml.dist", + "cs-fix": "./vendor/bin/phpcbf --standard=phpcs.xml.dist", + "test": "./vendor/bin/phpunit --testsuite Zephir", + "test-coverage": "./vendor/bin/phpunit --testsuite Zephir --coverage-php ./tests/output/coverage/coverage.xml", + "test-coverage-html": "./vendor/bin/phpunit --testsuite Zephir --coverage-html ./tests/output/coverage" + }, + "scripts-descriptions": { + "cs": "Run PHPCS", + "cs-fix": "Run PHPCBF", + "test": "Run all tests", + "test-coverage": "Run all tests with coverage (clover)", + "test-coverage-html": "Run all tests with coverage (HTML)" + } } diff --git a/composer.lock b/composer.lock index da93b3b90a..44d636e648 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3f5dd4044a9111ddb52745217aa41362", + "content-hash": "5aed9ef439169bbcb782874f47e36e51", "packages": [ { "name": "monolog/monolog", - "version": "2.9.1", + "version": "2.9.3", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1" + "reference": "a30bfe2e142720dfa990d0a7e573997f5d884215" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/a30bfe2e142720dfa990d0a7e573997f5d884215", + "reference": "a30bfe2e142720dfa990d0a7e573997f5d884215", "shasum": "" }, "require": { @@ -38,8 +38,8 @@ "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", "phpspec/prophecy": "^1.15", - "phpstan/phpstan": "^0.12.91", - "phpunit/phpunit": "^8.5.14", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.5.38 || ^9.6.19", "predis/predis": "^1.1 || ^2.0", "rollbar/rollbar": "^1.3 || ^2 || ^3", "ruflin/elastica": "^7", @@ -94,7 +94,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.9.1" + "source": "https://github.com/Seldaek/monolog/tree/2.9.3" }, "funding": [ { @@ -106,26 +106,31 @@ "type": "tidelift" } ], - "time": "2023-02-06T13:44:46+00:00" + "time": "2024-04-12T20:52:51+00:00" }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -152,9 +157,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/event-dispatcher", @@ -258,16 +263,16 @@ }, { "name": "symfony/console", - "version": "v5.4.19", + "version": "v5.4.44", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740" + "reference": "5b5a0aa66e3296e303e22490f90f521551835a83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740", + "url": "https://api.github.com/repos/symfony/console/zipball/5b5a0aa66e3296e303e22490f90f521551835a83", + "reference": "5b5a0aa66e3296e303e22490f90f521551835a83", "shasum": "" }, "require": { @@ -332,12 +337,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.19" + "source": "https://github.com/symfony/console/tree/v5.4.44" }, "funding": [ { @@ -353,29 +358,29 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2024-09-20T07:56:40+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -404,7 +409,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -420,20 +425,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.19", + "version": "v5.4.40", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "abf49cc084c087d94b4cb939c3f3672971784e0c" + "reference": "a54e2a8a114065f31020d6a89ede83e34c3b27a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/abf49cc084c087d94b4cb939c3f3672971784e0c", - "reference": "abf49cc084c087d94b4cb939c3f3672971784e0c", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a54e2a8a114065f31020d6a89ede83e34c3b27a4", + "reference": "a54e2a8a114065f31020d6a89ede83e34c3b27a4", "shasum": "" }, "require": { @@ -489,7 +494,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.19" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.40" }, "funding": [ { @@ -505,24 +510,24 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "psr/event-dispatcher": "^1" }, "suggest": { @@ -531,7 +536,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -568,7 +573,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.2" }, "funding": [ { @@ -584,24 +589,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -611,9 +616,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -650,7 +652,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -666,33 +668,30 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -731,7 +730,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" }, "funding": [ { @@ -747,33 +746,30 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -815,7 +811,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" }, "funding": [ { @@ -831,24 +827,24 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -858,9 +854,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -898,7 +891,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -914,30 +907,27 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -977,7 +967,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0" }, "funding": [ { @@ -993,30 +983,27 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -1060,7 +1047,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -1076,26 +1063,25 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.0.2", + "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -1106,7 +1092,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -1143,7 +1129,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" }, "funding": [ { @@ -1159,38 +1145,37 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2022-05-30T19:17:58+00:00" }, { "name": "symfony/string", - "version": "v5.4.19", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb" + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/0a01071610fd861cc160dfb7e2682ceec66064cb", - "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb", + "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -1229,7 +1214,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.19" + "source": "https://github.com/symfony/string/tree/v6.0.19" }, "funding": [ { @@ -1245,7 +1230,7 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2023-01-01T08:36:10+00:00" } ], "packages-dev": [ @@ -1321,16 +1306,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -1338,11 +1323,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -1368,7 +1354,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -1376,29 +1362,31 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v5.3.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a", + "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -1406,7 +1394,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1430,26 +1418,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2024-09-29T13:56:26+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -1490,9 +1479,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -1547,44 +1542,44 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.24", + "version": "9.2.32", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -1612,7 +1607,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" }, "funding": [ { @@ -1620,7 +1616,7 @@ "type": "github" } ], - "time": "2023-01-26T08:26:55+00:00" + "time": "2024-08-22T04:23:01+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1967,16 +1963,16 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -2011,7 +2007,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -2019,7 +2015,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -2208,20 +2204,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -2253,7 +2249,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -2261,20 +2257,20 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -2319,7 +2315,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -2327,7 +2323,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -2394,16 +2390,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -2459,7 +2455,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -2467,20 +2463,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -2523,7 +2519,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -2531,24 +2527,24 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -2580,7 +2576,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -2588,7 +2584,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -2767,16 +2763,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { @@ -2788,7 +2784,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2809,8 +2805,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { @@ -2818,7 +2813,7 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { "name": "sebastian/type", @@ -2929,18 +2924,98 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.10.3", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-09-18T10:38:58+00:00" + }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -2969,7 +3044,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -2977,7 +3052,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], @@ -2986,10 +3061,9 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.4.1", + "php": ">=8.0", "ext-ctype": "*", "ext-hash": "*", - "ext-json": "*", "ext-mbstring": "*", "ext-pcre": "*", "ext-xml": "*", @@ -3001,5 +3075,5 @@ "ext-pdo_sqlite": "*", "ext-zip": "*" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.6.0" } diff --git a/docker-compose.yml b/docker-compose.yml index 3bb2269d9a..bd2b5a34d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,10 @@ # For local development only. -version: '3' - services: - zephir-7.4: - container_name: phalcon-zephir-7.4 - hostname: zephir-74 - build: docker/7.4 - working_dir: /srv - environment: - - "USER=Zephir" - volumes: - - .:/srv - zephir-8.0: - container_name: phalcon-zephir-8.0 + container_name: zephir-8.0 hostname: zephir-80 - build: docker/8.0 + build: .docker/8.0 working_dir: /srv environment: - "USER=Zephir" @@ -24,9 +12,9 @@ services: - .:/srv zephir-8.1: - container_name: phalcon-zephir-8.1 + container_name: zephir-8.1 hostname: zephir-81 - build: docker/8.1 + build: .docker/8.1 working_dir: /srv environment: - "USER=Zephir" @@ -34,9 +22,19 @@ services: - .:/srv zephir-8.2: - container_name: phalcon-zephir-8.2 + container_name: zephir-8.2 hostname: zephir-82 - build: docker/8.2 + build: .docker/8.2 + working_dir: /srv + environment: + - "USER=Zephir" + volumes: + - .:/srv + + zephir-8.3: + container_name: zephir-8.3 + hostname: zephir-83 + build: .docker/8.3 working_dir: /srv environment: - "USER=Zephir" diff --git a/ext/config.m4 b/ext/config.m4 index c1fb9625c7..cac98f9af4 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -158,6 +158,7 @@ if test "$PHP_STUB" = "yes"; then stub/oo/scopes/abstractclassmagic.zep.c stub/oo/scopes/privatescopetester.zep.c stub/ooimpl/abeginning.zep.c + stub/openssl.zep.c stub/operator.zep.c stub/optimizers/isscalar.zep.c stub/optimizers/acos.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index 505cec6072..adc844df18 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -11,7 +11,7 @@ if (PHP_STUB != "no") { } ADD_SOURCES(configure_module_dirname + "/stub/invokes", "abstractprotected.zep.c abstractinvoker.zep.c abstractinvokercomplex.zep.c invokeprotected.zep.c invokeprotectedcomplex.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessarr.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1134.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue893.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessarr.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1134.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue893.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c openssl.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend", "exception.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/issue2165", "issueextendinterface.zep.c issueinterface.zep.c issue.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db", "exception.zep.c", "stub"); diff --git a/ext/kernel/array.h b/ext/kernel/array.h index 11d19b6f77..1c98ca2cc0 100644 --- a/ext/kernel/array.h +++ b/ext/kernel/array.h @@ -9,8 +9,6 @@ * following url: https://docs.zephir-lang.com/en/latest/license */ -#ifndef ZEPHIR_KERNEL_ARRAY_H -#define ZEPHIR_KERNEL_ARRAY_H #define ZEPHIR_MAX_ARRAY_LEVELS 16 #include @@ -73,5 +71,3 @@ int zephir_fast_in_array(zval *needle, zval *haystack); Z_TRY_ADDREF_P(value); \ zend_hash_next_index_insert(Z_ARRVAL_P(arr), value); \ } while (0) - -#endif /* ZEPHIR_KERNEL_ARRAY_H */ diff --git a/ext/kernel/exception.c b/ext/kernel/exception.c index 6d0a50ba3c..404162af8d 100644 --- a/ext/kernel/exception.c +++ b/ext/kernel/exception.c @@ -38,7 +38,8 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line) ZVAL_UNDEF(&curline); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); if (Z_TYPE_P(object) != IS_OBJECT) { ZVAL_COPY_VALUE(&object_copy, object); @@ -54,14 +55,8 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line) zephir_check_call_status(); if (ZEPHIR_IS_LONG(&curline, 0)) { default_exception_ce = zend_exception_get_default(); - -#if PHP_VERSION_ID >= 80000 zend_update_property_string(default_exception_ce, Z_OBJ_P(object), SL("file"), file); zend_update_property_long(default_exception_ce, Z_OBJ_P(object), SL("line"), line); -#else - zend_update_property_string(default_exception_ce, object, SL("file"), file); - zend_update_property_long(default_exception_ce, object, SL("line"), line); -#endif } } @@ -88,13 +83,8 @@ void zephir_throw_exception_string_debug(zend_class_entry *ce, const char *messa if (line > 0) { default_exception_ce = zend_exception_get_default(); -#if PHP_VERSION_ID >= 80000 zend_update_property_string(default_exception_ce, Z_OBJ(object), "file", sizeof("file")-1, file); zend_update_property_long(default_exception_ce, Z_OBJ(object), "line", sizeof("line")-1, line); -#else - zend_update_property_string(default_exception_ce, &object, "file", sizeof("file")-1, file); - zend_update_property_long(default_exception_ce, &object, "line", sizeof("line")-1, line); -#endif } if (ZEPHIR_LAST_CALL_STATUS != FAILURE) { diff --git a/ext/kernel/fcall.c b/ext/kernel/fcall.c index d017ec4db3..40b1f98f60 100644 --- a/ext/kernel/fcall.c +++ b/ext/kernel/fcall.c @@ -211,21 +211,12 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze } fcic->called_scope = called_scope; - -#if PHP_VERSION_ID >= 80000 calling_scope = zend_get_called_scope(EG(current_execute_data)); -#else - calling_scope = zend_get_executed_scope(); -#endif - fcic->object = this_ptr ? Z_OBJ_P(this_ptr) : NULL; switch (type) { case zephir_fcall_parent: - -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->parent->function_table, Z_STR_P(func)); - fcic->calling_scope = ce->parent; } else if (EXPECTED(calling_scope && calling_scope->parent)) { if (Z_TYPE_P(func) == IS_STRING) { @@ -235,7 +226,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze } else { return; } -#endif + if (UNEXPECTED(!calling_scope || !calling_scope->parent)) { return; } @@ -244,7 +235,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze break; case zephir_fcall_static: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); fcic->calling_scope = ce; @@ -252,17 +242,10 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func)); fcic->calling_scope = called_scope; } -#else - fcic->calling_scope = called_scope; - if (UNEXPECTED(!calling_scope)) { - return; - } -#endif break; case zephir_fcall_self: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); fcic->calling_scope = ce; @@ -273,13 +256,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze //fcic->called_scope = zend_get_called_scope(EG(current_execute_data)); fcic->calling_scope = calling_scope; } -#else - fcic->calling_scope = calling_scope; -#endif break; case zephir_fcall_ce: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); @@ -288,7 +267,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func)); fcic->calling_scope = calling_scope; } -#endif // TODO: Check for PHP 7.4 and PHP 8.0, as it rewrite from above fcic->calling_scope = ce; fcic->called_scope = ce; @@ -297,11 +275,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze case zephir_fcall_function: case zephir_fcall_method: if (Z_TYPE_P(func) == IS_OBJECT) { -#if PHP_VERSION_ID >= 80000 if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(Z_OBJ_P(func), &fcic->calling_scope, &fcic->function_handler, &fcic->object, 0) == SUCCESS) { -#else - if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(func, &fcic->calling_scope, &fcic->function_handler, &fcic->object) == SUCCESS) { -#endif fcic->called_scope = fcic->calling_scope; break; } @@ -309,11 +283,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze return; } -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); } -#endif fcic->calling_scope = this_ptr ? Z_OBJCE_P(this_ptr) : NULL; fcic->called_scope = fcic->calling_scope; break; @@ -383,12 +355,7 @@ int zephir_call_user_function( ZVAL_COPY_VALUE(&fci.function_name, function_name); fci.retval = retval_ptr ? retval_ptr : &local_retval_ptr; fci.param_count = param_count; - -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else fci.named_params = NULL; -#endif if (cache_entry && *cache_entry) { /* We have a cache record, initialize scope */ @@ -402,22 +369,22 @@ int zephir_call_user_function( /* The caller is interested in caching OR we have the call cache enabled */ resolve_callable(&callable, type, (object_pp && type != zephir_fcall_ce ? Z_OBJCE_P(object_pp) : obj_ce), object_pp, function_name); -#if PHP_VERSION_ID >= 80000 - char *is_callable_error = NULL; - zend_execute_data *frame = EG(current_execute_data); + char *is_callable_error = NULL; + zend_execute_data *frame = EG(current_execute_data); +#if PHP_VERSION_ID >= 80200 + if (obj_ce || !zend_is_callable_at_frame(&callable, fci.object, frame, IS_CALLABLE_SUPPRESS_DEPRECATIONS, &fcic, &is_callable_error)) { +#else if (obj_ce || !zend_is_callable_at_frame(&callable, fci.object, frame, 0, &fcic, &is_callable_error)) { - if (is_callable_error) { - zend_error(E_WARNING, "%s", is_callable_error); - efree(is_callable_error); +#endif + if (is_callable_error) { + zend_error(E_WARNING, "%s", is_callable_error); + efree(is_callable_error); - return FAILURE; - } + return FAILURE; + } populate_fcic(&fcic, type, obj_ce, object_pp, function_name, called_scope); } -#else - zend_is_callable_ex(&callable, fci.object, IS_CALLABLE_CHECK_SILENT, NULL, &fcic, NULL); -#endif } #ifdef _MSC_VER @@ -432,12 +399,9 @@ int zephir_call_user_function( } fci.params = p; - -#if PHP_VERSION_ID >= 80000 if (!fcic.function_handler) { ZVAL_COPY_VALUE(&fci.function_name, &callable); } -#endif status = zend_call_function(&fci, &fcic); @@ -630,31 +594,12 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa return FAILURE; } -#if PHP_VERSION_ID < 80000 - zend_fcall_info_init(handler, 0, &fci, &fci_cache, NULL, &is_callable_error); - - if (is_callable_error) { - zend_error(E_WARNING, "%s", is_callable_error); - efree(is_callable_error); - } else { - status = SUCCESS; - } - - if (status == SUCCESS) { - zend_fcall_info_args(&fci, params); - - fci.retval = return_value; - zend_call_function(&fci, &fci_cache); - - zend_fcall_info_args_clear(&fci, 1); - } - - if (EG(exception)) { - status = SUCCESS; - } -#else zend_execute_data *frame = EG(current_execute_data); +#if PHP_VERSION_ID >= 80200 + if (!zend_is_callable_at_frame(handler, NULL, frame, IS_CALLABLE_SUPPRESS_DEPRECATIONS, &fci_cache, &is_callable_error)) { +#else if (!zend_is_callable_at_frame(handler, NULL, frame, 0, &fci_cache, &is_callable_error)) { +#endif if (is_callable_error) { zend_error(E_WARNING, "%s", is_callable_error); efree(is_callable_error); @@ -674,7 +619,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa zend_fcall_info_args(&fci, params); status = zend_call_function(&fci, &fci_cache); zend_fcall_info_args_clear(&fci, 1); -#endif return status; } @@ -696,11 +640,7 @@ void zephir_eval_php(zval *str, zval *retval_ptr, char *context) #if PHP_VERSION_ID >= 80200 new_op_array = zend_compile_string(Z_STR_P(str), context, ZEND_COMPILE_POSITION_AFTER_OPEN_TAG); #else -#if PHP_VERSION_ID >= 80000 new_op_array = zend_compile_string(Z_STR_P(str), context); -#else - new_op_array = zend_compile_string(str, context); -#endif #endif CG(compiler_options) = original_compiler_options; diff --git a/ext/kernel/fcall.h b/ext/kernel/fcall.h index 2581360756..4754bf4626 100644 --- a/ext/kernel/fcall.h +++ b/ext/kernel/fcall.h @@ -167,19 +167,11 @@ typedef enum _zephir_call_type { ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif #define ZEPHIR_RETURN_CALL_PARENT(class_entry, this_ptr, method, cache, cache_slot, ...) \ do { \ @@ -187,51 +179,25 @@ typedef enum _zephir_call_type { ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_parent, this_ptr, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ - ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ - ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif #define ZEPHIR_CALL_CE_STATIC(return_value_ptr, class_entry, method, cache, cache_slot, ...) \ do { \ diff --git a/ext/kernel/main.c b/ext/kernel/main.c index 1bbd149639..8aeedda44e 100644 --- a/ext/kernel/main.c +++ b/ext/kernel/main.c @@ -137,26 +137,17 @@ void zephir_fast_count(zval *result, zval *value) } if (Z_TYPE_P(value) == IS_OBJECT) { - zval retval; if (Z_OBJ_HT_P(value)->count_elements) { ZVAL_LONG(result, 1); -#if PHP_VERSION_ID >= 80000 if (SUCCESS == Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &Z_LVAL_P(result))) { -#else - if (SUCCESS == Z_OBJ_HT(*value)->count_elements(value, &Z_LVAL_P(result))) { -#endif return; } } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); ZVAL_LONG(result, Z_LVAL(retval)); @@ -189,24 +180,15 @@ int zephir_fast_count_ev(zval *value) } if (Z_TYPE_P(value) == IS_OBJECT) { - zval retval; if (Z_OBJ_HT_P(value)->count_elements) { -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &count); -#else - Z_OBJ_HT(*value)->count_elements(value, &count); -#endif return (int) count > 0; } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); count = Z_LVAL(retval); @@ -241,20 +223,12 @@ int zephir_fast_count_int(zval *value) zval retval; if (Z_OBJ_HT_P(value)->count_elements) { -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &count); -#else - Z_OBJ_HT(*value)->count_elements(value, &count); -#endif return (int) count; } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); count = Z_LVAL(retval); @@ -282,7 +256,7 @@ int zephir_fast_count_int(zval *value) */ int zephir_function_exists(const zval *function_name) { - if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)) != NULL) { + if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name))) { return SUCCESS; } @@ -406,7 +380,6 @@ zend_class_entry* zephir_get_internal_ce(const char *class_name, unsigned int cl /* Declare constants */ int zephir_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value) { -#if PHP_VERSION_ID >= 80000 zend_string *key; if (ce->type == ZEND_INTERNAL_CLASS) { @@ -422,24 +395,6 @@ int zephir_declare_class_constant(zend_class_entry *ce, const char *name, size_t } return SUCCESS; -#else - int ret; - zend_string *key; - - if (ce->type == ZEND_INTERNAL_CLASS) { - key = zend_string_init_interned(name, name_length, 1); - } else { - key = zend_string_init(name, name_length, 0); - } - - ret = zend_declare_class_constant_ex(ce, key, value, ZEND_ACC_PUBLIC, NULL); - - if (ce->type != ZEND_INTERNAL_CLASS) { - zend_string_release(key); - } - - return ret; -#endif } int zephir_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length) diff --git a/ext/kernel/main.h b/ext/kernel/main.h index 72278a569f..99194e3c92 100644 --- a/ext/kernel/main.h +++ b/ext/kernel/main.h @@ -36,11 +36,6 @@ extern zend_string* i_self; #define PH_COPY 1024 #define PH_CTOR 4096 -/* Deprecated */ -#ifndef zend_uint - #define zend_uint uint32_t -#endif - #ifndef ZEND_ACC_FINAL_CLASS #define ZEND_ACC_FINAL_CLASS ZEND_ACC_FINAL #endif @@ -198,7 +193,6 @@ extern zend_string* i_self; #define RETURN_MM_ON_FAILURE(what) \ do { \ if (what == FAILURE) { \ - ZEPHIR_MM_RESTORE(); \ return; \ } \ } while (0) @@ -289,7 +283,7 @@ int zephir_fetch_parameters(int num_args, int required_args, int optional_args, zval _null; \ ZVAL_NULL(&_null); \ ZVAL_COPY(return_value, &_null); \ - zephir_ptr_dtor(&_null); \ + zval_ptr_dtor(&_null); \ } else { \ ZVAL_COPY(return_value, _constant_ptr); \ } \ diff --git a/ext/kernel/memory.c b/ext/kernel/memory.c index ac1f012fd0..68c76a15a1 100644 --- a/ext/kernel/memory.c +++ b/ext/kernel/memory.c @@ -38,147 +38,147 @@ static zend_always_inline zend_execute_data* find_symbol_table(zend_execute_data* ex) { - while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->common.type))) { - ex = ex->prev_execute_data; - } + while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->common.type))) { + ex = ex->prev_execute_data; + } - return ex; + return ex; } /** - * Adds a memory frame in the current executed method - */ +* Adds a memory frame in the current executed method +*/ void ZEPHIR_FASTCALL zephir_memory_grow_stack(zephir_method_globals *g, const char *func) { - if (g->active_memory == NULL) { - zephir_memory_entry *active_memory; +if (g->active_memory == NULL) { + zephir_memory_entry *active_memory; - active_memory = (zephir_memory_entry *) pecalloc(1, sizeof(zephir_memory_entry), 0); + active_memory = (zephir_memory_entry *) pecalloc(1, sizeof(zephir_memory_entry), 0); - active_memory->addresses = pecalloc(24, sizeof(zval*), 0); - active_memory->capacity = 24; + active_memory->addresses = pecalloc(24, sizeof(zval*), 0); + active_memory->capacity = 24; - g->active_memory = active_memory; - } + g->active_memory = active_memory; +} - assert(g->active_memory != NULL); - assert(g->active_memory->pointer == 0); +assert(g->active_memory != NULL); +assert(g->active_memory->pointer == 0); #ifndef ZEPHIR_RELEASE - g->active_memory->func = func; +g->active_memory->func = func; #endif } void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func) { - size_t i; - zephir_memory_entry *active_memory; - zephir_symbol_table *active_symbol_table; - zval *ptr; +size_t i; +zephir_memory_entry *active_memory; +zephir_symbol_table *active_symbol_table; +zval *ptr; #ifndef ZEPHIR_RELEASE - int show_backtrace = 0; +int show_backtrace = 0; #endif #ifndef ZEPHIR_RELEASE - if (UNEXPECTED(g->active_memory == NULL)) { - fprintf(stderr, "WARNING: calling zephir_memory_restore_stack() without an active memory frame!\n"); - fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); - fprintf(stderr, "Calling function: %s\n", func); - zephir_print_backtrace(); - return; - } +if (UNEXPECTED(g->active_memory == NULL)) { + fprintf(stderr, "WARNING: calling zephir_memory_restore_stack() without an active memory frame!\n"); + fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); + fprintf(stderr, "Calling function: %s\n", func); + zephir_print_backtrace(); + return; +} - if (UNEXPECTED(g->active_memory->func != func)) { - fprintf(stderr, "Trying to free someone else's memory frame!\n"); - fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); - fprintf(stderr, "Calling function: %s\n", func); - zephir_print_backtrace(); - return; - } +if (UNEXPECTED(g->active_memory->func != func)) { + fprintf(stderr, "Trying to free someone else's memory frame!\n"); + fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); + fprintf(stderr, "Calling function: %s\n", func); + zephir_print_backtrace(); + return; +} #endif - active_memory = g->active_memory; - assert(active_memory != NULL); +active_memory = g->active_memory; +assert(active_memory != NULL); - if (EXPECTED(!CG(unclean_shutdown))) { - /* Clean active symbol table */ - if (g->active_symbol_table) { - active_symbol_table = g->active_symbol_table; - while (active_symbol_table && active_symbol_table->scope == active_memory) { - zend_execute_data *ex = find_symbol_table(EG(current_execute_data)); +if (EXPECTED(!CG(unclean_shutdown))) { + /* Clean active symbol table */ + if (g->active_symbol_table) { + active_symbol_table = g->active_symbol_table; + while (active_symbol_table && active_symbol_table->scope == active_memory) { + zend_execute_data *ex = find_symbol_table(EG(current_execute_data)); #ifndef ZEPHIR_RELEASE - if (UNEXPECTED(!ex)) { - fprintf(stderr, "ERROR: unable to find a symbol table"); - zephir_print_backtrace(); - return; - } -#endif - zend_hash_destroy(ex->symbol_table); - efree(ex->symbol_table); - ex->symbol_table = active_symbol_table->symbol_table; - zend_attach_symbol_table(ex); - zend_rebuild_symbol_table(); - - g->active_symbol_table = active_symbol_table->prev; - efree(active_symbol_table); - active_symbol_table = g->active_symbol_table; + if (UNEXPECTED(!ex)) { + fprintf(stderr, "ERROR: unable to find a symbol table"); + zephir_print_backtrace(); + return; } +#endif + zend_hash_destroy(ex->symbol_table); + efree(ex->symbol_table); + ex->symbol_table = active_symbol_table->symbol_table; + zend_attach_symbol_table(ex); + zend_rebuild_symbol_table(); + + g->active_symbol_table = active_symbol_table->prev; + efree(active_symbol_table); + active_symbol_table = g->active_symbol_table; } + } #ifndef ZEPHIR_RELEASE - for (i = 0; i < active_memory->pointer; ++i) { - if (active_memory->addresses[i] != NULL) { - zval *var = active_memory->addresses[i]; - if (Z_TYPE_P(var) > IS_CALLABLE) { - fprintf(stderr, "%s: observed variable #%d (%p) has invalid type %u [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); - show_backtrace = 1; - } - - if (!Z_REFCOUNTED_P(var)) { - continue; - } - - if (Z_REFCOUNT_P(var) == 0) { - fprintf(stderr, "%s: observed variable #%d (%p) has 0 references, type=%d [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); - show_backtrace = 1; - } - else if (Z_REFCOUNT_P(var) >= 1000000) { - fprintf(stderr, "%s: observed variable #%d (%p) has too many references (%u), type=%d [%s]\n", __func__, (int)i, var, Z_REFCOUNT_P(var), Z_TYPE_P(var), active_memory->func); - show_backtrace = 1; - } + for (i = 0; i < active_memory->pointer; ++i) { + if (active_memory->addresses[i] != NULL) { + zval *var = active_memory->addresses[i]; + if (Z_TYPE_P(var) > IS_CALLABLE) { + fprintf(stderr, "%s: observed variable #%d (%p) has invalid type %u [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); + show_backtrace = 1; + } + + if (!Z_REFCOUNTED_P(var)) { + continue; + } + + if (Z_REFCOUNT_P(var) == 0) { + fprintf(stderr, "%s: observed variable #%d (%p) has 0 references, type=%d [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); + show_backtrace = 1; + } + else if (Z_REFCOUNT_P(var) >= 1000000) { + fprintf(stderr, "%s: observed variable #%d (%p) has too many references (%u), type=%d [%s]\n", __func__, (int)i, var, Z_REFCOUNT_P(var), Z_TYPE_P(var), active_memory->func); + show_backtrace = 1; } } + } #endif - /* Traverse all zvals allocated, reduce the reference counting or free them */ - for (i = 0; i < active_memory->pointer; ++i) { - ptr = active_memory->addresses[i]; - if (EXPECTED(ptr != NULL)) { - if (!Z_REFCOUNTED_P(ptr)) continue; - if (Z_REFCOUNT_P(ptr) == 1) { - zval_ptr_dtor(ptr); - } else { - Z_DELREF_P(ptr); - } + /* Traverse all zvals allocated, reduce the reference counting or free them */ + for (i = 0; i < active_memory->pointer; ++i) { + ptr = active_memory->addresses[i]; + if (EXPECTED(ptr != NULL)) { + if (!Z_REFCOUNTED_P(ptr)) continue; + if (Z_REFCOUNT_P(ptr) == 1) { + zval_ptr_dtor(ptr); + } else { + Z_DELREF_P(ptr); } } } +} #ifndef ZEPHIR_RELEASE - active_memory->func = NULL; +active_memory->func = NULL; #endif - if (active_memory->addresses != NULL) { - pefree(active_memory->addresses, 0); - } +if (active_memory->addresses != NULL) { + pefree(active_memory->addresses, 0); +} - pefree(g->active_memory, 0); - g->active_memory = NULL; +pefree(g->active_memory, 0); +g->active_memory = NULL; #ifndef ZEPHIR_RELEASE - if (show_backtrace == 1) { - zephir_print_backtrace(); - } +if (show_backtrace == 1) { + zephir_print_backtrace(); +} #endif } @@ -274,60 +274,6 @@ int zephir_set_symbol(zval *key_name, zval *value) return SUCCESS; } -/** - * Exports a string symbol to the active symbol table - */ -int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value) -{ - zend_array *symbol_table = zend_rebuild_symbol_table(); - - if (!symbol_table) { - php_error_docref(NULL, E_WARNING, "Cannot find a valid symbol_table"); - return FAILURE; - } - - Z_TRY_ADDREF_P(value); - zend_hash_str_update(symbol_table, key_name, key_length, value); - - return SUCCESS; -} - -/** - * Cleans the function/method cache up - */ -int zephir_cleanup_fcache(void *pDest, int num_args, va_list args, zend_hash_key *hash_key) -{ - zephir_fcall_cache_entry **entry = (zephir_fcall_cache_entry**) pDest; - zend_class_entry *scope; - size_t len = ZSTR_LEN(hash_key->key); - - assert(hash_key->key != NULL); - assert(len > 2 * sizeof(zend_class_entry**)); - - memcpy(&scope, &ZSTR_VAL(hash_key->key)[(len -1) - 2 * sizeof(zend_class_entry**)], sizeof(zend_class_entry*)); - -/* -#ifndef ZEPHIR_RELEASE - { - zend_class_entry *cls; - memcpy(&cls, &hash_key->arKey[len - sizeof(zend_class_entry**)], sizeof(zend_class_entry*)); - - fprintf(stderr, "func: %s, cls: %s, scope: %s [%u]\n", (*entry)->f->common.function_name, (cls ? cls->name : "N/A"), (scope ? scope->name : "N/A"), (uint)(*entry)->times); - } -#endif -*/ - - if ((*entry)->type != ZEND_INTERNAL_FUNCTION || (scope && scope->type != ZEND_INTERNAL_CLASS)) { - return ZEND_HASH_APPLY_REMOVE; - } - - if (scope && scope->type == ZEND_INTERNAL_CLASS && scope->info.internal.module->type != MODULE_PERSISTENT) { - return ZEND_HASH_APPLY_REMOVE; - } - - return ZEND_HASH_APPLY_KEEP; -} - void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g) { zephir_memory_entry *frame = g->active_memory; diff --git a/ext/kernel/memory.h b/ext/kernel/memory.h index 269ed60920..7da4ec47e2 100644 --- a/ext/kernel/memory.h +++ b/ext/kernel/memory.h @@ -17,12 +17,6 @@ #include "php_ext.h" #include "kernel/globals.h" -#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64) - #define ZEPHIR_ENABLE_64BITS 1 -#endif - -#define ZEPHIR_NUM_PREALLOCATED_FRAMES 25 - /** Memory frame */ typedef struct _zephir_memory_entry { size_t pointer; @@ -53,21 +47,14 @@ typedef struct _zephir_method_globals { void ZEPHIR_FASTCALL zephir_memory_grow_stack(zephir_method_globals *g, const char *func); void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func); -#define ZEPHIR_MM_GROW() \ - ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); \ - zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - #define ZEPHIR_MM_RESTORE() \ zephir_memory_restore_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); \ pefree(ZEPHIR_METHOD_GLOBALS_PTR, 0); \ ZEPHIR_METHOD_GLOBALS_PTR = NULL; void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); -int zephir_cleanup_fcache(void *pDest, int num_args, va_list args, zend_hash_key *hash_key); void zephir_deinitialize_memory(); -#define zephir_ptr_dtor(x) zval_ptr_dtor(x) - void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g); #define zephir_memory_observe(var) zephir_do_memory_observe(var, ZEPHIR_METHOD_GLOBALS_PTR); @@ -78,14 +65,11 @@ void zephir_create_symbol_table(zephir_method_globals *g); #define ZEPHIR_CREATE_SYMBOL_TABLE() zephir_create_symbol_table(ZEPHIR_METHOD_GLOBALS_PTR); int zephir_set_symbol(zval *key_name, zval *value); -int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); #define ZEPHIR_INIT_VAR(z) \ zephir_memory_observe(z); \ ZVAL_NULL(z); -#define ZEPHIR_INIT_ZVAL_NREF(z) ZVAL_UNDEF(&z); - #define ZEPHIR_INIT_NVAR(z) \ do { \ if (Z_TYPE_P(z) == IS_UNDEF) { \ @@ -100,14 +84,11 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); ZVAL_NULL(z); \ } while (0) -/* only removes the value body of the zval */ -#define ZEPHIR_INIT_LNVAR(z) ZEPHIR_INIT_NVAR(&z) - #define ZEPHIR_CPY_WRT(d, v) \ Z_TRY_ADDREF_P(v); \ if (Z_TYPE_P(d) > IS_UNDEF) { \ if (Z_REFCOUNTED_P(d) && Z_REFCOUNT_P(d) > 0) { \ - zephir_ptr_dtor(d); \ + zval_ptr_dtor(d); \ } \ } else { \ zephir_memory_observe(d); \ @@ -117,24 +98,16 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); #define ZEPHIR_CPY_WRT_CTOR(d, v) \ if (d) { \ if (Z_REFCOUNTED_P(d) && Z_REFCOUNT_P(d) > 0) { \ - zephir_ptr_dtor(d); \ + zval_ptr_dtor(d); \ } \ - } else { \ - /*TODO: as above */ \ } \ ZVAL_DUP(d, v); -#define ZEPHIR_OBS_VAR(z) \ - zephir_memory_observe(z) - -#define ZEPHIR_OBS_VAR_ONCE(z) \ +#define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ if (Z_TYPE_P(z) == IS_UNDEF) { \ zephir_memory_observe(z); \ - } - -#define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ - ZEPHIR_OBS_VAR_ONCE(z); \ - ZVAL_COPY(z, v); + } \ + ZVAL_COPY(z, v); #define ZEPHIR_HASH_COPY(z, v) \ if (Z_TYPE_P(z) == IS_ARRAY && Z_TYPE_P(v) == IS_ARRAY) { \ @@ -146,7 +119,7 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); if (Z_REFCOUNTED_P(z) && Z_REFCOUNT_P(z) > 1) { \ Z_DELREF_P(z); \ } else {\ - zephir_ptr_dtor(z); \ + zval_ptr_dtor(z); \ ZVAL_NULL(z); \ } \ } else { \ @@ -161,7 +134,7 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); zval *tmp_ = (ppzv); \ if (tmp_ != NULL) { \ if (Z_TYPE_P(tmp_) != IS_UNDEF) { \ - zephir_ptr_dtor(tmp_); \ + zval_ptr_dtor(tmp_); \ } else { \ zephir_memory_observe(tmp_); \ } \ @@ -169,13 +142,10 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); } \ } while (0) -#define ZEPHIR_SEPARATE(z) SEPARATE_ZVAL(z) - #define ZEPHIR_SEPARATE_PARAM(z) \ do { \ zval *orig_ptr = z; \ - ZEPHIR_SEPARATE(orig_ptr); \ - /*zephir_memory_observe(orig_ptr);*/ \ + SEPARATE_ZVAL(orig_ptr); \ } while (0) #endif diff --git a/ext/kernel/object.c b/ext/kernel/object.c index 3fb2e006c6..12f703ef27 100644 --- a/ext/kernel/object.c +++ b/ext/kernel/object.c @@ -338,11 +338,7 @@ int zephir_clone(zval *destination, zval *obj) status = FAILURE; } else { if (!EG(exception)) { -#if PHP_VERSION_ID >= 80000 ZVAL_OBJ(destination, clone_call(Z_OBJ_P(obj))); -#else - ZVAL_OBJ(destination, clone_call(obj)); -#endif if (EG(exception)) { zval_ptr_dtor(destination); } @@ -363,19 +359,11 @@ int zephir_isset_property(zval *object, const char *property_name, unsigned int return 1; } -#if PHP_VERSION_ID >= 80000 return zend_hash_str_exists( Z_OBJ_HT_P(object)->get_properties(Z_OBJ_P(object)), property_name, property_length ); -#else - return zend_hash_str_exists( - Z_OBJ_HT_P(object)->get_properties(object), - property_name, - property_length - ); -#endif } return 0; @@ -391,19 +379,11 @@ int zephir_isset_property_zval(zval *object, const zval *property) if (EXPECTED(zend_hash_str_exists(&Z_OBJCE_P(object)->properties_info, Z_STRVAL_P(property), Z_STRLEN_P(property)))) { return 1; } else { -#if PHP_VERSION_ID >= 80000 return zend_hash_str_exists( Z_OBJ_HT_P(object)->get_properties(Z_OBJ_P(object)), Z_STRVAL_P(property), Z_STRLEN_P(property) ); -#else - return zend_hash_str_exists( - Z_OBJ_HT_P(object)->get_properties(object), - Z_STRVAL_P(property), - Z_STRLEN_P(property) - ); -#endif } } } @@ -523,15 +503,9 @@ int zephir_read_property( } ZVAL_STRINGL(&property, property_name, property_length); -#if PHP_VERSION_ID >= 80000 res = Z_OBJ_HT_P(object)->read_property(Z_OBJ_P(object), Z_STR(property), flags ? BP_VAR_IS : BP_VAR_R, NULL, &tmp); -#else - res = Z_OBJ_HT_P(object)->read_property(object, &property, - flags ? BP_VAR_IS : BP_VAR_R, - NULL, &tmp); -#endif if ((flags & PH_READONLY) == PH_READONLY) { ZVAL_COPY_VALUE(result, res); @@ -674,11 +648,7 @@ int zephir_update_property_zval( /* write_property will add 1 to refcount, so no Z_TRY_ADDREF_P(value) is necessary */ -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT_P(object)->write_property(Z_OBJ_P(object), Z_STR(property), &sep_value, 0); -#else - Z_OBJ_HT_P(object)->write_property(object, &property, &sep_value, 0); -#endif zval_ptr_dtor(&property); @@ -770,7 +740,7 @@ int zephir_update_property_array(zval *object, const char *property, uint32_t pr if (separated) { zephir_update_property_zval(object, property, property_length, &tmp); - zephir_ptr_dtor(&tmp); + zval_ptr_dtor(&tmp); } return SUCCESS; @@ -858,7 +828,7 @@ int zephir_update_property_array_append(zval *object, char *property, unsigned i if (separated) { zephir_update_property_zval(object, property, property_length, &tmp); - zephir_ptr_dtor(&tmp); + zval_ptr_dtor(&tmp); } return SUCCESS; @@ -920,7 +890,7 @@ int zephir_update_property_array_multi(zval *object, const char *property, uint3 if (separated) { zephir_update_property_zval(object, property, property_length, &tmp_arr); - zephir_ptr_dtor(&tmp_arr); + zval_ptr_dtor(&tmp_arr); } } @@ -943,11 +913,7 @@ int zephir_unset_property(zval* object, const char* name) /* Use caller's scope */ zephir_set_scope(Z_OBJCE_P(object)); -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT_P(object)->unset_property(Z_OBJ_P(object), Z_STR(member), 0); -#else - Z_OBJ_HT_P(object)->unset_property(object, &member, 0); -#endif /* Restore original scope */ zephir_set_scope(scope); @@ -1296,11 +1262,7 @@ int zephir_create_instance(zval *return_value, const zval *class_name) fci.retval = 0; fci.param_count = 0; fci.params = 0; -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else - fci.named_params = NULL; -#endif + fci.named_params = NULL; ZVAL_NULL(&fci.function_name); @@ -1358,11 +1320,8 @@ int zephir_create_instance_params(zval *return_value, const zval *class_name, zv fci.retval = 0; fci.param_count = 0; fci.params = 0; -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else - fci.named_params = NULL; -#endif + fci.named_params = NULL; + ZVAL_NULL(&fci.function_name); fcc.object = obj; diff --git a/ext/kernel/operators.h b/ext/kernel/operators.h index 059f0a0fe2..44351f897a 100644 --- a/ext/kernel/operators.h +++ b/ext/kernel/operators.h @@ -146,7 +146,11 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define zephir_get_boolval(z) (Z_TYPE_P(z) == IS_TRUE ? 1 : (Z_TYPE_P(z) == IS_FALSE ? 0 : zephir_get_boolval_ex(z))) #define zephir_get_charval(z) (Z_TYPE_P(z) == IS_LONG ? Z_LVAL_P(z) : zephir_get_charval_ex(z)) +#if PHP_VERSION_ID >= 80300 +#define zephir_add_function(result, left, right) add_function(result, left, right) +#else #define zephir_add_function(result, left, right) fast_add_function(result, left, right) +#endif #define zephir_sub_function(result, left, right) sub_function(result, left, right) #define zephir_pow_function(result, op1, op2) pow_function(result, op1, op2) #define zephir_increment(var) increment_function(var) @@ -155,7 +159,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_ADD_ASSIGN(z, v) \ { \ zval tmp; \ - ZEPHIR_SEPARATE(z); \ + SEPARATE_ZVAL(z); \ add_function(&tmp, z, v); \ if (Z_TYPE(tmp) == IS_LONG) { \ Z_LVAL_P(z) = Z_LVAL(tmp); \ @@ -169,7 +173,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_SUB_ASSIGN(z, v) \ { \ zval tmp; \ - ZEPHIR_SEPARATE(z); \ + SEPARATE_ZVAL(z); \ sub_function(&tmp, z, v); \ if (Z_TYPE(tmp) == IS_LONG) { \ Z_LVAL_P(z) = Z_LVAL(tmp); \ @@ -183,7 +187,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_MUL_ASSIGN(z, v) \ { \ zval tmp; \ - ZEPHIR_SEPARATE(z); \ + SEPARATE_ZVAL(z); \ mul_function(&tmp, z, v); \ if (Z_TYPE(tmp) == IS_LONG) { \ Z_LVAL_P(z) = Z_LVAL(tmp); \ diff --git a/ext/kernel/string.c b/ext/kernel/string.c index dd5ba9d432..96a49a4254 100644 --- a/ext/kernel/string.c +++ b/ext/kernel/string.c @@ -461,11 +461,8 @@ void zephir_fast_join(zval *result, zval *glue, zval *pieces) zend_error(E_WARNING, "Invalid arguments supplied for join()"); return; } -#if PHP_VERSION_ID < 80000 - php_implode(Z_STR_P(glue), pieces, result); -#else + php_implode(Z_STR_P(glue), Z_ARRVAL_P(pieces), result); -#endif } /** diff --git a/ext/php_stub.h b/ext/php_stub.h index 1b24455ca5..c72a095d34 100644 --- a/ext/php_stub.h +++ b/ext/php_stub.h @@ -14,7 +14,7 @@ #define PHP_STUB_VERSION "1.0.0" #define PHP_STUB_EXTNAME "stub" #define PHP_STUB_AUTHOR "Phalcon Team and contributors" -#define PHP_STUB_ZEPVERSION "0.17.0-$Id$" +#define PHP_STUB_ZEPVERSION "0.18.0-$Id$" #define PHP_STUB_DESCRIPTION "Description test for
Test Extension." typedef struct _zephir_struct_db { diff --git a/ext/stub.c b/ext/stub.c index 23752125f1..2acae2d3be 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -186,6 +186,7 @@ zend_class_entry *stub_oo_propertyaccess_ce; zend_class_entry *stub_oo_scopes_abstractclass_ce; zend_class_entry *stub_oo_scopes_abstractclassmagic_ce; zend_class_entry *stub_oo_scopes_privatescopetester_ce; +zend_class_entry *stub_openssl_ce; zend_class_entry *stub_operator_ce; zend_class_entry *stub_optimizers_acos_ce; zend_class_entry *stub_optimizers_arraymerge_ce; @@ -417,6 +418,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_Oo_Scopes_AbstractClass); ZEPHIR_INIT(Stub_Oo_Scopes_AbstractClassMagic); ZEPHIR_INIT(Stub_Oo_Scopes_PrivateScopeTester); + ZEPHIR_INIT(Stub_Openssl); ZEPHIR_INIT(Stub_Operator); ZEPHIR_INIT(Stub_Optimizers_ACos); ZEPHIR_INIT(Stub_Optimizers_ASin); @@ -586,7 +588,7 @@ static PHP_MINFO_FUNCTION(stub) php_info_print_table_start(); php_info_print_table_header(2, "Test Extension support", "Value"); php_info_print_table_row(2, "Lifecycle hooks", "PHP provides several lifecycle events, which extensions can use to perform common initialization or shutdown tasks."); - php_info_print_table_row(2, "Static Analysis", "Test extensions' compiler provides static analysis of the compiled code."); + php_info_print_table_row(2, "Static Analysis", "Test extensions' compiler provides static analysis of the compiled code."); php_info_print_table_end(); php_info_print_table_start(); php_info_print_table_header(2, "Test variable", "Value"); diff --git a/ext/stub.h b/ext/stub.h index 48be14ef4f..02f8e7ed58 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -153,6 +153,7 @@ #include "stub/oo/scopes/abstractclassmagic.zep.h" #include "stub/oo/scopes/privatescopetester.zep.h" #include "stub/ooimpl/abeginning.zep.h" +#include "stub/openssl.zep.h" #include "stub/operator.zep.h" #include "stub/optimizers/isscalar.zep.h" #include "stub/optimizers/acos.zep.h" diff --git a/ext/stub/0__closure.zep.c b/ext/stub/0__closure.zep.c index 9cbbd80596..3bf21974eb 100644 --- a/ext/stub/0__closure.zep.c +++ b/ext/stub/0__closure.zep.c @@ -27,20 +27,12 @@ ZEPHIR_INIT_CLASS(stub_0__closure) PHP_METHOD(stub_0__closure, __invoke) { zval *x, x_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&x_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &x); - - RETURN_LONG((zephir_get_numberval(x) * 100)); } diff --git a/ext/stub/10__closure.zep.c b/ext/stub/10__closure.zep.c index 46af198cac..b74a33c19a 100644 --- a/ext/stub/10__closure.zep.c +++ b/ext/stub/10__closure.zep.c @@ -26,20 +26,12 @@ ZEPHIR_INIT_CLASS(stub_10__closure) PHP_METHOD(stub_10__closure, __invoke) { zval *config, config_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&config_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(config) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &config); - - RETVAL_ZVAL(config, 1, 0); return; } diff --git a/ext/stub/11__closure.zep.c b/ext/stub/11__closure.zep.c index b1f5df9d74..3ca9b384e4 100644 --- a/ext/stub/11__closure.zep.c +++ b/ext/stub/11__closure.zep.c @@ -27,20 +27,12 @@ ZEPHIR_INIT_CLASS(stub_11__closure) PHP_METHOD(stub_11__closure, __invoke) { zval *x, x_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&x_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &x); - - mul_function(return_value, x, x); return; } diff --git a/ext/stub/12__closure.zep.c b/ext/stub/12__closure.zep.c index 0c969f7be9..327f365347 100644 --- a/ext/stub/12__closure.zep.c +++ b/ext/stub/12__closure.zep.c @@ -24,9 +24,6 @@ ZEPHIR_INIT_CLASS(stub_12__closure) PHP_METHOD(stub_12__closure, __invoke) { - zval *this_ptr = getThis(); - - RETURN_LONG(5); } diff --git a/ext/stub/12__closure.zep.h b/ext/stub/12__closure.zep.h index e55860734b..f1d4463d87 100644 --- a/ext/stub/12__closure.zep.h +++ b/ext/stub/12__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_12__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_12__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_12__closure, __invoke, arginfo_stub_12__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_12__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_12__closure, __invoke, arginfo_stub_12__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/13__closure.zep.c b/ext/stub/13__closure.zep.c index 86eadb4885..3903499e5e 100644 --- a/ext/stub/13__closure.zep.c +++ b/ext/stub/13__closure.zep.c @@ -28,14 +28,10 @@ PHP_METHOD(stub_13__closure, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_CE_STATIC(stub_mcall_caller_ce, "perform", &_0, 0); + ZEPHIR_RETURN_CALL_CE_STATIC(stub_mcall_caller_ce, "perform", NULL, 0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/13__closure.zep.h b/ext/stub/13__closure.zep.h index b4d5d38647..1e69eecb70 100644 --- a/ext/stub/13__closure.zep.h +++ b/ext/stub/13__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_13__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_13__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_13__closure, __invoke, arginfo_stub_13__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_13__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_13__closure, __invoke, arginfo_stub_13__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/1__closure.zep.c b/ext/stub/1__closure.zep.c index 2b68c6696a..e888e319b0 100644 --- a/ext/stub/1__closure.zep.c +++ b/ext/stub/1__closure.zep.c @@ -24,9 +24,6 @@ ZEPHIR_INIT_CLASS(stub_1__closure) PHP_METHOD(stub_1__closure, __invoke) { - zval *this_ptr = getThis(); - - } diff --git a/ext/stub/1__closure.zep.h b/ext/stub/1__closure.zep.h index b0da61413e..30d25ce92f 100644 --- a/ext/stub/1__closure.zep.h +++ b/ext/stub/1__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_1__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_1__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_1__closure, __invoke, arginfo_stub_1__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_1__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_1__closure, __invoke, arginfo_stub_1__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/2__closure.zep.c b/ext/stub/2__closure.zep.c index 1d473f352a..250a54f644 100644 --- a/ext/stub/2__closure.zep.c +++ b/ext/stub/2__closure.zep.c @@ -24,9 +24,6 @@ ZEPHIR_INIT_CLASS(stub_2__closure) PHP_METHOD(stub_2__closure, __invoke) { - zval *this_ptr = getThis(); - - } diff --git a/ext/stub/2__closure.zep.h b/ext/stub/2__closure.zep.h index 13f7c95086..afe190da9d 100644 --- a/ext/stub/2__closure.zep.h +++ b/ext/stub/2__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_2__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_2__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_2__closure, __invoke, arginfo_stub_2__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_2__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_2__closure, __invoke, arginfo_stub_2__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/3__closure.zep.c b/ext/stub/3__closure.zep.c index 6d3ea9ab04..fd7f02b840 100644 --- a/ext/stub/3__closure.zep.c +++ b/ext/stub/3__closure.zep.c @@ -26,19 +26,11 @@ ZEPHIR_INIT_CLASS(stub_3__closure) PHP_METHOD(stub_3__closure, __invoke) { zval *param1, param1_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param1) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m1); - - } diff --git a/ext/stub/4__closure.zep.c b/ext/stub/4__closure.zep.c index 0c3188b1c9..4a22a518c6 100644 --- a/ext/stub/4__closure.zep.c +++ b/ext/stub/4__closure.zep.c @@ -26,19 +26,11 @@ ZEPHIR_INIT_CLASS(stub_4__closure) PHP_METHOD(stub_4__closure, __invoke) { zval *param1, param1_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param1) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m1); - - } diff --git a/ext/stub/5__closure.zep.c b/ext/stub/5__closure.zep.c index 9f39cfc5a4..bf006718f2 100644 --- a/ext/stub/5__closure.zep.c +++ b/ext/stub/5__closure.zep.c @@ -26,20 +26,12 @@ ZEPHIR_INIT_CLASS(stub_5__closure) PHP_METHOD(stub_5__closure, __invoke) { zval *param1, param1_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param1) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m1); - - RETURN_NULL(); } diff --git a/ext/stub/6__closure.zep.c b/ext/stub/6__closure.zep.c index dc65c493de..c75beecf02 100644 --- a/ext/stub/6__closure.zep.c +++ b/ext/stub/6__closure.zep.c @@ -27,20 +27,12 @@ ZEPHIR_INIT_CLASS(stub_6__closure) PHP_METHOD(stub_6__closure, __invoke) { zval *x, x_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&x_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &x); - - RETURN_LONG((zephir_get_numberval(x) + 100)); } diff --git a/ext/stub/7__closure.zep.c b/ext/stub/7__closure.zep.c index 11aa31e130..075e3a3153 100644 --- a/ext/stub/7__closure.zep.c +++ b/ext/stub/7__closure.zep.c @@ -27,20 +27,12 @@ ZEPHIR_INIT_CLASS(stub_7__closure) PHP_METHOD(stub_7__closure, __invoke) { zval *x, x_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&x_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &x); - - RETURN_LONG((((zephir_get_numberval(x) + 100)) + ((zephir_get_numberval(x) * 150)))); } diff --git a/ext/stub/8__closure.zep.c b/ext/stub/8__closure.zep.c index 138be7593c..069acede3f 100644 --- a/ext/stub/8__closure.zep.c +++ b/ext/stub/8__closure.zep.c @@ -27,11 +27,8 @@ ZEPHIR_INIT_CLASS(stub_8__closure) PHP_METHOD(stub_8__closure, __invoke) { zval abc; - zval *this_ptr = getThis(); ZVAL_UNDEF(&abc); - - zephir_read_static_property_ce(&abc, stub_8__closure_ce, SL("abc"), PH_NOISY_CC); RETURN_LONG((zephir_get_numberval(&abc) + 1)); diff --git a/ext/stub/8__closure.zep.h b/ext/stub/8__closure.zep.h index a6584a11da..759675c67e 100644 --- a/ext/stub/8__closure.zep.h +++ b/ext/stub/8__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_8__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_8__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_8__closure, __invoke, arginfo_stub_8__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_8__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_8__closure, __invoke, arginfo_stub_8__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/9__closure.zep.c b/ext/stub/9__closure.zep.c index 261fad039d..9fa1df6933 100644 --- a/ext/stub/9__closure.zep.c +++ b/ext/stub/9__closure.zep.c @@ -27,12 +27,9 @@ ZEPHIR_INIT_CLASS(stub_9__closure) PHP_METHOD(stub_9__closure, __invoke) { zval abc, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&abc); ZVAL_UNDEF(&_0); - - zephir_read_static_property_ce(&abc, stub_9__closure_ce, SL("abc"), PH_NOISY_CC); zephir_array_fetch_string(&_0, &abc, SL("a"), PH_NOISY | PH_READONLY, "stub/closures.zep", 66); diff --git a/ext/stub/9__closure.zep.h b/ext/stub/9__closure.zep.h index 32f88976fc..7542dd891f 100644 --- a/ext/stub/9__closure.zep.h +++ b/ext/stub/9__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_9__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_9__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_9__closure, __invoke, arginfo_stub_9__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_9__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_9__closure, __invoke, arginfo_stub_9__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/arithmetic.zep.c b/ext/stub/arithmetic.zep.c index 1f33c47d31..c9567197d2 100644 --- a/ext/stub/arithmetic.zep.c +++ b/ext/stub/arithmetic.zep.c @@ -34,11 +34,6 @@ ZEPHIR_INIT_CLASS(Stub_Arithmetic) PHP_METHOD(Stub_Arithmetic, intSum) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a + b); @@ -48,11 +43,6 @@ PHP_METHOD(Stub_Arithmetic, intSum) PHP_METHOD(Stub_Arithmetic, int2Sum) { zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (a + 2); RETURN_LONG(c); @@ -61,11 +51,6 @@ PHP_METHOD(Stub_Arithmetic, int2Sum) PHP_METHOD(Stub_Arithmetic, intSumSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 3; RETURN_LONG(c); } @@ -73,11 +58,6 @@ PHP_METHOD(Stub_Arithmetic, intSumSimple) PHP_METHOD(Stub_Arithmetic, boolSum) { zend_bool a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = ((2) ? 1 : 0); c = (a | b); @@ -87,11 +67,6 @@ PHP_METHOD(Stub_Arithmetic, boolSum) PHP_METHOD(Stub_Arithmetic, bool2Sum) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); c = (a + 2); RETURN_BOOL(c); @@ -100,11 +75,6 @@ PHP_METHOD(Stub_Arithmetic, bool2Sum) PHP_METHOD(Stub_Arithmetic, bool3Sum) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (a | 0); RETURN_BOOL(c); @@ -113,11 +83,6 @@ PHP_METHOD(Stub_Arithmetic, bool3Sum) PHP_METHOD(Stub_Arithmetic, boolSumSimple) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = ((3) ? 1 : 0); RETURN_BOOL(c); } @@ -128,13 +93,11 @@ PHP_METHOD(Stub_Arithmetic, boolSumExpression) zend_bool a = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 1; ZVAL_LONG(&_0, 0); @@ -146,39 +109,24 @@ PHP_METHOD(Stub_Arithmetic, boolSumExpression) PHP_METHOD(Stub_Arithmetic, doubleSum) { double a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = (double) (2); - c = (a + b); + c = ((a + b)); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, double2Sum) { double a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - - a = 1.0; - b = 2.0; - c = (a + b); + a = (1.0); + b = (2.0); + c = ((a + b)); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, doubleSumSimple) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (3); RETURN_DOUBLE(c); } @@ -186,12 +134,7 @@ PHP_METHOD(Stub_Arithmetic, doubleSumSimple) PHP_METHOD(Stub_Arithmetic, doubleSum2Simple) { double c = 0; - zval *this_ptr = getThis(); - - - - - c = 3; + c = (3); RETURN_DOUBLE(c); } @@ -200,13 +143,11 @@ PHP_METHOD(Stub_Arithmetic, doubleSumExpression) zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 0); ZEPHIR_CALL_FUNCTION(&_1, "exp", NULL, 2, &_0); @@ -220,15 +161,13 @@ PHP_METHOD(Stub_Arithmetic, doubleSumVarExpression) double a = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - a = 1.0; + a = (1.0); ZVAL_LONG(&_0, 0); ZEPHIR_CALL_FUNCTION(&_1, "exp", NULL, 2, &_0); zephir_check_call_status(); @@ -238,11 +177,6 @@ PHP_METHOD(Stub_Arithmetic, doubleSumVarExpression) PHP_METHOD(Stub_Arithmetic, varSum) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a + b); @@ -252,11 +186,6 @@ PHP_METHOD(Stub_Arithmetic, varSum) PHP_METHOD(Stub_Arithmetic, varSumSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 3; RETURN_LONG(c); } @@ -265,11 +194,6 @@ PHP_METHOD(Stub_Arithmetic, intDoubleSum) { double a = 0; zend_long b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = 2; c = (long) ((a + (double) b)); @@ -279,11 +203,6 @@ PHP_METHOD(Stub_Arithmetic, intDoubleSum) PHP_METHOD(Stub_Arithmetic, intDoubleSumSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = (long) (3); RETURN_LONG(c); } @@ -292,37 +211,22 @@ PHP_METHOD(Stub_Arithmetic, doubleIntSum) { double a = 0, c = 0; zend_long b = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = 2; - c = (a + (double) b); + c = ((a + (double) b)); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, doubleIntSumSimple) { double c = 0; - zval *this_ptr = getThis(); - - - - - c = 3; + c = (3); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, varIntSum) { zend_long b = 0, c = 0, a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a + b); @@ -332,11 +236,6 @@ PHP_METHOD(Stub_Arithmetic, varIntSum) PHP_METHOD(Stub_Arithmetic, intVarSum) { zend_long b = 0, c = 0, a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (b + a); @@ -348,14 +247,12 @@ PHP_METHOD(Stub_Arithmetic, intVarImplicitCastSum) zend_long c = 0; zval a, b, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "1"); @@ -372,12 +269,10 @@ PHP_METHOD(Stub_Arithmetic, intVarImplicitCast2Sum) zend_long b = 0, c = 0; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "1"); @@ -389,23 +284,13 @@ PHP_METHOD(Stub_Arithmetic, intVarImplicitCast2Sum) PHP_METHOD(Stub_Arithmetic, complexSum) { double c = 0; - zval *this_ptr = getThis(); - - - - - c = 3; + c = (3); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, complex2Sum) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (1 | 1); RETURN_BOOL(c); } @@ -413,11 +298,6 @@ PHP_METHOD(Stub_Arithmetic, complex2Sum) PHP_METHOD(Stub_Arithmetic, complex3Sum) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 + 1.0)) ? 1 : 0); RETURN_BOOL(c); } @@ -426,12 +306,10 @@ PHP_METHOD(Stub_Arithmetic, complex4Sum) { zval c; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&c); ZVAL_DOUBLE(&c, (1.0 + 1)); @@ -441,11 +319,6 @@ PHP_METHOD(Stub_Arithmetic, complex4Sum) PHP_METHOD(Stub_Arithmetic, complex5Sum) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = (1 + 1); RETURN_LONG(c); } @@ -453,11 +326,6 @@ PHP_METHOD(Stub_Arithmetic, complex5Sum) PHP_METHOD(Stub_Arithmetic, complex6Sum) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 + 1)) ? 1 : 0); RETURN_BOOL(c); } @@ -466,11 +334,6 @@ PHP_METHOD(Stub_Arithmetic, complex7Sum) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = 2; c = (a + b); @@ -481,11 +344,6 @@ PHP_METHOD(Stub_Arithmetic, complex9Sum) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = 2; c = (b + a); @@ -497,11 +355,6 @@ PHP_METHOD(Stub_Arithmetic, complex10Sum) double c = 0; zend_long b = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1.0 != 0.0) ? 1 : 0); b = 2; c = (double) ((b + a)); @@ -513,11 +366,6 @@ PHP_METHOD(Stub_Arithmetic, complex11Sum) double c = 0; zend_long b = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = (long) (2.0); c = (double) ((b + a)); @@ -528,11 +376,6 @@ PHP_METHOD(Stub_Arithmetic, complex12Sum) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = (long) (2.0); c = (b + a); @@ -543,11 +386,6 @@ PHP_METHOD(Stub_Arithmetic, complex13Sum) { zend_long c = 0; zend_bool a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = ((2.0 != 0.0) ? 1 : 0); c = (b | a); @@ -558,11 +396,6 @@ PHP_METHOD(Stub_Arithmetic, complex14Sum) { zend_bool b = 0; zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); c = (b + a); @@ -574,13 +407,8 @@ PHP_METHOD(Stub_Arithmetic, complex15Sum) zend_bool c = 0; double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; - b = 2.0; + b = (2.0); c = (((b + (double) a) != 0.0) ? 1 : 0); RETURN_BOOL(c); } @@ -589,14 +417,9 @@ PHP_METHOD(Stub_Arithmetic, complex16Sum) { double b = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; - b = 2.0; - c = (b + (double) a); + b = (2.0); + c = ((b + (double) a)); RETURN_DOUBLE(c); } @@ -605,11 +428,6 @@ PHP_METHOD(Stub_Arithmetic, complex17Sum) double c = 0; zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); c = (double) ((a + b)); @@ -621,15 +439,10 @@ PHP_METHOD(Stub_Arithmetic, complex18Sum) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a + b)); - c = (double) ((a + b) + d); + c = ((double) ((a + b) + d)); RETURN_DOUBLE(c); } @@ -638,15 +451,10 @@ PHP_METHOD(Stub_Arithmetic, complex19Sum) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a + b)); - c = (((double) a + d) + b); + c = ((((double) a + d) + b)); RETURN_DOUBLE(c); } @@ -655,15 +463,10 @@ PHP_METHOD(Stub_Arithmetic, complex20Sum) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a + b)); - c = (double) ((double) ((d + d) + d) + d); + c = ((double) ((double) ((d + d) + d) + d)); RETURN_DOUBLE(c); } @@ -672,15 +475,10 @@ PHP_METHOD(Stub_Arithmetic, complex21Sum) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a + b)); - c = ((double) (((double) ((double) (((b + d) + b) + d) + d) + b) + d) + b); + c = (((double) (((double) ((double) (((b + d) + b) + d) + d) + b) + d) + b)); RETURN_DOUBLE(c); } @@ -688,15 +486,10 @@ PHP_METHOD(Stub_Arithmetic, complex22Sum) { double d = 0, c = 0; zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = (long) (2.0); d = (double) ((a + b)); - c = ((double) (((double) ((double) ((double) (((double) b + d) + d) + d) + d) + b) + d) + b); + c = (((double) (((double) ((double) ((double) (((double) b + d) + d) + d) + d) + b) + d) + b)); RETURN_DOUBLE(c); } @@ -705,11 +498,6 @@ PHP_METHOD(Stub_Arithmetic, complex23Sum) double d = 0; zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a + b)); @@ -721,11 +509,6 @@ PHP_METHOD(Stub_Arithmetic, complex24Sum) zend_bool b = 0; double d = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((((1 + a) + 0) + b)); @@ -735,11 +518,6 @@ PHP_METHOD(Stub_Arithmetic, complex24Sum) PHP_METHOD(Stub_Arithmetic, addSum1) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a += 10; RETURN_LONG(a); @@ -748,11 +526,6 @@ PHP_METHOD(Stub_Arithmetic, addSum1) PHP_METHOD(Stub_Arithmetic, addSum2) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a += 0; RETURN_LONG(a); @@ -761,11 +534,6 @@ PHP_METHOD(Stub_Arithmetic, addSum2) PHP_METHOD(Stub_Arithmetic, addSum2b) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 5; a += 0; RETURN_LONG(a); @@ -774,11 +542,6 @@ PHP_METHOD(Stub_Arithmetic, addSum2b) PHP_METHOD(Stub_Arithmetic, addSum3) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a += 1; RETURN_LONG(a); @@ -787,11 +550,6 @@ PHP_METHOD(Stub_Arithmetic, addSum3) PHP_METHOD(Stub_Arithmetic, addSum4) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a += 0; RETURN_LONG(a); @@ -800,11 +558,6 @@ PHP_METHOD(Stub_Arithmetic, addSum4) PHP_METHOD(Stub_Arithmetic, addSum5) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a += (long) (1.0); RETURN_LONG(a); @@ -813,11 +566,6 @@ PHP_METHOD(Stub_Arithmetic, addSum5) PHP_METHOD(Stub_Arithmetic, addSum6) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a += (long) (1.0); RETURN_LONG(a); @@ -826,12 +574,7 @@ PHP_METHOD(Stub_Arithmetic, addSum6) PHP_METHOD(Stub_Arithmetic, addSum7) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); a += (double) (10); RETURN_DOUBLE(a); } @@ -839,12 +582,7 @@ PHP_METHOD(Stub_Arithmetic, addSum7) PHP_METHOD(Stub_Arithmetic, addSum8) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); a += 0.0; RETURN_DOUBLE(a); } @@ -852,12 +590,7 @@ PHP_METHOD(Stub_Arithmetic, addSum8) PHP_METHOD(Stub_Arithmetic, addSum8b) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 6.3; + a = (6.3); a += 0.0; RETURN_DOUBLE(a); } @@ -865,12 +598,7 @@ PHP_METHOD(Stub_Arithmetic, addSum8b) PHP_METHOD(Stub_Arithmetic, addSum9) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); a += 1; RETURN_DOUBLE(a); } @@ -878,12 +606,7 @@ PHP_METHOD(Stub_Arithmetic, addSum9) PHP_METHOD(Stub_Arithmetic, addSum10) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); a += 0; RETURN_DOUBLE(a); } @@ -891,24 +614,14 @@ PHP_METHOD(Stub_Arithmetic, addSum10) PHP_METHOD(Stub_Arithmetic, addSum11) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; - a += 1.0; + a = (0.0); + a += (1.0); RETURN_DOUBLE(a); } PHP_METHOD(Stub_Arithmetic, addSum12) { zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 0; b = 10; a += b; @@ -919,11 +632,6 @@ PHP_METHOD(Stub_Arithmetic, addSum13) { zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; b = 1; a += b; @@ -934,11 +642,6 @@ PHP_METHOD(Stub_Arithmetic, addSum14) { zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; b = 0; a += b; @@ -949,13 +652,8 @@ PHP_METHOD(Stub_Arithmetic, addSum15) { double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; - b = 1.0; + b = (1.0); a += (long) b; RETURN_LONG(a); } @@ -963,14 +661,9 @@ PHP_METHOD(Stub_Arithmetic, addSum15) PHP_METHOD(Stub_Arithmetic, addSum16) { double a = 0, b = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; - b = 10.0; - a += b; + a = (0.0); + b = (10.0); + a += b; RETURN_DOUBLE(a); } @@ -978,12 +671,7 @@ PHP_METHOD(Stub_Arithmetic, addSum17) { zend_bool b = 0; double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); b = 1; a += (double) b; RETURN_DOUBLE(a); @@ -993,12 +681,7 @@ PHP_METHOD(Stub_Arithmetic, addSum18) { zend_bool b = 0; double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); b = 0; a += (double) b; RETURN_DOUBLE(a); @@ -1008,12 +691,7 @@ PHP_METHOD(Stub_Arithmetic, addSum19) { zend_long b = 0; double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); b = 1; a += (double) b; RETURN_DOUBLE(a); @@ -1022,11 +700,6 @@ PHP_METHOD(Stub_Arithmetic, addSum19) PHP_METHOD(Stub_Arithmetic, addSum20) { zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = (long) (0.0); b = 1; a += b; @@ -1037,12 +710,7 @@ PHP_METHOD(Stub_Arithmetic, addSum21) { zend_long b = 0; double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); b = 1; a += (double) b; RETURN_DOUBLE(a); @@ -1053,12 +721,10 @@ PHP_METHOD(Stub_Arithmetic, addSum22) zend_long b = 0, _0; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_DOUBLE(&a, 0.0); @@ -1072,11 +738,6 @@ PHP_METHOD(Stub_Arithmetic, addSum22) PHP_METHOD(Stub_Arithmetic, addSum23) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; a += 1024; RETURN_LONG(a); @@ -1086,23 +747,16 @@ PHP_METHOD(Stub_Arithmetic, addSum24) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a); ZEPHIR_SEPARATE_PARAM(a); - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1024); ZEPHIR_ADD_ASSIGN(a, &_0); @@ -1113,11 +767,6 @@ PHP_METHOD(Stub_Arithmetic, addSum24) PHP_METHOD(Stub_Arithmetic, intSub) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a - b); @@ -1127,11 +776,6 @@ PHP_METHOD(Stub_Arithmetic, intSub) PHP_METHOD(Stub_Arithmetic, intLetSub) { zend_long b = 0, c = 0; - zval *this_ptr = getThis(); - - - - c = 1; b = 2; c -= b; @@ -1141,11 +785,6 @@ PHP_METHOD(Stub_Arithmetic, intLetSub) PHP_METHOD(Stub_Arithmetic, intSub2) { zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (a - 2); RETURN_LONG(c); @@ -1154,11 +793,6 @@ PHP_METHOD(Stub_Arithmetic, intSub2) PHP_METHOD(Stub_Arithmetic, intSubSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = -1; RETURN_LONG(c); } @@ -1166,11 +800,6 @@ PHP_METHOD(Stub_Arithmetic, intSubSimple) PHP_METHOD(Stub_Arithmetic, boolSub) { zend_bool a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = ((2) ? 1 : 0); c = (a & b); @@ -1180,11 +809,6 @@ PHP_METHOD(Stub_Arithmetic, boolSub) PHP_METHOD(Stub_Arithmetic, bool2Sub) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); c = (a - 2); RETURN_BOOL(c); @@ -1193,11 +817,6 @@ PHP_METHOD(Stub_Arithmetic, bool2Sub) PHP_METHOD(Stub_Arithmetic, bool3Sub) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (a & 0); RETURN_BOOL(c); @@ -1206,11 +825,6 @@ PHP_METHOD(Stub_Arithmetic, bool3Sub) PHP_METHOD(Stub_Arithmetic, bool4Sub) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (a & 1); RETURN_BOOL(c); @@ -1219,11 +833,6 @@ PHP_METHOD(Stub_Arithmetic, bool4Sub) PHP_METHOD(Stub_Arithmetic, boolSubSimple) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = ((-1) ? 1 : 0); RETURN_BOOL(c); } @@ -1231,39 +840,24 @@ PHP_METHOD(Stub_Arithmetic, boolSubSimple) PHP_METHOD(Stub_Arithmetic, doubleSub) { double a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = (double) (2); - c = (a - b); + c = ((a - b)); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, double2Sub) { double a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - - a = 1.0; - b = 2.0; - c = (a - b); + a = (1.0); + b = (2.0); + c = ((a - b)); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, doubleSubSimple) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (-1); RETURN_DOUBLE(c); } @@ -1271,23 +865,13 @@ PHP_METHOD(Stub_Arithmetic, doubleSubSimple) PHP_METHOD(Stub_Arithmetic, doubleSub2Simple) { double c = 0; - zval *this_ptr = getThis(); - - - - - c = -1; + c = (-1); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, varSub) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a - b); @@ -1297,11 +881,6 @@ PHP_METHOD(Stub_Arithmetic, varSub) PHP_METHOD(Stub_Arithmetic, varSubSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = -1; RETURN_LONG(c); } @@ -1310,11 +889,6 @@ PHP_METHOD(Stub_Arithmetic, intDoubleSub) { double a = 0; zend_long b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = 2; c = (long) ((a - (double) b)); @@ -1324,11 +898,6 @@ PHP_METHOD(Stub_Arithmetic, intDoubleSub) PHP_METHOD(Stub_Arithmetic, intDoubleSubSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = (long) (-1); RETURN_LONG(c); } @@ -1337,37 +906,22 @@ PHP_METHOD(Stub_Arithmetic, doubleIntSub) { double a = 0, c = 0; zend_long b = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = 2; - c = (a - (double) b); + c = ((a - (double) b)); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, doubleIntSubSimple) { double c = 0; - zval *this_ptr = getThis(); - - - - - c = -1; + c = (-1); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, varIntSub) { zend_long b = 0, c = 0, a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a - b); @@ -1377,11 +931,6 @@ PHP_METHOD(Stub_Arithmetic, varIntSub) PHP_METHOD(Stub_Arithmetic, intVarSub) { zend_long b = 0, c = 0, a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (b - a); @@ -1393,14 +942,12 @@ PHP_METHOD(Stub_Arithmetic, intVarImplicitCastSub) zend_long c = 0; zval a, b, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "1"); @@ -1417,12 +964,10 @@ PHP_METHOD(Stub_Arithmetic, intVarImplicitCast2Sub) zend_long b = 0, c = 0; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "1"); @@ -1434,23 +979,13 @@ PHP_METHOD(Stub_Arithmetic, intVarImplicitCast2Sub) PHP_METHOD(Stub_Arithmetic, complexSub) { double c = 0; - zval *this_ptr = getThis(); - - - - - c = 1; + c = (1); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, complex2Sub) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (1 & 1); RETURN_BOOL(c); } @@ -1458,11 +993,6 @@ PHP_METHOD(Stub_Arithmetic, complex2Sub) PHP_METHOD(Stub_Arithmetic, complex3Sub) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 + 1.0)) ? 1 : 0); RETURN_BOOL(c); } @@ -1471,12 +1001,10 @@ PHP_METHOD(Stub_Arithmetic, complex4Sub) { zval c; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&c); ZVAL_DOUBLE(&c, (1.0 - 1)); @@ -1486,11 +1014,6 @@ PHP_METHOD(Stub_Arithmetic, complex4Sub) PHP_METHOD(Stub_Arithmetic, complex5Sub) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = (1 - 1); RETURN_LONG(c); } @@ -1498,11 +1021,6 @@ PHP_METHOD(Stub_Arithmetic, complex5Sub) PHP_METHOD(Stub_Arithmetic, complex6Sub) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 + 1)) ? 1 : 0); RETURN_BOOL(c); } @@ -1511,11 +1029,6 @@ PHP_METHOD(Stub_Arithmetic, complex7Sub) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = 2; c = (a - b); @@ -1526,11 +1039,6 @@ PHP_METHOD(Stub_Arithmetic, complex9Sub) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = 2; c = (b - a); @@ -1542,11 +1050,6 @@ PHP_METHOD(Stub_Arithmetic, complex10Sub) double c = 0; zend_long b = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1.0 != 0.0) ? 1 : 0); b = 2; c = (double) ((b - a)); @@ -1558,11 +1061,6 @@ PHP_METHOD(Stub_Arithmetic, complex11Sub) double c = 0; zend_long b = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = (long) (2.0); c = (double) ((b - a)); @@ -1573,11 +1071,6 @@ PHP_METHOD(Stub_Arithmetic, complex12Sub) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = (long) (2.0); c = (b - a); @@ -1588,11 +1081,6 @@ PHP_METHOD(Stub_Arithmetic, complex13Sub) { zend_long c = 0; zend_bool a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = ((2.0 != 0.0) ? 1 : 0); c = (b & a); @@ -1603,11 +1091,6 @@ PHP_METHOD(Stub_Arithmetic, complex14Sub) { zend_bool b = 0; zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); c = (b - a); @@ -1619,13 +1102,8 @@ PHP_METHOD(Stub_Arithmetic, complex15Sub) zend_bool c = 0; double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; - b = 2.0; + b = (2.0); c = (((b - (double) a) != 0.0) ? 1 : 0); RETURN_BOOL(c); } @@ -1634,14 +1112,9 @@ PHP_METHOD(Stub_Arithmetic, complex16Sub) { double b = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; - b = 2.0; - c = (b - (double) a); + b = (2.0); + c = ((b - (double) a)); RETURN_DOUBLE(c); } @@ -1650,11 +1123,6 @@ PHP_METHOD(Stub_Arithmetic, complex17Sub) double c = 0; zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); c = (double) ((a - b)); @@ -1666,15 +1134,10 @@ PHP_METHOD(Stub_Arithmetic, complex18Sub) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a - b)); - c = (double) ((a - b) - d); + c = ((double) ((a - b) - d)); RETURN_DOUBLE(c); } @@ -1683,15 +1146,10 @@ PHP_METHOD(Stub_Arithmetic, complex19Sub) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a - b)); - c = (((double) a - d) - b); + c = ((((double) a - d) - b)); RETURN_DOUBLE(c); } @@ -1700,32 +1158,22 @@ PHP_METHOD(Stub_Arithmetic, complex20Sub) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a - b)); - c = (double) ((double) ((d - d) - d) - d); + c = ((double) ((double) ((d - d) - d) - d)); RETURN_DOUBLE(c); } PHP_METHOD(Stub_Arithmetic, complex21Sub) { - zend_bool b = 0; - double d = 0, c = 0; - zend_long a = 0; - zval *this_ptr = getThis(); - - - - + zend_bool b = 0; + double d = 0, c = 0; + zend_long a = 0; a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a - b)); - c = ((double) (((double) ((double) (((b - d) - b) - d) - d) - b) - d) - b); + c = (((double) (((double) ((double) (((b - d) - b) - d) - d) - b) - d) - b)); RETURN_DOUBLE(c); } @@ -1733,15 +1181,10 @@ PHP_METHOD(Stub_Arithmetic, complex22Sub) { double d = 0, c = 0; zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = (long) (2.0); d = (double) ((a - b)); - c = ((double) (((double) ((double) ((double) (((double) b - d) - d) - d) - d) - b) - d) - b); + c = (((double) (((double) ((double) ((double) (((double) b - d) - d) - d) - d) - b) - d) - b)); RETURN_DOUBLE(c); } @@ -1750,11 +1193,6 @@ PHP_METHOD(Stub_Arithmetic, complex23Sub) double d = 0; zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a - b)); @@ -1766,11 +1204,6 @@ PHP_METHOD(Stub_Arithmetic, complex24Sub) zend_bool b = 0; double d = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((((1 - a) - 0) - b)); @@ -1780,11 +1213,6 @@ PHP_METHOD(Stub_Arithmetic, complex24Sub) PHP_METHOD(Stub_Arithmetic, sub1) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a -= 10; RETURN_LONG(a); @@ -1793,11 +1221,6 @@ PHP_METHOD(Stub_Arithmetic, sub1) PHP_METHOD(Stub_Arithmetic, sub2) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a -= 0; RETURN_LONG(a); @@ -1806,11 +1229,6 @@ PHP_METHOD(Stub_Arithmetic, sub2) PHP_METHOD(Stub_Arithmetic, sub2b) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 5; a -= 0; RETURN_LONG(a); @@ -1819,11 +1237,6 @@ PHP_METHOD(Stub_Arithmetic, sub2b) PHP_METHOD(Stub_Arithmetic, sub3) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a -= 1; RETURN_LONG(a); @@ -1832,11 +1245,6 @@ PHP_METHOD(Stub_Arithmetic, sub3) PHP_METHOD(Stub_Arithmetic, sub4) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a -= 0; RETURN_LONG(a); @@ -1845,11 +1253,6 @@ PHP_METHOD(Stub_Arithmetic, sub4) PHP_METHOD(Stub_Arithmetic, sub5) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a -= (long) (1.0); RETURN_LONG(a); @@ -1858,11 +1261,6 @@ PHP_METHOD(Stub_Arithmetic, sub5) PHP_METHOD(Stub_Arithmetic, sub6) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; a -= (long) (1.0); RETURN_LONG(a); @@ -1871,12 +1269,7 @@ PHP_METHOD(Stub_Arithmetic, sub6) PHP_METHOD(Stub_Arithmetic, sub7) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); a -= (double) (10); RETURN_DOUBLE(a); } @@ -1884,12 +1277,7 @@ PHP_METHOD(Stub_Arithmetic, sub7) PHP_METHOD(Stub_Arithmetic, sub8) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); a -= 0.0; RETURN_DOUBLE(a); } @@ -1897,12 +1285,7 @@ PHP_METHOD(Stub_Arithmetic, sub8) PHP_METHOD(Stub_Arithmetic, sub8b) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 6.3; + a = (6.3); a -= 0.0; RETURN_DOUBLE(a); } @@ -1910,12 +1293,7 @@ PHP_METHOD(Stub_Arithmetic, sub8b) PHP_METHOD(Stub_Arithmetic, sub9) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); a -= 1; RETURN_DOUBLE(a); } @@ -1923,12 +1301,7 @@ PHP_METHOD(Stub_Arithmetic, sub9) PHP_METHOD(Stub_Arithmetic, sub10) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); a -= 0; RETURN_DOUBLE(a); } @@ -1936,24 +1309,14 @@ PHP_METHOD(Stub_Arithmetic, sub10) PHP_METHOD(Stub_Arithmetic, sub11) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; - a -= 1.0; + a = (0.0); + a -= (1.0); RETURN_DOUBLE(a); } PHP_METHOD(Stub_Arithmetic, sub12) { zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 0; b = 10; a -= b; @@ -1964,11 +1327,6 @@ PHP_METHOD(Stub_Arithmetic, sub13) { zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; b = 1; a -= b; @@ -1979,11 +1337,6 @@ PHP_METHOD(Stub_Arithmetic, sub14) { zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; b = 0; a -= b; @@ -1994,13 +1347,8 @@ PHP_METHOD(Stub_Arithmetic, sub15) { double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; - b = 1.0; + b = (1.0); a -= (long) b; RETURN_LONG(a); } @@ -2008,14 +1356,9 @@ PHP_METHOD(Stub_Arithmetic, sub15) PHP_METHOD(Stub_Arithmetic, sub16) { double a = 0, b = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; - b = 10.0; - a -= b; + a = (0.0); + b = (10.0); + a -= b; RETURN_DOUBLE(a); } @@ -2023,12 +1366,7 @@ PHP_METHOD(Stub_Arithmetic, sub17) { zend_bool b = 0; double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); b = 1; a -= (double) b; RETURN_DOUBLE(a); @@ -2038,12 +1376,7 @@ PHP_METHOD(Stub_Arithmetic, sub18) { zend_bool b = 0; double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); b = 0; a -= (double) b; RETURN_DOUBLE(a); @@ -2053,12 +1386,7 @@ PHP_METHOD(Stub_Arithmetic, sub19) { zend_long b = 0; double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); b = 1; a -= (double) b; RETURN_DOUBLE(a); @@ -2067,11 +1395,6 @@ PHP_METHOD(Stub_Arithmetic, sub19) PHP_METHOD(Stub_Arithmetic, sub20) { zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = (long) (0.0); b = 1; a -= b; @@ -2082,12 +1405,7 @@ PHP_METHOD(Stub_Arithmetic, sub21) { zend_long b = 0; double a = 0; - zval *this_ptr = getThis(); - - - - - a = 0.0; + a = (0.0); b = 1; a -= (double) b; RETURN_DOUBLE(a); @@ -2098,12 +1416,10 @@ PHP_METHOD(Stub_Arithmetic, sub22) zend_long b = 0, _0; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_DOUBLE(&a, 0.0); @@ -2117,11 +1433,6 @@ PHP_METHOD(Stub_Arithmetic, sub22) PHP_METHOD(Stub_Arithmetic, sub23) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; a -= 1024; RETURN_LONG(a); @@ -2131,23 +1442,16 @@ PHP_METHOD(Stub_Arithmetic, sub24) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a); ZEPHIR_SEPARATE_PARAM(a); - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1024); ZEPHIR_SUB_ASSIGN(a, &_0); @@ -2158,11 +1462,6 @@ PHP_METHOD(Stub_Arithmetic, sub24) PHP_METHOD(Stub_Arithmetic, mul1) { zend_long a; - zval *this_ptr = getThis(); - - - - a = 1; a *= 5; RETURN_LONG(a); @@ -2172,23 +1471,16 @@ PHP_METHOD(Stub_Arithmetic, mul2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a); ZEPHIR_SEPARATE_PARAM(a); - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 5); ZEPHIR_MUL_ASSIGN(a, &_0); @@ -2199,11 +1491,6 @@ PHP_METHOD(Stub_Arithmetic, mul2) PHP_METHOD(Stub_Arithmetic, mul3) { zend_long a; - zval *this_ptr = getThis(); - - - - a = 1; a *= 1024; RETURN_LONG(a); @@ -2212,11 +1499,6 @@ PHP_METHOD(Stub_Arithmetic, mul3) PHP_METHOD(Stub_Arithmetic, less1) { zend_long a, b; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; RETURN_BOOL(a < b); @@ -2225,11 +1507,6 @@ PHP_METHOD(Stub_Arithmetic, less1) PHP_METHOD(Stub_Arithmetic, less2) { zend_long a, b; - zval *this_ptr = getThis(); - - - - a = 2; b = 1; RETURN_BOOL(a < b); @@ -2238,51 +1515,30 @@ PHP_METHOD(Stub_Arithmetic, less2) PHP_METHOD(Stub_Arithmetic, less3) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(ZEPHIR_LT_LONG(a, 5)); } PHP_METHOD(Stub_Arithmetic, less4) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(ZEPHIR_LT_LONG(a, 5.0)); } PHP_METHOD(Stub_Arithmetic, greater1) { zend_long a, b; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; RETURN_BOOL(a > b); @@ -2291,11 +1547,6 @@ PHP_METHOD(Stub_Arithmetic, greater1) PHP_METHOD(Stub_Arithmetic, greater2) { zend_long a, b; - zval *this_ptr = getThis(); - - - - a = 2; b = 1; RETURN_BOOL(a > b); @@ -2304,51 +1555,30 @@ PHP_METHOD(Stub_Arithmetic, greater2) PHP_METHOD(Stub_Arithmetic, greater3) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(ZEPHIR_GT_LONG(a, 5)); } PHP_METHOD(Stub_Arithmetic, greater4) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(ZEPHIR_GT_LONG(a, 5.0)); } PHP_METHOD(Stub_Arithmetic, letStatementIntMinus) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = -1; RETURN_LONG(a); } @@ -2356,11 +1586,6 @@ PHP_METHOD(Stub_Arithmetic, letStatementIntMinus) PHP_METHOD(Stub_Arithmetic, declaredIntMinus) { zend_long a; - zval *this_ptr = getThis(); - - - - a = -1; RETURN_LONG(a); } @@ -2372,20 +1597,12 @@ PHP_METHOD(Stub_Arithmetic, letStatementBoolMinus) { zend_bool a = 0; zval *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &b); - - zephir_negate(b); a = zephir_is_true(b); RETURN_BOOL(a); @@ -2395,22 +1612,15 @@ PHP_METHOD(Stub_Arithmetic, letStatementVarMinus) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *b, b_sub, a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &b); - - zephir_negate(b); ZEPHIR_CPY_WRT(&a, b); RETURN_CCTOR(&a); @@ -2419,11 +1629,6 @@ PHP_METHOD(Stub_Arithmetic, letStatementVarMinus) PHP_METHOD(Stub_Arithmetic, div1) { zend_long a; - zval *this_ptr = getThis(); - - - - a = 100; RETURN_DOUBLE(zephir_safe_div_long_long(((a - 1)), 4)); } @@ -2434,9 +1639,6 @@ PHP_METHOD(Stub_Arithmetic, div2) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("tmp1"), PH_NOISY_CC | PH_READONLY); RETURN_DOUBLE(zephir_safe_div_long_long(((zephir_get_numberval(&_0) - 1)), 4)); } @@ -2448,24 +1650,16 @@ PHP_METHOD(Stub_Arithmetic, absParam) { zval *val_param = NULL; zend_ulong val; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val_param); if (UNEXPECTED(Z_TYPE_P(val_param) != IS_LONG)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'val' must be of the type uint")); RETURN_NULL(); } val = ZEND_ABS(Z_LVAL_P(val_param)); - - RETURN_LONG(val); } @@ -2473,20 +1667,11 @@ PHP_METHOD(Stub_Arithmetic, negativeInt) { zval *val_param = NULL; zend_long val; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val_param); - val = zephir_get_intval(val_param); - - RETURN_LONG(val); } @@ -2494,20 +1679,11 @@ PHP_METHOD(Stub_Arithmetic, negativeLong) { zval *val_param = NULL; long val; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val_param); - val = zephir_get_intval(val_param); - - RETURN_LONG(val); } diff --git a/ext/stub/arithmetic.zep.h b/ext/stub/arithmetic.zep.h index de9a0bf616..8ee0c806c1 100644 --- a/ext/stub/arithmetic.zep.h +++ b/ext/stub/arithmetic.zep.h @@ -677,780 +677,168 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arithmetic_negativelong, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arithmetic_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSum, arginfo_stub_arithmetic_intsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, int2Sum, arginfo_stub_arithmetic_int2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, int2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSumSimple, arginfo_stub_arithmetic_intsumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSum, arginfo_stub_arithmetic_boolsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool2Sum, arginfo_stub_arithmetic_bool2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool3Sum, arginfo_stub_arithmetic_bool3sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool3Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSumSimple, arginfo_stub_arithmetic_boolsumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSumExpression, arginfo_stub_arithmetic_boolsumexpression, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSumExpression, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSum, arginfo_stub_arithmetic_doublesum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, double2Sum, arginfo_stub_arithmetic_double2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, double2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSumSimple, arginfo_stub_arithmetic_doublesumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSum2Simple, arginfo_stub_arithmetic_doublesum2simple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSum2Simple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSumExpression, arginfo_stub_arithmetic_doublesumexpression, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSumExpression, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSumVarExpression, arginfo_stub_arithmetic_doublesumvarexpression, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSumVarExpression, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varSum, arginfo_stub_arithmetic_varsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varSumSimple, arginfo_stub_arithmetic_varsumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intDoubleSum, arginfo_stub_arithmetic_intdoublesum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intDoubleSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intDoubleSumSimple, arginfo_stub_arithmetic_intdoublesumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intDoubleSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleIntSum, arginfo_stub_arithmetic_doubleintsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleIntSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleIntSumSimple, arginfo_stub_arithmetic_doubleintsumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleIntSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varIntSum, arginfo_stub_arithmetic_varintsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varIntSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarSum, arginfo_stub_arithmetic_intvarsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarImplicitCastSum, arginfo_stub_arithmetic_intvarimplicitcastsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarImplicitCastSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sum, arginfo_stub_arithmetic_intvarimplicitcast2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complexSum, arginfo_stub_arithmetic_complexsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complexSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex2Sum, arginfo_stub_arithmetic_complex2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex3Sum, arginfo_stub_arithmetic_complex3sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex3Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex4Sum, arginfo_stub_arithmetic_complex4sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex4Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex5Sum, arginfo_stub_arithmetic_complex5sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex5Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex6Sum, arginfo_stub_arithmetic_complex6sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex6Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex7Sum, arginfo_stub_arithmetic_complex7sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex7Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex9Sum, arginfo_stub_arithmetic_complex9sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex9Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex10Sum, arginfo_stub_arithmetic_complex10sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex10Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex11Sum, arginfo_stub_arithmetic_complex11sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex11Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex12Sum, arginfo_stub_arithmetic_complex12sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex12Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex13Sum, arginfo_stub_arithmetic_complex13sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex13Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex14Sum, arginfo_stub_arithmetic_complex14sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex14Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex15Sum, arginfo_stub_arithmetic_complex15sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex15Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex16Sum, arginfo_stub_arithmetic_complex16sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex16Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex17Sum, arginfo_stub_arithmetic_complex17sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex17Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex18Sum, arginfo_stub_arithmetic_complex18sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex18Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex19Sum, arginfo_stub_arithmetic_complex19sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex19Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex20Sum, arginfo_stub_arithmetic_complex20sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex20Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex21Sum, arginfo_stub_arithmetic_complex21sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex21Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex22Sum, arginfo_stub_arithmetic_complex22sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex22Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex23Sum, arginfo_stub_arithmetic_complex23sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex23Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex24Sum, arginfo_stub_arithmetic_complex24sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex24Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum1, arginfo_stub_arithmetic_addsum1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum2, arginfo_stub_arithmetic_addsum2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum2b, arginfo_stub_arithmetic_addsum2b, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum2b, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum3, arginfo_stub_arithmetic_addsum3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum4, arginfo_stub_arithmetic_addsum4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum5, arginfo_stub_arithmetic_addsum5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum6, arginfo_stub_arithmetic_addsum6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum7, arginfo_stub_arithmetic_addsum7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum8, arginfo_stub_arithmetic_addsum8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum8b, arginfo_stub_arithmetic_addsum8b, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum8b, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum9, arginfo_stub_arithmetic_addsum9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum10, arginfo_stub_arithmetic_addsum10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum11, arginfo_stub_arithmetic_addsum11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum12, arginfo_stub_arithmetic_addsum12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum13, arginfo_stub_arithmetic_addsum13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum14, arginfo_stub_arithmetic_addsum14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum15, arginfo_stub_arithmetic_addsum15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum15, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum16, arginfo_stub_arithmetic_addsum16, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum16, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum17, arginfo_stub_arithmetic_addsum17, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum17, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum18, arginfo_stub_arithmetic_addsum18, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum18, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum19, arginfo_stub_arithmetic_addsum19, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum19, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum20, arginfo_stub_arithmetic_addsum20, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum20, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum21, arginfo_stub_arithmetic_addsum21, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum21, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum22, arginfo_stub_arithmetic_addsum22, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum22, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum23, arginfo_stub_arithmetic_addsum23, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum23, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, intSum, arginfo_stub_arithmetic_intsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, int2Sum, arginfo_stub_arithmetic_int2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intSumSimple, arginfo_stub_arithmetic_intsumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSum, arginfo_stub_arithmetic_boolsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool2Sum, arginfo_stub_arithmetic_bool2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool3Sum, arginfo_stub_arithmetic_bool3sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSumSimple, arginfo_stub_arithmetic_boolsumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSumExpression, arginfo_stub_arithmetic_boolsumexpression, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSum, arginfo_stub_arithmetic_doublesum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, double2Sum, arginfo_stub_arithmetic_double2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSumSimple, arginfo_stub_arithmetic_doublesumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSum2Simple, arginfo_stub_arithmetic_doublesum2simple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSumExpression, arginfo_stub_arithmetic_doublesumexpression, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSumVarExpression, arginfo_stub_arithmetic_doublesumvarexpression, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varSum, arginfo_stub_arithmetic_varsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varSumSimple, arginfo_stub_arithmetic_varsumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intDoubleSum, arginfo_stub_arithmetic_intdoublesum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intDoubleSumSimple, arginfo_stub_arithmetic_intdoublesumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleIntSum, arginfo_stub_arithmetic_doubleintsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleIntSumSimple, arginfo_stub_arithmetic_doubleintsumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varIntSum, arginfo_stub_arithmetic_varintsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarSum, arginfo_stub_arithmetic_intvarsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarImplicitCastSum, arginfo_stub_arithmetic_intvarimplicitcastsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sum, arginfo_stub_arithmetic_intvarimplicitcast2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complexSum, arginfo_stub_arithmetic_complexsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex2Sum, arginfo_stub_arithmetic_complex2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex3Sum, arginfo_stub_arithmetic_complex3sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex4Sum, arginfo_stub_arithmetic_complex4sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex5Sum, arginfo_stub_arithmetic_complex5sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex6Sum, arginfo_stub_arithmetic_complex6sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex7Sum, arginfo_stub_arithmetic_complex7sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex9Sum, arginfo_stub_arithmetic_complex9sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex10Sum, arginfo_stub_arithmetic_complex10sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex11Sum, arginfo_stub_arithmetic_complex11sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex12Sum, arginfo_stub_arithmetic_complex12sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex13Sum, arginfo_stub_arithmetic_complex13sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex14Sum, arginfo_stub_arithmetic_complex14sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex15Sum, arginfo_stub_arithmetic_complex15sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex16Sum, arginfo_stub_arithmetic_complex16sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex17Sum, arginfo_stub_arithmetic_complex17sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex18Sum, arginfo_stub_arithmetic_complex18sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex19Sum, arginfo_stub_arithmetic_complex19sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex20Sum, arginfo_stub_arithmetic_complex20sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex21Sum, arginfo_stub_arithmetic_complex21sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex22Sum, arginfo_stub_arithmetic_complex22sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex23Sum, arginfo_stub_arithmetic_complex23sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex24Sum, arginfo_stub_arithmetic_complex24sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum1, arginfo_stub_arithmetic_addsum1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum2, arginfo_stub_arithmetic_addsum2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum2b, arginfo_stub_arithmetic_addsum2b, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum3, arginfo_stub_arithmetic_addsum3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum4, arginfo_stub_arithmetic_addsum4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum5, arginfo_stub_arithmetic_addsum5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum6, arginfo_stub_arithmetic_addsum6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum7, arginfo_stub_arithmetic_addsum7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum8, arginfo_stub_arithmetic_addsum8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum8b, arginfo_stub_arithmetic_addsum8b, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum9, arginfo_stub_arithmetic_addsum9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum10, arginfo_stub_arithmetic_addsum10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum11, arginfo_stub_arithmetic_addsum11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum12, arginfo_stub_arithmetic_addsum12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum13, arginfo_stub_arithmetic_addsum13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum14, arginfo_stub_arithmetic_addsum14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum15, arginfo_stub_arithmetic_addsum15, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum16, arginfo_stub_arithmetic_addsum16, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum17, arginfo_stub_arithmetic_addsum17, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum18, arginfo_stub_arithmetic_addsum18, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum19, arginfo_stub_arithmetic_addsum19, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum20, arginfo_stub_arithmetic_addsum20, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum21, arginfo_stub_arithmetic_addsum21, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum22, arginfo_stub_arithmetic_addsum22, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum23, arginfo_stub_arithmetic_addsum23, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, addSum24, arginfo_stub_arithmetic_addsum24, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSub, arginfo_stub_arithmetic_intsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intLetSub, arginfo_stub_arithmetic_intletsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intLetSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSub2, arginfo_stub_arithmetic_intsub2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSub2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSubSimple, arginfo_stub_arithmetic_intsubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSub, arginfo_stub_arithmetic_boolsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool2Sub, arginfo_stub_arithmetic_bool2sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool2Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool3Sub, arginfo_stub_arithmetic_bool3sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool3Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool4Sub, arginfo_stub_arithmetic_bool4sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool4Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSubSimple, arginfo_stub_arithmetic_boolsubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSub, arginfo_stub_arithmetic_doublesub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, double2Sub, arginfo_stub_arithmetic_double2sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, double2Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSubSimple, arginfo_stub_arithmetic_doublesubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSub2Simple, arginfo_stub_arithmetic_doublesub2simple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSub2Simple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varSub, arginfo_stub_arithmetic_varsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varSubSimple, arginfo_stub_arithmetic_varsubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intDoubleSub, arginfo_stub_arithmetic_intdoublesub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intDoubleSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intDoubleSubSimple, arginfo_stub_arithmetic_intdoublesubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intDoubleSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleIntSub, arginfo_stub_arithmetic_doubleintsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleIntSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleIntSubSimple, arginfo_stub_arithmetic_doubleintsubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleIntSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varIntSub, arginfo_stub_arithmetic_varintsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varIntSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarSub, arginfo_stub_arithmetic_intvarsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarImplicitCastSub, arginfo_stub_arithmetic_intvarimplicitcastsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarImplicitCastSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sub, arginfo_stub_arithmetic_intvarimplicitcast2sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complexSub, arginfo_stub_arithmetic_complexsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complexSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex2Sub, arginfo_stub_arithmetic_complex2sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex2Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex3Sub, arginfo_stub_arithmetic_complex3sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex3Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex4Sub, arginfo_stub_arithmetic_complex4sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex4Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex5Sub, arginfo_stub_arithmetic_complex5sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex5Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex6Sub, arginfo_stub_arithmetic_complex6sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex6Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex7Sub, arginfo_stub_arithmetic_complex7sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex7Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex9Sub, arginfo_stub_arithmetic_complex9sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex9Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex10Sub, arginfo_stub_arithmetic_complex10sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex10Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex11Sub, arginfo_stub_arithmetic_complex11sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex11Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex12Sub, arginfo_stub_arithmetic_complex12sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex12Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex13Sub, arginfo_stub_arithmetic_complex13sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex13Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex14Sub, arginfo_stub_arithmetic_complex14sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex14Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex15Sub, arginfo_stub_arithmetic_complex15sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex15Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex16Sub, arginfo_stub_arithmetic_complex16sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex16Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex17Sub, arginfo_stub_arithmetic_complex17sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex17Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex18Sub, arginfo_stub_arithmetic_complex18sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex18Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex19Sub, arginfo_stub_arithmetic_complex19sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex19Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex20Sub, arginfo_stub_arithmetic_complex20sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex20Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex21Sub, arginfo_stub_arithmetic_complex21sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex21Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex22Sub, arginfo_stub_arithmetic_complex22sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex22Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex23Sub, arginfo_stub_arithmetic_complex23sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex23Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex24Sub, arginfo_stub_arithmetic_complex24sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex24Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub1, arginfo_stub_arithmetic_sub1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub2, arginfo_stub_arithmetic_sub2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub2b, arginfo_stub_arithmetic_sub2b, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub2b, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub3, arginfo_stub_arithmetic_sub3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub4, arginfo_stub_arithmetic_sub4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub5, arginfo_stub_arithmetic_sub5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub6, arginfo_stub_arithmetic_sub6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub7, arginfo_stub_arithmetic_sub7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub8, arginfo_stub_arithmetic_sub8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub8b, arginfo_stub_arithmetic_sub8b, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub8b, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub9, arginfo_stub_arithmetic_sub9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub10, arginfo_stub_arithmetic_sub10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub11, arginfo_stub_arithmetic_sub11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub12, arginfo_stub_arithmetic_sub12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub13, arginfo_stub_arithmetic_sub13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub14, arginfo_stub_arithmetic_sub14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub15, arginfo_stub_arithmetic_sub15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub15, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub16, arginfo_stub_arithmetic_sub16, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub16, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub17, arginfo_stub_arithmetic_sub17, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub17, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub18, arginfo_stub_arithmetic_sub18, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub18, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub19, arginfo_stub_arithmetic_sub19, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub19, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub20, arginfo_stub_arithmetic_sub20, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub20, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub21, arginfo_stub_arithmetic_sub21, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub21, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub22, arginfo_stub_arithmetic_sub22, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub22, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub23, arginfo_stub_arithmetic_sub23, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub23, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, intSub, arginfo_stub_arithmetic_intsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intLetSub, arginfo_stub_arithmetic_intletsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intSub2, arginfo_stub_arithmetic_intsub2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intSubSimple, arginfo_stub_arithmetic_intsubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSub, arginfo_stub_arithmetic_boolsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool2Sub, arginfo_stub_arithmetic_bool2sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool3Sub, arginfo_stub_arithmetic_bool3sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool4Sub, arginfo_stub_arithmetic_bool4sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSubSimple, arginfo_stub_arithmetic_boolsubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSub, arginfo_stub_arithmetic_doublesub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, double2Sub, arginfo_stub_arithmetic_double2sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSubSimple, arginfo_stub_arithmetic_doublesubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSub2Simple, arginfo_stub_arithmetic_doublesub2simple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varSub, arginfo_stub_arithmetic_varsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varSubSimple, arginfo_stub_arithmetic_varsubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intDoubleSub, arginfo_stub_arithmetic_intdoublesub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intDoubleSubSimple, arginfo_stub_arithmetic_intdoublesubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleIntSub, arginfo_stub_arithmetic_doubleintsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleIntSubSimple, arginfo_stub_arithmetic_doubleintsubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varIntSub, arginfo_stub_arithmetic_varintsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarSub, arginfo_stub_arithmetic_intvarsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarImplicitCastSub, arginfo_stub_arithmetic_intvarimplicitcastsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sub, arginfo_stub_arithmetic_intvarimplicitcast2sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complexSub, arginfo_stub_arithmetic_complexsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex2Sub, arginfo_stub_arithmetic_complex2sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex3Sub, arginfo_stub_arithmetic_complex3sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex4Sub, arginfo_stub_arithmetic_complex4sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex5Sub, arginfo_stub_arithmetic_complex5sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex6Sub, arginfo_stub_arithmetic_complex6sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex7Sub, arginfo_stub_arithmetic_complex7sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex9Sub, arginfo_stub_arithmetic_complex9sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex10Sub, arginfo_stub_arithmetic_complex10sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex11Sub, arginfo_stub_arithmetic_complex11sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex12Sub, arginfo_stub_arithmetic_complex12sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex13Sub, arginfo_stub_arithmetic_complex13sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex14Sub, arginfo_stub_arithmetic_complex14sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex15Sub, arginfo_stub_arithmetic_complex15sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex16Sub, arginfo_stub_arithmetic_complex16sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex17Sub, arginfo_stub_arithmetic_complex17sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex18Sub, arginfo_stub_arithmetic_complex18sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex19Sub, arginfo_stub_arithmetic_complex19sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex20Sub, arginfo_stub_arithmetic_complex20sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex21Sub, arginfo_stub_arithmetic_complex21sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex22Sub, arginfo_stub_arithmetic_complex22sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex23Sub, arginfo_stub_arithmetic_complex23sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex24Sub, arginfo_stub_arithmetic_complex24sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub1, arginfo_stub_arithmetic_sub1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub2, arginfo_stub_arithmetic_sub2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub2b, arginfo_stub_arithmetic_sub2b, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub3, arginfo_stub_arithmetic_sub3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub4, arginfo_stub_arithmetic_sub4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub5, arginfo_stub_arithmetic_sub5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub6, arginfo_stub_arithmetic_sub6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub7, arginfo_stub_arithmetic_sub7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub8, arginfo_stub_arithmetic_sub8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub8b, arginfo_stub_arithmetic_sub8b, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub9, arginfo_stub_arithmetic_sub9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub10, arginfo_stub_arithmetic_sub10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub11, arginfo_stub_arithmetic_sub11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub12, arginfo_stub_arithmetic_sub12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub13, arginfo_stub_arithmetic_sub13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub14, arginfo_stub_arithmetic_sub14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub15, arginfo_stub_arithmetic_sub15, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub16, arginfo_stub_arithmetic_sub16, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub17, arginfo_stub_arithmetic_sub17, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub18, arginfo_stub_arithmetic_sub18, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub19, arginfo_stub_arithmetic_sub19, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub20, arginfo_stub_arithmetic_sub20, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub21, arginfo_stub_arithmetic_sub21, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub22, arginfo_stub_arithmetic_sub22, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub23, arginfo_stub_arithmetic_sub23, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, sub24, arginfo_stub_arithmetic_sub24, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, mul1, arginfo_stub_arithmetic_mul1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, mul1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, mul1, arginfo_stub_arithmetic_mul1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, mul2, arginfo_stub_arithmetic_mul2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, mul3, arginfo_stub_arithmetic_mul3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, mul3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, less1, arginfo_stub_arithmetic_less1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, less1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, less2, arginfo_stub_arithmetic_less2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, less2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, mul3, arginfo_stub_arithmetic_mul3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, less1, arginfo_stub_arithmetic_less1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, less2, arginfo_stub_arithmetic_less2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, less3, arginfo_stub_arithmetic_less3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, less4, arginfo_stub_arithmetic_less4, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, greater1, arginfo_stub_arithmetic_greater1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, greater1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, greater2, arginfo_stub_arithmetic_greater2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, greater2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, greater1, arginfo_stub_arithmetic_greater1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, greater2, arginfo_stub_arithmetic_greater2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, greater3, arginfo_stub_arithmetic_greater3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, greater4, arginfo_stub_arithmetic_greater4, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, letStatementIntMinus, arginfo_stub_arithmetic_letstatementintminus, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, letStatementIntMinus, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, declaredIntMinus, arginfo_stub_arithmetic_declaredintminus, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, declaredIntMinus, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, letStatementIntMinus, arginfo_stub_arithmetic_letstatementintminus, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, declaredIntMinus, arginfo_stub_arithmetic_declaredintminus, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, letStatementBoolMinus, arginfo_stub_arithmetic_letstatementboolminus, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, letStatementVarMinus, arginfo_stub_arithmetic_letstatementvarminus, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, div1, arginfo_stub_arithmetic_div1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, div1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, div2, arginfo_stub_arithmetic_div2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, div2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, div1, arginfo_stub_arithmetic_div1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, div2, arginfo_stub_arithmetic_div2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, absParam, arginfo_stub_arithmetic_absparam, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, negativeInt, arginfo_stub_arithmetic_negativeint, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, negativeLong, arginfo_stub_arithmetic_negativelong, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayaccessarr.zep.c b/ext/stub/arrayaccessarr.zep.c index e498d4e969..319624f5fd 100644 --- a/ext/stub/arrayaccessarr.zep.c +++ b/ext/stub/arrayaccessarr.zep.c @@ -33,9 +33,8 @@ PHP_METHOD(Stub_ArrayAccessArr, __construct) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 3, 0); @@ -54,18 +53,11 @@ PHP_METHOD(Stub_ArrayAccessArr, offsetSet) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(offset) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &offset, &value); - - if (Z_TYPE_P(offset) == IS_NULL) { zephir_update_property_array_append(this_ptr, SL("test"), value); } else { @@ -81,17 +73,10 @@ PHP_METHOD(Stub_ArrayAccessArr, offsetExists) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &offset); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); RETURN_BOOL(zephir_array_isset(&_0, offset)); } @@ -104,17 +89,10 @@ PHP_METHOD(Stub_ArrayAccessArr, offsetUnset) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &offset); - - zephir_unset_property_array(this_ptr, ZEND_STRL("test"), offset); zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); zephir_array_unset(&_0, offset, PH_SEPARATE); @@ -131,24 +109,20 @@ PHP_METHOD(Stub_ArrayAccessArr, offsetGet) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &offset); - - ZEPHIR_INIT_VAR(&_0); zephir_read_property(&_1, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); if (zephir_array_isset(&_1, offset)) { zephir_read_property(&_2, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_NVAR(&_0); zephir_array_fetch(&_0, &_2, offset, PH_NOISY, "stub/arrayaccessarr.zep", 37); } else { + ZEPHIR_INIT_NVAR(&_0); ZVAL_NULL(&_0); } RETURN_CCTOR(&_0); diff --git a/ext/stub/arrayaccessarr.zep.h b/ext/stub/arrayaccessarr.zep.h index a57fea4256..aa15473bba 100644 --- a/ext/stub/arrayaccessarr.zep.h +++ b/ext/stub/arrayaccessarr.zep.h @@ -27,20 +27,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetunset, ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetget, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessarr_offsetget, 0, 0, 1) -#endif ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayaccessarr_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayAccessArr, __construct, arginfo_stub_arrayaccessarr___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_ArrayAccessArr, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_ArrayAccessArr, __construct, arginfo_stub_arrayaccessarr___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_ArrayAccessArr, offsetSet, arginfo_stub_arrayaccessarr_offsetset, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessArr, offsetExists, arginfo_stub_arrayaccessarr_offsetexists, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessArr, offsetUnset, arginfo_stub_arrayaccessarr_offsetunset, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayaccessobj.zep.c b/ext/stub/arrayaccessobj.zep.c index 5c7fa4dd25..7654f33755 100644 --- a/ext/stub/arrayaccessobj.zep.c +++ b/ext/stub/arrayaccessobj.zep.c @@ -35,9 +35,8 @@ PHP_METHOD(Stub_ArrayAccessObj, __construct) ZVAL_UNDEF(&obj); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&obj); object_init(&obj); @@ -65,20 +64,14 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetSet) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&obj); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(offset) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &offset, &value); - - - ZEPHIR_OBS_VAR(&obj); + zephir_memory_observe(&obj); zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); if (!(Z_TYPE_P(offset) == IS_NULL)) { zephir_update_property_zval_zval(&obj, offset, value); @@ -96,19 +89,13 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetExists) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&obj); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &offset); - - - ZEPHIR_OBS_VAR(&obj); + zephir_memory_observe(&obj); zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); RETURN_MM_BOOL(zephir_isset_property_zval(&obj, offset)); } @@ -124,19 +111,13 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&obj); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &offset); - - - ZEPHIR_OBS_VAR(&obj); + zephir_memory_observe(&obj); zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); zephir_get_arrval(&_0, &obj); ZEPHIR_CPY_WRT(&obj, &_0); @@ -157,25 +138,21 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetGet) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &offset); - - ZEPHIR_INIT_VAR(&_0); zephir_read_property(&_1, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); if (zephir_isset_property_zval(&_1, offset)) { - ZEPHIR_OBS_VAR(&_2); + zephir_memory_observe(&_2); zephir_read_property(&_2, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); + ZEPHIR_OBS_NVAR(&_0); zephir_read_property_zval(&_0, &_2, offset, PH_NOISY_CC); } else { + ZEPHIR_INIT_NVAR(&_0); ZVAL_NULL(&_0); } RETURN_CCTOR(&_0); diff --git a/ext/stub/arrayaccessobj.zep.h b/ext/stub/arrayaccessobj.zep.h index 590a96238b..6771b56479 100644 --- a/ext/stub/arrayaccessobj.zep.h +++ b/ext/stub/arrayaccessobj.zep.h @@ -27,20 +27,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetunset, ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetget, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetget, 0, 0, 1) -#endif ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayaccessobj_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayAccessObj, __construct, arginfo_stub_arrayaccessobj___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_ArrayAccessObj, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_ArrayAccessObj, __construct, arginfo_stub_arrayaccessobj___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_ArrayAccessObj, offsetSet, arginfo_stub_arrayaccessobj_offsetset, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessObj, offsetExists, arginfo_stub_arrayaccessobj_offsetexists, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessObj, offsetUnset, arginfo_stub_arrayaccessobj_offsetunset, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index c1df0c7072..6be1d339d7 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -38,12 +38,10 @@ PHP_METHOD(Stub_ArrayAccessTest, exits) zval arr; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&arr); object_init_ex(&arr, stub_arrayaccessarr_ce); @@ -57,13 +55,11 @@ PHP_METHOD(Stub_ArrayAccessTest, get) zval arr, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&arr); object_init_ex(&arr, stub_arrayaccessarr_ce); @@ -79,20 +75,15 @@ PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromArray) zval data; zval *key_param = NULL, *data_param = NULL; zval key; - zval *this_ptr = getThis(); ZVAL_UNDEF(&key); ZVAL_UNDEF(&data); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(key) Z_PARAM_ARRAY(data) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &key_param, &data_param); if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); @@ -104,8 +95,6 @@ PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromArray) ZEPHIR_INIT_VAR(&key); } zephir_get_arrval(&data, data_param); - - zephir_array_unset(&data, &key, PH_SEPARATE); RETURN_CTOR(&data); } @@ -121,16 +110,12 @@ PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromProperty) ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&dataFromProperty); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(key) Z_PARAM_ARRAY(dataFromProperty) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &key_param, &dataFromProperty_param); if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string")); @@ -142,8 +127,6 @@ PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromProperty) ZEPHIR_INIT_VAR(&key); } zephir_get_arrval(&dataFromProperty, dataFromProperty_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("assigedFromMethod"), &dataFromProperty); zephir_unset_property_array(this_ptr, ZEND_STRL("assigedFromMethod"), &key); zephir_read_property(&_0, this_ptr, ZEND_STRL("assigedFromMethod"), PH_NOISY_CC | PH_READONLY); @@ -162,14 +145,13 @@ PHP_METHOD(Stub_ArrayAccessTest, issue645) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &_0); - ZEPHIR_OBS_VAR(&_1); + zephir_memory_observe(&_1); zephir_read_property(&_1, this_ptr, ZEND_STRL("data"), PH_NOISY_CC); RETURN_CCTOR(&_1); } @@ -182,14 +164,12 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1155) zval s, _0; zval arr; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&s); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&arr); zephir_create_array(&arr, 3, 0); @@ -213,27 +193,21 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test1) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *items_param = NULL; zval items; - zval *this_ptr = getThis(); ZVAL_UNDEF(&items); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(items) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &items_param); if (!items_param) { ZEPHIR_INIT_VAR(&items); } else { zephir_get_arrval(&items, items_param); } - - RETURN_MM_BOOL(isItemsNULL); } @@ -243,27 +217,21 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test2) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *items_param = NULL; zval items; - zval *this_ptr = getThis(); ZVAL_UNDEF(&items); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(items) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &items_param); if (!items_param) { ZEPHIR_INIT_VAR(&items); } else { zephir_get_arrval(&items, items_param); } - - isItemsNULL = ZEPHIR_IS_NULL(&items); RETURN_MM_BOOL(isItemsNULL); } @@ -274,27 +242,21 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *items_param = NULL; zval items; - zval *this_ptr = getThis(); ZVAL_UNDEF(&items); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(items) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &items_param); if (!items_param) { ZEPHIR_INIT_VAR(&items); } else { zephir_get_arrval(&items, items_param); } - - isItemsNULL = Z_TYPE_P(&items) == IS_NULL; RETURN_MM_BOOL(isItemsNULL); } @@ -307,23 +269,16 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086Strict) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *params_param = NULL, _0; zval params; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶ms); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, ¶ms_param); ZEPHIR_OBS_COPY_OR_DUP(¶ms, params_param); - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1234); zephir_array_update_string(¶ms, SL("test2"), &_0, PH_COPY | PH_SEPARATE); @@ -339,13 +294,11 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithStr zval params; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶ms); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(¶ms); array_init(¶ms); @@ -365,23 +318,16 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086NotStrictParams) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *params_param = NULL, _0; zval params; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶ms); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, ¶ms_param); zephir_get_arrval(¶ms, params_param); - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1234); zephir_array_update_string(¶ms, SL("test2"), &_0, PH_COPY | PH_SEPARATE); @@ -397,13 +343,11 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086WontNullArrayAfterPassViaStaticWithout zval params; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶ms); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(¶ms); array_init(¶ms); @@ -422,13 +366,11 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetKeyFromArrayInternalVariable) { zval ret, unsetData; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&ret); ZVAL_UNDEF(&unsetData); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&ret); array_init(&ret); @@ -457,9 +399,8 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetStringKeyFromArrayProperty) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&ret); array_init(&ret); @@ -487,9 +428,8 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1259UnsetLongKeyFromArrayProperty) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&ret); array_init(&ret); @@ -514,7 +454,8 @@ zend_object *zephir_init_properties_Stub_ArrayAccessTest(zend_class_entry *class ZVAL_UNDEF(&_1$$3); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); { zval local_this_ptr, *this_ptr = &local_this_ptr; diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index 4a4542a78e..90389bfe7a 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -44,27 +44,15 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1155, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test1, 0, 0, _IS_BOOL, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, items, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test2, 0, 0, _IS_BOOL, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, items, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test3, 0, 0, _IS_BOOL, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, items, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086strict, 0, 0, 1) @@ -94,16 +82,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_zephir_init_properties_stub_ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayAccessTest, exits, arginfo_stub_arrayaccesstest_exits, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_ArrayAccessTest, exits, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayAccessTest, get, arginfo_stub_arrayaccesstest_get, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_ArrayAccessTest, get, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_ArrayAccessTest, exits, arginfo_stub_arrayaccesstest_exits, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_ArrayAccessTest, get, arginfo_stub_arrayaccesstest_get, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_ArrayAccessTest, unsetByKeyFromArray, arginfo_stub_arrayaccesstest_unsetbykeyfromarray, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, unsetByKeyFromProperty, arginfo_stub_arrayaccesstest_unsetbykeyfromproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue645, arginfo_stub_arrayaccesstest_issue645, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayiterator.zep.c b/ext/stub/arrayiterator.zep.c index 6845cdb52f..7fa60b0e36 100644 --- a/ext/stub/arrayiterator.zep.c +++ b/ext/stub/arrayiterator.zep.c @@ -37,9 +37,8 @@ PHP_METHOD(Stub_ArrayIterator, __construct) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 3, 0); @@ -53,7 +52,7 @@ PHP_METHOD(Stub_ArrayIterator, __construct) ZVAL_STRING(&_1, "three"); zephir_array_fast_append(&_0, &_1); zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_2); + ZVAL_UNDEF(&_2); ZVAL_LONG(&_2, 0); zephir_update_property_zval(this_ptr, ZEND_STRL("position"), &_2); ZEPHIR_MM_RESTORE(); @@ -65,10 +64,7 @@ PHP_METHOD(Stub_ArrayIterator, rewind) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 0); zephir_update_property_zval(this_ptr, ZEND_STRL("position"), &_0); } @@ -82,12 +78,11 @@ PHP_METHOD(Stub_ArrayIterator, current) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&_2); + zephir_memory_observe(&_2); zephir_read_property(&_2, this_ptr, ZEND_STRL("position"), PH_NOISY_CC); zephir_array_fetch(&_1, &_0, &_2, PH_NOISY | PH_READONLY, "stub/arrayiterator.zep", 25); RETURN_CTOR(&_1); @@ -95,9 +90,6 @@ PHP_METHOD(Stub_ArrayIterator, current) PHP_METHOD(Stub_ArrayIterator, key) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "position"); } @@ -105,9 +97,6 @@ PHP_METHOD(Stub_ArrayIterator, key) PHP_METHOD(Stub_ArrayIterator, next) { zval *this_ptr = getThis(); - - - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("position"))); } @@ -118,9 +107,6 @@ PHP_METHOD(Stub_ArrayIterator, valid) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, ZEND_STRL("position"), PH_NOISY_CC | PH_READONLY); RETURN_BOOL(zephir_array_isset(&_0, &_1)); diff --git a/ext/stub/arrayiterator.zep.h b/ext/stub/arrayiterator.zep.h index f912b09eb7..6fe2566171 100644 --- a/ext/stub/arrayiterator.zep.h +++ b/ext/stub/arrayiterator.zep.h @@ -16,18 +16,10 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_rewind, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_current, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_current, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_key, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_key, 0, 0, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_next, 0, 0, IS_VOID, 0) @@ -37,11 +29,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_valid, 0, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayiterator_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayIterator, __construct, arginfo_stub_arrayiterator___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_ArrayIterator, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_ArrayIterator, __construct, arginfo_stub_arrayiterator___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_ArrayIterator, rewind, arginfo_stub_arrayiterator_rewind, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayIterator, current, arginfo_stub_arrayiterator_current, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayIterator, key, arginfo_stub_arrayiterator_key, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayiteratortest.zep.c b/ext/stub/arrayiteratortest.zep.c index d6ebbb1101..c4f7e9b1e8 100644 --- a/ext/stub/arrayiteratortest.zep.c +++ b/ext/stub/arrayiteratortest.zep.c @@ -32,15 +32,13 @@ PHP_METHOD(Stub_ArrayIteratorTest, test) zval arr, k, v, *_0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&k); ZVAL_UNDEF(&v); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&arr); object_init_ex(&arr, stub_arrayiterator_ce); diff --git a/ext/stub/arrayiteratortest.zep.h b/ext/stub/arrayiteratortest.zep.h index 033327a2d3..d458b8c7da 100644 --- a/ext/stub/arrayiteratortest.zep.h +++ b/ext/stub/arrayiteratortest.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiteratortest_test, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayiteratortest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayIteratorTest, test, arginfo_stub_arrayiteratortest_test, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_ArrayIteratorTest, test, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_ArrayIteratorTest, test, arginfo_stub_arrayiteratortest_test, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/ext/stub/arraymanipulation.zep.c b/ext/stub/arraymanipulation.zep.c index ec9179bfdf..e51c841847 100644 --- a/ext/stub/arraymanipulation.zep.c +++ b/ext/stub/arraymanipulation.zep.c @@ -42,9 +42,8 @@ PHP_METHOD(Stub_ArrayManipulation, arrayFillMany) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 1000000); @@ -64,21 +63,19 @@ PHP_METHOD(Stub_ArrayManipulation, issue774) zval _1; zval obj, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&obj); object_init(&obj); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 0); zephir_update_property_zval(&obj, ZEND_STRL("prop0"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_zval(&obj, ZEND_STRL("prop1"), &_0); zephir_get_arrval(&_1, &obj); @@ -94,7 +91,8 @@ zend_object *zephir_init_properties_Stub_ArrayManipulation(zend_class_entry *cla ZVAL_UNDEF(&_1$$3); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); { zval local_this_ptr, *this_ptr = &local_this_ptr; diff --git a/ext/stub/arraysearch.zep.c b/ext/stub/arraysearch.zep.c index a988b1119e..58ac3de266 100644 --- a/ext/stub/arraysearch.zep.c +++ b/ext/stub/arraysearch.zep.c @@ -34,32 +34,24 @@ PHP_METHOD(Stub_ArraySearch, simpleSearch) zend_bool strict; zval haystack; zval *needle, needle_sub, *haystack_param = NULL, *strict_param = NULL, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&needle_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&haystack); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_ZVAL(needle) Z_PARAM_ARRAY(haystack) Z_PARAM_OPTIONAL Z_PARAM_BOOL(strict) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 1, &needle, &haystack_param, &strict_param); zephir_get_arrval(&haystack, haystack_param); if (!strict_param) { strict = 0; } else { - strict = zephir_get_boolval(strict_param); - } - - + } ZVAL_BOOL(&_0, (strict ? 1 : 0)); ZEPHIR_RETURN_CALL_FUNCTION("array_search", NULL, 6, needle, &haystack, &_0); zephir_check_call_status(); @@ -73,14 +65,12 @@ PHP_METHOD(Stub_ArraySearch, searchUsingArrayInsideZephir) zval itoA64; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&itoA64); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&pos); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&itoA64); zephir_create_array(&itoA64, 9, 0); diff --git a/ext/stub/arraysearch.zep.h b/ext/stub/arraysearch.zep.h index d34e1d8511..f71f0393f1 100644 --- a/ext/stub/arraysearch.zep.h +++ b/ext/stub/arraysearch.zep.h @@ -17,10 +17,6 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arraysearch_method_entry) { PHP_ME(Stub_ArraySearch, simpleSearch, arginfo_stub_arraysearch_simplesearch, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArraySearch, searchUsingArrayInsideZephir, arginfo_stub_arraysearch_searchusingarrayinsidezephir, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArraySearch, searchUsingArrayInsideZephir, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ArraySearch, searchUsingArrayInsideZephir, arginfo_stub_arraysearch_searchusingarrayinsidezephir, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/assign.zep.c b/ext/stub/assign.zep.c index bb7cae62a4..04e0b9fcc4 100644 --- a/ext/stub/assign.zep.c +++ b/ext/stub/assign.zep.c @@ -34,18 +34,12 @@ ZEPHIR_INIT_CLASS(Stub_Assign) PHP_METHOD(Stub_Assign, getTestVar) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "testVar"); } PHP_METHOD(Stub_Assign, getMyArray) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "myArray"); } @@ -53,11 +47,6 @@ PHP_METHOD(Stub_Assign, getMyArray) PHP_METHOD(Stub_Assign, testAssign1) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_LONG(a); } @@ -65,11 +54,6 @@ PHP_METHOD(Stub_Assign, testAssign1) PHP_METHOD(Stub_Assign, testAssign2) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_LONG(a); } @@ -77,11 +61,6 @@ PHP_METHOD(Stub_Assign, testAssign2) PHP_METHOD(Stub_Assign, testAssign3) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_LONG(a); } @@ -89,11 +68,6 @@ PHP_METHOD(Stub_Assign, testAssign3) PHP_METHOD(Stub_Assign, testAssign4) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_LONG(a); } @@ -101,11 +75,6 @@ PHP_METHOD(Stub_Assign, testAssign4) PHP_METHOD(Stub_Assign, testAssign5) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = (long) (2.0); RETURN_LONG(a); } @@ -113,11 +82,6 @@ PHP_METHOD(Stub_Assign, testAssign5) PHP_METHOD(Stub_Assign, testAssign6) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); RETURN_BOOL(a); } @@ -125,11 +89,6 @@ PHP_METHOD(Stub_Assign, testAssign6) PHP_METHOD(Stub_Assign, testAssign7) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1.0 != 0.0) ? 1 : 0); RETURN_BOOL(a); } @@ -137,11 +96,6 @@ PHP_METHOD(Stub_Assign, testAssign7) PHP_METHOD(Stub_Assign, testAssign8) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_BOOL(a); } @@ -149,11 +103,6 @@ PHP_METHOD(Stub_Assign, testAssign8) PHP_METHOD(Stub_Assign, testAssign9) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_BOOL(a); } @@ -161,11 +110,6 @@ PHP_METHOD(Stub_Assign, testAssign9) PHP_METHOD(Stub_Assign, testAssign10) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_BOOL(a); } @@ -173,11 +117,6 @@ PHP_METHOD(Stub_Assign, testAssign10) PHP_METHOD(Stub_Assign, testAssign11) { double a = 0; - zval *this_ptr = getThis(); - - - - a = 0.0; RETURN_DOUBLE(a); } @@ -185,11 +124,6 @@ PHP_METHOD(Stub_Assign, testAssign11) PHP_METHOD(Stub_Assign, testAssign12) { double a = 0; - zval *this_ptr = getThis(); - - - - a = (double) (4); RETURN_DOUBLE(a); } @@ -197,11 +131,6 @@ PHP_METHOD(Stub_Assign, testAssign12) PHP_METHOD(Stub_Assign, testAssign13) { double a = 0; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_DOUBLE(a); } @@ -209,11 +138,6 @@ PHP_METHOD(Stub_Assign, testAssign13) PHP_METHOD(Stub_Assign, testAssign14) { double a = 0; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_DOUBLE(a); } @@ -221,23 +145,13 @@ PHP_METHOD(Stub_Assign, testAssign14) PHP_METHOD(Stub_Assign, testAssign15) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 5.0; + a = (5.0); RETURN_DOUBLE(a); } PHP_METHOD(Stub_Assign, testAssign16) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_LONG(a); } @@ -245,23 +159,13 @@ PHP_METHOD(Stub_Assign, testAssign16) PHP_METHOD(Stub_Assign, testAssign17) { double a = 0; - zval *this_ptr = getThis(); - - - - - a = 1.0; + a = (1.0); RETURN_DOUBLE(a); } PHP_METHOD(Stub_Assign, testAssign18) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_BOOL(a); } @@ -269,11 +173,6 @@ PHP_METHOD(Stub_Assign, testAssign18) PHP_METHOD(Stub_Assign, testAssign19) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_BOOL(a); } @@ -282,12 +181,10 @@ PHP_METHOD(Stub_Assign, testAssign20) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_NULL(&a); @@ -297,11 +194,6 @@ PHP_METHOD(Stub_Assign, testAssign20) PHP_METHOD(Stub_Assign, testAssign21) { zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = a; RETURN_LONG(b); @@ -310,24 +202,14 @@ PHP_METHOD(Stub_Assign, testAssign21) PHP_METHOD(Stub_Assign, testAssign22) { double a = 0, b = 0; - zval *this_ptr = getThis(); - - - - - a = 1.0; - b = a; + a = (1.0); + b = a; RETURN_DOUBLE(b); } PHP_METHOD(Stub_Assign, testAssign23) { zend_bool a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = a; RETURN_BOOL(b); @@ -337,11 +219,6 @@ PHP_METHOD(Stub_Assign, testAssign24) { double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = (double) a; RETURN_DOUBLE(b); @@ -351,11 +228,6 @@ PHP_METHOD(Stub_Assign, testAssign25) { double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = (double) a; RETURN_DOUBLE(b); @@ -365,11 +237,6 @@ PHP_METHOD(Stub_Assign, testAssign26) { double a = 0; zend_long b = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = (long) a; RETURN_LONG(b); @@ -379,11 +246,6 @@ PHP_METHOD(Stub_Assign, testAssign27) { double a = 0; zend_long b = 0; - zval *this_ptr = getThis(); - - - - b = 1; a = (double) b; RETURN_DOUBLE(a); @@ -393,11 +255,6 @@ PHP_METHOD(Stub_Assign, testAssign28) { zend_bool a = 0; zend_long b = 0; - zval *this_ptr = getThis(); - - - - b = 1; a = ((b) ? 1 : 0); RETURN_BOOL(a); @@ -407,12 +264,7 @@ PHP_METHOD(Stub_Assign, testAssign29) { zend_bool a = 0; double b = 0; - zval *this_ptr = getThis(); - - - - - b = 1.0; + b = (1.0); a = ((b != 0.0) ? 1 : 0); RETURN_BOOL(a); } @@ -421,11 +273,6 @@ PHP_METHOD(Stub_Assign, testAssign30) { zend_long a = 0; zend_bool b = 0; - zval *this_ptr = getThis(); - - - - b = 0; a = b; RETURN_LONG(a); @@ -435,11 +282,6 @@ PHP_METHOD(Stub_Assign, testAssign31) { double a = 0; zend_bool b = 0; - zval *this_ptr = getThis(); - - - - b = 0; a = (double) b; RETURN_DOUBLE(a); @@ -448,11 +290,6 @@ PHP_METHOD(Stub_Assign, testAssign31) PHP_METHOD(Stub_Assign, testAssign32) { zend_bool b = 0, a = 0; - zval *this_ptr = getThis(); - - - - b = 0; a = b; RETURN_BOOL(a); @@ -461,11 +298,6 @@ PHP_METHOD(Stub_Assign, testAssign32) PHP_METHOD(Stub_Assign, testAssign33) { zend_bool b = 0, a = 0; - zval *this_ptr = getThis(); - - - - b = 0; a = b; RETURN_BOOL(a); @@ -475,11 +307,6 @@ PHP_METHOD(Stub_Assign, testAssign34) { zend_bool a = 0; zend_long b = 0; - zval *this_ptr = getThis(); - - - - b = 0; a = ((b) ? 1 : 0); RETURN_BOOL(a); @@ -489,11 +316,6 @@ PHP_METHOD(Stub_Assign, testAssign35) { zend_bool a = 0; double b = 0; - zval *this_ptr = getThis(); - - - - b = 0; a = ((b != 0.0) ? 1 : 0); RETURN_BOOL(a); @@ -502,11 +324,6 @@ PHP_METHOD(Stub_Assign, testAssign35) PHP_METHOD(Stub_Assign, testAssign36) { zend_bool b = 0, a = 0; - zval *this_ptr = getThis(); - - - - b = 0; a = b; RETURN_BOOL(a); @@ -517,7 +334,6 @@ PHP_METHOD(Stub_Assign, testAssign37) zval _1, _4; zval v, arr, _0, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&v); ZVAL_UNDEF(&arr); @@ -526,9 +342,8 @@ PHP_METHOD(Stub_Assign, testAssign37) ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_4); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&v); ZVAL_STRING(&v, "abc"); @@ -571,23 +386,16 @@ PHP_METHOD(Stub_Assign, testAssign38) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *index, index_sub, arr, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index); - - ZEPHIR_INIT_VAR(&arr); array_init(&arr); ZEPHIR_INIT_VAR(&_0); @@ -600,14 +408,12 @@ PHP_METHOD(Stub_Assign, testAssign39) { zval a, b, c; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "hello"); @@ -626,13 +432,11 @@ PHP_METHOD(Stub_Assign, testAssign40) { zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); object_init(&b); @@ -653,20 +457,11 @@ PHP_METHOD(Stub_Assign, testAssign41) { zval *num_param = NULL; zend_long num, a = 0; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - a = 42; a /= num; RETURN_LONG(a); @@ -679,20 +474,11 @@ PHP_METHOD(Stub_Assign, testAssign42) { zval *num_param = NULL; zend_long num, a = 0; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - a = 2; num /= a; RETURN_LONG(num); @@ -702,20 +488,11 @@ PHP_METHOD(Stub_Assign, testAssign43) { zval *num_param = NULL; zend_long num, a = 0; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - a = 43; a %= num; RETURN_LONG(a); @@ -725,20 +502,11 @@ PHP_METHOD(Stub_Assign, testAssign44) { zval *num_param = NULL; zend_long num, a = 0; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - a = 2; num %= a; RETURN_LONG(num); @@ -755,14 +523,13 @@ PHP_METHOD(Stub_Assign, testPropertyAssign1) ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_DOUBLE(&_0, 1.5); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &__$null); @@ -776,7 +543,7 @@ PHP_METHOD(Stub_Assign, testPropertyAssign1) } else { zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &__$false); } - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 'A'); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); ZEPHIR_INIT_VAR(&_1); @@ -805,22 +572,21 @@ PHP_METHOD(Stub_Assign, testPropertyAssign2) ZVAL_UNDEF(&c); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&f); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 1; - b = 1.5; + b = (1.5); ZEPHIR_INIT_VAR(&c); ZVAL_NULL(&c); d = 0; e = 'A'; ZEPHIR_INIT_VAR(&f); array_init(&f); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, a); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_DOUBLE(&_0, b); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &c); @@ -829,7 +595,7 @@ PHP_METHOD(Stub_Assign, testPropertyAssign2) } else { zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &__$false); } - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, e); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &f); @@ -842,10 +608,7 @@ PHP_METHOD(Stub_Assign, testPropertyIncr1) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("testVar"))); @@ -860,11 +623,10 @@ PHP_METHOD(Stub_Assign, testPropertyAddAssign1) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 0); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); ZEPHIR_INIT_VAR(&_1); @@ -883,11 +645,10 @@ PHP_METHOD(Stub_Assign, testPropertyAddAssign2) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); ZEPHIR_INIT_VAR(&_1); @@ -905,14 +666,11 @@ PHP_METHOD(Stub_Assign, testPropertyAssignValuePlus1) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); zephir_read_property(&_0, this_ptr, ZEND_STRL("testVar"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZVAL_LONG(&_1, (zephir_get_numberval(&_0) + 1)); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_1); RETURN_MEMBER(getThis(), "testVar"); @@ -924,10 +682,7 @@ PHP_METHOD(Stub_Assign, testPropertyDecr) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 2); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("testVar"))); @@ -942,11 +697,10 @@ PHP_METHOD(Stub_Assign, testPropertySubAssign1) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 0); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); ZEPHIR_INIT_VAR(&_1); @@ -965,11 +719,10 @@ PHP_METHOD(Stub_Assign, testPropertySubAssign2) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); ZEPHIR_INIT_VAR(&_1); @@ -988,11 +741,10 @@ PHP_METHOD(Stub_Assign, testPropertyMulAssign1) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); ZEPHIR_INIT_VAR(&_1); @@ -1011,11 +763,10 @@ PHP_METHOD(Stub_Assign, testPropertyMulAssign2) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_zval(this_ptr, ZEND_STRL("testVar"), &_0); ZEPHIR_INIT_VAR(&_1); @@ -1033,9 +784,8 @@ PHP_METHOD(Stub_Assign, testPropertyAssignStringConcat) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); @@ -1058,17 +808,16 @@ PHP_METHOD(Stub_Assign, testPropertyArray1) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_property_zval(this_ptr, ZEND_STRL("myArray"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZVAL_LONG(&_1, 1); zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZVAL_DOUBLE(&_1, 1.5); zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); zephir_update_property_array_append(this_ptr, SL("myArray"), &__$null); @@ -1082,10 +831,10 @@ PHP_METHOD(Stub_Assign, testPropertyArray1) } else { zephir_update_property_array_append(this_ptr, SL("myArray"), &__$false); } - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZVAL_LONG(&_1, 'A'); zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "hello"); zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); @@ -1110,12 +859,11 @@ PHP_METHOD(Stub_Assign, testPropertyArray2) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&f); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 1; - b = 1.5; + b = (1.5); ZEPHIR_INIT_VAR(&c); ZVAL_NULL(&c); d = 0; @@ -1125,17 +873,17 @@ PHP_METHOD(Stub_Assign, testPropertyArray2) ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_property_zval(this_ptr, ZEND_STRL("myArray"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZVAL_LONG(&_1, a); zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZVAL_DOUBLE(&_1, b); zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); zephir_update_property_array_append(this_ptr, SL("myArray"), &c); - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZVAL_BOOL(&_1, d); zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZVAL_LONG(&_1, e); zephir_update_property_array_append(this_ptr, SL("myArray"), &_1); zephir_update_property_array_append(this_ptr, SL("myArray"), &f); @@ -1163,9 +911,8 @@ PHP_METHOD(Stub_Assign, testPropertyArray3) ZVAL_UNDEF(&_9); ZVAL_UNDEF(&_10); ZVAL_UNDEF(&_11); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -1217,18 +964,12 @@ PHP_METHOD(Stub_Assign, testPropertyArray4) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index); - - ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_property_zval(this_ptr, ZEND_STRL("myArray"), &_0); @@ -1266,19 +1007,13 @@ PHP_METHOD(Stub_Assign, testPropertyArray5) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index_param); zephir_get_strval(&index, index_param); - - ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_property_zval(this_ptr, ZEND_STRL("myArray"), &_0); @@ -1311,9 +1046,8 @@ PHP_METHOD(Stub_Assign, testPropertyArray6) ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -1350,9 +1084,8 @@ PHP_METHOD(Stub_Assign, testPropertyArray7) ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -1390,18 +1123,12 @@ PHP_METHOD(Stub_Assign, testPropertyArray8) ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index); - - ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_property_zval(this_ptr, ZEND_STRL("myArray"), &_0); @@ -1438,19 +1165,12 @@ PHP_METHOD(Stub_Assign, testPropertyArray9) ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index_param); - index = zephir_get_intval(index_param); - - ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_property_zval(this_ptr, ZEND_STRL("myArray"), &_0); @@ -1488,19 +1208,13 @@ PHP_METHOD(Stub_Assign, testPropertyArray10) ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index_param); zephir_get_strval(&index, index_param); - - ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_property_zval(this_ptr, ZEND_STRL("myArray"), &_0); @@ -1540,18 +1254,12 @@ PHP_METHOD(Stub_Assign, testPropertyArray11) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index); - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_array_multi(this_ptr, SL("myArray"), &_0, SL("zza"), 3, index, index); @@ -1593,18 +1301,12 @@ PHP_METHOD(Stub_Assign, testPropertyArray12) ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index); - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_array_multi(this_ptr, SL("myArray"), &_0, SL("zza"), 3, index, index); @@ -1614,9 +1316,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray12) zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$null, SL("zza"), 3, index, index); zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$false, SL("zza"), 3, index, index); zephir_read_property(&_2, this_ptr, ZEND_STRL("myArray"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&temp1); + zephir_memory_observe(&temp1); zephir_array_fetch(&temp1, &_2, index, PH_NOISY, "stub/assign.zep", 657); - ZEPHIR_OBS_VAR(&temp2); + zephir_memory_observe(&temp2); zephir_read_property(&temp2, this_ptr, ZEND_STRL("myArray"), PH_NOISY_CC); zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$true, SL("zza"), 3, index, index); ZEPHIR_INIT_VAR(&_3); @@ -1654,18 +1356,12 @@ PHP_METHOD(Stub_Assign, testPropertyArray13) ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index); - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 1); zephir_update_property_array_multi(this_ptr, SL("myArray"), &_0, SL("za"), 2, index); @@ -1675,9 +1371,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray13) zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$null, SL("za"), 2, index); zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$false, SL("za"), 2, index); zephir_read_property(&_2, this_ptr, ZEND_STRL("myArray"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&temp1); + zephir_memory_observe(&temp1); zephir_array_fetch(&temp1, &_2, index, PH_NOISY, "stub/assign.zep", 674); - ZEPHIR_OBS_VAR(&temp2); + zephir_memory_observe(&temp2); zephir_read_property(&temp2, this_ptr, ZEND_STRL("myArray"), PH_NOISY_CC); zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$true, SL("za"), 2, index); ZEPHIR_INIT_VAR(&_3); @@ -1710,9 +1406,8 @@ PHP_METHOD(Stub_Assign, testPropertyArray14) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&v); ZVAL_STRING(&v, "abc"); @@ -1755,7 +1450,6 @@ PHP_METHOD(Stub_Assign, testStaticPropertyAssign1) zval _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$false, __$true, _0, _1, _3; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); @@ -1764,23 +1458,22 @@ PHP_METHOD(Stub_Assign, testStaticPropertyAssign1) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_2); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_DOUBLE(&_0, 1.5); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &__$null); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &__$false); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &__$true); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 'A'); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello"); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); @@ -1812,34 +1505,32 @@ PHP_METHOD(Stub_Assign, testStaticPropertyAssign2) double b; zend_long a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&f); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 1; - b = 1.5; + b = (1.5); ZEPHIR_INIT_VAR(&c); ZVAL_NULL(&c); d = 0; e = 'A'; ZEPHIR_INIT_VAR(&f); array_init(&f); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, a); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_DOUBLE(&_0, b); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &c); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_BOOL(&_0, d); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, e); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &f); @@ -1851,7 +1542,6 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArray1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$false, __$true, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); @@ -1859,9 +1549,8 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArray1) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -1892,7 +1581,6 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArray2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$false, __$true, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); @@ -1900,9 +1588,8 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArray2) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -1933,7 +1620,6 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArray3) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *index, index_sub, __$null, __$false, __$true, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&index_sub); ZVAL_NULL(&__$null); @@ -1942,18 +1628,12 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArray3) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index); - - ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); @@ -1983,15 +1663,13 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayAppend) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$false, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -2017,7 +1695,6 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayMutli1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$false, __$true, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); @@ -2025,9 +1702,8 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayMutli1) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -2058,7 +1734,6 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayMutli2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$false, __$true, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); @@ -2066,9 +1741,8 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayMutli2) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -2099,7 +1773,6 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayMutli3) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *index, index_sub, __$null, __$false, __$true, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&index_sub); ZVAL_NULL(&__$null); @@ -2108,18 +1781,12 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayMutli3) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index); - - ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_static_property_ce(stub_assign_ce, ZEND_STRL("testVarStatic"), &_0); @@ -2150,7 +1817,6 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayMulti4) zval _0, _1, _3; zval v, _2, _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&v); ZVAL_UNDEF(&_2); @@ -2158,9 +1824,8 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayMulti4) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&v); ZVAL_STRING(&v, "abc"); @@ -2199,7 +1864,6 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayAppend1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$false, __$true, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); @@ -2207,9 +1871,8 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayAppend1) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -2240,24 +1903,17 @@ PHP_METHOD(Stub_Assign, testArrayVarAssign1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *index, index_sub, *value, value_sub, a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &index, &value); - - ZEPHIR_INIT_VAR(&a); array_init(&a); zephir_array_update_zval(&a, index, value, PH_COPY | PH_SEPARATE); @@ -2268,24 +1924,17 @@ PHP_METHOD(Stub_Assign, testArrayVarAssign2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *index, index_sub, *value, value_sub, _POST; - zval *this_ptr = getThis(); ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_POST); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &index, &value); - - ZEPHIR_INIT_VAR(&_POST); array_init(&_POST); zephir_array_update_zval(&_POST, index, value, PH_COPY | PH_SEPARATE); @@ -2296,24 +1945,17 @@ PHP_METHOD(Stub_Assign, testArrayProperty) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *index, index_sub, *value, value_sub, _POST; - zval *this_ptr = getThis(); ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_POST); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &index, &value); - - ZEPHIR_INIT_VAR(&_POST); array_init(&_POST); zephir_array_update_zval(&_POST, index, value, PH_COPY | PH_SEPARATE); @@ -2326,24 +1968,16 @@ PHP_METHOD(Stub_Assign, testArrayProperty) PHP_METHOD(Stub_Assign, testGlobalVarAssign) { zval *index, index_sub, *value, value_sub, _POST; - zval *this_ptr = getThis(); ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_POST); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_get_global(&_POST, SL("_POST")); zephir_fetch_params_without_memory_grow(2, 0, &index, &value); - - zephir_array_update_zval(&_POST, index, value, PH_COPY | PH_SEPARATE); } @@ -2354,12 +1988,10 @@ PHP_METHOD(Stub_Assign, testConstantKeyAssign) { zval elements; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&elements); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&elements); zephir_create_array(&elements, 3, 0); @@ -2385,9 +2017,8 @@ PHP_METHOD(Stub_Assign, testArrayBoolExpressionAssign) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&str); ZVAL_STRING(&str, "abc"); @@ -2413,7 +2044,6 @@ PHP_METHOD(Stub_Assign, testAssignBitwiseX) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a_param = NULL, *b_param = NULL, op, i, result, _1, *_2, _3; zend_long a, b, ZEPHIR_LAST_CALL_STATUS, _4$$4, _5$$5, _6$$6, _7$$7, _8$$8, _9$$10, _10$$11, _11$$12, _12$$13, _13$$14; - zval *this_ptr = getThis(); ZVAL_UNDEF(&op); ZVAL_UNDEF(&i); @@ -2421,21 +2051,13 @@ PHP_METHOD(Stub_Assign, testAssignBitwiseX) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a_param, &b_param); - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - ZEPHIR_INIT_VAR(&result); array_init(&result); ZEPHIR_INIT_VAR(&_0); @@ -2560,7 +2182,6 @@ PHP_METHOD(Stub_Assign, testAssignSuperGlobals) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval _GET, v, _0, _1, _2, _3; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_GET); ZVAL_UNDEF(&v); @@ -2568,9 +2189,8 @@ PHP_METHOD(Stub_Assign, testAssignSuperGlobals) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_GET, SL("_GET")); ZEPHIR_INIT_VAR(&v); @@ -2599,14 +2219,12 @@ PHP_METHOD(Stub_Assign, testAssignSuperGlobalsSERVER) zval _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval _SERVER, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_SERVER); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_SERVER, SL("_SERVER")); ZEPHIR_INIT_VAR(&_0); @@ -2627,14 +2245,12 @@ PHP_METHOD(Stub_Assign, testAssignSuperGlobalsGET) zval _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval _GET, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_GET); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_GET, SL("_GET")); ZEPHIR_INIT_VAR(&_0); @@ -2651,15 +2267,13 @@ PHP_METHOD(Stub_Assign, issue597) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval _POST, _GET, s$$4, _0$$4; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_POST); ZVAL_UNDEF(&_GET); ZVAL_UNDEF(&s$$4); ZVAL_UNDEF(&_0$$4); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_GET, SL("_GET")); zephir_get_global(&_POST, SL("_POST")); diff --git a/ext/stub/assign.zep.h b/ext/stub/assign.zep.h index 9a46eec1ef..f234b6b4e0 100644 --- a/ext/stub/assign.zep.h +++ b/ext/stub/assign.zep.h @@ -406,16 +406,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_assign_issue597, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_assign_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, getTestVar, arginfo_stub_assign_gettestvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, getTestVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, getMyArray, arginfo_stub_assign_getmyarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, getMyArray, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, getTestVar, arginfo_stub_assign_gettestvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, getMyArray, arginfo_stub_assign_getmyarray, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign1, arginfo_stub_assign_testassign1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign2, arginfo_stub_assign_testassign2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign3, arginfo_stub_assign_testassign3, ZEND_ACC_PUBLIC) @@ -460,185 +452,53 @@ ZEPHIR_INIT_FUNCS(stub_assign_method_entry) { PHP_ME(Stub_Assign, testAssign42, arginfo_stub_assign_testassign42, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign43, arginfo_stub_assign_testassign43, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign44, arginfo_stub_assign_testassign44, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAssign1, arginfo_stub_assign_testpropertyassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAssign2, arginfo_stub_assign_testpropertyassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyIncr1, arginfo_stub_assign_testpropertyincr1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyIncr1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAddAssign1, arginfo_stub_assign_testpropertyaddassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAddAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAddAssign2, arginfo_stub_assign_testpropertyaddassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAddAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAssignValuePlus1, arginfo_stub_assign_testpropertyassignvalueplus1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAssignValuePlus1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyDecr, arginfo_stub_assign_testpropertydecr, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyDecr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertySubAssign1, arginfo_stub_assign_testpropertysubassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertySubAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertySubAssign2, arginfo_stub_assign_testpropertysubassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertySubAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyMulAssign1, arginfo_stub_assign_testpropertymulassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyMulAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyMulAssign2, arginfo_stub_assign_testpropertymulassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyMulAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAssignStringConcat, arginfo_stub_assign_testpropertyassignstringconcat, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAssignStringConcat, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray1, arginfo_stub_assign_testpropertyarray1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray2, arginfo_stub_assign_testpropertyarray2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray3, arginfo_stub_assign_testpropertyarray3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testPropertyAssign1, arginfo_stub_assign_testpropertyassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAssign2, arginfo_stub_assign_testpropertyassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyIncr1, arginfo_stub_assign_testpropertyincr1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAddAssign1, arginfo_stub_assign_testpropertyaddassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAddAssign2, arginfo_stub_assign_testpropertyaddassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAssignValuePlus1, arginfo_stub_assign_testpropertyassignvalueplus1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyDecr, arginfo_stub_assign_testpropertydecr, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertySubAssign1, arginfo_stub_assign_testpropertysubassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertySubAssign2, arginfo_stub_assign_testpropertysubassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyMulAssign1, arginfo_stub_assign_testpropertymulassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyMulAssign2, arginfo_stub_assign_testpropertymulassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAssignStringConcat, arginfo_stub_assign_testpropertyassignstringconcat, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyArray1, arginfo_stub_assign_testpropertyarray1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyArray2, arginfo_stub_assign_testpropertyarray2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyArray3, arginfo_stub_assign_testpropertyarray3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray4, arginfo_stub_assign_testpropertyarray4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray5, arginfo_stub_assign_testpropertyarray5, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray6, arginfo_stub_assign_testpropertyarray6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray7, arginfo_stub_assign_testpropertyarray7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray7, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testPropertyArray6, arginfo_stub_assign_testpropertyarray6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyArray7, arginfo_stub_assign_testpropertyarray7, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray8, arginfo_stub_assign_testpropertyarray8, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray9, arginfo_stub_assign_testpropertyarray9, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray10, arginfo_stub_assign_testpropertyarray10, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray11, arginfo_stub_assign_testpropertyarray11, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray12, arginfo_stub_assign_testpropertyarray12, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray13, arginfo_stub_assign_testpropertyarray13, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray14, arginfo_stub_assign_testpropertyarray14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyAssign1, arginfo_stub_assign_teststaticpropertyassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyAssign2, arginfo_stub_assign_teststaticpropertyassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArray1, arginfo_stub_assign_teststaticpropertyarray1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArray1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArray2, arginfo_stub_assign_teststaticpropertyarray2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArray2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testPropertyArray14, arginfo_stub_assign_testpropertyarray14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyAssign1, arginfo_stub_assign_teststaticpropertyassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyAssign2, arginfo_stub_assign_teststaticpropertyassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArray1, arginfo_stub_assign_teststaticpropertyarray1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArray2, arginfo_stub_assign_teststaticpropertyarray2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testStaticPropertyArray3, arginfo_stub_assign_teststaticpropertyarray3, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayAppend, arginfo_stub_assign_teststaticpropertyarrayappend, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayAppend, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayMutli1, arginfo_stub_assign_teststaticpropertyarraymutli1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayMutli1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayMutli2, arginfo_stub_assign_teststaticpropertyarraymutli2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayMutli2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testStaticPropertyArrayAppend, arginfo_stub_assign_teststaticpropertyarrayappend, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArrayMutli1, arginfo_stub_assign_teststaticpropertyarraymutli1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArrayMutli2, arginfo_stub_assign_teststaticpropertyarraymutli2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testStaticPropertyArrayMutli3, arginfo_stub_assign_teststaticpropertyarraymutli3, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayMulti4, arginfo_stub_assign_teststaticpropertyarraymulti4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayMulti4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayAppend1, arginfo_stub_assign_teststaticpropertyarrayappend1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayAppend1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testStaticPropertyArrayMulti4, arginfo_stub_assign_teststaticpropertyarraymulti4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArrayAppend1, arginfo_stub_assign_teststaticpropertyarrayappend1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testArrayVarAssign1, arginfo_stub_assign_testarrayvarassign1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testArrayVarAssign2, arginfo_stub_assign_testarrayvarassign2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testArrayProperty, arginfo_stub_assign_testarrayproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testGlobalVarAssign, arginfo_stub_assign_testglobalvarassign, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testConstantKeyAssign, arginfo_stub_assign_testconstantkeyassign, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testConstantKeyAssign, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testArrayBoolExpressionAssign, arginfo_stub_assign_testarrayboolexpressionassign, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testArrayBoolExpressionAssign, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testConstantKeyAssign, arginfo_stub_assign_testconstantkeyassign, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testArrayBoolExpressionAssign, arginfo_stub_assign_testarrayboolexpressionassign, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssignBitwiseX, arginfo_stub_assign_testassignbitwisex, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testAssignSuperGlobals, arginfo_stub_assign_testassignsuperglobals, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testAssignSuperGlobals, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testAssignSuperGlobalsSERVER, arginfo_stub_assign_testassignsuperglobalsserver, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testAssignSuperGlobalsSERVER, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testAssignSuperGlobalsGET, arginfo_stub_assign_testassignsuperglobalsget, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testAssignSuperGlobalsGET, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, issue597, arginfo_stub_assign_issue597, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, issue597, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testAssignSuperGlobals, arginfo_stub_assign_testassignsuperglobals, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testAssignSuperGlobalsSERVER, arginfo_stub_assign_testassignsuperglobalsserver, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testAssignSuperGlobalsGET, arginfo_stub_assign_testassignsuperglobalsget, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, issue597, arginfo_stub_assign_issue597, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/bench/foo.zep.c b/ext/stub/bench/foo.zep.c index 4e3cc024fd..907ea6c1e4 100644 --- a/ext/stub/bench/foo.zep.c +++ b/ext/stub/bench/foo.zep.c @@ -35,23 +35,16 @@ PHP_METHOD(Stub_Bench_Foo, emptyForInRange) zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *n, n_sub, i, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -78,24 +71,17 @@ PHP_METHOD(Stub_Bench_Foo, readStatic) zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *n, n_sub, x, i, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&x); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -124,24 +110,17 @@ PHP_METHOD(Stub_Bench_Foo, writeStatic) zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *n, n_sub, i, _2, _3$$3; - zval *this_ptr = getThis(); ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -157,7 +136,7 @@ PHP_METHOD(Stub_Bench_Foo, writeStatic) } ZEPHIR_INIT_NVAR(&i); ZVAL_LONG(&i, _1); - ZEPHIR_INIT_ZVAL_NREF(_3$$3); + ZVAL_UNDEF(&_3$$3); ZVAL_LONG(&_3$$3, 0); zephir_update_static_property_ce(stub_bench_foo_ce, ZEND_STRL("a"), &_3$$3); } @@ -171,23 +150,16 @@ PHP_METHOD(Stub_Bench_Foo, issetStatic) zend_bool x = 0, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *n, n_sub, i, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -215,24 +187,17 @@ PHP_METHOD(Stub_Bench_Foo, emptyStatic) zend_bool x = 0, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *n, n_sub, i, _2, _3$$3; - zval *this_ptr = getThis(); ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -268,18 +233,12 @@ PHP_METHOD(Stub_Bench_Foo, readProp) ZVAL_UNDEF(&x); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -313,18 +272,12 @@ PHP_METHOD(Stub_Bench_Foo, writeProp) ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -340,7 +293,7 @@ PHP_METHOD(Stub_Bench_Foo, writeProp) } ZEPHIR_INIT_NVAR(&i); ZVAL_LONG(&i, _1); - ZEPHIR_INIT_ZVAL_NREF(_3$$3); + ZVAL_UNDEF(&_3$$3); ZVAL_LONG(&_3$$3, 0); zephir_update_property_zval(this_ptr, ZEND_STRL("b"), &_3$$3); } @@ -361,18 +314,12 @@ PHP_METHOD(Stub_Bench_Foo, assignAddProp) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -425,18 +372,12 @@ PHP_METHOD(Stub_Bench_Foo, postIncProp) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -469,18 +410,12 @@ PHP_METHOD(Stub_Bench_Foo, postDecProp) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -513,18 +448,12 @@ PHP_METHOD(Stub_Bench_Foo, issetProp) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -558,18 +487,12 @@ PHP_METHOD(Stub_Bench_Foo, emptyProp) ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -595,9 +518,6 @@ PHP_METHOD(Stub_Bench_Foo, emptyProp) PHP_METHOD(Stub_Bench_Foo, g) { - zval *this_ptr = getThis(); - - } @@ -613,18 +533,12 @@ PHP_METHOD(Stub_Bench_Foo, call) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -649,17 +563,11 @@ PHP_METHOD(Stub_Bench_Foo, call) PHP_METHOD(Stub_Bench_Foo, staticMethod) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Bench_Foo, staticMethod1) { - zval *this_ptr = getThis(); - - RETURN_BOOL(1); } @@ -671,23 +579,16 @@ PHP_METHOD(Stub_Bench_Foo, scall) zend_long ZEPHIR_LAST_CALL_STATUS, _1; zephir_fcall_cache_entry *_3 = NULL; zval *n, n_sub, i, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -717,23 +618,16 @@ PHP_METHOD(Stub_Bench_Foo, scallWithReturnTrue) zend_long ZEPHIR_LAST_CALL_STATUS, _1; zephir_fcall_cache_entry *_3 = NULL; zval *n, n_sub, i, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; @@ -762,24 +656,17 @@ PHP_METHOD(Stub_Bench_Foo, readConst) zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *n, n_sub, i, x, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&x); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_CPY_WRT(&_2, n); _1 = 1; _0 = 0; diff --git a/ext/stub/bench/foo.zep.h b/ext/stub/bench/foo.zep.h index e138460b1d..a03af29b58 100644 --- a/ext/stub/bench/foo.zep.h +++ b/ext/stub/bench/foo.zep.h @@ -109,11 +109,7 @@ ZEPHIR_INIT_FUNCS(stub_bench_foo_method_entry) { PHP_ME(Stub_Bench_Foo, postDecProp, arginfo_stub_bench_foo_postdecprop, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, issetProp, arginfo_stub_bench_foo_issetprop, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, emptyProp, arginfo_stub_bench_foo_emptyprop, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bench_Foo, g, arginfo_stub_bench_foo_g, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bench_Foo, g, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Bench_Foo, g, arginfo_stub_bench_foo_g, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, call, arginfo_stub_bench_foo_call, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, staticMethod, arginfo_stub_bench_foo_staticmethod, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, staticMethod1, arginfo_stub_bench_foo_staticmethod1, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) diff --git a/ext/stub/bitwise.zep.c b/ext/stub/bitwise.zep.c index 8e36c8a37f..1c99fb069c 100644 --- a/ext/stub/bitwise.zep.c +++ b/ext/stub/bitwise.zep.c @@ -31,11 +31,6 @@ ZEPHIR_INIT_CLASS(Stub_Bitwise) PHP_METHOD(Stub_Bitwise, intAnd) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a & b); @@ -45,11 +40,6 @@ PHP_METHOD(Stub_Bitwise, intAnd) PHP_METHOD(Stub_Bitwise, int2And) { zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (a & 2); RETURN_LONG(c); @@ -58,11 +48,6 @@ PHP_METHOD(Stub_Bitwise, int2And) PHP_METHOD(Stub_Bitwise, intAndSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 0; RETURN_LONG(c); } @@ -70,11 +55,6 @@ PHP_METHOD(Stub_Bitwise, intAndSimple) PHP_METHOD(Stub_Bitwise, boolAnd) { zend_bool a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = ((2) ? 1 : 0); c = (((a & b)) ? 1 : 0); @@ -84,11 +64,6 @@ PHP_METHOD(Stub_Bitwise, boolAnd) PHP_METHOD(Stub_Bitwise, bool2And) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); c = (((a & 2)) ? 1 : 0); RETURN_BOOL(c); @@ -97,11 +72,6 @@ PHP_METHOD(Stub_Bitwise, bool2And) PHP_METHOD(Stub_Bitwise, bool3And) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (((a & 0)) ? 1 : 0); RETURN_BOOL(c); @@ -110,11 +80,6 @@ PHP_METHOD(Stub_Bitwise, bool3And) PHP_METHOD(Stub_Bitwise, boolAndSimple) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = ((0) ? 1 : 0); RETURN_BOOL(c); } @@ -122,11 +87,6 @@ PHP_METHOD(Stub_Bitwise, boolAndSimple) PHP_METHOD(Stub_Bitwise, doubleAnd) { double a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = (double) (2); c = (double) (((int) (a) & (int) (b))); @@ -136,13 +96,8 @@ PHP_METHOD(Stub_Bitwise, doubleAnd) PHP_METHOD(Stub_Bitwise, double2And) { double a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - - a = 1.0; - b = 2.0; + a = (1.0); + b = (2.0); c = (double) (((int) (a) & (int) (b))); RETURN_DOUBLE(c); } @@ -150,11 +105,6 @@ PHP_METHOD(Stub_Bitwise, double2And) PHP_METHOD(Stub_Bitwise, doubleAndSimple) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (0); RETURN_DOUBLE(c); } @@ -162,11 +112,6 @@ PHP_METHOD(Stub_Bitwise, doubleAndSimple) PHP_METHOD(Stub_Bitwise, doubleAnd2Simple) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (0.0); RETURN_DOUBLE(c); } @@ -174,11 +119,6 @@ PHP_METHOD(Stub_Bitwise, doubleAnd2Simple) PHP_METHOD(Stub_Bitwise, varAnd) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a & b); @@ -188,11 +128,6 @@ PHP_METHOD(Stub_Bitwise, varAnd) PHP_METHOD(Stub_Bitwise, varAndSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 0; RETURN_LONG(c); } @@ -201,11 +136,6 @@ PHP_METHOD(Stub_Bitwise, intDoubleAnd) { double a = 0; zend_long b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = 2; c = ((int) (a) & b); @@ -215,11 +145,6 @@ PHP_METHOD(Stub_Bitwise, intDoubleAnd) PHP_METHOD(Stub_Bitwise, intDoubleAndSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 0; RETURN_LONG(c); } @@ -228,11 +153,6 @@ PHP_METHOD(Stub_Bitwise, doubleIntAnd) { double a = 0, c = 0; zend_long b = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = 2; c = (double) (((int) (a) & b)); @@ -242,11 +162,6 @@ PHP_METHOD(Stub_Bitwise, doubleIntAnd) PHP_METHOD(Stub_Bitwise, doubleIntAndSimple) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (0); RETURN_DOUBLE(c); } @@ -254,11 +169,6 @@ PHP_METHOD(Stub_Bitwise, doubleIntAndSimple) PHP_METHOD(Stub_Bitwise, varIntAnd) { zend_long b = 0, c = 0, a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a & b); @@ -268,11 +178,6 @@ PHP_METHOD(Stub_Bitwise, varIntAnd) PHP_METHOD(Stub_Bitwise, intVarAnd) { zend_long b = 0, c = 0, a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (b & a); @@ -284,14 +189,12 @@ PHP_METHOD(Stub_Bitwise, intVarImplicitCastAnd) zend_long c = 0; zval a, b, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "1"); @@ -308,12 +211,10 @@ PHP_METHOD(Stub_Bitwise, intVarImplicitCast2And) zend_long b = 0, c = 0; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "1"); @@ -325,11 +226,6 @@ PHP_METHOD(Stub_Bitwise, intVarImplicitCast2And) PHP_METHOD(Stub_Bitwise, complexAnd) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (0); RETURN_DOUBLE(c); } @@ -337,11 +233,6 @@ PHP_METHOD(Stub_Bitwise, complexAnd) PHP_METHOD(Stub_Bitwise, complex2And) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 & 1)) ? 1 : 0); RETURN_BOOL(c); } @@ -349,11 +240,6 @@ PHP_METHOD(Stub_Bitwise, complex2And) PHP_METHOD(Stub_Bitwise, complex3And) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 &((1.0) ? 1 : 0))) ? 1 : 0); RETURN_BOOL(c); } @@ -362,12 +248,10 @@ PHP_METHOD(Stub_Bitwise, complex4And) { zval c; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&c); ZVAL_LONG(&c, ((int) (1.0) & 1)); @@ -377,11 +261,6 @@ PHP_METHOD(Stub_Bitwise, complex4And) PHP_METHOD(Stub_Bitwise, complex5And) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = (1 & 1); RETURN_LONG(c); } @@ -389,11 +268,6 @@ PHP_METHOD(Stub_Bitwise, complex5And) PHP_METHOD(Stub_Bitwise, complex6And) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 &((1) ? 1 : 0))) ? 1 : 0); RETURN_BOOL(c); } @@ -402,11 +276,6 @@ PHP_METHOD(Stub_Bitwise, complex7And) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = 2; c = (a & b); @@ -417,11 +286,6 @@ PHP_METHOD(Stub_Bitwise, complex9And) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = 2; c = (b & a); @@ -433,11 +297,6 @@ PHP_METHOD(Stub_Bitwise, complex10And) double c = 0; zend_long b = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1.0 != 0.0) ? 1 : 0); b = 2; c = (double) ((b & a)); @@ -449,11 +308,6 @@ PHP_METHOD(Stub_Bitwise, complex11And) double c = 0; zend_long b = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = (long) (2.0); c = (double) ((b & a)); @@ -464,11 +318,6 @@ PHP_METHOD(Stub_Bitwise, complex12And) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = (long) (2.0); c = (b & a); @@ -479,11 +328,6 @@ PHP_METHOD(Stub_Bitwise, complex13And) { zend_long c = 0; zend_bool a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = ((2.0 != 0.0) ? 1 : 0); c = (b & a); @@ -494,11 +338,6 @@ PHP_METHOD(Stub_Bitwise, complex14And) { zend_bool b = 0; zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); c = (b & a); @@ -510,13 +349,8 @@ PHP_METHOD(Stub_Bitwise, complex15And) zend_bool c = 0; double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; - b = 2.0; + b = (2.0); c = ((((int) (b) & a)) ? 1 : 0); RETURN_BOOL(c); } @@ -525,13 +359,8 @@ PHP_METHOD(Stub_Bitwise, complex16And) { double b = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; - b = 2.0; + b = (2.0); c = (double) (((int) (b) & a)); RETURN_DOUBLE(c); } @@ -541,11 +370,6 @@ PHP_METHOD(Stub_Bitwise, complex17And) double c = 0; zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); c = (double) ((a & b)); @@ -557,11 +381,6 @@ PHP_METHOD(Stub_Bitwise, complex18And) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a & b)); @@ -574,11 +393,6 @@ PHP_METHOD(Stub_Bitwise, complex19And) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a & b)); @@ -591,11 +405,6 @@ PHP_METHOD(Stub_Bitwise, complex20And) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a & b)); @@ -608,11 +417,6 @@ PHP_METHOD(Stub_Bitwise, complex21And) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a & b)); @@ -624,11 +428,6 @@ PHP_METHOD(Stub_Bitwise, complex22And) { double d = 0, c = 0; zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = (long) (2.0); d = (double) ((a & b)); @@ -641,11 +440,6 @@ PHP_METHOD(Stub_Bitwise, complex23And) double d = 0; zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a & b)); @@ -656,11 +450,6 @@ PHP_METHOD(Stub_Bitwise, complex24And) { zend_bool b = 0; zend_long a = 0, d = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (1 & (a & ((int) (0) & b))); @@ -670,11 +459,6 @@ PHP_METHOD(Stub_Bitwise, complex24And) PHP_METHOD(Stub_Bitwise, intOr) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a | b); @@ -684,11 +468,6 @@ PHP_METHOD(Stub_Bitwise, intOr) PHP_METHOD(Stub_Bitwise, int2Or) { zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (a | 2); RETURN_LONG(c); @@ -697,11 +476,6 @@ PHP_METHOD(Stub_Bitwise, int2Or) PHP_METHOD(Stub_Bitwise, intOrSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 3; RETURN_LONG(c); } @@ -709,11 +483,6 @@ PHP_METHOD(Stub_Bitwise, intOrSimple) PHP_METHOD(Stub_Bitwise, boolOr) { zend_bool a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = ((2) ? 1 : 0); c = (((a | b)) ? 1 : 0); @@ -723,11 +492,6 @@ PHP_METHOD(Stub_Bitwise, boolOr) PHP_METHOD(Stub_Bitwise, bool2Or) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); c = (((a | 2)) ? 1 : 0); RETURN_BOOL(c); @@ -736,11 +500,6 @@ PHP_METHOD(Stub_Bitwise, bool2Or) PHP_METHOD(Stub_Bitwise, bool3Or) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (((a | 0)) ? 1 : 0); RETURN_BOOL(c); @@ -749,11 +508,6 @@ PHP_METHOD(Stub_Bitwise, bool3Or) PHP_METHOD(Stub_Bitwise, bool4Or) { zend_bool a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (((a | 1)) ? 1 : 0); RETURN_BOOL(c); @@ -762,11 +516,6 @@ PHP_METHOD(Stub_Bitwise, bool4Or) PHP_METHOD(Stub_Bitwise, boolOrSimple) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = ((3) ? 1 : 0); RETURN_BOOL(c); } @@ -774,11 +523,6 @@ PHP_METHOD(Stub_Bitwise, boolOrSimple) PHP_METHOD(Stub_Bitwise, doubleOr) { double a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = (double) (2); c = (double) (((int) (a) | (int) (b))); @@ -788,13 +532,8 @@ PHP_METHOD(Stub_Bitwise, doubleOr) PHP_METHOD(Stub_Bitwise, double2Or) { double a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - - a = 1.0; - b = 2.0; + a = (1.0); + b = (2.0); c = (double) (((int) (a) | (int) (b))); RETURN_DOUBLE(c); } @@ -802,11 +541,6 @@ PHP_METHOD(Stub_Bitwise, double2Or) PHP_METHOD(Stub_Bitwise, doubleOrSimple) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (3); RETURN_DOUBLE(c); } @@ -814,11 +548,6 @@ PHP_METHOD(Stub_Bitwise, doubleOrSimple) PHP_METHOD(Stub_Bitwise, doubleOr2Simple) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (3.0); RETURN_DOUBLE(c); } @@ -826,11 +555,6 @@ PHP_METHOD(Stub_Bitwise, doubleOr2Simple) PHP_METHOD(Stub_Bitwise, varOr) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a | b); @@ -840,11 +564,6 @@ PHP_METHOD(Stub_Bitwise, varOr) PHP_METHOD(Stub_Bitwise, varOrSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 3; RETURN_LONG(c); } @@ -853,11 +572,6 @@ PHP_METHOD(Stub_Bitwise, intDoubleOr) { double a = 0; zend_long b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = 2; c = ((int) (a) | b); @@ -867,11 +581,6 @@ PHP_METHOD(Stub_Bitwise, intDoubleOr) PHP_METHOD(Stub_Bitwise, intDoubleOrSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 3.0; RETURN_LONG(c); } @@ -880,11 +589,6 @@ PHP_METHOD(Stub_Bitwise, doubleIntOr) { double a = 0, c = 0; zend_long b = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); b = 2; c = (double) (((int) (a) | b)); @@ -894,11 +598,6 @@ PHP_METHOD(Stub_Bitwise, doubleIntOr) PHP_METHOD(Stub_Bitwise, doubleIntOrSimple) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (3.0); RETURN_DOUBLE(c); } @@ -906,11 +605,6 @@ PHP_METHOD(Stub_Bitwise, doubleIntOrSimple) PHP_METHOD(Stub_Bitwise, varIntOr) { zend_long b = 0, c = 0, a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a | b); @@ -920,11 +614,6 @@ PHP_METHOD(Stub_Bitwise, varIntOr) PHP_METHOD(Stub_Bitwise, intVarOr) { zend_long b = 0, c = 0, a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (b | a); @@ -936,14 +625,12 @@ PHP_METHOD(Stub_Bitwise, intVarImplicitCastOr) zend_long c = 0; zval a, b, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "1"); @@ -960,12 +647,10 @@ PHP_METHOD(Stub_Bitwise, intVarImplicitCast2Or) zend_long b = 0, c = 0; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "1"); @@ -977,11 +662,6 @@ PHP_METHOD(Stub_Bitwise, intVarImplicitCast2Or) PHP_METHOD(Stub_Bitwise, complexOr) { double c = 0; - zval *this_ptr = getThis(); - - - - c = (double) (3.0); RETURN_DOUBLE(c); } @@ -989,11 +669,6 @@ PHP_METHOD(Stub_Bitwise, complexOr) PHP_METHOD(Stub_Bitwise, complex2Or) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 | 1)) ? 1 : 0); RETURN_BOOL(c); } @@ -1001,11 +676,6 @@ PHP_METHOD(Stub_Bitwise, complex2Or) PHP_METHOD(Stub_Bitwise, complex3Or) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 |((1.0) ? 1 : 0))) ? 1 : 0); RETURN_BOOL(c); } @@ -1014,12 +684,10 @@ PHP_METHOD(Stub_Bitwise, complex4Or) { zval c; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&c); ZVAL_LONG(&c, ((int) (1.0) | 1)); @@ -1029,11 +697,6 @@ PHP_METHOD(Stub_Bitwise, complex4Or) PHP_METHOD(Stub_Bitwise, complex5Or) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = (1 | 1); RETURN_LONG(c); } @@ -1041,11 +704,6 @@ PHP_METHOD(Stub_Bitwise, complex5Or) PHP_METHOD(Stub_Bitwise, complex6Or) { zend_bool c = 0; - zval *this_ptr = getThis(); - - - - c = (((1 |((1) ? 1 : 0))) ? 1 : 0); RETURN_BOOL(c); } @@ -1054,11 +712,6 @@ PHP_METHOD(Stub_Bitwise, complex7Or) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = 2; c = (a | b); @@ -1069,11 +722,6 @@ PHP_METHOD(Stub_Bitwise, complex9Or) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = 2; c = (b | a); @@ -1085,11 +733,6 @@ PHP_METHOD(Stub_Bitwise, complex10Or) double c = 0; zend_long b = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1.0 != 0.0) ? 1 : 0); b = 2; c = (double) ((b | a)); @@ -1101,11 +744,6 @@ PHP_METHOD(Stub_Bitwise, complex11Or) double c = 0; zend_long b = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = (long) (2.0); c = (double) ((b | a)); @@ -1116,11 +754,6 @@ PHP_METHOD(Stub_Bitwise, complex12Or) { zend_long b = 0, c = 0; zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = (long) (2.0); c = (b | a); @@ -1131,11 +764,6 @@ PHP_METHOD(Stub_Bitwise, complex13Or) { zend_long c = 0; zend_bool a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); b = ((2.0 != 0.0) ? 1 : 0); c = (b | a); @@ -1146,11 +774,6 @@ PHP_METHOD(Stub_Bitwise, complex14Or) { zend_bool b = 0; zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); c = (b | a); @@ -1162,13 +785,8 @@ PHP_METHOD(Stub_Bitwise, complex15Or) zend_bool c = 0; double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; - b = 2.0; + b = (2.0); c = ((((int) (b) | a)) ? 1 : 0); RETURN_BOOL(c); } @@ -1177,13 +795,8 @@ PHP_METHOD(Stub_Bitwise, complex16Or) { double b = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; - b = 2.0; + b = (2.0); c = (double) (((int) (b) | a)); RETURN_DOUBLE(c); } @@ -1193,11 +806,6 @@ PHP_METHOD(Stub_Bitwise, complex17Or) double c = 0; zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); c = (double) ((a | b)); @@ -1209,11 +817,6 @@ PHP_METHOD(Stub_Bitwise, complex18Or) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a | b)); @@ -1226,11 +829,6 @@ PHP_METHOD(Stub_Bitwise, complex19Or) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a | b)); @@ -1243,11 +841,6 @@ PHP_METHOD(Stub_Bitwise, complex20Or) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a | b)); @@ -1260,11 +853,6 @@ PHP_METHOD(Stub_Bitwise, complex21Or) zend_bool b = 0; double d = 0, c = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a | b)); @@ -1276,11 +864,6 @@ PHP_METHOD(Stub_Bitwise, complex22Or) { double d = 0, c = 0; zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = (long) (2.0); d = (double) ((a | b)); @@ -1293,11 +876,6 @@ PHP_METHOD(Stub_Bitwise, complex23Or) double d = 0; zend_bool b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((a | b)); @@ -1309,11 +887,6 @@ PHP_METHOD(Stub_Bitwise, complex24Or) zend_bool b = 0; double d = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = ((2.0 != 0.0) ? 1 : 0); d = (double) ((((1 | a) | 0) | b)); @@ -1323,11 +896,6 @@ PHP_METHOD(Stub_Bitwise, complex24Or) PHP_METHOD(Stub_Bitwise, intShiftLeft) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a << b); @@ -1337,11 +905,6 @@ PHP_METHOD(Stub_Bitwise, intShiftLeft) PHP_METHOD(Stub_Bitwise, int2ShiftLeft) { zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (a << 2); RETURN_LONG(c); @@ -1350,11 +913,6 @@ PHP_METHOD(Stub_Bitwise, int2ShiftLeft) PHP_METHOD(Stub_Bitwise, intShiftLeftSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 4; RETURN_LONG(c); } @@ -1362,11 +920,6 @@ PHP_METHOD(Stub_Bitwise, intShiftLeftSimple) PHP_METHOD(Stub_Bitwise, intShiftRight) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = (a >> b); @@ -1376,11 +929,6 @@ PHP_METHOD(Stub_Bitwise, intShiftRight) PHP_METHOD(Stub_Bitwise, int2ShiftRight) { zend_long a = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; c = (a >> 2); RETURN_LONG(c); @@ -1389,11 +937,6 @@ PHP_METHOD(Stub_Bitwise, int2ShiftRight) PHP_METHOD(Stub_Bitwise, intShiftRightSimple) { zend_long c = 0; - zval *this_ptr = getThis(); - - - - c = 0; RETURN_LONG(c); } @@ -1402,20 +945,11 @@ PHP_METHOD(Stub_Bitwise, testBitwiseNot) { zval *a_param = NULL; zend_long a; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a_param); - a = zephir_get_intval(a_param); - - RETURN_LONG(~a); } @@ -1423,22 +957,12 @@ PHP_METHOD(Stub_Bitwise, testBitwiseAndNot) { zval *a_param = NULL, *b_param = NULL; zend_long a, b; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - RETURN_LONG((a & ~b)); } @@ -1446,20 +970,11 @@ PHP_METHOD(Stub_Bitwise, getInt) { zval *num_param = NULL; zend_long num; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - RETURN_LONG(num); } @@ -1476,9 +991,8 @@ PHP_METHOD(Stub_Bitwise, testbitwiseXor) ZVAL_UNDEF(&i); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&j); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 123); ZEPHIR_CALL_METHOD(&i, this_ptr, "getint", NULL, 0, &_0); diff --git a/ext/stub/bitwise.zep.h b/ext/stub/bitwise.zep.h index cc94f5ccdc..7aebc38e11 100644 --- a/ext/stub/bitwise.zep.h +++ b/ext/stub/bitwise.zep.h @@ -405,488 +405,104 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_bitwise_testbitwisexor, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_bitwise_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intAnd, arginfo_stub_bitwise_intand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, int2And, arginfo_stub_bitwise_int2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, int2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intAndSimple, arginfo_stub_bitwise_intandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, boolAnd, arginfo_stub_bitwise_booland, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, boolAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool2And, arginfo_stub_bitwise_bool2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool3And, arginfo_stub_bitwise_bool3and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool3And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, boolAndSimple, arginfo_stub_bitwise_boolandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, boolAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleAnd, arginfo_stub_bitwise_doubleand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, double2And, arginfo_stub_bitwise_double2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, double2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleAndSimple, arginfo_stub_bitwise_doubleandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleAnd2Simple, arginfo_stub_bitwise_doubleand2simple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleAnd2Simple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varAnd, arginfo_stub_bitwise_varand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varAndSimple, arginfo_stub_bitwise_varandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intDoubleAnd, arginfo_stub_bitwise_intdoubleand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intDoubleAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intDoubleAndSimple, arginfo_stub_bitwise_intdoubleandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intDoubleAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleIntAnd, arginfo_stub_bitwise_doubleintand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleIntAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleIntAndSimple, arginfo_stub_bitwise_doubleintandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleIntAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varIntAnd, arginfo_stub_bitwise_varintand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varIntAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarAnd, arginfo_stub_bitwise_intvarand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarImplicitCastAnd, arginfo_stub_bitwise_intvarimplicitcastand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarImplicitCastAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarImplicitCast2And, arginfo_stub_bitwise_intvarimplicitcast2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarImplicitCast2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complexAnd, arginfo_stub_bitwise_complexand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complexAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex2And, arginfo_stub_bitwise_complex2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex3And, arginfo_stub_bitwise_complex3and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex3And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex4And, arginfo_stub_bitwise_complex4and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex4And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex5And, arginfo_stub_bitwise_complex5and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex5And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex6And, arginfo_stub_bitwise_complex6and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex6And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex7And, arginfo_stub_bitwise_complex7and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex7And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex9And, arginfo_stub_bitwise_complex9and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex9And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex10And, arginfo_stub_bitwise_complex10and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex10And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex11And, arginfo_stub_bitwise_complex11and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex11And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex12And, arginfo_stub_bitwise_complex12and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex12And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex13And, arginfo_stub_bitwise_complex13and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex13And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex14And, arginfo_stub_bitwise_complex14and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex14And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex15And, arginfo_stub_bitwise_complex15and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex15And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex16And, arginfo_stub_bitwise_complex16and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex16And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex17And, arginfo_stub_bitwise_complex17and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex17And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex18And, arginfo_stub_bitwise_complex18and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex18And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex19And, arginfo_stub_bitwise_complex19and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex19And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex20And, arginfo_stub_bitwise_complex20and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex20And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex21And, arginfo_stub_bitwise_complex21and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex21And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex22And, arginfo_stub_bitwise_complex22and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex22And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex23And, arginfo_stub_bitwise_complex23and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex23And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex24And, arginfo_stub_bitwise_complex24and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex24And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intOr, arginfo_stub_bitwise_intor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, int2Or, arginfo_stub_bitwise_int2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, int2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intOrSimple, arginfo_stub_bitwise_intorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, boolOr, arginfo_stub_bitwise_boolor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, boolOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool2Or, arginfo_stub_bitwise_bool2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool3Or, arginfo_stub_bitwise_bool3or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool3Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool4Or, arginfo_stub_bitwise_bool4or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool4Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, boolOrSimple, arginfo_stub_bitwise_boolorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, boolOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleOr, arginfo_stub_bitwise_doubleor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, double2Or, arginfo_stub_bitwise_double2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, double2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleOrSimple, arginfo_stub_bitwise_doubleorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleOr2Simple, arginfo_stub_bitwise_doubleor2simple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleOr2Simple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varOr, arginfo_stub_bitwise_varor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varOrSimple, arginfo_stub_bitwise_varorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intDoubleOr, arginfo_stub_bitwise_intdoubleor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intDoubleOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intDoubleOrSimple, arginfo_stub_bitwise_intdoubleorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intDoubleOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleIntOr, arginfo_stub_bitwise_doubleintor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleIntOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleIntOrSimple, arginfo_stub_bitwise_doubleintorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleIntOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varIntOr, arginfo_stub_bitwise_varintor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varIntOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarOr, arginfo_stub_bitwise_intvaror, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarImplicitCastOr, arginfo_stub_bitwise_intvarimplicitcastor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarImplicitCastOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarImplicitCast2Or, arginfo_stub_bitwise_intvarimplicitcast2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarImplicitCast2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complexOr, arginfo_stub_bitwise_complexor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complexOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex2Or, arginfo_stub_bitwise_complex2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex3Or, arginfo_stub_bitwise_complex3or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex3Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex4Or, arginfo_stub_bitwise_complex4or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex4Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex5Or, arginfo_stub_bitwise_complex5or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex5Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex6Or, arginfo_stub_bitwise_complex6or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex6Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex7Or, arginfo_stub_bitwise_complex7or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex7Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex9Or, arginfo_stub_bitwise_complex9or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex9Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex10Or, arginfo_stub_bitwise_complex10or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex10Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex11Or, arginfo_stub_bitwise_complex11or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex11Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex12Or, arginfo_stub_bitwise_complex12or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex12Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex13Or, arginfo_stub_bitwise_complex13or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex13Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex14Or, arginfo_stub_bitwise_complex14or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex14Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex15Or, arginfo_stub_bitwise_complex15or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex15Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex16Or, arginfo_stub_bitwise_complex16or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex16Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex17Or, arginfo_stub_bitwise_complex17or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex17Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex18Or, arginfo_stub_bitwise_complex18or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex18Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex19Or, arginfo_stub_bitwise_complex19or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex19Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex20Or, arginfo_stub_bitwise_complex20or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex20Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex21Or, arginfo_stub_bitwise_complex21or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex21Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex22Or, arginfo_stub_bitwise_complex22or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex22Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex23Or, arginfo_stub_bitwise_complex23or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex23Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex24Or, arginfo_stub_bitwise_complex24or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex24Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intShiftLeft, arginfo_stub_bitwise_intshiftleft, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intShiftLeft, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, int2ShiftLeft, arginfo_stub_bitwise_int2shiftleft, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, int2ShiftLeft, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intShiftLeftSimple, arginfo_stub_bitwise_intshiftleftsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intShiftLeftSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intShiftRight, arginfo_stub_bitwise_intshiftright, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intShiftRight, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, int2ShiftRight, arginfo_stub_bitwise_int2shiftright, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, int2ShiftRight, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intShiftRightSimple, arginfo_stub_bitwise_intshiftrightsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intShiftRightSimple, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Bitwise, intAnd, arginfo_stub_bitwise_intand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, int2And, arginfo_stub_bitwise_int2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intAndSimple, arginfo_stub_bitwise_intandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, boolAnd, arginfo_stub_bitwise_booland, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool2And, arginfo_stub_bitwise_bool2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool3And, arginfo_stub_bitwise_bool3and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, boolAndSimple, arginfo_stub_bitwise_boolandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleAnd, arginfo_stub_bitwise_doubleand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, double2And, arginfo_stub_bitwise_double2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleAndSimple, arginfo_stub_bitwise_doubleandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleAnd2Simple, arginfo_stub_bitwise_doubleand2simple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varAnd, arginfo_stub_bitwise_varand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varAndSimple, arginfo_stub_bitwise_varandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intDoubleAnd, arginfo_stub_bitwise_intdoubleand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intDoubleAndSimple, arginfo_stub_bitwise_intdoubleandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleIntAnd, arginfo_stub_bitwise_doubleintand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleIntAndSimple, arginfo_stub_bitwise_doubleintandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varIntAnd, arginfo_stub_bitwise_varintand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarAnd, arginfo_stub_bitwise_intvarand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarImplicitCastAnd, arginfo_stub_bitwise_intvarimplicitcastand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarImplicitCast2And, arginfo_stub_bitwise_intvarimplicitcast2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complexAnd, arginfo_stub_bitwise_complexand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex2And, arginfo_stub_bitwise_complex2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex3And, arginfo_stub_bitwise_complex3and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex4And, arginfo_stub_bitwise_complex4and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex5And, arginfo_stub_bitwise_complex5and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex6And, arginfo_stub_bitwise_complex6and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex7And, arginfo_stub_bitwise_complex7and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex9And, arginfo_stub_bitwise_complex9and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex10And, arginfo_stub_bitwise_complex10and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex11And, arginfo_stub_bitwise_complex11and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex12And, arginfo_stub_bitwise_complex12and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex13And, arginfo_stub_bitwise_complex13and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex14And, arginfo_stub_bitwise_complex14and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex15And, arginfo_stub_bitwise_complex15and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex16And, arginfo_stub_bitwise_complex16and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex17And, arginfo_stub_bitwise_complex17and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex18And, arginfo_stub_bitwise_complex18and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex19And, arginfo_stub_bitwise_complex19and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex20And, arginfo_stub_bitwise_complex20and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex21And, arginfo_stub_bitwise_complex21and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex22And, arginfo_stub_bitwise_complex22and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex23And, arginfo_stub_bitwise_complex23and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex24And, arginfo_stub_bitwise_complex24and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intOr, arginfo_stub_bitwise_intor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, int2Or, arginfo_stub_bitwise_int2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intOrSimple, arginfo_stub_bitwise_intorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, boolOr, arginfo_stub_bitwise_boolor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool2Or, arginfo_stub_bitwise_bool2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool3Or, arginfo_stub_bitwise_bool3or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool4Or, arginfo_stub_bitwise_bool4or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, boolOrSimple, arginfo_stub_bitwise_boolorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleOr, arginfo_stub_bitwise_doubleor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, double2Or, arginfo_stub_bitwise_double2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleOrSimple, arginfo_stub_bitwise_doubleorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleOr2Simple, arginfo_stub_bitwise_doubleor2simple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varOr, arginfo_stub_bitwise_varor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varOrSimple, arginfo_stub_bitwise_varorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intDoubleOr, arginfo_stub_bitwise_intdoubleor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intDoubleOrSimple, arginfo_stub_bitwise_intdoubleorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleIntOr, arginfo_stub_bitwise_doubleintor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleIntOrSimple, arginfo_stub_bitwise_doubleintorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varIntOr, arginfo_stub_bitwise_varintor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarOr, arginfo_stub_bitwise_intvaror, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarImplicitCastOr, arginfo_stub_bitwise_intvarimplicitcastor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarImplicitCast2Or, arginfo_stub_bitwise_intvarimplicitcast2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complexOr, arginfo_stub_bitwise_complexor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex2Or, arginfo_stub_bitwise_complex2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex3Or, arginfo_stub_bitwise_complex3or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex4Or, arginfo_stub_bitwise_complex4or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex5Or, arginfo_stub_bitwise_complex5or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex6Or, arginfo_stub_bitwise_complex6or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex7Or, arginfo_stub_bitwise_complex7or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex9Or, arginfo_stub_bitwise_complex9or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex10Or, arginfo_stub_bitwise_complex10or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex11Or, arginfo_stub_bitwise_complex11or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex12Or, arginfo_stub_bitwise_complex12or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex13Or, arginfo_stub_bitwise_complex13or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex14Or, arginfo_stub_bitwise_complex14or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex15Or, arginfo_stub_bitwise_complex15or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex16Or, arginfo_stub_bitwise_complex16or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex17Or, arginfo_stub_bitwise_complex17or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex18Or, arginfo_stub_bitwise_complex18or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex19Or, arginfo_stub_bitwise_complex19or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex20Or, arginfo_stub_bitwise_complex20or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex21Or, arginfo_stub_bitwise_complex21or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex22Or, arginfo_stub_bitwise_complex22or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex23Or, arginfo_stub_bitwise_complex23or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex24Or, arginfo_stub_bitwise_complex24or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intShiftLeft, arginfo_stub_bitwise_intshiftleft, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, int2ShiftLeft, arginfo_stub_bitwise_int2shiftleft, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intShiftLeftSimple, arginfo_stub_bitwise_intshiftleftsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intShiftRight, arginfo_stub_bitwise_intshiftright, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, int2ShiftRight, arginfo_stub_bitwise_int2shiftright, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intShiftRightSimple, arginfo_stub_bitwise_intshiftrightsimple, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bitwise, testBitwiseNot, arginfo_stub_bitwise_testbitwisenot, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bitwise, testBitwiseAndNot, arginfo_stub_bitwise_testbitwiseandnot, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bitwise, getInt, arginfo_stub_bitwise_getint, ZEND_ACC_PROTECTED) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, testbitwiseXor, arginfo_stub_bitwise_testbitwisexor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, testbitwiseXor, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Bitwise, testbitwiseXor, arginfo_stub_bitwise_testbitwisexor, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/branchprediction.zep.c b/ext/stub/branchprediction.zep.c index b0015f76f7..59467964bf 100644 --- a/ext/stub/branchprediction.zep.c +++ b/ext/stub/branchprediction.zep.c @@ -29,9 +29,6 @@ ZEPHIR_INIT_CLASS(Stub_BranchPrediction) PHP_METHOD(Stub_BranchPrediction, testLikely1) { - zval *this_ptr = getThis(); - - if (EXPECTED(1 == 1)) { RETURN_BOOL(1); @@ -43,20 +40,12 @@ PHP_METHOD(Stub_BranchPrediction, testLikely1) PHP_METHOD(Stub_BranchPrediction, testLikely2) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - if (EXPECTED(ZEPHIR_IS_LONG_IDENTICAL(a, 1))) { RETURN_BOOL(1); } else { @@ -66,9 +55,6 @@ PHP_METHOD(Stub_BranchPrediction, testLikely2) PHP_METHOD(Stub_BranchPrediction, testUnlikely1) { - zval *this_ptr = getThis(); - - if (EXPECTED(1 == 1)) { RETURN_BOOL(1); @@ -80,20 +66,12 @@ PHP_METHOD(Stub_BranchPrediction, testUnlikely1) PHP_METHOD(Stub_BranchPrediction, testUnlikely2) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - if (EXPECTED(ZEPHIR_IS_LONG_IDENTICAL(a, 1))) { RETURN_BOOL(1); } else { diff --git a/ext/stub/branchprediction.zep.h b/ext/stub/branchprediction.zep.h index 7ba6de0329..51baccee75 100644 --- a/ext/stub/branchprediction.zep.h +++ b/ext/stub/branchprediction.zep.h @@ -23,17 +23,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_branchprediction_testunlikely2, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_branchprediction_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BranchPrediction, testLikely1, arginfo_stub_branchprediction_testlikely1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BranchPrediction, testLikely1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BranchPrediction, testLikely1, arginfo_stub_branchprediction_testlikely1, ZEND_ACC_PUBLIC) PHP_ME(Stub_BranchPrediction, testLikely2, arginfo_stub_branchprediction_testlikely2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BranchPrediction, testUnlikely1, arginfo_stub_branchprediction_testunlikely1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BranchPrediction, testUnlikely1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BranchPrediction, testUnlikely1, arginfo_stub_branchprediction_testunlikely1, ZEND_ACC_PUBLIC) PHP_ME(Stub_BranchPrediction, testUnlikely2, arginfo_stub_branchprediction_testunlikely2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/builtin/arraymethods.zep.c b/ext/stub/builtin/arraymethods.zep.c index 1da502c2cf..b41f79ce82 100644 --- a/ext/stub/builtin/arraymethods.zep.c +++ b/ext/stub/builtin/arraymethods.zep.c @@ -31,13 +31,11 @@ PHP_METHOD(Stub_BuiltIn_ArrayMethods, getJoin1) zval _1; zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 3, 0); @@ -61,14 +59,12 @@ PHP_METHOD(Stub_BuiltIn_ArrayMethods, getReversed1) zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 3, 0); @@ -92,14 +88,12 @@ PHP_METHOD(Stub_BuiltIn_ArrayMethods, getMap1) zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 3, 0); diff --git a/ext/stub/builtin/arraymethods.zep.h b/ext/stub/builtin/arraymethods.zep.h index 1e49dcbfc5..74d59029af 100644 --- a/ext/stub/builtin/arraymethods.zep.h +++ b/ext/stub/builtin/arraymethods.zep.h @@ -17,20 +17,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_builtin_arraymethods_getmap1, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_builtin_arraymethods_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_ArrayMethods, getJoin1, arginfo_stub_builtin_arraymethods_getjoin1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_ArrayMethods, getJoin1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_ArrayMethods, getReversed1, arginfo_stub_builtin_arraymethods_getreversed1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_ArrayMethods, getReversed1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_ArrayMethods, getMap1, arginfo_stub_builtin_arraymethods_getmap1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_ArrayMethods, getMap1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_ArrayMethods, getJoin1, arginfo_stub_builtin_arraymethods_getjoin1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_BuiltIn_ArrayMethods, getReversed1, arginfo_stub_builtin_arraymethods_getreversed1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_BuiltIn_ArrayMethods, getMap1, arginfo_stub_builtin_arraymethods_getmap1, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/builtin/charmethods.zep.c b/ext/stub/builtin/charmethods.zep.c index 0b7ec11017..b597545b34 100644 --- a/ext/stub/builtin/charmethods.zep.c +++ b/ext/stub/builtin/charmethods.zep.c @@ -29,13 +29,11 @@ PHP_METHOD(Stub_BuiltIn_CharMethods, getHex) { zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_VAR(&_1); @@ -51,26 +49,19 @@ PHP_METHOD(Stub_BuiltIn_CharMethods, getHexForString) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, o, _1$$3, _2$$3, _3$$3; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&o); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - ZEPHIR_INIT_VAR(&o); ZVAL_STRING(&o, ""); for (_0 = 0; _0 < Z_STRLEN_P(&str); _0++) { diff --git a/ext/stub/builtin/charmethods.zep.h b/ext/stub/builtin/charmethods.zep.h index f3576f4dcb..5e2da73c06 100644 --- a/ext/stub/builtin/charmethods.zep.h +++ b/ext/stub/builtin/charmethods.zep.h @@ -14,11 +14,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_builtin_charmethods_gethexforstring, 0, 0, 1 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_builtin_charmethods_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_CharMethods, getHex, arginfo_stub_builtin_charmethods_gethex, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_CharMethods, getHex, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_CharMethods, getHex, arginfo_stub_builtin_charmethods_gethex, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_CharMethods, getHexForString, arginfo_stub_builtin_charmethods_gethexforstring, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/builtin/intmethods.zep.c b/ext/stub/builtin/intmethods.zep.c index b573864dcd..c4ae1d8ea6 100644 --- a/ext/stub/builtin/intmethods.zep.c +++ b/ext/stub/builtin/intmethods.zep.c @@ -31,23 +31,15 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAbs) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *num_param = NULL, _0, _1; zend_long num, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); ZEPHIR_CALL_FUNCTION(&_1, "abs", NULL, 9, &_0); zephir_check_call_status(); @@ -59,13 +51,11 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAbs1) zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, -5); ZEPHIR_CALL_FUNCTION(&_1, "abs", NULL, 9, &_0); @@ -78,23 +68,15 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getBinary) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *num_param = NULL, _0, _1; zend_long num, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); ZEPHIR_CALL_FUNCTION(&_1, "decbin", NULL, 10, &_0); zephir_check_call_status(); @@ -106,23 +88,15 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getHex) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *num_param = NULL, _0, _1; zend_long num, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); ZEPHIR_CALL_FUNCTION(&_1, "dechex", NULL, 11, &_0); zephir_check_call_status(); @@ -134,23 +108,15 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getOctal) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *num_param = NULL, _0, _1; zend_long num, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); ZEPHIR_CALL_FUNCTION(&_1, "decoct", NULL, 12, &_0); zephir_check_call_status(); @@ -161,53 +127,35 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getPow) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *num_param = NULL, *exp_param = NULL, _0, _1, _2; - zend_long num, exp; - zval *this_ptr = getThis(); + zend_long num, exp, ZEPHIR_LAST_CALL_STATUS; ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(num) Z_PARAM_LONG(exp) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &num_param, &exp_param); - num = zephir_get_intval(num_param); - exp = zephir_get_intval(exp_param); - - - ZEPHIR_INIT_VAR(&_0); - ZVAL_LONG(&_1, num); - ZVAL_LONG(&_2, exp); - zephir_pow_function(&_0, &_1, &_2); - RETURN_CCTOR(&_0); + ZVAL_LONG(&_0, num); + ZVAL_LONG(&_1, exp); + ZEPHIR_CALL_FUNCTION(&_2, "pow", NULL, 13, &_0, &_1); + zephir_check_call_status(); + RETURN_CCTOR(&_2); } PHP_METHOD(Stub_BuiltIn_IntMethods, getSqrt) { zval *num_param = NULL, _0; zend_long num; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); RETURN_DOUBLE(sqrt(num)); } @@ -217,23 +165,15 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getExp) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *num_param = NULL, _0, _1; zend_long num, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); ZEPHIR_CALL_FUNCTION(&_1, "exp", NULL, 2, &_0); zephir_check_call_status(); @@ -244,21 +184,12 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getSin) { zval *num_param = NULL, _0; zend_long num; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); RETURN_DOUBLE(sin(num)); } @@ -267,21 +198,12 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getCos) { zval *num_param = NULL, _0; zend_long num; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); RETURN_DOUBLE(cos(num)); } @@ -290,21 +212,12 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getTan) { zval *num_param = NULL, _0; zend_long num; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); RETURN_DOUBLE(tan(num)); } @@ -313,21 +226,12 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAsin) { zval *num_param = NULL, _0; zend_long num; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); RETURN_DOUBLE(asin(num)); } @@ -336,21 +240,12 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAcos) { zval *num_param = NULL, _0; zend_long num; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); RETURN_DOUBLE(acos(num)); } @@ -360,25 +255,17 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAtan) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *num_param = NULL, _0, _1; zend_long num, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZVAL_LONG(&_0, num); - ZEPHIR_CALL_FUNCTION(&_1, "atan", NULL, 13, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "atan", NULL, 14, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); } @@ -388,42 +275,33 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getLog) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *num_param = NULL, *base_param = NULL, _0$$3, _1$$3, _2, _3, _4; zend_long num, base, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_LONG(num) Z_PARAM_OPTIONAL Z_PARAM_LONG(base) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &num_param, &base_param); - num = zephir_get_intval(num_param); if (!base_param) { base = -1; } else { - base = zephir_get_intval(base_param); - } - - + } if (base == -1) { ZVAL_LONG(&_0$$3, num); - ZEPHIR_CALL_FUNCTION(&_1$$3, "log", NULL, 14, &_0$$3); + ZEPHIR_CALL_FUNCTION(&_1$$3, "log", NULL, 15, &_0$$3); zephir_check_call_status(); RETURN_CCTOR(&_1$$3); } ZVAL_LONG(&_2, num); ZVAL_LONG(&_3, base); - ZEPHIR_CALL_FUNCTION(&_4, "log", NULL, 14, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "log", NULL, 15, &_2, &_3); zephir_check_call_status(); RETURN_CCTOR(&_4); } diff --git a/ext/stub/builtin/intmethods.zep.h b/ext/stub/builtin/intmethods.zep.h index f73dae4ad3..d30f4ead49 100644 --- a/ext/stub/builtin/intmethods.zep.h +++ b/ext/stub/builtin/intmethods.zep.h @@ -82,11 +82,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_builtin_intmethods_method_entry) { PHP_ME(Stub_BuiltIn_IntMethods, getAbs, arginfo_stub_builtin_intmethods_getabs, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_IntMethods, getAbs1, arginfo_stub_builtin_intmethods_getabs1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_IntMethods, getAbs1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_IntMethods, getAbs1, arginfo_stub_builtin_intmethods_getabs1, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_IntMethods, getBinary, arginfo_stub_builtin_intmethods_getbinary, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_IntMethods, getHex, arginfo_stub_builtin_intmethods_gethex, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_IntMethods, getOctal, arginfo_stub_builtin_intmethods_getoctal, ZEND_ACC_PUBLIC) diff --git a/ext/stub/builtin/stringmethods.zep.c b/ext/stub/builtin/stringmethods.zep.c index d8cd136fa0..f6877962bc 100644 --- a/ext/stub/builtin/stringmethods.zep.c +++ b/ext/stub/builtin/stringmethods.zep.c @@ -32,33 +32,27 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, camelize) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, *delimiter = NULL, delimiter_sub, __$null, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &str_param, &delimiter); zephir_get_strval(&str, str_param); if (!delimiter) { delimiter = &delimiter_sub; delimiter = &__$null; } - - ZEPHIR_INIT_VAR(&_0); - zephir_camelize(&_0, &str, delimiter ); + zephir_camelize(&_0, &str, delimiter); RETURN_CCTOR(&_0); } @@ -67,33 +61,27 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, uncamelize) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, *delimiter = NULL, delimiter_sub, __$null, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &str_param, &delimiter); zephir_get_strval(&str, str_param); if (!delimiter) { delimiter = &delimiter_sub; delimiter = &__$null; } - - ZEPHIR_INIT_VAR(&_0); - zephir_uncamelize(&_0, &str, delimiter ); + zephir_uncamelize(&_0, &str, delimiter); RETURN_CCTOR(&_0); } @@ -101,12 +89,10 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLength1) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello"); @@ -117,12 +103,10 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLength2) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello"); @@ -133,12 +117,10 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLength3) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SS(&_0, "hello", "hello"); @@ -150,22 +132,15 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLength4) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a_param = NULL; zval a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); zephir_get_strval(&a, a_param); - - RETURN_MM_LONG(zephir_fast_strlen_ev(&a)); } @@ -174,23 +149,16 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLength5) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a_param = NULL; zval a, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); zephir_get_strval(&a, a_param); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SV(&_0, "hello", &a); RETURN_MM_LONG(zephir_fast_strlen_ev(&_0)); @@ -201,26 +169,19 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getIndex) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, *needle_param = NULL, _0; zval str, needle; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&needle); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(str) Z_PARAM_STR(needle) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &str_param, &needle_param); zephir_get_strval(&str, str_param); zephir_get_strval(&needle, needle_param); - - ZEPHIR_INIT_VAR(&_0); zephir_fast_strpos(&_0, &str, &needle, 0 ); RETURN_CCTOR(&_0); @@ -232,29 +193,21 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getIndexWithPosition) zend_long position; zval *str_param = NULL, *needle_param = NULL, *position_param = NULL, _0, _1; zval str, needle; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&needle); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_STR(str) Z_PARAM_STR(needle) Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 3, 0, &str_param, &needle_param, &position_param); zephir_get_strval(&str, str_param); zephir_get_strval(&needle, needle_param); - position = zephir_get_intval(position_param); - - ZVAL_LONG(&_0, position); ZEPHIR_INIT_VAR(&_1); zephir_fast_strpos(&_1, &str, &needle, zephir_get_intval(&_0) ); @@ -265,13 +218,11 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getTrimmed) { zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_VAR(&_1); @@ -285,23 +236,16 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getTrimmed1) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - ZEPHIR_INIT_VAR(&_0); zephir_fast_trim(&_0, &str, NULL , ZEPHIR_TRIM_BOTH); RETURN_CCTOR(&_0); @@ -312,23 +256,16 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLeftTrimmed) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - ZEPHIR_INIT_VAR(&_0); zephir_fast_trim(&_0, &str, NULL , ZEPHIR_TRIM_LEFT); RETURN_CCTOR(&_0); @@ -339,23 +276,16 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getRightTrimmed) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - ZEPHIR_INIT_VAR(&_0); zephir_fast_trim(&_0, &str, NULL , ZEPHIR_TRIM_RIGHT); RETURN_CCTOR(&_0); @@ -366,23 +296,16 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLower) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - ZEPHIR_INIT_VAR(&_0); zephir_fast_strtolower(&_0, &str); RETURN_CCTOR(&_0); @@ -393,23 +316,16 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getUpper) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - ZEPHIR_INIT_VAR(&_0); zephir_fast_strtoupper(&_0, &str); RETURN_CCTOR(&_0); @@ -421,24 +337,17 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLowerFirst) zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "lcfirst", NULL, 15, &str); + ZEPHIR_CALL_FUNCTION(&_0, "lcfirst", NULL, 16, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -448,23 +357,16 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getUpperFirst) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - ZEPHIR_INIT_VAR(&_0); zephir_ucfirst(&_0, &str); RETURN_CCTOR(&_0); @@ -476,27 +378,20 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getFormatted) zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, _0, _1; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello %s!"); - ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 16, &_0, &str); + ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 17, &_0, &str); zephir_check_call_status(); RETURN_CCTOR(&_1); } @@ -506,23 +401,16 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getMd5) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - ZEPHIR_INIT_VAR(&_0); zephir_md5(&_0, &str); RETURN_CCTOR(&_0); @@ -534,24 +422,17 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getSha1) zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "sha1", NULL, 17, &str); + ZEPHIR_CALL_FUNCTION(&_0, "sha1", NULL, 18, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -562,24 +443,17 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getNl2br) zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "nl2br", NULL, 18, &str); + ZEPHIR_CALL_FUNCTION(&_0, "nl2br", NULL, 19, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -590,24 +464,17 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getParsedCsv) zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "str_getcsv", NULL, 19, &str); + ZEPHIR_CALL_FUNCTION(&_0, "str_getcsv", NULL, 20, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -618,31 +485,23 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getParsedJson) zend_bool assoc; zval *str_param = NULL, *assoc_param = NULL, _0, _1; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_BOOL(assoc) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &str_param, &assoc_param); zephir_get_strval(&str, str_param); if (!assoc_param) { assoc = 1; } else { - assoc = zephir_get_boolval(assoc_param); - } - - + } ZEPHIR_INIT_VAR(&_0); ZVAL_BOOL(&_1, (assoc ? 1 : 0)); zephir_json_decode(&_0, &str, zephir_get_intval(&str) ); @@ -655,28 +514,20 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getRepeatted) zend_long count, ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, *count_param = NULL, _0, _1; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(str) Z_PARAM_LONG(count) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &str_param, &count_param); zephir_get_strval(&str, str_param); - count = zephir_get_intval(count_param); - - ZVAL_LONG(&_0, count); - ZEPHIR_CALL_FUNCTION(&_1, "str_repeat", NULL, 20, &str, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "str_repeat", NULL, 21, &str, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); } @@ -687,24 +538,17 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getShuffled) zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "str_shuffle", NULL, 21, &str); + ZEPHIR_CALL_FUNCTION(&_0, "str_shuffle", NULL, 22, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -715,27 +559,20 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getSplited) zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, *del_param = NULL, _0; zval str, del; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&del); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(str) Z_PARAM_STR(del) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &str_param, &del_param); zephir_get_strval(&str, str_param); zephir_get_strval(&del, del_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "str_split", NULL, 22, &str, &del); + ZEPHIR_CALL_FUNCTION(&_0, "str_split", NULL, 23, &str, &del); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -746,27 +583,20 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getCompare) zend_long ZEPHIR_LAST_CALL_STATUS; zval *left_param = NULL, *right_param = NULL, _0; zval left, right; - zval *this_ptr = getThis(); ZVAL_UNDEF(&left); ZVAL_UNDEF(&right); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(left) Z_PARAM_STR(right) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &left_param, &right_param); zephir_get_strval(&left, left_param); zephir_get_strval(&right, right_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "strcmp", NULL, 23, &left, &right); + ZEPHIR_CALL_FUNCTION(&_0, "strcmp", NULL, 24, &left, &right); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -777,27 +607,20 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getCompareLocale) zend_long ZEPHIR_LAST_CALL_STATUS; zval *left_param = NULL, *right_param = NULL, _0; zval left, right; - zval *this_ptr = getThis(); ZVAL_UNDEF(&left); ZVAL_UNDEF(&right); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(left) Z_PARAM_STR(right) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &left_param, &right_param); zephir_get_strval(&left, left_param); zephir_get_strval(&right, right_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "strcoll", NULL, 24, &left, &right); + ZEPHIR_CALL_FUNCTION(&_0, "strcoll", NULL, 25, &left, &right); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -808,24 +631,17 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getReversed) zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "strrev", NULL, 25, &str); + ZEPHIR_CALL_FUNCTION(&_0, "strrev", NULL, 26, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -836,24 +652,17 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getHtmlSpecialChars) zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, _0; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(&str, str_param); - - - ZEPHIR_CALL_FUNCTION(&_0, "htmlspecialchars", NULL, 26, &str); + ZEPHIR_CALL_FUNCTION(&_0, "htmlspecialchars", NULL, 27, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } diff --git a/ext/stub/builtin/stringmethods.zep.h b/ext/stub/builtin/stringmethods.zep.h index 22cc2eb3e8..016bbc4d18 100644 --- a/ext/stub/builtin/stringmethods.zep.h +++ b/ext/stub/builtin/stringmethods.zep.h @@ -163,30 +163,14 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_builtin_stringmethods_method_entry) { PHP_ME(Stub_BuiltIn_StringMethods, camelize, arginfo_stub_builtin_stringmethods_camelize, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, uncamelize, arginfo_stub_builtin_stringmethods_uncamelize, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_StringMethods, getLength1, arginfo_stub_builtin_stringmethods_getlength1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_StringMethods, getLength1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_StringMethods, getLength2, arginfo_stub_builtin_stringmethods_getlength2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_StringMethods, getLength2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_StringMethods, getLength3, arginfo_stub_builtin_stringmethods_getlength3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_StringMethods, getLength3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_StringMethods, getLength1, arginfo_stub_builtin_stringmethods_getlength1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_BuiltIn_StringMethods, getLength2, arginfo_stub_builtin_stringmethods_getlength2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_BuiltIn_StringMethods, getLength3, arginfo_stub_builtin_stringmethods_getlength3, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getLength4, arginfo_stub_builtin_stringmethods_getlength4, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getLength5, arginfo_stub_builtin_stringmethods_getlength5, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getIndex, arginfo_stub_builtin_stringmethods_getindex, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getIndexWithPosition, arginfo_stub_builtin_stringmethods_getindexwithposition, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_StringMethods, getTrimmed, arginfo_stub_builtin_stringmethods_gettrimmed, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_StringMethods, getTrimmed, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_StringMethods, getTrimmed, arginfo_stub_builtin_stringmethods_gettrimmed, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getTrimmed1, arginfo_stub_builtin_stringmethods_gettrimmed1, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getLeftTrimmed, arginfo_stub_builtin_stringmethods_getlefttrimmed, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getRightTrimmed, arginfo_stub_builtin_stringmethods_getrighttrimmed, ZEND_ACC_PUBLIC) diff --git a/ext/stub/cast.zep.c b/ext/stub/cast.zep.c index 0b90c38123..aa5ee24d00 100644 --- a/ext/stub/cast.zep.c +++ b/ext/stub/cast.zep.c @@ -33,9 +33,6 @@ ZEPHIR_INIT_CLASS(Stub_Cast) */ PHP_METHOD(Stub_Cast, testCharCastFromChar) { - zval *this_ptr = getThis(); - - RETURN_LONG('a'); } @@ -46,11 +43,6 @@ PHP_METHOD(Stub_Cast, testCharCastFromChar) PHP_METHOD(Stub_Cast, testCharCastFromVariableChar) { char a, _0; - zval *this_ptr = getThis(); - - - - a = 'A'; _0 = a; RETURN_LONG(_0); @@ -61,9 +53,6 @@ PHP_METHOD(Stub_Cast, testCharCastFromVariableChar) */ PHP_METHOD(Stub_Cast, testStringCastChar) { - zval *this_ptr = getThis(); - - RETURN_STRING("z"); } @@ -76,12 +65,10 @@ PHP_METHOD(Stub_Cast, testStringCastVariableChar) zval _0; char a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 'X'; ZEPHIR_INIT_VAR(&_0); @@ -97,13 +84,11 @@ PHP_METHOD(Stub_Cast, testStringCastFromNull) zval _0; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_NULL(&a); @@ -113,9 +98,6 @@ PHP_METHOD(Stub_Cast, testStringCastFromNull) PHP_METHOD(Stub_Cast, testIntCastFromFloat) { - zval *this_ptr = getThis(); - - RETURN_LONG((int) 5.0); } @@ -123,12 +105,7 @@ PHP_METHOD(Stub_Cast, testIntCastFromFloat) PHP_METHOD(Stub_Cast, testIntCastFromVariableFloat) { double a; - zval *this_ptr = getThis(); - - - - - a = 5.0; + a = (5.0); RETURN_LONG((int) (a)); } @@ -137,9 +114,6 @@ PHP_METHOD(Stub_Cast, testIntCastFromVariableFloat) */ PHP_METHOD(Stub_Cast, testIntCastFromChar) { - zval *this_ptr = getThis(); - - RETURN_LONG('A'); } @@ -150,29 +124,18 @@ PHP_METHOD(Stub_Cast, testIntCastFromChar) PHP_METHOD(Stub_Cast, testIntCastFromVariableChar) { char a; - zval *this_ptr = getThis(); - - - - a = 'a'; RETURN_LONG(a); } PHP_METHOD(Stub_Cast, testIntCastFromBooleanTrue) { - zval *this_ptr = getThis(); - - RETURN_LONG(1); } PHP_METHOD(Stub_Cast, testIntCastFromBooleanFalse) { - zval *this_ptr = getThis(); - - RETURN_LONG(0); } @@ -180,11 +143,6 @@ PHP_METHOD(Stub_Cast, testIntCastFromBooleanFalse) PHP_METHOD(Stub_Cast, testIntCastFromVariableBooleanTrue) { zend_bool a; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_LONG((int) (a)); } @@ -192,11 +150,6 @@ PHP_METHOD(Stub_Cast, testIntCastFromVariableBooleanTrue) PHP_METHOD(Stub_Cast, testIntCastFromVariableBooleanFalse) { zend_bool a; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_LONG((int) (a)); } @@ -205,12 +158,10 @@ PHP_METHOD(Stub_Cast, testIntCastFromVariableNull) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_NULL(&a); @@ -221,12 +172,10 @@ PHP_METHOD(Stub_Cast, testIntCastFromStringValue) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); @@ -238,12 +187,10 @@ PHP_METHOD(Stub_Cast, testIntCastFromVariableString) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "test"); @@ -255,30 +202,20 @@ PHP_METHOD(Stub_Cast, testIntCastFromParameterString) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a_param = NULL; zval a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); zephir_get_strval(&a, a_param); - - RETURN_MM_LONG(zephir_get_intval(&a)); } PHP_METHOD(Stub_Cast, testIntCastFromNull) { - zval *this_ptr = getThis(); - - RETURN_LONG(0); } @@ -287,12 +224,10 @@ PHP_METHOD(Stub_Cast, testIntCastFromVariableEmptyArray) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -303,12 +238,10 @@ PHP_METHOD(Stub_Cast, testIntCastFromEmptyArray) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -319,13 +252,11 @@ PHP_METHOD(Stub_Cast, testIntCastFromVariableArray) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 4, 0); @@ -349,13 +280,11 @@ PHP_METHOD(Stub_Cast, testIntCastFromArray) zval _1; zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 4, 0); @@ -382,12 +311,10 @@ PHP_METHOD(Stub_Cast, testIntCastFromStdClass) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); object_init(&_0); @@ -402,12 +329,10 @@ PHP_METHOD(Stub_Cast, testIntCastFromVariableStdClass) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); object_init(&a); @@ -419,9 +344,6 @@ PHP_METHOD(Stub_Cast, testIntCastFromVariableStdClass) */ PHP_METHOD(Stub_Cast, testLongCastFromChar) { - zval *this_ptr = getThis(); - - RETURN_LONG((long) 'a'); } @@ -432,20 +354,12 @@ PHP_METHOD(Stub_Cast, testLongCastFromChar) PHP_METHOD(Stub_Cast, testLongCastFromVariableChar) { char a; - zval *this_ptr = getThis(); - - - - a = 'A'; RETURN_LONG(a); } PHP_METHOD(Stub_Cast, testFloatCastFromFloat) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(5.0); } @@ -453,29 +367,18 @@ PHP_METHOD(Stub_Cast, testFloatCastFromFloat) PHP_METHOD(Stub_Cast, testFloatCastFromVariableFloat) { double a; - zval *this_ptr = getThis(); - - - - - a = 5.0; + a = (5.0); RETURN_DOUBLE((double) (a)); } PHP_METHOD(Stub_Cast, testFloatCastFromBooleanTrue) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(1); } PHP_METHOD(Stub_Cast, testFloatCastFromBooleanFalse) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(0); } @@ -483,11 +386,6 @@ PHP_METHOD(Stub_Cast, testFloatCastFromBooleanFalse) PHP_METHOD(Stub_Cast, testFloatCastFromVariableBooleanTrue) { zend_bool a; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_DOUBLE((double) (a)); } @@ -495,11 +393,6 @@ PHP_METHOD(Stub_Cast, testFloatCastFromVariableBooleanTrue) PHP_METHOD(Stub_Cast, testFloatCastFromVariableBooleanFalse) { zend_bool a; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_DOUBLE((double) (a)); } @@ -508,12 +401,10 @@ PHP_METHOD(Stub_Cast, testFloatCastFromVariableNull) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_NULL(&a); @@ -522,9 +413,6 @@ PHP_METHOD(Stub_Cast, testFloatCastFromVariableNull) PHP_METHOD(Stub_Cast, testFloatCastFromNull) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(0); } @@ -533,12 +421,10 @@ PHP_METHOD(Stub_Cast, testFloatCastFromVariableEmptyArray) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -549,12 +435,10 @@ PHP_METHOD(Stub_Cast, testFloatCastFromEmptyArray) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -565,13 +449,11 @@ PHP_METHOD(Stub_Cast, testFloatCastFromVariableArray) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 4, 0); @@ -595,13 +477,11 @@ PHP_METHOD(Stub_Cast, testFloatCastFromArray) zval _1; zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 4, 0); @@ -628,12 +508,10 @@ PHP_METHOD(Stub_Cast, testFloatCastFromStdClass) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); object_init(&_0); @@ -648,12 +526,10 @@ PHP_METHOD(Stub_Cast, testFloatCastFromVariableStdClass) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); object_init(&a); @@ -665,9 +541,6 @@ PHP_METHOD(Stub_Cast, testFloatCastFromVariableStdClass) */ PHP_METHOD(Stub_Cast, testDoubleCastFromVChar) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE((double) 'a'); } @@ -678,38 +551,24 @@ PHP_METHOD(Stub_Cast, testDoubleCastFromVChar) PHP_METHOD(Stub_Cast, testDoubleCastFromVariableChar) { char a; - zval *this_ptr = getThis(); - - - - a = 'A'; RETURN_DOUBLE((double) a); } PHP_METHOD(Stub_Cast, testBooleanCastFromIntTrue1) { - zval *this_ptr = getThis(); - - RETURN_BOOL((zend_bool) 1); } PHP_METHOD(Stub_Cast, testBooleanCastFromIntTrue2) { - zval *this_ptr = getThis(); - - RETURN_BOOL((zend_bool) 1000); } PHP_METHOD(Stub_Cast, testBooleanCastFromIntFalse) { - zval *this_ptr = getThis(); - - RETURN_BOOL((zend_bool) 0); } @@ -718,12 +577,10 @@ PHP_METHOD(Stub_Cast, testBooleanCastFromObject) { zval simpleObject; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&simpleObject); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&simpleObject); object_init(&simpleObject); @@ -734,12 +591,10 @@ PHP_METHOD(Stub_Cast, testBooleanCastFromEmptyArray) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -750,13 +605,11 @@ PHP_METHOD(Stub_Cast, testBooleanCastFromArray) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 4, 0); @@ -779,12 +632,10 @@ PHP_METHOD(Stub_Cast, testBooleanCastFromNull) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_NULL(&a); @@ -796,9 +647,6 @@ PHP_METHOD(Stub_Cast, testBooleanCastFromNull) */ PHP_METHOD(Stub_Cast, testBooleanCastFromChar) { - zval *this_ptr = getThis(); - - RETURN_BOOL((zend_bool) 'a'); } @@ -809,11 +657,6 @@ PHP_METHOD(Stub_Cast, testBooleanCastFromChar) PHP_METHOD(Stub_Cast, testBooleanCastFromVariableChar) { char a; - zval *this_ptr = getThis(); - - - - a = 'A'; RETURN_BOOL((zend_bool) a); } @@ -822,12 +665,10 @@ PHP_METHOD(Stub_Cast, testObjectCastFromInt) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 5); @@ -839,12 +680,10 @@ PHP_METHOD(Stub_Cast, testObjectCastFromFloat) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_DOUBLE(&_0, 5.0); @@ -856,12 +695,10 @@ PHP_METHOD(Stub_Cast, testObjectCastFromFalse) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_BOOL(&_0, 0); @@ -873,12 +710,10 @@ PHP_METHOD(Stub_Cast, testObjectCastFromTrue) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_BOOL(&_0, 1); @@ -890,12 +725,10 @@ PHP_METHOD(Stub_Cast, testObjectCastFromNull) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_NULL(&_0); @@ -907,13 +740,11 @@ PHP_METHOD(Stub_Cast, testObjectCastFromEmptyArray) { zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -927,14 +758,12 @@ PHP_METHOD(Stub_Cast, testObjectCastFromArray) zval _1, _2; zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 4, 0); @@ -959,12 +788,10 @@ PHP_METHOD(Stub_Cast, testObjectCastFromEmptyString) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, ""); @@ -976,12 +803,10 @@ PHP_METHOD(Stub_Cast, testObjectCastFromString) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "test string"); @@ -993,12 +818,10 @@ PHP_METHOD(Stub_Cast, testCastStdinToInteger) { zval handle; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&handle); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&handle); ZEPHIR_GET_CONSTANT(&handle, "STDIN"); @@ -1009,12 +832,10 @@ PHP_METHOD(Stub_Cast, testCastStdoutToInteger) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_GET_CONSTANT(&_0, "STDOUT"); @@ -1025,20 +846,12 @@ PHP_METHOD(Stub_Cast, testCastFileResourceToInteger) { zend_long id = 0; zval *fileName, fileName_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&fileName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(fileName) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &fileName); - - id = zephir_get_intval(fileName); RETURN_LONG(id); } @@ -1048,14 +861,12 @@ PHP_METHOD(Stub_Cast, testArrayCastFromVariableArray) zval _1; zval uids, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&uids); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&uids); zephir_create_array(&uids, 3, 0); @@ -1078,13 +889,11 @@ PHP_METHOD(Stub_Cast, testArrayCastFromVariableTrue) zval _0; zval uids; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&uids); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&uids); ZVAL_BOOL(&uids, 1); @@ -1098,13 +907,11 @@ PHP_METHOD(Stub_Cast, testArrayCastFromVariableFalse) zval _0; zval uids; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&uids); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&uids); ZVAL_BOOL(&uids, 0); @@ -1118,13 +925,11 @@ PHP_METHOD(Stub_Cast, testArrayCastFromVariableNull) zval _0; zval uids; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&uids); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&uids); ZVAL_NULL(&uids); @@ -1138,13 +943,11 @@ PHP_METHOD(Stub_Cast, testArrayCastFromVariableInteger) zval _0; zval uids; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&uids); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&uids); ZVAL_LONG(&uids, 1); @@ -1158,13 +961,11 @@ PHP_METHOD(Stub_Cast, testArrayCastFromVariableFloat) zval _0; zval uids; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&uids); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&uids); ZVAL_DOUBLE(&uids, 1.1); @@ -1178,13 +979,11 @@ PHP_METHOD(Stub_Cast, testArrayCastFromVariableString) zval _0; zval uids; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&uids); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&uids); ZVAL_STRING(&uids, "aaa"); @@ -1198,14 +997,12 @@ PHP_METHOD(Stub_Cast, testArrayCastFromVariableStdClass) zval _1; zval uids, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&uids); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&uids); object_init(&uids); @@ -1228,15 +1025,13 @@ PHP_METHOD(Stub_Cast, testIssue828) zval version, nonNumericString, _0; zval ret; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&ret); ZVAL_UNDEF(&version); ZVAL_UNDEF(&nonNumericString); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&ret); array_init(&ret); @@ -1246,9 +1041,9 @@ PHP_METHOD(Stub_Cast, testIssue828) ZVAL_STRING(&nonNumericString, "OK"); zephir_array_append(&ret, &version, PH_SEPARATE, "stub/cast.zep", 501); zephir_array_append(&ret, &nonNumericString, PH_SEPARATE, "stub/cast.zep", 502); - floatVersion = zephir_get_doubleval(&version); + floatVersion = (zephir_get_doubleval(&version)); intVersion = zephir_get_intval(&version); - floatNonNumeric = zephir_get_doubleval(&nonNumericString); + floatNonNumeric = (zephir_get_doubleval(&nonNumericString)); intNonNumeric = zephir_get_intval(&nonNumericString); ZEPHIR_INIT_VAR(&_0); ZVAL_DOUBLE(&_0, floatVersion); diff --git a/ext/stub/cast.zep.h b/ext/stub/cast.zep.h index 349ab4b944..a87e6074f9 100644 --- a/ext/stub/cast.zep.h +++ b/ext/stub/cast.zep.h @@ -346,51 +346,15 @@ ZEPHIR_INIT_FUNCS(stub_cast_method_entry) { PHP_ME(Stub_Cast, testBooleanCastFromNull, arginfo_stub_cast_testbooleancastfromnull, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testBooleanCastFromChar, arginfo_stub_cast_testbooleancastfromchar, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testBooleanCastFromVariableChar, arginfo_stub_cast_testbooleancastfromvariablechar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromInt, arginfo_stub_cast_testobjectcastfromint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromFloat, arginfo_stub_cast_testobjectcastfromfloat, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromFloat, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromFalse, arginfo_stub_cast_testobjectcastfromfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromTrue, arginfo_stub_cast_testobjectcastfromtrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromNull, arginfo_stub_cast_testobjectcastfromnull, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromNull, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromEmptyArray, arginfo_stub_cast_testobjectcastfromemptyarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromEmptyArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromArray, arginfo_stub_cast_testobjectcastfromarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromEmptyString, arginfo_stub_cast_testobjectcastfromemptystring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromEmptyString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromString, arginfo_stub_cast_testobjectcastfromstring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Cast, testObjectCastFromInt, arginfo_stub_cast_testobjectcastfromint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromFloat, arginfo_stub_cast_testobjectcastfromfloat, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromFalse, arginfo_stub_cast_testobjectcastfromfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromTrue, arginfo_stub_cast_testobjectcastfromtrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromNull, arginfo_stub_cast_testobjectcastfromnull, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromEmptyArray, arginfo_stub_cast_testobjectcastfromemptyarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromArray, arginfo_stub_cast_testobjectcastfromarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromEmptyString, arginfo_stub_cast_testobjectcastfromemptystring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromString, arginfo_stub_cast_testobjectcastfromstring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testCastStdinToInteger, arginfo_stub_cast_testcaststdintointeger, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testCastStdoutToInteger, arginfo_stub_cast_testcaststdouttointeger, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testCastFileResourceToInteger, arginfo_stub_cast_testcastfileresourcetointeger, ZEND_ACC_PUBLIC) diff --git a/ext/stub/cblock.zep.c b/ext/stub/cblock.zep.c index b2f9e223e8..a02bb343b4 100644 --- a/ext/stub/cblock.zep.c +++ b/ext/stub/cblock.zep.c @@ -46,11 +46,6 @@ ZEPHIR_INIT_CLASS(Stub_Cblock) PHP_METHOD(Stub_Cblock, testCblock1) { zend_long a; - zval *this_ptr = getThis(); - - - - a = 0; a = MAX_FACTOR; @@ -61,11 +56,6 @@ PHP_METHOD(Stub_Cblock, testCblock1) PHP_METHOD(Stub_Cblock, testCblock2) { long a; - zval *this_ptr = getThis(); - - - - a = 0; a = fibonacci(MAX_FACTOR); diff --git a/ext/stub/cblock.zep.h b/ext/stub/cblock.zep.h index 2787016396..4825236091 100644 --- a/ext/stub/cblock.zep.h +++ b/ext/stub/cblock.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_cblock_testcblock2, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_cblock_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cblock, testCblock1, arginfo_stub_cblock_testcblock1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cblock, testCblock1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cblock, testCblock2, arginfo_stub_cblock_testcblock2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cblock, testCblock2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Cblock, testCblock1, arginfo_stub_cblock_testcblock1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cblock, testCblock2, arginfo_stub_cblock_testcblock2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/chars.zep.c b/ext/stub/chars.zep.c index be8513a91a..a0616024f0 100644 --- a/ext/stub/chars.zep.c +++ b/ext/stub/chars.zep.c @@ -30,11 +30,6 @@ ZEPHIR_INIT_CLASS(Stub_Chars) PHP_METHOD(Stub_Chars, sumChars1) { char ch, chlower = 0; - zval *this_ptr = getThis(); - - - - ch = 'A'; chlower = (ch + 32); RETURN_LONG(chlower); @@ -44,20 +39,12 @@ PHP_METHOD(Stub_Chars, sumChars2) { zval *ch_param = NULL; char ch, chlower = 0; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(ch) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &ch_param); ch = zephir_get_charval(ch_param); - - chlower = (ch + 32); RETURN_LONG(chlower); } @@ -65,11 +52,6 @@ PHP_METHOD(Stub_Chars, sumChars2) PHP_METHOD(Stub_Chars, diffChars1) { char ch, chlower = 0; - zval *this_ptr = getThis(); - - - - ch = 'a'; chlower = (ch - 32); RETURN_LONG(chlower); @@ -79,20 +61,12 @@ PHP_METHOD(Stub_Chars, diffChars2) { zval *ch_param = NULL; char ch, chlower = 0; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(ch) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &ch_param); ch = zephir_get_charval(ch_param); - - chlower = (ch - 32); RETURN_LONG(chlower); } diff --git a/ext/stub/closures.zep.c b/ext/stub/closures.zep.c index fd3274dbb1..b59df9f75c 100644 --- a/ext/stub/closures.zep.c +++ b/ext/stub/closures.zep.c @@ -13,9 +13,9 @@ #include "kernel/main.h" #include "kernel/object.h" -#include "kernel/memory.h" #include "ext/spl/spl_exceptions.h" #include "kernel/exception.h" +#include "kernel/memory.h" #include "kernel/array.h" #include "kernel/fcall.h" @@ -31,9 +31,6 @@ ZEPHIR_INIT_CLASS(Stub_Closures) PHP_METHOD(Stub_Closures, simple1) { - zval *this_ptr = getThis(); - - zephir_create_closure_ex(return_value, NULL, stub_1__closure_ce, SL("__invoke")); return; @@ -41,9 +38,6 @@ PHP_METHOD(Stub_Closures, simple1) PHP_METHOD(Stub_Closures, simple2) { - zval *this_ptr = getThis(); - - zephir_create_closure_ex(return_value, NULL, stub_2__closure_ce, SL("__invoke")); return; @@ -51,9 +45,6 @@ PHP_METHOD(Stub_Closures, simple2) PHP_METHOD(Stub_Closures, simple3) { - zval *this_ptr = getThis(); - - zephir_create_closure_ex(return_value, NULL, stub_3__closure_ce, SL("__invoke")); return; @@ -61,9 +52,6 @@ PHP_METHOD(Stub_Closures, simple3) PHP_METHOD(Stub_Closures, simple4) { - zval *this_ptr = getThis(); - - zephir_create_closure_ex(return_value, NULL, stub_4__closure_ce, SL("__invoke")); return; @@ -71,9 +59,6 @@ PHP_METHOD(Stub_Closures, simple4) PHP_METHOD(Stub_Closures, simple5) { - zval *this_ptr = getThis(); - - zephir_create_closure_ex(return_value, NULL, stub_5__closure_ce, SL("__invoke")); return; @@ -81,9 +66,6 @@ PHP_METHOD(Stub_Closures, simple5) PHP_METHOD(Stub_Closures, arrow1) { - zval *this_ptr = getThis(); - - zephir_create_closure_ex(return_value, NULL, stub_6__closure_ce, SL("__invoke")); return; @@ -91,9 +73,6 @@ PHP_METHOD(Stub_Closures, arrow1) PHP_METHOD(Stub_Closures, arrow2) { - zval *this_ptr = getThis(); - - zephir_create_closure_ex(return_value, NULL, stub_7__closure_ce, SL("__invoke")); return; @@ -103,15 +82,11 @@ PHP_METHOD(Stub_Closures, testUseCommand) { zval _0; zend_long abc; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - abc = 1; zephir_create_closure_ex(return_value, NULL, stub_8__closure_ce, SL("__invoke")); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, abc); zephir_update_static_property_ce(stub_8__closure_ce, ZEND_STRL("abc"), &_0); return; @@ -122,22 +97,15 @@ PHP_METHOD(Stub_Closures, issue1860) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *abc_param = NULL; zval abc; - zval *this_ptr = getThis(); ZVAL_UNDEF(&abc); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(abc) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &abc_param); ZEPHIR_OBS_COPY_OR_DUP(&abc, abc_param); - - zephir_create_closure_ex(return_value, NULL, stub_9__closure_ce, SL("__invoke")); zephir_update_static_property_ce(stub_9__closure_ce, ZEND_STRL("abc"), &abc); RETURN_MM(); @@ -152,14 +120,12 @@ PHP_METHOD(Stub_Closures, issue642) zval obj, closure; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj); ZVAL_UNDEF(&closure); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&obj); object_init(&obj); @@ -179,17 +145,10 @@ PHP_METHOD(Stub_Closures, issue1036SetArgument) zval *this_ptr = getThis(); ZVAL_UNDEF(&argument_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(argument) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &argument); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_argument"), argument); } @@ -199,17 +158,10 @@ PHP_METHOD(Stub_Closures, issue1036SetFunction) zval *this_ptr = getThis(); ZVAL_UNDEF(&func_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(func) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &func); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_function"), func); } @@ -225,13 +177,12 @@ PHP_METHOD(Stub_Closures, issue1036Call) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_read_property(&_0, this_ptr, ZEND_STRL("_function"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, ZEND_STRL("_argument"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 27, &_0, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 28, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/closures.zep.h b/ext/stub/closures.zep.h index c26b65d745..1f61cacc8d 100644 --- a/ext/stub/closures.zep.h +++ b/ext/stub/closures.zep.h @@ -60,58 +60,18 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_closures_issue1036call, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_closures_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple1, arginfo_stub_closures_simple1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple2, arginfo_stub_closures_simple2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple3, arginfo_stub_closures_simple3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple4, arginfo_stub_closures_simple4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple5, arginfo_stub_closures_simple5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, arrow1, arginfo_stub_closures_arrow1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, arrow1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, arrow2, arginfo_stub_closures_arrow2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, arrow2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, testUseCommand, arginfo_stub_closures_testusecommand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, testUseCommand, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Closures, simple1, arginfo_stub_closures_simple1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, simple2, arginfo_stub_closures_simple2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, simple3, arginfo_stub_closures_simple3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, simple4, arginfo_stub_closures_simple4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, simple5, arginfo_stub_closures_simple5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, arrow1, arginfo_stub_closures_arrow1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, arrow2, arginfo_stub_closures_arrow2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, testUseCommand, arginfo_stub_closures_testusecommand, ZEND_ACC_PUBLIC) PHP_ME(Stub_Closures, issue1860, arginfo_stub_closures_issue1860, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, issue642, arginfo_stub_closures_issue642, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, issue642, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Closures, issue642, arginfo_stub_closures_issue642, ZEND_ACC_PUBLIC) PHP_ME(Stub_Closures, issue1036SetArgument, arginfo_stub_closures_issue1036setargument, ZEND_ACC_PUBLIC) PHP_ME(Stub_Closures, issue1036SetFunction, arginfo_stub_closures_issue1036setfunction, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, issue1036Call, arginfo_stub_closures_issue1036call, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, issue1036Call, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Closures, issue1036Call, arginfo_stub_closures_issue1036call, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/compare.zep.c b/ext/stub/compare.zep.c index 60dacf8819..361245a0c9 100644 --- a/ext/stub/compare.zep.c +++ b/ext/stub/compare.zep.c @@ -32,22 +32,12 @@ PHP_METHOD(Stub_Compare, isLessInt) { zval *a_param = NULL, *b_param = NULL; zend_long a, b; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - RETURN_BOOL(a < b); } @@ -55,22 +45,12 @@ PHP_METHOD(Stub_Compare, isGreaterEqual) { zval *a_param = NULL, *b_param = NULL; zend_long a, b; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - RETURN_BOOL(a >= b); } @@ -78,22 +58,14 @@ PHP_METHOD(Stub_Compare, isLessDouble) { zval *a_param = NULL, *b_param = NULL; double a, b; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); a = zephir_get_doubleval(a_param); b = zephir_get_doubleval(b_param); - - RETURN_BOOL(a < b); } @@ -101,20 +73,12 @@ PHP_METHOD(Stub_Compare, isLessThenPi) { zval *a_param = NULL; double a; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a_param); a = zephir_get_doubleval(a_param); - - RETURN_BOOL(a < 3.14); } @@ -122,20 +86,12 @@ PHP_METHOD(Stub_Compare, isMoreThenPi) { zval *a_param = NULL; double a; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a_param); a = zephir_get_doubleval(a_param); - - RETURN_BOOL(3.14 < a); } @@ -147,18 +103,13 @@ PHP_METHOD(Stub_Compare, testVarWithStringEquals) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str_param); if (UNEXPECTED(Z_TYPE_P(str_param) != IS_STRING && Z_TYPE_P(str_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be of the type string")); @@ -169,8 +120,6 @@ PHP_METHOD(Stub_Compare, testVarWithStringEquals) } else { ZEPHIR_INIT_VAR(&str); } - - if (ZEPHIR_IS_STRING_IDENTICAL(&str, "wrong testing")) { ZEPHIR_INIT_NVAR(&str); ZVAL_STRING(&str, "NOK"); @@ -194,20 +143,12 @@ PHP_METHOD(Stub_Compare, testVarWithStringEquals) PHP_METHOD(Stub_Compare, testVarEqualsNull) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - if (Z_TYPE_P(a) == IS_NULL) { RETURN_BOOL(1); } @@ -217,20 +158,12 @@ PHP_METHOD(Stub_Compare, testVarEqualsNull) PHP_METHOD(Stub_Compare, testNullEqualsVar) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - if (Z_TYPE_P(a) == IS_NULL) { RETURN_BOOL(1); } @@ -240,11 +173,6 @@ PHP_METHOD(Stub_Compare, testNullEqualsVar) PHP_METHOD(Stub_Compare, testNotIdenticalZeroVar) { zend_long a; - zval *this_ptr = getThis(); - - - - a = 5; RETURN_BOOL(0 != a); } @@ -252,11 +180,6 @@ PHP_METHOD(Stub_Compare, testNotIdenticalZeroVar) PHP_METHOD(Stub_Compare, testNotIdenticalZeroInt) { zend_long a; - zval *this_ptr = getThis(); - - - - a = 5; RETURN_BOOL(0 != a); } @@ -264,11 +187,6 @@ PHP_METHOD(Stub_Compare, testNotIdenticalZeroInt) PHP_METHOD(Stub_Compare, testNotIdenticalZeroLong) { long a; - zval *this_ptr = getThis(); - - - - a = 5; RETURN_BOOL(0 != a); } diff --git a/ext/stub/compare.zep.h b/ext/stub/compare.zep.h index 71df3fed42..ae2266e855 100644 --- a/ext/stub/compare.zep.h +++ b/ext/stub/compare.zep.h @@ -68,20 +68,8 @@ ZEPHIR_INIT_FUNCS(stub_compare_method_entry) { PHP_ME(Stub_Compare, testVarWithStringEquals, arginfo_stub_compare_testvarwithstringequals, ZEND_ACC_PUBLIC) PHP_ME(Stub_Compare, testVarEqualsNull, arginfo_stub_compare_testvarequalsnull, ZEND_ACC_PUBLIC) PHP_ME(Stub_Compare, testNullEqualsVar, arginfo_stub_compare_testnullequalsvar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Compare, testNotIdenticalZeroVar, arginfo_stub_compare_testnotidenticalzerovar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Compare, testNotIdenticalZeroVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Compare, testNotIdenticalZeroInt, arginfo_stub_compare_testnotidenticalzeroint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Compare, testNotIdenticalZeroInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Compare, testNotIdenticalZeroLong, arginfo_stub_compare_testnotidenticalzerolong, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Compare, testNotIdenticalZeroLong, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Compare, testNotIdenticalZeroVar, arginfo_stub_compare_testnotidenticalzerovar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Compare, testNotIdenticalZeroInt, arginfo_stub_compare_testnotidenticalzeroint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Compare, testNotIdenticalZeroLong, arginfo_stub_compare_testnotidenticalzerolong, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/concat.zep.c b/ext/stub/concat.zep.c index 24f1583fe5..6e9f5b0f86 100644 --- a/ext/stub/concat.zep.c +++ b/ext/stub/concat.zep.c @@ -29,12 +29,8 @@ ZEPHIR_INIT_CLASS(Stub_Concat) PHP_METHOD(Stub_Concat, getTestProperty) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_static_property_ce(&_0, stub_concat_ce, SL("testProperty"), PH_NOISY_CC | PH_READONLY); RETURN_CTORW(&_0); } @@ -44,23 +40,16 @@ PHP_METHOD(Stub_Concat, testConcatBySelfProperty) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *title_param = NULL, _0; zval title; - zval *this_ptr = getThis(); ZVAL_UNDEF(&title); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(title) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &title_param); zephir_get_strval(&title, title_param); - - ZEPHIR_OBS_NVAR(&_0); zephir_read_static_property_ce(&_0, stub_concat_ce, SL("testProperty"), PH_NOISY_CC); SEPARATE_ZVAL(&title); @@ -73,13 +62,11 @@ PHP_METHOD(Stub_Concat, testConcat1) { zval url, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&url); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&url); ZVAL_STRING(&url, "test"); @@ -94,14 +81,12 @@ PHP_METHOD(Stub_Concat, testConcat2) zval _1; zval url, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&url); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&url); ZVAL_STRING(&url, "test"); @@ -124,13 +109,11 @@ PHP_METHOD(Stub_Concat, testConcat3) { zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "1"); @@ -149,7 +132,6 @@ PHP_METHOD(Stub_Concat, testConcat4) double min = 0, max = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *value, value_sub, _0, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); @@ -157,21 +139,15 @@ PHP_METHOD(Stub_Concat, testConcat4) ZVAL_UNDEF(&query); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &value); - - ZEPHIR_INIT_VAR(&query); - min = (zephir_safe_div_zval_long(value, 100) * (double) (25)); - max = (zephir_safe_div_zval_long(value, 100) * (double) (50)); + min = ((zephir_safe_div_zval_long(value, 100) * (double) (25))); + max = ((zephir_safe_div_zval_long(value, 100) * (double) (50))); ZEPHIR_INIT_VAR(&_0); ZVAL_DOUBLE(&_0, max); ZEPHIR_INIT_VAR(&_1); @@ -194,24 +170,17 @@ PHP_METHOD(Stub_Concat, testConcat5) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *number_param = NULL, _0; double number; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&retval); ZVAL_UNDEF(&left); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(number) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &number_param); number = zephir_get_doubleval(number_param); - - ZEPHIR_INIT_VAR(&left); ZVAL_STRING(&left, "Concatenated string with number "); ZEPHIR_INIT_VAR(&_0); diff --git a/ext/stub/constants.zep.c b/ext/stub/constants.zep.c index c4f07a1086..eb47caedf9 100644 --- a/ext/stub/constants.zep.c +++ b/ext/stub/constants.zep.c @@ -71,81 +71,54 @@ ZEPHIR_INIT_CLASS(Stub_Constants) PHP_METHOD(Stub_Constants, getPropWsVarsGet) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propWsVarsGet"); } PHP_METHOD(Stub_Constants, getPropertyC1) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propertyC1"); } PHP_METHOD(Stub_Constants, getPropertyC2) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propertyC2"); } PHP_METHOD(Stub_Constants, getPropertyC3) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propertyC3"); } PHP_METHOD(Stub_Constants, getPropertyC4) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propertyC4"); } PHP_METHOD(Stub_Constants, getPropertyC5) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propertyC5"); } PHP_METHOD(Stub_Constants, getPropertyC6) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propertyC6"); } PHP_METHOD(Stub_Constants, getPropertyC7) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propertyC7"); } PHP_METHOD(Stub_Constants, getPropertyC8) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propertyC8"); } @@ -154,54 +127,36 @@ PHP_METHOD(Stub_Constants, getPropertyC8) */ PHP_METHOD(Stub_Constants, getPropertyC9) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propertyC9"); } PHP_METHOD(Stub_Constants, testReadConstant) { - zval *this_ptr = getThis(); - - RETURN_LONG(3); } PHP_METHOD(Stub_Constants, testReadClassConstant1) { - zval *this_ptr = getThis(); - - RETURN_LONG(10); } PHP_METHOD(Stub_Constants, testReadClassConstant2) { - zval *this_ptr = getThis(); - - RETURN_LONG(10); } PHP_METHOD(Stub_Constants, testReadClassConstant3) { - zval *this_ptr = getThis(); - - RETURN_LONG(10); } PHP_METHOD(Stub_Constants, testPHPVersionEnvConstant) { - zval *this_ptr = getThis(); - - ZEPHIR_GET_CONSTANT(return_value, "PHP_VERSION"); return; @@ -209,45 +164,30 @@ PHP_METHOD(Stub_Constants, testPHPVersionEnvConstant) PHP_METHOD(Stub_Constants, testClassMagicConstant) { - zval *this_ptr = getThis(); - - RETURN_STRING("Stub\\Constants"); } PHP_METHOD(Stub_Constants, testMethodMagicConstant) { - zval *this_ptr = getThis(); - - RETURN_STRING("Constants:testMethodMagicConstant"); } PHP_METHOD(Stub_Constants, testFunctionMagicConstant) { - zval *this_ptr = getThis(); - - RETURN_STRING("testFunctionMagicConstant"); } PHP_METHOD(Stub_Constants, testNamespaceMagicConstant) { - zval *this_ptr = getThis(); - - RETURN_STRING("Stub"); } PHP_METHOD(Stub_Constants, testDirConstant) { - zval *this_ptr = getThis(); - - RETURN_NULL(); } @@ -256,12 +196,10 @@ PHP_METHOD(Stub_Constants, testPHPVersionEnvConstantInExpValue) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZEPHIR_GET_CONSTANT(&a, "PHP_VERSION"); @@ -277,12 +215,10 @@ PHP_METHOD(Stub_Constants, testStringDelimiterConstantDoubleQuoted) { zval delimiter; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&delimiter); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&delimiter); ZVAL_STRING(&delimiter, "."); @@ -293,12 +229,10 @@ PHP_METHOD(Stub_Constants, testStringConstantWithVars) { zval property; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&property); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&property); ZVAL_STRING(&property, "$SOME/CSRF/KEY$"); @@ -307,18 +241,12 @@ PHP_METHOD(Stub_Constants, testStringConstantWithVars) PHP_METHOD(Stub_Constants, testStringPropertyWithVarsAssigned) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propWsVarsAssigned"); } PHP_METHOD(Stub_Constants, testStringPropertyWithVarsGet) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propWsVarsGet"); } diff --git a/ext/stub/constants.zep.h b/ext/stub/constants.zep.h index 1c7f8c870d..d975c181ee 100644 --- a/ext/stub/constants.zep.h +++ b/ext/stub/constants.zep.h @@ -105,130 +105,30 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constants_teststringpropertywithvarsget, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constants_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropWsVarsGet, arginfo_stub_constants_getpropwsvarsget, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropWsVarsGet, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC1, arginfo_stub_constants_getpropertyc1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC2, arginfo_stub_constants_getpropertyc2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC3, arginfo_stub_constants_getpropertyc3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC4, arginfo_stub_constants_getpropertyc4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC5, arginfo_stub_constants_getpropertyc5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC6, arginfo_stub_constants_getpropertyc6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC7, arginfo_stub_constants_getpropertyc7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC8, arginfo_stub_constants_getpropertyc8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC9, arginfo_stub_constants_getpropertyc9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testReadConstant, arginfo_stub_constants_testreadconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testReadConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testReadClassConstant1, arginfo_stub_constants_testreadclassconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testReadClassConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testReadClassConstant2, arginfo_stub_constants_testreadclassconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testReadClassConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testReadClassConstant3, arginfo_stub_constants_testreadclassconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testReadClassConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testPHPVersionEnvConstant, arginfo_stub_constants_testphpversionenvconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testPHPVersionEnvConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testClassMagicConstant, arginfo_stub_constants_testclassmagicconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testClassMagicConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testMethodMagicConstant, arginfo_stub_constants_testmethodmagicconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testMethodMagicConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testFunctionMagicConstant, arginfo_stub_constants_testfunctionmagicconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testFunctionMagicConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testNamespaceMagicConstant, arginfo_stub_constants_testnamespacemagicconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testNamespaceMagicConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testDirConstant, arginfo_stub_constants_testdirconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testDirConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testPHPVersionEnvConstantInExpValue, arginfo_stub_constants_testphpversionenvconstantinexpvalue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testPHPVersionEnvConstantInExpValue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testStringDelimiterConstantDoubleQuoted, arginfo_stub_constants_teststringdelimiterconstantdoublequoted, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testStringDelimiterConstantDoubleQuoted, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testStringConstantWithVars, arginfo_stub_constants_teststringconstantwithvars, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testStringConstantWithVars, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testStringPropertyWithVarsAssigned, arginfo_stub_constants_teststringpropertywithvarsassigned, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testStringPropertyWithVarsAssigned, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testStringPropertyWithVarsGet, arginfo_stub_constants_teststringpropertywithvarsget, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testStringPropertyWithVarsGet, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Constants, getPropWsVarsGet, arginfo_stub_constants_getpropwsvarsget, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC1, arginfo_stub_constants_getpropertyc1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC2, arginfo_stub_constants_getpropertyc2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC3, arginfo_stub_constants_getpropertyc3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC4, arginfo_stub_constants_getpropertyc4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC5, arginfo_stub_constants_getpropertyc5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC6, arginfo_stub_constants_getpropertyc6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC7, arginfo_stub_constants_getpropertyc7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC8, arginfo_stub_constants_getpropertyc8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC9, arginfo_stub_constants_getpropertyc9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testReadConstant, arginfo_stub_constants_testreadconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testReadClassConstant1, arginfo_stub_constants_testreadclassconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testReadClassConstant2, arginfo_stub_constants_testreadclassconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testReadClassConstant3, arginfo_stub_constants_testreadclassconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testPHPVersionEnvConstant, arginfo_stub_constants_testphpversionenvconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testClassMagicConstant, arginfo_stub_constants_testclassmagicconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testMethodMagicConstant, arginfo_stub_constants_testmethodmagicconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testFunctionMagicConstant, arginfo_stub_constants_testfunctionmagicconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testNamespaceMagicConstant, arginfo_stub_constants_testnamespacemagicconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testDirConstant, arginfo_stub_constants_testdirconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testPHPVersionEnvConstantInExpValue, arginfo_stub_constants_testphpversionenvconstantinexpvalue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testStringDelimiterConstantDoubleQuoted, arginfo_stub_constants_teststringdelimiterconstantdoublequoted, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testStringConstantWithVars, arginfo_stub_constants_teststringconstantwithvars, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testStringPropertyWithVarsAssigned, arginfo_stub_constants_teststringpropertywithvarsassigned, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testStringPropertyWithVarsGet, arginfo_stub_constants_teststringpropertywithvarsget, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/constantsinterface.zep.c b/ext/stub/constantsinterface.zep.c index e6ed8ba172..9c619ddf4a 100644 --- a/ext/stub/constantsinterface.zep.c +++ b/ext/stub/constantsinterface.zep.c @@ -25,108 +25,72 @@ ZEPHIR_INIT_CLASS(Stub_ConstantsInterface) PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant1) { - zval *this_ptr = getThis(); - - RETURN_NULL(); } PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant2) { - zval *this_ptr = getThis(); - - RETURN_BOOL(0); } PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant3) { - zval *this_ptr = getThis(); - - RETURN_BOOL(1); } PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant4) { - zval *this_ptr = getThis(); - - RETURN_LONG(10); } PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant5) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(10.25); } PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant6) { - zval *this_ptr = getThis(); - - RETURN_STRING("test"); } PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant1) { - zval *this_ptr = getThis(); - - RETURN_NULL(); } PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant2) { - zval *this_ptr = getThis(); - - RETURN_BOOL(0); } PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant3) { - zval *this_ptr = getThis(); - - RETURN_BOOL(1); } PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant4) { - zval *this_ptr = getThis(); - - RETURN_LONG(10); } PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant5) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(10.25); } PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant6) { - zval *this_ptr = getThis(); - - RETURN_STRING("test"); } diff --git a/ext/stub/constantsinterface.zep.h b/ext/stub/constantsinterface.zep.h index e9a940d24a..5bd9aa3c65 100644 --- a/ext/stub/constantsinterface.zep.h +++ b/ext/stub/constantsinterface.zep.h @@ -53,65 +53,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constantsinterface_testreadinheritancefromin ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constantsinterface_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant1, arginfo_stub_constantsinterface_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant2, arginfo_stub_constantsinterface_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant3, arginfo_stub_constantsinterface_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant4, arginfo_stub_constantsinterface_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant5, arginfo_stub_constantsinterface_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant6, arginfo_stub_constantsinterface_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant1, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant2, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant3, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant4, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant5, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant6, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant1, arginfo_stub_constantsinterface_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant2, arginfo_stub_constantsinterface_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant3, arginfo_stub_constantsinterface_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant4, arginfo_stub_constantsinterface_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant5, arginfo_stub_constantsinterface_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant6, arginfo_stub_constantsinterface_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant1, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant2, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant3, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant4, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant5, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant6, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant6, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/constantsinterfacea.zep.c b/ext/stub/constantsinterfacea.zep.c index b13995703a..288dc16bf1 100644 --- a/ext/stub/constantsinterfacea.zep.c +++ b/ext/stub/constantsinterfacea.zep.c @@ -25,54 +25,36 @@ ZEPHIR_INIT_CLASS(Stub_ConstantsInterfaceA) PHP_METHOD(Stub_ConstantsInterfaceA, testReadInterfaceConstant1) { - zval *this_ptr = getThis(); - - RETURN_NULL(); } PHP_METHOD(Stub_ConstantsInterfaceA, testReadInterfaceConstant2) { - zval *this_ptr = getThis(); - - RETURN_BOOL(0); } PHP_METHOD(Stub_ConstantsInterfaceA, testReadInterfaceConstant3) { - zval *this_ptr = getThis(); - - RETURN_BOOL(1); } PHP_METHOD(Stub_ConstantsInterfaceA, testReadInterfaceConstant4) { - zval *this_ptr = getThis(); - - RETURN_LONG(10); } PHP_METHOD(Stub_ConstantsInterfaceA, testReadInterfaceConstant5) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(10.25); } PHP_METHOD(Stub_ConstantsInterfaceA, testReadInterfaceConstant6) { - zval *this_ptr = getThis(); - - RETURN_STRING("test"); } diff --git a/ext/stub/constantsinterfacea.zep.h b/ext/stub/constantsinterfacea.zep.h index b332767b6a..95153a5bfd 100644 --- a/ext/stub/constantsinterfacea.zep.h +++ b/ext/stub/constantsinterfacea.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constantsinterfacea_testreadinterfaceconstan ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constantsinterfacea_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant1, arginfo_stub_constantsinterfacea_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant2, arginfo_stub_constantsinterfacea_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant3, arginfo_stub_constantsinterfacea_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant4, arginfo_stub_constantsinterfacea_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant5, arginfo_stub_constantsinterfacea_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant6, arginfo_stub_constantsinterfacea_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant1, arginfo_stub_constantsinterfacea_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant2, arginfo_stub_constantsinterfacea_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant3, arginfo_stub_constantsinterfacea_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant4, arginfo_stub_constantsinterfacea_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant5, arginfo_stub_constantsinterfacea_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant6, arginfo_stub_constantsinterfacea_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/constantsinterfaceb.zep.c b/ext/stub/constantsinterfaceb.zep.c index 2b5605012c..a12db42421 100644 --- a/ext/stub/constantsinterfaceb.zep.c +++ b/ext/stub/constantsinterfaceb.zep.c @@ -25,54 +25,36 @@ ZEPHIR_INIT_CLASS(Stub_ConstantsInterfaceB) PHP_METHOD(Stub_ConstantsInterfaceB, testReadInterfaceConstant1) { - zval *this_ptr = getThis(); - - RETURN_NULL(); } PHP_METHOD(Stub_ConstantsInterfaceB, testReadInterfaceConstant2) { - zval *this_ptr = getThis(); - - RETURN_BOOL(0); } PHP_METHOD(Stub_ConstantsInterfaceB, testReadInterfaceConstant3) { - zval *this_ptr = getThis(); - - RETURN_BOOL(1); } PHP_METHOD(Stub_ConstantsInterfaceB, testReadInterfaceConstant4) { - zval *this_ptr = getThis(); - - RETURN_LONG(10); } PHP_METHOD(Stub_ConstantsInterfaceB, testReadInterfaceConstant5) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(10.25); } PHP_METHOD(Stub_ConstantsInterfaceB, testReadInterfaceConstant6) { - zval *this_ptr = getThis(); - - RETURN_STRING("test"); } diff --git a/ext/stub/constantsinterfaceb.zep.h b/ext/stub/constantsinterfaceb.zep.h index a643c4dc33..39c7850cb7 100644 --- a/ext/stub/constantsinterfaceb.zep.h +++ b/ext/stub/constantsinterfaceb.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constantsinterfaceb_testreadinterfaceconstan ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constantsinterfaceb_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant1, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant2, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant3, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant4, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant5, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant6, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant1, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant2, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant3, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant4, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant5, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant6, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/constructors/issue1803.zep.c b/ext/stub/constructors/issue1803.zep.c index b16eecc55e..da0d9eb0a8 100644 --- a/ext/stub/constructors/issue1803.zep.c +++ b/ext/stub/constructors/issue1803.zep.c @@ -34,9 +34,8 @@ PHP_METHOD(Stub_Constructors_Issue1803, Issue1803) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); diff --git a/ext/stub/constructors/issue1803.zep.h b/ext/stub/constructors/issue1803.zep.h index 7b90bbfe28..0ce7ff2525 100644 --- a/ext/stub/constructors/issue1803.zep.h +++ b/ext/stub/constructors/issue1803.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constructors_issue1803_issue1803, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constructors_issue1803_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constructors_Issue1803, Issue1803, arginfo_stub_constructors_issue1803_issue1803, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constructors_Issue1803, Issue1803, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Constructors_Issue1803, Issue1803, arginfo_stub_constructors_issue1803_issue1803, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/declaretest.zep.c b/ext/stub/declaretest.zep.c index 3c54615cea..0af8801217 100644 --- a/ext/stub/declaretest.zep.c +++ b/ext/stub/declaretest.zep.c @@ -31,12 +31,10 @@ PHP_METHOD(Stub_DeclareTest, testStringDeclare1) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "/@(\\w+)(?:\\s*(?:\\(\\s*)?(.*?)(?:\\s*\\))?)??\\s*(?:\n|\\*\\/)/"); @@ -47,12 +45,10 @@ PHP_METHOD(Stub_DeclareTest, testStringDeclare2) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "/(\\w+)\\s*=\\s*(\\[[^\\]]*\\]|\"[^\"]*\"|[^,)]*)\\s*(?:,|$)/"); @@ -62,11 +58,6 @@ PHP_METHOD(Stub_DeclareTest, testStringDeclare2) PHP_METHOD(Stub_DeclareTest, testDeclare1) { zend_long a; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_LONG(a); } @@ -74,11 +65,6 @@ PHP_METHOD(Stub_DeclareTest, testDeclare1) PHP_METHOD(Stub_DeclareTest, testDeclare2) { zend_ulong a; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_LONG(a); } @@ -86,35 +72,20 @@ PHP_METHOD(Stub_DeclareTest, testDeclare2) PHP_METHOD(Stub_DeclareTest, testDeclare3) { double a; - zval *this_ptr = getThis(); - - - - - a = 1.0; + a = (1.0); RETURN_DOUBLE(a); } PHP_METHOD(Stub_DeclareTest, testDeclare4) { double a; - zval *this_ptr = getThis(); - - - - - a = 1.0; + a = (1.0); RETURN_DOUBLE(a); } PHP_METHOD(Stub_DeclareTest, testDeclare5) { char a; - zval *this_ptr = getThis(); - - - - a = 'A'; RETURN_LONG(a); } @@ -122,11 +93,6 @@ PHP_METHOD(Stub_DeclareTest, testDeclare5) PHP_METHOD(Stub_DeclareTest, testDeclare6) { unsigned char a; - zval *this_ptr = getThis(); - - - - a = 'A'; RETURN_LONG(a); } @@ -134,11 +100,6 @@ PHP_METHOD(Stub_DeclareTest, testDeclare6) PHP_METHOD(Stub_DeclareTest, testDeclare7) { long a; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_LONG(a); } @@ -146,11 +107,6 @@ PHP_METHOD(Stub_DeclareTest, testDeclare7) PHP_METHOD(Stub_DeclareTest, testDeclare8) { zend_bool a; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_BOOL(a); } @@ -158,11 +114,6 @@ PHP_METHOD(Stub_DeclareTest, testDeclare8) PHP_METHOD(Stub_DeclareTest, testDeclare9) { zend_bool a; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_BOOL(a); } @@ -170,11 +121,6 @@ PHP_METHOD(Stub_DeclareTest, testDeclare9) PHP_METHOD(Stub_DeclareTest, testDeclare10) { zend_long a; - zval *this_ptr = getThis(); - - - - a = 10; RETURN_LONG(a); } @@ -182,23 +128,13 @@ PHP_METHOD(Stub_DeclareTest, testDeclare10) PHP_METHOD(Stub_DeclareTest, testDeclare11) { double a; - zval *this_ptr = getThis(); - - - - - a = 10.5; + a = (10.5); RETURN_DOUBLE(a); } PHP_METHOD(Stub_DeclareTest, testDeclare12) { zend_bool a; - zval *this_ptr = getThis(); - - - - a = 0; RETURN_BOOL(a); } @@ -206,11 +142,6 @@ PHP_METHOD(Stub_DeclareTest, testDeclare12) PHP_METHOD(Stub_DeclareTest, testDeclare13) { zend_bool a; - zval *this_ptr = getThis(); - - - - a = 1; RETURN_BOOL(a); } @@ -219,12 +150,10 @@ PHP_METHOD(Stub_DeclareTest, testDeclare14) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "hello"); @@ -235,12 +164,10 @@ PHP_METHOD(Stub_DeclareTest, testDeclare15) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_NULL(&a); @@ -255,9 +182,8 @@ PHP_METHOD(Stub_DeclareTest, testDeclareMcallExpression) zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_CALL_METHOD(&a, this_ptr, "testdeclare14", NULL, 0); zephir_check_call_status(); diff --git a/ext/stub/declaretest.zep.h b/ext/stub/declaretest.zep.h index bd341be029..7a15c78f67 100644 --- a/ext/stub/declaretest.zep.h +++ b/ext/stub/declaretest.zep.h @@ -77,95 +77,23 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_declaretest_testdeclaremcallexpression, 0, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_declaretest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testStringDeclare1, arginfo_stub_declaretest_teststringdeclare1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testStringDeclare1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testStringDeclare2, arginfo_stub_declaretest_teststringdeclare2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testStringDeclare2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare1, arginfo_stub_declaretest_testdeclare1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare2, arginfo_stub_declaretest_testdeclare2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare3, arginfo_stub_declaretest_testdeclare3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare4, arginfo_stub_declaretest_testdeclare4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare5, arginfo_stub_declaretest_testdeclare5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare6, arginfo_stub_declaretest_testdeclare6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare7, arginfo_stub_declaretest_testdeclare7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare8, arginfo_stub_declaretest_testdeclare8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare9, arginfo_stub_declaretest_testdeclare9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare10, arginfo_stub_declaretest_testdeclare10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare11, arginfo_stub_declaretest_testdeclare11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare12, arginfo_stub_declaretest_testdeclare12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare13, arginfo_stub_declaretest_testdeclare13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare14, arginfo_stub_declaretest_testdeclare14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare15, arginfo_stub_declaretest_testdeclare15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare15, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclareMcallExpression, arginfo_stub_declaretest_testdeclaremcallexpression, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclareMcallExpression, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_DeclareTest, testStringDeclare1, arginfo_stub_declaretest_teststringdeclare1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testStringDeclare2, arginfo_stub_declaretest_teststringdeclare2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare1, arginfo_stub_declaretest_testdeclare1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare2, arginfo_stub_declaretest_testdeclare2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare3, arginfo_stub_declaretest_testdeclare3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare4, arginfo_stub_declaretest_testdeclare4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare5, arginfo_stub_declaretest_testdeclare5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare6, arginfo_stub_declaretest_testdeclare6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare7, arginfo_stub_declaretest_testdeclare7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare8, arginfo_stub_declaretest_testdeclare8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare9, arginfo_stub_declaretest_testdeclare9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare10, arginfo_stub_declaretest_testdeclare10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare11, arginfo_stub_declaretest_testdeclare11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare12, arginfo_stub_declaretest_testdeclare12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare13, arginfo_stub_declaretest_testdeclare13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare14, arginfo_stub_declaretest_testdeclare14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare15, arginfo_stub_declaretest_testdeclare15, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclareMcallExpression, arginfo_stub_declaretest_testdeclaremcallexpression, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/echoes.zep.c b/ext/stub/echoes.zep.c index b4523f63c8..45b76044e5 100644 --- a/ext/stub/echoes.zep.c +++ b/ext/stub/echoes.zep.c @@ -27,45 +27,30 @@ ZEPHIR_INIT_CLASS(Stub_Echoes) PHP_METHOD(Stub_Echoes, testEcho1) { - zval *this_ptr = getThis(); - - php_printf("%d", 1); } PHP_METHOD(Stub_Echoes, testEcho2) { - zval *this_ptr = getThis(); - - php_printf("%f", 1.0); } PHP_METHOD(Stub_Echoes, testEcho3) { - zval *this_ptr = getThis(); - - php_printf("%s", 1 ? "1": ""); } PHP_METHOD(Stub_Echoes, testEcho4) { - zval *this_ptr = getThis(); - - php_printf("%s", 0 ? "1": ""); } PHP_METHOD(Stub_Echoes, testEcho5) { - zval *this_ptr = getThis(); - - php_printf("%s", "hello"); } diff --git a/ext/stub/echoes.zep.h b/ext/stub/echoes.zep.h index 01b93baf47..727eecdf8e 100644 --- a/ext/stub/echoes.zep.h +++ b/ext/stub/echoes.zep.h @@ -25,30 +25,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_echoes_testecho5, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_echoes_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho1, arginfo_stub_echoes_testecho1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho2, arginfo_stub_echoes_testecho2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho3, arginfo_stub_echoes_testecho3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho4, arginfo_stub_echoes_testecho4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho5, arginfo_stub_echoes_testecho5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho5, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Echoes, testEcho1, arginfo_stub_echoes_testecho1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Echoes, testEcho2, arginfo_stub_echoes_testecho2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Echoes, testEcho3, arginfo_stub_echoes_testecho3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Echoes, testEcho4, arginfo_stub_echoes_testecho4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Echoes, testEcho5, arginfo_stub_echoes_testecho5, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/emptytest.zep.c b/ext/stub/emptytest.zep.c index 86489b35f7..d56e14f818 100644 --- a/ext/stub/emptytest.zep.c +++ b/ext/stub/emptytest.zep.c @@ -35,12 +35,10 @@ PHP_METHOD(Stub_EmptyTest, testDynamicVarArrayEmpty) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -51,13 +49,11 @@ PHP_METHOD(Stub_EmptyTest, testDynamicVarArrayNotEmpty) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 4, 0); @@ -80,12 +76,10 @@ PHP_METHOD(Stub_EmptyTest, testEmptyString) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, ""); @@ -96,12 +90,10 @@ PHP_METHOD(Stub_EmptyTest, testNotEmptyString) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "test string"); @@ -113,22 +105,15 @@ PHP_METHOD(Stub_EmptyTest, testString) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a_param = NULL; zval a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); zephir_get_strval(&a, a_param); - - RETURN_MM_BOOL(ZEPHIR_IS_EMPTY(&a)); } diff --git a/ext/stub/emptytest.zep.h b/ext/stub/emptytest.zep.h index 4a39df105a..1174fef9d5 100644 --- a/ext/stub/emptytest.zep.h +++ b/ext/stub/emptytest.zep.h @@ -26,26 +26,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_emptytest_teststring, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_emptytest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_EmptyTest, testDynamicVarArrayEmpty, arginfo_stub_emptytest_testdynamicvararrayempty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_EmptyTest, testDynamicVarArrayEmpty, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_EmptyTest, testDynamicVarArrayNotEmpty, arginfo_stub_emptytest_testdynamicvararraynotempty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_EmptyTest, testDynamicVarArrayNotEmpty, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_EmptyTest, testEmptyString, arginfo_stub_emptytest_testemptystring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_EmptyTest, testEmptyString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_EmptyTest, testNotEmptyString, arginfo_stub_emptytest_testnotemptystring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_EmptyTest, testNotEmptyString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_EmptyTest, testDynamicVarArrayEmpty, arginfo_stub_emptytest_testdynamicvararrayempty, ZEND_ACC_PUBLIC) +PHP_ME(Stub_EmptyTest, testDynamicVarArrayNotEmpty, arginfo_stub_emptytest_testdynamicvararraynotempty, ZEND_ACC_PUBLIC) +PHP_ME(Stub_EmptyTest, testEmptyString, arginfo_stub_emptytest_testemptystring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_EmptyTest, testNotEmptyString, arginfo_stub_emptytest_testnotemptystring, ZEND_ACC_PUBLIC) PHP_ME(Stub_EmptyTest, testString, arginfo_stub_emptytest_teststring, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/evaltest.zep.c b/ext/stub/evaltest.zep.c index ec0b6856f3..ee8777f820 100644 --- a/ext/stub/evaltest.zep.c +++ b/ext/stub/evaltest.zep.c @@ -30,22 +30,15 @@ PHP_METHOD(Stub_EvalTest, evalCode) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *code_param = NULL; zval code; - zval *this_ptr = getThis(); ZVAL_UNDEF(&code); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(code) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &code_param); zephir_get_strval(&code, code_param); - - zephir_eval_php(&code, return_value, "stub/evaltest.zep:7"); RETURN_MM(); } diff --git a/ext/stub/exception.zep.c b/ext/stub/exception.zep.c index e118b09254..24bf69dd52 100644 --- a/ext/stub/exception.zep.c +++ b/ext/stub/exception.zep.c @@ -40,15 +40,11 @@ PHP_METHOD(Stub_Exception, testRuntimePropertyFetch) zval *this_ptr = getThis(); ZVAL_UNDEF(&message); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(message) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &message_param); if (UNEXPECTED(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be of the type string")); @@ -59,8 +55,6 @@ PHP_METHOD(Stub_Exception, testRuntimePropertyFetch) } else { ZEPHIR_INIT_VAR(&message); } - - zephir_update_property_zval(this_ptr, ZEND_STRL("message"), &message); ZEPHIR_MM_RESTORE(); } diff --git a/ext/stub/exceptions.zep.c b/ext/stub/exceptions.zep.c index bf6aea1eb3..94f1bb0d66 100644 --- a/ext/stub/exceptions.zep.c +++ b/ext/stub/exceptions.zep.c @@ -31,9 +31,6 @@ ZEPHIR_INIT_CLASS(Stub_Exceptions) PHP_METHOD(Stub_Exceptions, testException1) { - zval *this_ptr = getThis(); - - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(stub_exception_ce, "hello1", "stub/exceptions.zep", 11); return; @@ -41,9 +38,6 @@ PHP_METHOD(Stub_Exceptions, testException1) PHP_METHOD(Stub_Exceptions, testExceptionStringEscape) { - zval *this_ptr = getThis(); - - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(stub_exception_ce, "hello \"simple code\" test", "stub/exceptions.zep", 16); return; @@ -54,19 +48,17 @@ PHP_METHOD(Stub_Exceptions, testException2) zval msg, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&msg); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&msg); ZVAL_STRING(&msg, "hello2"); ZEPHIR_INIT_VAR(&_0); object_init_ex(&_0, stub_exception_ce); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 28, &msg); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 29, &msg); zephir_check_call_status(); zephir_throw_exception_debug(&_0, "stub/exceptions.zep", 23); ZEPHIR_MM_RESTORE(); @@ -78,19 +70,17 @@ PHP_METHOD(Stub_Exceptions, testException3) zval ex, msg; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&ex); ZVAL_UNDEF(&msg); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&msg); ZVAL_STRING(&msg, "hello3"); ZEPHIR_INIT_VAR(&ex); object_init_ex(&ex, stub_exception_ce); - ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 28, &msg); + ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 29, &msg); zephir_check_call_status(); zephir_throw_exception_debug(&ex, "stub/exceptions.zep", 31); ZEPHIR_MM_RESTORE(); @@ -102,17 +92,15 @@ PHP_METHOD(Stub_Exceptions, getException) zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); object_init_ex(return_value, stub_exception_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello4"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 28, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 29, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -125,9 +113,8 @@ PHP_METHOD(Stub_Exceptions, testException4) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_CALL_METHOD(&_0, this_ptr, "getexception", NULL, 0); zephir_check_call_status(); @@ -141,19 +128,17 @@ PHP_METHOD(Stub_Exceptions, testException5) zval exception, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&exception); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&exception); object_init_ex(&exception, stub_exception_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello5"); - ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 28, &_0); + ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 29, &_0); zephir_check_call_status(); zephir_throw_exception_debug(&exception, "stub/exceptions.zep", 49); ZEPHIR_MM_RESTORE(); @@ -165,22 +150,15 @@ PHP_METHOD(Stub_Exceptions, testExceptionLiteral) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *type_param = NULL; zval type; - zval *this_ptr = getThis(); ZVAL_UNDEF(&type); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(type) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &type_param); zephir_get_strval(&type, type_param); - - do { if (ZEPHIR_IS_STRING(&type, "string")) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(stub_exception_ce, "Test", "stub/exceptions.zep", 56); @@ -209,27 +187,20 @@ PHP_METHOD(Stub_Exceptions, testExceptionSprintf) zend_long ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, _0, _1; zval name; - zval *this_ptr = getThis(); ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(&name, name_param); - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "Hello, %s"); - ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 16, &_0, &name); + ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 17, &_0, &name); zephir_check_call_status(); zephir_throw_exception_debug(&_1, "stub/exceptions.zep", 68); ZEPHIR_MM_RESTORE(); @@ -241,26 +212,19 @@ PHP_METHOD(Stub_Exceptions, testExceptionConcat) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *framework_param = NULL, *language_param = NULL; zval framework, language, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&framework); ZVAL_UNDEF(&language); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(framework) Z_PARAM_STR(language) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &framework_param, &language_param); zephir_get_strval(&framework, framework_param); zephir_get_strval(&language, language_param); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SVSV(&_0, "Framework ", &framework, " written using ", &language); zephir_throw_exception_debug(&_0, "stub/exceptions.zep", 73); @@ -277,11 +241,8 @@ PHP_METHOD(Stub_Exceptions, testExceptionRethrow) ZVAL_UNDEF(&e); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); /* try_start_1: */ ZEPHIR_CALL_METHOD(NULL, this_ptr, "testexception1", NULL, 0); @@ -323,30 +284,22 @@ PHP_METHOD(Stub_Exceptions, testMultiException) ZVAL_UNDEF(&_4$$7); ZVAL_UNDEF(&_6$$10); ZVAL_UNDEF(&_8$$13); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(returnValue) Z_PARAM_ZVAL(exception) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &returnValue, &exception); - - - ZEPHIR_OBS_VAR(&iexc); + zephir_memory_observe(&iexc); zephir_read_property(&iexc, this_ptr, ZEND_STRL("internalExceptionCallable"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(&exc); + zephir_memory_observe(&exc); zephir_read_property(&exc, this_ptr, ZEND_STRL("exceptionCallable"), PH_NOISY_CC); /* try_start_1: */ zephir_throw_exception_debug(exception, "stub/exceptions.zep", 95); goto try_end_1; - - try_end_1: if (EG(exception)) { @@ -435,14 +388,11 @@ PHP_METHOD(Stub_Exceptions, issue1325) ZVAL_UNDEF(&e); ZVAL_UNDEF(&status); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); /* try_start_1: */ - ZEPHIR_CALL_METHOD(&status, this_ptr, "donoopexception", NULL, 29); + ZEPHIR_CALL_METHOD(&status, this_ptr, "donoopexception", NULL, 30); zephir_check_call_status_or_jump(try_end_1); try_end_1: @@ -463,9 +413,6 @@ PHP_METHOD(Stub_Exceptions, issue1325) PHP_METHOD(Stub_Exceptions, doNoopException) { - zval *this_ptr = getThis(); - - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(zend_ce_exception, "I am exception", "stub/exceptions.zep", 140); return; diff --git a/ext/stub/exceptions.zep.h b/ext/stub/exceptions.zep.h index 1a6edfd7ec..9e16bab5fb 100644 --- a/ext/stub/exceptions.zep.h +++ b/ext/stub/exceptions.zep.h @@ -67,59 +67,19 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_exceptions_donoopexception, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_exceptions_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException1, arginfo_stub_exceptions_testexception1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testExceptionStringEscape, arginfo_stub_exceptions_testexceptionstringescape, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testExceptionStringEscape, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException2, arginfo_stub_exceptions_testexception2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException3, arginfo_stub_exceptions_testexception3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, getException, arginfo_stub_exceptions_getexception, ZEND_ACC_PROTECTED) -#else - PHP_ME(Stub_Exceptions, getException, NULL, ZEND_ACC_PROTECTED) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException4, arginfo_stub_exceptions_testexception4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException5, arginfo_stub_exceptions_testexception5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException5, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Exceptions, testException1, arginfo_stub_exceptions_testexception1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, testExceptionStringEscape, arginfo_stub_exceptions_testexceptionstringescape, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, testException2, arginfo_stub_exceptions_testexception2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, testException3, arginfo_stub_exceptions_testexception3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, getException, arginfo_stub_exceptions_getexception, ZEND_ACC_PROTECTED) +PHP_ME(Stub_Exceptions, testException4, arginfo_stub_exceptions_testexception4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, testException5, arginfo_stub_exceptions_testexception5, ZEND_ACC_PUBLIC) PHP_ME(Stub_Exceptions, testExceptionLiteral, arginfo_stub_exceptions_testexceptionliteral, ZEND_ACC_PUBLIC) PHP_ME(Stub_Exceptions, testExceptionSprintf, arginfo_stub_exceptions_testexceptionsprintf, ZEND_ACC_PUBLIC) PHP_ME(Stub_Exceptions, testExceptionConcat, arginfo_stub_exceptions_testexceptionconcat, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testExceptionRethrow, arginfo_stub_exceptions_testexceptionrethrow, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testExceptionRethrow, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Exceptions, testExceptionRethrow, arginfo_stub_exceptions_testexceptionrethrow, ZEND_ACC_PUBLIC) PHP_ME(Stub_Exceptions, testMultiException, arginfo_stub_exceptions_testmultiexception, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, issue1325, arginfo_stub_exceptions_issue1325, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, issue1325, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, doNoopException, arginfo_stub_exceptions_donoopexception, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_Exceptions, doNoopException, NULL, ZEND_ACC_PRIVATE) -#endif +PHP_ME(Stub_Exceptions, issue1325, arginfo_stub_exceptions_issue1325, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, doNoopException, arginfo_stub_exceptions_donoopexception, ZEND_ACC_PRIVATE) PHP_FE_END }; diff --git a/ext/stub/exists.zep.c b/ext/stub/exists.zep.c index 4a8dd9a916..2f5f5fd5c2 100644 --- a/ext/stub/exists.zep.c +++ b/ext/stub/exists.zep.c @@ -29,28 +29,19 @@ PHP_METHOD(Stub_Exists, testClassExists) { zend_bool autoload; zval *className, className_sub, *autoload_param = NULL, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&className_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(className) Z_PARAM_OPTIONAL Z_PARAM_BOOL(autoload) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 1, &className, &autoload_param); if (!autoload_param) { autoload = 1; } else { - autoload = zephir_get_boolval(autoload_param); - } - - + } ZVAL_BOOL(&_0, (autoload ? 1 : 0)); RETURN_BOOL(zephir_class_exists(className, zephir_is_true(&_0) )); } @@ -59,28 +50,19 @@ PHP_METHOD(Stub_Exists, testInterfaceExists) { zend_bool autoload; zval *interfaceName, interfaceName_sub, *autoload_param = NULL, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&interfaceName_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(interfaceName) Z_PARAM_OPTIONAL Z_PARAM_BOOL(autoload) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 1, &interfaceName, &autoload_param); if (!autoload_param) { autoload = 1; } else { - autoload = zephir_get_boolval(autoload_param); - } - - + } ZVAL_BOOL(&_0, (autoload ? 1 : 0)); RETURN_BOOL(zephir_interface_exists(interfaceName, zephir_is_true(&_0) )); } @@ -88,42 +70,26 @@ PHP_METHOD(Stub_Exists, testInterfaceExists) PHP_METHOD(Stub_Exists, testMethodExists) { zval *obj, obj_sub, *methodName, methodName_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); ZVAL_UNDEF(&methodName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(obj) Z_PARAM_ZVAL(methodName) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &obj, &methodName); - - RETURN_BOOL((zephir_method_exists(obj, methodName) == SUCCESS)); } PHP_METHOD(Stub_Exists, testFileExists) { zval *fileName, fileName_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&fileName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(fileName) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &fileName); - - RETURN_BOOL((zephir_file_exists(fileName) == SUCCESS)); } diff --git a/ext/stub/exitdie.zep.c b/ext/stub/exitdie.zep.c index 797c1a8a1f..c4d3b63b7b 100644 --- a/ext/stub/exitdie.zep.c +++ b/ext/stub/exitdie.zep.c @@ -28,26 +28,19 @@ ZEPHIR_INIT_CLASS(Stub_ExitDie) PHP_METHOD(Stub_ExitDie, testExit) { zval *param = NULL, param_sub, __$null; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶m); if (!param) { param = ¶m_sub; param = &__$null; } - - if (ZEPHIR_IS_EMPTY(param)) { zephir_exit_empty(); } @@ -57,26 +50,19 @@ PHP_METHOD(Stub_ExitDie, testExit) PHP_METHOD(Stub_ExitDie, testDie) { zval *param = NULL, param_sub, __$null; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶m); if (!param) { param = ¶m_sub; param = &__$null; } - - if (ZEPHIR_IS_EMPTY(param)) { zephir_exit_empty(); } diff --git a/ext/stub/factorial.zep.c b/ext/stub/factorial.zep.c index 238f1ebb68..004bc240d3 100644 --- a/ext/stub/factorial.zep.c +++ b/ext/stub/factorial.zep.c @@ -31,20 +31,11 @@ PHP_METHOD(Stub_Factorial, intIterativeFactorial) long result, i = 0; zval *n_param = NULL; zend_long n, _1, _2; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &n_param); - n = zephir_get_intval(n_param); - - result = 1; _2 = n; _1 = 2; @@ -77,30 +68,25 @@ PHP_METHOD(Stub_Factorial, intRecursiveFactorial) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &num_param); - num = zephir_get_intval(num_param); - - ZEPHIR_INIT_VAR(&_0); _1 = num == 0; if (!(_1)) { _1 = num == 1; } if (_1) { + ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 1); } else { ZVAL_LONG(&_3, (num - 1)); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "intrecursivefactorial", NULL, 30, &_3); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "intrecursivefactorial", NULL, 31, &_3); zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, (num * zephir_get_numberval(&_2))); } RETURN_CCTOR(&_0); diff --git a/ext/stub/fannkuch.zep.c b/ext/stub/fannkuch.zep.c index 91d53018bf..cd0e4ee587 100644 --- a/ext/stub/fannkuch.zep.c +++ b/ext/stub/fannkuch.zep.c @@ -38,7 +38,6 @@ PHP_METHOD(Stub_Fannkuch, process) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *n_param = NULL, perm, perm0, perm1, count, temp, _3$$3, _4$$6, _9$$4, _8$$7, _10$$8, _14$$9, _15$$14, _16$$15, _17$$13, _18$$13, _19$$13; zend_long n, maxFlipsCount, permCount, checksum, i = 0, j = 0, flipsCount = 0, k = 0, r = 0, k2 = 0, _1, _2, _6$$4, _7$$4, _12$$8, _13$$8; - zval *this_ptr = getThis(); ZVAL_UNDEF(&perm); ZVAL_UNDEF(&perm0); @@ -56,19 +55,12 @@ PHP_METHOD(Stub_Fannkuch, process) ZVAL_UNDEF(&_17$$13); ZVAL_UNDEF(&_18$$13); ZVAL_UNDEF(&_19$$13); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n_param); - n = zephir_get_intval(n_param); - - maxFlipsCount = 0; permCount = 0; checksum = 0; diff --git a/ext/stub/fasta.zep.c b/ext/stub/fasta.zep.c index f6d6e80952..33621f0e62 100644 --- a/ext/stub/fasta.zep.c +++ b/ext/stub/fasta.zep.c @@ -36,7 +36,6 @@ PHP_METHOD(Stub_Fasta, fastaRepeat) zend_long ZEPHIR_LAST_CALL_STATUS, seqi, i = 0; zval seq; zval *n, n_sub, *seq_param = NULL, len, j, k, l, block, str, lines, _0, _1, _3, _4, _9, _10, _6$$3, _7$$3, _8$$3, _11$$6, _12$$7, _13$$7, _14$$7, _15$$7; - zval *this_ptr = getThis(); ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&len); @@ -63,20 +62,14 @@ PHP_METHOD(Stub_Fasta, fastaRepeat) ZVAL_UNDEF(&seq); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(n) Z_PARAM_STR(seq) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &n, &seq_param); zephir_get_strval(&seq, seq_param); - - seqi = 0; ZEPHIR_INIT_VAR(&len); ZVAL_LONG(&len, zephir_fast_strlen_ev(&seq)); @@ -99,7 +92,7 @@ PHP_METHOD(Stub_Fasta, fastaRepeat) if (ZEPHIR_LE_LONG(&j, -1)) { break; } - ZEPHIR_SEPARATE(&j); + SEPARATE_ZVAL(&j); zephir_decrement(&j); ZVAL_LONG(&_6$$3, (60 * zephir_get_numberval(&j))); ZVAL_LONG(&_7$$3, 60); @@ -122,7 +115,7 @@ PHP_METHOD(Stub_Fasta, fastaRepeat) break; } zend_print_zval(&block, 0); - ZEPHIR_SEPARATE(&j); + SEPARATE_ZVAL(&j); zephir_increment(&j); } ZEPHIR_INIT_NVAR(&j); @@ -135,7 +128,7 @@ PHP_METHOD(Stub_Fasta, fastaRepeat) } zephir_array_fetch(&_11$$6, &lines, &j, PH_NOISY | PH_READONLY, "stub/fasta.zep", 38); zend_print_zval(&_11$$6, 0); - ZEPHIR_SEPARATE(&j); + SEPARATE_ZVAL(&j); zephir_increment(&j); } if (zephir_safe_mod_zval_long(n, 60) > 0) { @@ -151,9 +144,6 @@ PHP_METHOD(Stub_Fasta, fastaRepeat) PHP_METHOD(Stub_Fasta, fastRandom) { - zval *this_ptr = getThis(); - - } @@ -171,18 +161,12 @@ PHP_METHOD(Stub_Fasta, main) ZVAL_UNDEF(&homoSap); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SSSSSSS(&_0, "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG", "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA", "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT", "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA", "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG", "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC", "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"); ZEPHIR_CPY_WRT(&alu, &_0); diff --git a/ext/stub/fasta.zep.h b/ext/stub/fasta.zep.h index acc0cf9d48..ddc3d9c374 100644 --- a/ext/stub/fasta.zep.h +++ b/ext/stub/fasta.zep.h @@ -21,11 +21,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_fasta_method_entry) { PHP_ME(Stub_Fasta, fastaRepeat, arginfo_stub_fasta_fastarepeat, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fasta, fastRandom, arginfo_stub_fasta_fastrandom, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fasta, fastRandom, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Fasta, fastRandom, arginfo_stub_fasta_fastrandom, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fasta, main, arginfo_stub_fasta_main, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/fcall.zep.c b/ext/stub/fcall.zep.c index 060bdcab57..9086587406 100644 --- a/ext/stub/fcall.zep.c +++ b/ext/stub/fcall.zep.c @@ -41,13 +41,11 @@ PHP_METHOD(Stub_Fcall, testCall1) { zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello"); @@ -63,18 +61,16 @@ PHP_METHOD(Stub_Fcall, testCall2) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_2 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); while (1) { ZVAL_LONG(&_0$$3, 0); ZVAL_LONG(&_1$$3, 100); - ZEPHIR_RETURN_CALL_FUNCTION("mt_rand", &_2, 31, &_0$$3, &_1$$3); + ZEPHIR_RETURN_CALL_FUNCTION("mt_rand", &_2, 32, &_0$$3, &_1$$3); zephir_check_call_status(); RETURN_MM(); } @@ -86,7 +82,6 @@ PHP_METHOD(Stub_Fcall, testCall3) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_2 = NULL, *_4 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&handle); ZVAL_UNDEF(&handle2); @@ -94,26 +89,25 @@ PHP_METHOD(Stub_Fcall, testCall3) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3$$4); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "inputfile.txt"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "r"); - ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 33, &_0, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "outputfile.txt"); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "w"); - ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 33, &_0, &_1); zephir_check_call_status(); if (zephir_is_true(&handle)) { while (1) { ZVAL_LONG(&_3$$4, 4096); - ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 33, &handle, &_3$$4); + ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 34, &handle, &_3$$4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&buffer)) { break; @@ -132,7 +126,6 @@ PHP_METHOD(Stub_Fcall, testCall4) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_2 = NULL, *_4 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&handle); ZVAL_UNDEF(&handle2); @@ -140,26 +133,25 @@ PHP_METHOD(Stub_Fcall, testCall4) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3$$4); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "r"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "inputfile.txt"); - ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 33, &_0, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "outputfile.txt"); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "w"); - ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 33, &_0, &_1); zephir_check_call_status(); if (zephir_is_true(&handle)) { while (1) { ZVAL_LONG(&_3$$4, 4096); - ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 33, &handle, &_3$$4); + ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 34, &handle, &_3$$4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&buffer)) { break; @@ -177,24 +169,17 @@ PHP_METHOD(Stub_Fcall, testCall5) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", NULL, 20, a, b); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", NULL, 21, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -203,13 +188,10 @@ PHP_METHOD(Stub_Fcall, testCall6) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_FUNCTION("rand", NULL, 34); + ZEPHIR_RETURN_CALL_FUNCTION("rand", NULL, 35); zephir_check_call_status(); RETURN_MM(); } @@ -218,13 +200,10 @@ PHP_METHOD(Stub_Fcall, testCall7) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_FUNCTION(NULL, "memory_get_usage", NULL, 35); + ZEPHIR_CALL_FUNCTION(NULL, "memory_get_usage", NULL, 36); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -234,29 +213,23 @@ PHP_METHOD(Stub_Fcall, zvalFcallWith1Parameter) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *callback, callback_sub, *param1 = NULL, param1_sub, __$null; - zval *this_ptr = getThis(); ZVAL_UNDEF(&callback_sub); ZVAL_UNDEF(¶m1_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(callback) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param1) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &callback, ¶m1); if (!param1) { param1 = ¶m1_sub; param1 = &__$null; } - - ZEPHIR_CALL_ZVAL_FUNCTION(NULL, callback, NULL, 0, param1); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -267,25 +240,18 @@ PHP_METHOD(Stub_Fcall, testCall8) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub, *b, b_sub, x; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&x); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - - ZEPHIR_CALL_FUNCTION(&x, "str_repeat", NULL, 20, a, b); + ZEPHIR_CALL_FUNCTION(&x, "str_repeat", NULL, 21, a, b); zephir_check_call_status(); RETURN_CCTOR(&x); } @@ -295,14 +261,12 @@ PHP_METHOD(Stub_Fcall, testCall1FromVar) zval funcName, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&funcName); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&funcName); ZVAL_STRING(&funcName, "strpos"); @@ -317,9 +281,6 @@ PHP_METHOD(Stub_Fcall, testCall1FromVar) PHP_METHOD(Stub_Fcall, testStrtokFalse) { - zval *this_ptr = getThis(); - - RETURN_BOOL(0); } @@ -329,25 +290,18 @@ PHP_METHOD(Stub_Fcall, testStrtokVarBySlash) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *value, value_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &value); - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "/"); - ZEPHIR_RETURN_CALL_FUNCTION("strtok", NULL, 36, value, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("strtok", NULL, 37, value, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -355,31 +309,20 @@ PHP_METHOD(Stub_Fcall, testStrtokVarBySlash) PHP_METHOD(Stub_Fcall, testFunctionGetArgs) { zval *param1, param1_sub, *param2, param2_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1_sub); ZVAL_UNDEF(¶m2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(param1) Z_PARAM_ZVAL(param2) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, ¶m1, ¶m2); - - zephir_get_args(return_value); return; } PHP_METHOD(Stub_Fcall, testFunctionGetArgsAllExtra) { - zval *this_ptr = getThis(); - - zephir_get_args(return_value); return; @@ -387,9 +330,6 @@ PHP_METHOD(Stub_Fcall, testFunctionGetArgsAllExtra) PHP_METHOD(Stub_Fcall, testStaticFunctionGetArgsAllExtra) { - zval *this_ptr = getThis(); - - zephir_get_args(return_value); return; @@ -399,26 +339,19 @@ PHP_METHOD(Stub_Fcall, testFunctionGetArg) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *param1, param1_sub, *param2, param2_sub, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1_sub); ZVAL_UNDEF(¶m2_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(param1) Z_PARAM_ZVAL(param2) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, ¶m1, ¶m2); - - zephir_create_array(return_value, 2, 0); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_1, 0); @@ -435,14 +368,12 @@ PHP_METHOD(Stub_Fcall, testFunctionGetArgAllExtra) { zval _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_create_array(return_value, 2, 0); ZEPHIR_INIT_VAR(&_0); @@ -460,14 +391,12 @@ PHP_METHOD(Stub_Fcall, testStaticFunctionGetArgAllExtra) { zval _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_create_array(return_value, 2, 0); ZEPHIR_INIT_VAR(&_0); @@ -487,16 +416,14 @@ PHP_METHOD(Stub_Fcall, testArrayFill) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&v1); ZVAL_UNDEF(&v2); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 5); @@ -522,18 +449,12 @@ PHP_FUNCTION(g_stub_zephir_global_method_test) { zval *str, str_sub, _0; ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str); - - ZEPHIR_INIT_VAR(&_0); object_init_ex(&_0, stub_fcall_ce); if (zephir_has_constructor(&_0)) { @@ -541,7 +462,7 @@ PHP_FUNCTION(g_stub_zephir_global_method_test) { zephir_check_call_status(); } - ZEPHIR_RETURN_CALL_METHOD(&_0, "teststrtokvarbyslash", NULL, 37, str); + ZEPHIR_RETURN_CALL_METHOD(&_0, "teststrtokvarbyslash", NULL, 38, str); zephir_check_call_status(); RETURN_MM(); } @@ -549,17 +470,10 @@ PHP_FUNCTION(g_stub_zephir_global_method_test) { PHP_FUNCTION(g_stub_zephir_global_method_with_type_casting) { zval *variable, variable_sub; ZVAL_UNDEF(&variable_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(variable) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &variable); - - RETVAL_ZVAL(variable, 1, 0); return; } @@ -571,18 +485,12 @@ PHP_FUNCTION(f_Stub_zephir_namespaced_method_test) { ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &str); - - ZEPHIR_INIT_VAR(&_0); object_init_ex(&_0, stub_fcall_ce); if (zephir_has_constructor(&_0)) { @@ -591,7 +499,7 @@ PHP_FUNCTION(f_Stub_zephir_namespaced_method_test) { } ZVAL_LONG(&_1, 5); - ZEPHIR_RETURN_CALL_METHOD(&_0, "testcall5", NULL, 38, str, &_1); + ZEPHIR_RETURN_CALL_METHOD(&_0, "testcall5", NULL, 39, str, &_1); zephir_check_call_status(); RETURN_MM(); } @@ -599,34 +507,20 @@ PHP_FUNCTION(f_Stub_zephir_namespaced_method_test) { PHP_FUNCTION(f_Stub_test_call_relative_object_hint) { zval *a, a_sub; ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(1); } PHP_FUNCTION(f_Stub_zephir_namespaced_method_with_type_casting) { zval *variable, variable_sub; ZVAL_UNDEF(&variable_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(variable) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &variable); - - RETVAL_ZVAL(variable, 1, 0); return; } @@ -634,17 +528,10 @@ PHP_FUNCTION(f_Stub_zephir_namespaced_method_with_type_casting) { PHP_FUNCTION(f_Stub_test_call_object_hint) { zval *a, a_sub; ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(1); } diff --git a/ext/stub/fcall.zep.h b/ext/stub/fcall.zep.h index 47e875729a..3b955311e4 100644 --- a/ext/stub/fcall.zep.h +++ b/ext/stub/fcall.zep.h @@ -94,27 +94,11 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_fcall_method_entry) { PHP_ME(Stub_Fcall, testCall1, arginfo_stub_fcall_testcall1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, testCall2, arginfo_stub_fcall_testcall2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fcall, testCall3, arginfo_stub_fcall_testcall3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fcall, testCall3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fcall, testCall4, arginfo_stub_fcall_testcall4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fcall, testCall4, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Fcall, testCall3, arginfo_stub_fcall_testcall3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fcall, testCall4, arginfo_stub_fcall_testcall4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, testCall5, arginfo_stub_fcall_testcall5, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fcall, testCall6, arginfo_stub_fcall_testcall6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fcall, testCall6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fcall, testCall7, arginfo_stub_fcall_testcall7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fcall, testCall7, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Fcall, testCall6, arginfo_stub_fcall_testcall6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fcall, testCall7, arginfo_stub_fcall_testcall7, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, zvalFcallWith1Parameter, arginfo_stub_fcall_zvalfcallwith1parameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, testCall8, arginfo_stub_fcall_testcall8, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, testCall1FromVar, arginfo_stub_fcall_testcall1fromvar, ZEND_ACC_PUBLIC) diff --git a/ext/stub/fetchtest.zep.c b/ext/stub/fetchtest.zep.c index ef3d2ad542..c006f98154 100644 --- a/ext/stub/fetchtest.zep.c +++ b/ext/stub/fetchtest.zep.c @@ -35,101 +35,75 @@ PHP_METHOD(Stub_FetchTest, setValues) zval *this_ptr = getThis(); ZVAL_UNDEF(&values_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(values) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &values); - - zephir_update_property_zval(this_ptr, ZEND_STRL("values"), values); RETURN_THISW(); } PHP_METHOD(Stub_FetchTest, getValues) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "values"); } PHP_METHOD(Stub_FetchTest, testFetchArray1) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub, *b, b_sub, c; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - - RETURN_BOOL(zephir_array_isset_fetch(&c, a, b, 1)); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); + zephir_fetch_params(1, 2, 0, &a, &b); + zephir_memory_observe(&c); + RETURN_MM_BOOL(zephir_array_isset_fetch(&c, a, b, 0)); } PHP_METHOD(Stub_FetchTest, testFetchArray2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a = NULL, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); ZEPHIR_SEPARATE_PARAM(a); - - ZEPHIR_OBS_NVAR(a); RETURN_MM_BOOL(zephir_array_isset_fetch(a, a, b, 0)); } PHP_METHOD(Stub_FetchTest, testFetchArray3) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long b; zval *a, a_sub, *b_param = NULL, c; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b_param); - b = zephir_get_intval(b_param); - - - RETURN_BOOL(zephir_array_isset_long_fetch(&c, a, b, 1)); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); + zephir_fetch_params(1, 2, 0, &a, &b_param); + zephir_memory_observe(&c); + RETURN_MM_BOOL(zephir_array_isset_long_fetch(&c, a, b, 0)); } PHP_METHOD(Stub_FetchTest, testFetchArray4) @@ -137,24 +111,16 @@ PHP_METHOD(Stub_FetchTest, testFetchArray4) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long b; zval *a = NULL, a_sub, *b_param = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b_param); ZEPHIR_SEPARATE_PARAM(a); - b = zephir_get_intval(b_param); - - ZEPHIR_OBS_NVAR(a); RETURN_MM_BOOL(zephir_array_isset_long_fetch(a, a, b, 0)); } @@ -164,26 +130,20 @@ PHP_METHOD(Stub_FetchTest, testFetchArray5) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval b; zval *a, a_sub, *b_param = NULL, c; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&c); ZVAL_UNDEF(&b); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_STR(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b_param); zephir_get_strval(&b, b_param); - - - RETURN_MM_BOOL(zephir_array_isset_fetch(&c, a, &b, 1)); + zephir_memory_observe(&c); + RETURN_MM_BOOL(zephir_array_isset_fetch(&c, a, &b, 0)); } PHP_METHOD(Stub_FetchTest, testFetchArray6) @@ -191,25 +151,18 @@ PHP_METHOD(Stub_FetchTest, testFetchArray6) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval b; zval *a = NULL, a_sub, *b_param = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_STR(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b_param); ZEPHIR_SEPARATE_PARAM(a); zephir_get_strval(&b, b_param); - - ZEPHIR_OBS_NVAR(a); RETURN_MM_BOOL(zephir_array_isset_fetch(a, a, &b, 0)); } @@ -218,25 +171,18 @@ PHP_METHOD(Stub_FetchTest, testFetchObject1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub, *b, b_sub, c; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - - ZEPHIR_OBS_VAR(&c); + zephir_memory_observe(&c); RETURN_MM_BOOL(zephir_fetch_property_zval(&c, a, b, PH_SILENT_CC)); } @@ -244,119 +190,89 @@ PHP_METHOD(Stub_FetchTest, testFetchObject2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a = NULL, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); ZEPHIR_SEPARATE_PARAM(a); - - ZEPHIR_OBS_NVAR(a); RETURN_MM_BOOL(zephir_fetch_property_zval(a, a, b, PH_SILENT_CC)); } PHP_METHOD(Stub_FetchTest, testFetchPost) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *b, b_sub, _POST, c; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_POST); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_POST, SL("_POST")); - zephir_fetch_params_without_memory_grow(1, 0, &b); - - - if (!(zephir_array_isset_fetch(&c, &_POST, b, 1))) { - RETURN_BOOL(0); + zephir_fetch_params(1, 1, 0, &b); + zephir_memory_observe(&c); + if (!(zephir_array_isset_fetch(&c, &_POST, b, 0))) { + RETURN_MM_BOOL(0); } - RETURN_CTORW(&c); + RETURN_CCTOR(&c); } PHP_METHOD(Stub_FetchTest, hasValue) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, _POST, _0$$4; - zval name; + zval *name, name_sub, _POST, _0$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&name_sub); ZVAL_UNDEF(&_POST); ZVAL_UNDEF(&_0$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + Z_PARAM_ZVAL(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); zephir_get_global(&_POST, SL("_POST")); - zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&name, name_param); - - - if (zephir_array_isset(&_POST, &name)) { - RETURN_MM_BOOL(1); + zephir_fetch_params_without_memory_grow(1, 0, &name); + if (zephir_array_isset(&_POST, name)) { + RETURN_BOOL(1); } else { zephir_read_property(&_0$$4, this_ptr, ZEND_STRL("values"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset(&_0$$4, &name)) { - RETURN_MM_BOOL(1); + if (zephir_array_isset(&_0$$4, name)) { + RETURN_BOOL(1); } } - RETURN_MM_BOOL(0); + RETURN_BOOL(0); } PHP_METHOD(Stub_FetchTest, getValue) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, _POST, value, _0$$3; - zval name; + zval *name, name_sub, _POST, value, _0$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&name_sub); ZVAL_UNDEF(&_POST); ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STR(name) + Z_PARAM_ZVAL(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_POST, SL("_POST")); - zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&name, name_param); - - - ZEPHIR_OBS_VAR(&value); - if (!(zephir_array_isset_fetch(&value, &_POST, &name, 0))) { + zephir_fetch_params(1, 1, 0, &name); + zephir_memory_observe(&value); + if (!(zephir_array_isset_fetch(&value, &_POST, name, 0))) { ZEPHIR_OBS_NVAR(&value); zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("values"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&value, &_0$$3, &name, 0))) { + if (!(zephir_array_isset_fetch(&value, &_0$$3, name, 0))) { RETURN_MM_NULL(); } } diff --git a/ext/stub/fetchtest.zep.h b/ext/stub/fetchtest.zep.h index 0787fec806..9d3cc5cd8d 100644 --- a/ext/stub/fetchtest.zep.h +++ b/ext/stub/fetchtest.zep.h @@ -69,20 +69,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_fetchtest_testfetchpost, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_fetchtest_hasvalue, 0, 1, _IS_BOOL, 0) - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) + ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_fetchtest_getvalue, 0, 0, 1) - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) + ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_fetchtest_method_entry) { PHP_ME(Stub_FetchTest, setValues, arginfo_stub_fetchtest_setvalues, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_FetchTest, getValues, arginfo_stub_fetchtest_getvalues, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_FetchTest, getValues, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_FetchTest, getValues, arginfo_stub_fetchtest_getvalues, ZEND_ACC_PUBLIC) PHP_ME(Stub_FetchTest, testFetchArray1, arginfo_stub_fetchtest_testfetcharray1, ZEND_ACC_PUBLIC) PHP_ME(Stub_FetchTest, testFetchArray2, arginfo_stub_fetchtest_testfetcharray2, ZEND_ACC_PUBLIC) PHP_ME(Stub_FetchTest, testFetchArray3, arginfo_stub_fetchtest_testfetcharray3, ZEND_ACC_PUBLIC) diff --git a/ext/stub/fibonnaci.zep.c b/ext/stub/fibonnaci.zep.c index b5d533012f..2b51a1f97b 100644 --- a/ext/stub/fibonnaci.zep.c +++ b/ext/stub/fibonnaci.zep.c @@ -29,11 +29,6 @@ ZEPHIR_INIT_CLASS(Stub_Fibonnaci) PHP_METHOD(Stub_Fibonnaci, fibInt) { zend_long x = 0, y = 0, n = 0, z = 0; - zval *this_ptr = getThis(); - - - - z = 0; x = 1; y = 2; @@ -52,22 +47,17 @@ PHP_METHOD(Stub_Fibonnaci, fibInt) PHP_METHOD(Stub_Fibonnaci, fibDouble) { double x = 0, y = 0, n = 0, z = 0; - zval *this_ptr = getThis(); - - - - - z = 0.0; - x = 1.0; - y = 2.0; - n = 10.0; + z = (0.0); + x = (1.0); + y = (2.0); + n = (10.0); while (1) { if (!(z < n)) { break; } - z = (x + y); - x = y; - y = z; + z = ((x + y)); + x = y; + y = z; } RETURN_DOUBLE(z); } @@ -77,16 +67,14 @@ PHP_METHOD(Stub_Fibonnaci, fibArray) zend_long i = 0, n = 0, k = 0, j = 0; zval fib, a, b, c, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&fib); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&fib); zephir_create_array(&fib, 2, 0); @@ -104,8 +92,10 @@ PHP_METHOD(Stub_Fibonnaci, fibArray) } k = (i - 1); j = (i - 2); - zephir_array_fetch_long(&a, &fib, k, PH_NOISY | PH_READONLY, "stub/fibonnaci.zep", 51); - zephir_array_fetch_long(&b, &fib, j, PH_NOISY | PH_READONLY, "stub/fibonnaci.zep", 52); + ZEPHIR_OBS_NVAR(&a); + zephir_array_fetch_long(&a, &fib, k, PH_NOISY, "stub/fibonnaci.zep", 51); + ZEPHIR_OBS_NVAR(&b); + zephir_array_fetch_long(&b, &fib, j, PH_NOISY, "stub/fibonnaci.zep", 52); ZEPHIR_INIT_NVAR(&c); zephir_add_function(&c, &a, &b); zephir_array_update_long(&fib, i, &c, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); @@ -119,16 +109,14 @@ PHP_METHOD(Stub_Fibonnaci, fibArray2) zend_long i = 0, n = 0; zval fib, _0, _1$$3, _2$$3, _3$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&fib); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&fib); zephir_create_array(&fib, 2, 0); @@ -165,19 +153,12 @@ PHP_METHOD(Stub_Fibonnaci, fibonacciRecursive) ZVAL_UNDEF(&_0$$6); ZVAL_UNDEF(&_1$$6); ZVAL_UNDEF(&_3$$6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n_param); - n = zephir_get_intval(n_param); - - if (n == 0) { RETURN_MM_LONG(0); } else { @@ -185,10 +166,10 @@ PHP_METHOD(Stub_Fibonnaci, fibonacciRecursive) RETURN_MM_LONG(1); } else { ZVAL_LONG(&_1$$6, (n - 1)); - ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccirecursive", &_2, 39, &_1$$6); + ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccirecursive", &_2, 40, &_1$$6); zephir_check_call_status(); ZVAL_LONG(&_1$$6, (n - 2)); - ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccirecursive", &_2, 39, &_1$$6); + ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccirecursive", &_2, 40, &_1$$6); zephir_check_call_status(); zephir_add_function(return_value, &_0$$6, &_3$$6); RETURN_MM(); @@ -207,19 +188,12 @@ PHP_METHOD(Stub_Fibonnaci, fibonacciFinalRecursive) ZVAL_UNDEF(&_0$$6); ZVAL_UNDEF(&_1$$6); ZVAL_UNDEF(&_3$$6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n_param); - n = zephir_get_intval(n_param); - - if (n == 0) { RETURN_MM_LONG(0); } else { @@ -227,10 +201,10 @@ PHP_METHOD(Stub_Fibonnaci, fibonacciFinalRecursive) RETURN_MM_LONG(1); } else { ZVAL_LONG(&_1$$6, (n - 1)); - ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccifinalrecursive", &_2, 40, &_1$$6); + ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccifinalrecursive", &_2, 41, &_1$$6); zephir_check_call_status(); ZVAL_LONG(&_1$$6, (n - 2)); - ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccifinalrecursive", &_2, 40, &_1$$6); + ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccifinalrecursive", &_2, 41, &_1$$6); zephir_check_call_status(); zephir_add_function(return_value, &_0$$6, &_3$$6); RETURN_MM(); diff --git a/ext/stub/fibonnaci.zep.h b/ext/stub/fibonnaci.zep.h index b9a1847d7f..70b8f76f6e 100644 --- a/ext/stub/fibonnaci.zep.h +++ b/ext/stub/fibonnaci.zep.h @@ -31,26 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_fibonnaci_fibonaccifinalrecursive, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_fibonnaci_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fibonnaci, fibInt, arginfo_stub_fibonnaci_fibint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fibonnaci, fibInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fibonnaci, fibDouble, arginfo_stub_fibonnaci_fibdouble, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fibonnaci, fibDouble, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fibonnaci, fibArray, arginfo_stub_fibonnaci_fibarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fibonnaci, fibArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fibonnaci, fibArray2, arginfo_stub_fibonnaci_fibarray2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fibonnaci, fibArray2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Fibonnaci, fibInt, arginfo_stub_fibonnaci_fibint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fibonnaci, fibDouble, arginfo_stub_fibonnaci_fibdouble, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fibonnaci, fibArray, arginfo_stub_fibonnaci_fibarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fibonnaci, fibArray2, arginfo_stub_fibonnaci_fibarray2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fibonnaci, fibonacciRecursive, arginfo_stub_fibonnaci_fibonaccirecursive, ZEND_ACC_PRIVATE) PHP_ME(Stub_Fibonnaci, fibonacciFinalRecursive, arginfo_stub_fibonnaci_fibonaccifinalrecursive, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) PHP_FE_END diff --git a/ext/stub/flow.zep.c b/ext/stub/flow.zep.c index b9e63b7a86..b6a0697bf0 100644 --- a/ext/stub/flow.zep.c +++ b/ext/stub/flow.zep.c @@ -35,11 +35,6 @@ ZEPHIR_INIT_CLASS(Stub_Flow) PHP_METHOD(Stub_Flow, testIf1) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; if (a) { RETURN_LONG(1); @@ -50,11 +45,6 @@ PHP_METHOD(Stub_Flow, testIf1) PHP_METHOD(Stub_Flow, testIf2) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; if (a) { RETURN_LONG(1); @@ -65,11 +55,6 @@ PHP_METHOD(Stub_Flow, testIf2) PHP_METHOD(Stub_Flow, testIf3) { double a = 0; - zval *this_ptr = getThis(); - - - - a = (double) (1); if (a) { RETURN_LONG(1); @@ -80,11 +65,6 @@ PHP_METHOD(Stub_Flow, testIf3) PHP_METHOD(Stub_Flow, testIf4) { double a = 0; - zval *this_ptr = getThis(); - - - - a = (double) (0); if (a) { RETURN_LONG(1); @@ -95,11 +75,6 @@ PHP_METHOD(Stub_Flow, testIf4) PHP_METHOD(Stub_Flow, testIf5) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((1) ? 1 : 0); if (a) { RETURN_LONG(1); @@ -110,11 +85,6 @@ PHP_METHOD(Stub_Flow, testIf5) PHP_METHOD(Stub_Flow, testIf6) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = ((0) ? 1 : 0); if (a) { RETURN_LONG(1); @@ -125,11 +95,6 @@ PHP_METHOD(Stub_Flow, testIf6) PHP_METHOD(Stub_Flow, testIf7) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; if (a) { RETURN_LONG(1); @@ -141,11 +106,6 @@ PHP_METHOD(Stub_Flow, testIf7) PHP_METHOD(Stub_Flow, testIf8) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 0; if (a) { RETURN_LONG(1); @@ -159,11 +119,6 @@ PHP_METHOD(Stub_Flow, testIf9) zend_bool c = 0; double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; if (a) { b = (double) (1); @@ -182,11 +137,6 @@ PHP_METHOD(Stub_Flow, testIf10) zend_bool c = 0; double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; if (a) { b = (double) (1); @@ -210,11 +160,6 @@ PHP_METHOD(Stub_Flow, testIf12) zend_bool c = 0; double b = 0; zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; if (a) { b = (double) (1); @@ -236,11 +181,6 @@ PHP_METHOD(Stub_Flow, testIf12) PHP_METHOD(Stub_Flow, testIf13) { zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; if ((a + b)) { @@ -252,11 +192,6 @@ PHP_METHOD(Stub_Flow, testIf13) PHP_METHOD(Stub_Flow, testIf14) { zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; if ((a + b)) { @@ -268,11 +203,6 @@ PHP_METHOD(Stub_Flow, testIf14) PHP_METHOD(Stub_Flow, testIf15) { zend_long a = 0, b = 0, c = 0; - zval *this_ptr = getThis(); - - - - a = 1; b = 2; c = 3; @@ -285,20 +215,12 @@ PHP_METHOD(Stub_Flow, testIf15) PHP_METHOD(Stub_Flow, testIf16) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - if (ZEPHIR_IS_EMPTY(a)) { RETURN_BOOL(1); } @@ -308,20 +230,12 @@ PHP_METHOD(Stub_Flow, testIf16) PHP_METHOD(Stub_Flow, testIf17) { zval *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &b); - - if (Z_TYPE_P(b) != IS_NULL) { RETURN_BOOL(1); } @@ -331,11 +245,6 @@ PHP_METHOD(Stub_Flow, testIf17) PHP_METHOD(Stub_Flow, testLoop1) { zend_bool a = 0; - zval *this_ptr = getThis(); - - - - a = 1; while (1) { if (a) { @@ -348,11 +257,6 @@ PHP_METHOD(Stub_Flow, testLoop1) PHP_METHOD(Stub_Flow, testLoop2) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; while (1) { a = (a + 1); @@ -366,11 +270,6 @@ PHP_METHOD(Stub_Flow, testLoop2) PHP_METHOD(Stub_Flow, testLoop3) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; while (1) { a = (a + 1); @@ -388,11 +287,6 @@ PHP_METHOD(Stub_Flow, testLoop3) PHP_METHOD(Stub_Flow, testLoop4) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; while (1) { a = (a + 1); @@ -410,11 +304,6 @@ PHP_METHOD(Stub_Flow, testLoop4) PHP_METHOD(Stub_Flow, testWhile1) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 5; while (1) { if (!(a)) { @@ -428,11 +317,6 @@ PHP_METHOD(Stub_Flow, testWhile1) PHP_METHOD(Stub_Flow, testWhile2) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 5; while (1) { if (!(a)) { @@ -447,11 +331,6 @@ PHP_METHOD(Stub_Flow, testWhile3) { double c = 0; zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 5; b = 0; while (1) { @@ -475,11 +354,6 @@ PHP_METHOD(Stub_Flow, testWhile4) { double c = 0; zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 5; b = 0; while (1) { @@ -502,11 +376,6 @@ PHP_METHOD(Stub_Flow, testWhile4) PHP_METHOD(Stub_Flow, testWhile5) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 5; while (1) { if (!(a)) { @@ -520,11 +389,6 @@ PHP_METHOD(Stub_Flow, testWhile5) PHP_METHOD(Stub_Flow, testWhile6) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 5; while (1) { if (!(a)) { @@ -538,11 +402,6 @@ PHP_METHOD(Stub_Flow, testWhile6) PHP_METHOD(Stub_Flow, testWhile7) { double a = 0; - zval *this_ptr = getThis(); - - - - a = (double) (5); while (1) { if (!(a)) { @@ -556,11 +415,6 @@ PHP_METHOD(Stub_Flow, testWhile7) PHP_METHOD(Stub_Flow, testWhile8) { double a = 0; - zval *this_ptr = getThis(); - - - - a = (double) (5); while (1) { if (!(a)) { @@ -575,11 +429,6 @@ PHP_METHOD(Stub_Flow, testWhile9) { double c = 0; zend_long a = 0, b = 0; - zval *this_ptr = getThis(); - - - - a = 5; b = 0; while (1) { @@ -605,22 +454,15 @@ PHP_METHOD(Stub_Flow, testWhile10) zend_long b = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a); ZEPHIR_SEPARATE_PARAM(a); - - b = 0; while (1) { if (!(zephir_is_true(a))) { @@ -633,7 +475,7 @@ PHP_METHOD(Stub_Flow, testWhile10) } b--; } - ZEPHIR_SEPARATE(a); + SEPARATE_ZVAL(a); zephir_decrement(a); } c = (double) ((zephir_get_numberval(a) + b)); @@ -646,24 +488,17 @@ PHP_METHOD(Stub_Flow, testWhile11) zend_long b = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub, *d, d_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&d_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(d) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &d); ZEPHIR_SEPARATE_PARAM(a); - - b = 0; while (1) { if (!(zephir_is_true(a))) { @@ -676,7 +511,7 @@ PHP_METHOD(Stub_Flow, testWhile11) } b--; } - ZEPHIR_SEPARATE(a); + SEPARATE_ZVAL(a); zephir_decrement(a); } c = (double) ((zephir_get_numberval(a) + b)); @@ -688,13 +523,11 @@ PHP_METHOD(Stub_Flow, testWhile12) zval _0; zval b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SS(&_0, "+", "10"); @@ -703,7 +536,7 @@ PHP_METHOD(Stub_Flow, testWhile12) if (!(ZEPHIR_GT_LONG(&b, 5))) { break; } - ZEPHIR_SEPARATE(&b); + SEPARATE_ZVAL(&b); zephir_decrement(&b); } RETURN_CCTOR(&b); @@ -715,13 +548,11 @@ PHP_METHOD(Stub_Flow, testWhile13) zend_long a; zval b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 5; ZEPHIR_INIT_VAR(&_0); @@ -731,7 +562,7 @@ PHP_METHOD(Stub_Flow, testWhile13) if (!(ZEPHIR_GT_LONG(&b, a))) { break; } - ZEPHIR_SEPARATE(&b); + SEPARATE_ZVAL(&b); zephir_decrement(&b); } RETURN_CCTOR(&b); @@ -739,9 +570,6 @@ PHP_METHOD(Stub_Flow, testWhile13) PHP_METHOD(Stub_Flow, testDoWhile1) { - zval *this_ptr = getThis(); - - do { } while (1); @@ -753,35 +581,28 @@ PHP_METHOD(Stub_Flow, testWhileNextTest) zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_1 = NULL, *_3 = NULL; zval *variable, variable_sub, returnValue, _0, _2$$3; - zval *this_ptr = getThis(); ZVAL_UNDEF(&variable_sub); ZVAL_UNDEF(&returnValue); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(variable) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &variable); - - ZEPHIR_INIT_VAR(&returnValue); array_init(&returnValue); while (1) { ZEPHIR_MAKE_REF(variable); - ZEPHIR_CALL_FUNCTION(&_0, "next", &_1, 41, variable); + ZEPHIR_CALL_FUNCTION(&_0, "next", &_1, 42, variable); ZEPHIR_UNREF(variable); zephir_check_call_status(); if (!(zephir_is_true(&_0))) { break; } - ZEPHIR_CALL_FUNCTION(&_2$$3, "current", &_3, 42, variable); + ZEPHIR_CALL_FUNCTION(&_2$$3, "current", &_3, 43, variable); zephir_check_call_status(); zephir_array_append(&returnValue, &_2$$3, PH_SEPARATE, "stub/flow.zep", 420); } @@ -794,32 +615,25 @@ PHP_METHOD(Stub_Flow, testWhileDoNextTest) zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_1 = NULL, *_3 = NULL; zval *variable, variable_sub, returnValue, _2, _0$$3; - zval *this_ptr = getThis(); ZVAL_UNDEF(&variable_sub); ZVAL_UNDEF(&returnValue); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_0$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(variable) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &variable); - - ZEPHIR_INIT_VAR(&returnValue); array_init(&returnValue); do { - ZEPHIR_CALL_FUNCTION(&_0$$3, "current", &_1, 42, variable); + ZEPHIR_CALL_FUNCTION(&_0$$3, "current", &_1, 43, variable); zephir_check_call_status(); zephir_array_append(&returnValue, &_0$$3, PH_SEPARATE, "stub/flow.zep", 430); ZEPHIR_MAKE_REF(variable); - ZEPHIR_CALL_FUNCTION(&_2, "next", &_3, 41, variable); + ZEPHIR_CALL_FUNCTION(&_2, "next", &_3, 42, variable); ZEPHIR_UNREF(variable); zephir_check_call_status(); } while (zephir_is_true(&_2)); @@ -831,15 +645,13 @@ PHP_METHOD(Stub_Flow, testFor1) zval v, b, _0, *_1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, c = 0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&v); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); c = 0; ZEPHIR_INIT_VAR(&b); @@ -892,16 +704,14 @@ PHP_METHOD(Stub_Flow, testFor2) zval v, k, b, _0, *_1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&v); ZVAL_UNDEF(&k); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); c = (double) (0); ZEPHIR_INIT_VAR(&b); @@ -960,16 +770,14 @@ PHP_METHOD(Stub_Flow, testFor3) zval v, b, c, _0, *_1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&v); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&c); array_init(&c); @@ -1021,13 +829,11 @@ PHP_METHOD(Stub_Flow, testFor4) zend_bool _0; zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_LONG(&b, 0); @@ -1056,11 +862,6 @@ PHP_METHOD(Stub_Flow, testFor5) { zend_bool _0; zend_long a = 0, b = 0, _1, _2; - zval *this_ptr = getThis(); - - - - b = 0; _2 = 10; _1 = 1; @@ -1088,13 +889,11 @@ PHP_METHOD(Stub_Flow, testFor6) zend_bool _0; zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_LONG(&b, 0); @@ -1123,11 +922,6 @@ PHP_METHOD(Stub_Flow, testFor7) { zend_bool _0; zend_long a = 0, b = 0, _1, _2; - zval *this_ptr = getThis(); - - - - b = 0; _2 = 10; _1 = _2; @@ -1153,11 +947,6 @@ PHP_METHOD(Stub_Flow, testFor8) { zend_bool _0; zend_long a = 0, b = 0, c = 0, d = 0, _1, _2; - zval *this_ptr = getThis(); - - - - b = 0; c = 1; d = 10; @@ -1185,11 +974,6 @@ PHP_METHOD(Stub_Flow, testFor9) { zend_bool _0; zend_long a = 0, b = 0, c = 0, d = 0, _1, _2; - zval *this_ptr = getThis(); - - - - b = 0; c = 1; d = 10; @@ -1219,13 +1003,11 @@ PHP_METHOD(Stub_Flow, testFor10) zend_long c = 0, d = 0, _1, _2; zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_LONG(&b, 0); @@ -1258,12 +1040,10 @@ PHP_METHOD(Stub_Flow, testFor11) zval b; char a = 0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); _2 = 'z'; @@ -1292,12 +1072,10 @@ PHP_METHOD(Stub_Flow, testFor12) zval b; char a = 0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); _2 = 'z'; @@ -1326,12 +1104,10 @@ PHP_METHOD(Stub_Flow, testFor13) zval b; char a = 0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); _2 = '9'; @@ -1360,12 +1136,10 @@ PHP_METHOD(Stub_Flow, testFor14) zval b; char a = 0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); _2 = '9'; @@ -1393,22 +1167,12 @@ PHP_METHOD(Stub_Flow, testFor15) zend_bool _0; zval *c_param = NULL, *d_param = NULL; zend_long c, d, a = 0, b = 0, _1, _2; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(c) Z_PARAM_LONG(d) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &c_param, &d_param); - c = zephir_get_intval(c_param); - d = zephir_get_intval(d_param); - - b = 0; _2 = d; _1 = _2; @@ -1437,14 +1201,12 @@ PHP_METHOD(Stub_Flow, testFor16) long _0; zval a, b, c; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&c); array_init(&c); @@ -1480,14 +1242,12 @@ PHP_METHOD(Stub_Flow, testFor17) long _0; zval a, b, c; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&c); array_init(&c); @@ -1523,13 +1283,11 @@ PHP_METHOD(Stub_Flow, testFor18) zval c, _4$$3; zend_long a = 0, b = 0, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_4$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&c); array_init(&c); @@ -1564,13 +1322,11 @@ PHP_METHOD(Stub_Flow, testFor19) zend_bool _0; zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_LONG(&b, 0); @@ -1601,13 +1357,11 @@ PHP_METHOD(Stub_Flow, testFor20) zend_bool _0; zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_LONG(&b, 0); @@ -1638,13 +1392,11 @@ PHP_METHOD(Stub_Flow, testFor21) zend_bool _0; zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_LONG(&b, 0); @@ -1675,13 +1427,11 @@ PHP_METHOD(Stub_Flow, testFor22) zend_bool _0; zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_LONG(&b, 0); @@ -1713,13 +1463,11 @@ PHP_METHOD(Stub_Flow, testFor23) zval b; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); _2 = 'z'; @@ -1751,16 +1499,14 @@ PHP_METHOD(Stub_Flow, testFor24) zval a, _1, *_2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZEPHIR_INIT_VAR(&_0); @@ -1812,14 +1558,12 @@ PHP_METHOD(Stub_Flow, testFor30) zval b; zval a, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1841,14 +1585,12 @@ PHP_METHOD(Stub_Flow, testFor31) zval b; zval a, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1870,23 +1612,16 @@ PHP_METHOD(Stub_Flow, testFor32) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *e, e_sub, v, *_0, _1; - zval *this_ptr = getThis(); ZVAL_UNDEF(&e_sub); ZVAL_UNDEF(&v); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(e) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &e); - - sum = 0; zephir_is_iterable(e, 0, "stub/flow.zep", 703); if (Z_TYPE_P(e) == IS_ARRAY) { @@ -1921,23 +1656,16 @@ PHP_METHOD(Stub_Flow, testFor33) zend_object_iterator *_0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *e, e_sub, v, result; - zval *this_ptr = getThis(); ZVAL_UNDEF(&e_sub); ZVAL_UNDEF(&v); ZVAL_UNDEF(&result); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(e, zend_ce_iterator) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &e); - - ZEPHIR_INIT_VAR(&result); array_init(&result); _0 = zephir_get_iterator(e); @@ -1957,29 +1685,23 @@ PHP_METHOD(Stub_Flow, testFor34) zend_object_iterator *_0$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *e = NULL, e_sub, __$null, v, result; - zval *this_ptr = getThis(); ZVAL_UNDEF(&e_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&v); ZVAL_UNDEF(&result); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_OBJECT_OF_CLASS_OR_NULL(e, zend_ce_iterator) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &e); if (!e) { e = &e_sub; e = &__$null; } - - ZEPHIR_INIT_VAR(&result); array_init(&result); if (Z_TYPE_P(e) == IS_OBJECT) { @@ -2000,20 +1722,12 @@ PHP_METHOD(Stub_Flow, testFor34) PHP_METHOD(Stub_Flow, testFor35Aux) { zval *hello, hello_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&hello_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(hello) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &hello); - - RETURN_BOOL(0); } @@ -2028,9 +1742,8 @@ PHP_METHOD(Stub_Flow, testFor35) ZVAL_UNDEF(&i); ZVAL_UNDEF(&_3$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); _2 = 100; _1 = 1; @@ -2059,20 +1772,12 @@ PHP_METHOD(Stub_Flow, testFor35) PHP_METHOD(Stub_Flow, testFor36Aux) { zval *hello, hello_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&hello_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(hello) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &hello); - - zephir_create_array(return_value, 1, 0); zephir_array_fast_append(return_value, hello); return; @@ -2089,9 +1794,8 @@ PHP_METHOD(Stub_Flow, testFor36) ZVAL_UNDEF(&i); ZVAL_UNDEF(&_3$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); _2 = 100; _1 = 1; @@ -2121,11 +1825,6 @@ PHP_METHOD(Stub_Flow, testFor37) { zend_bool _0; zend_long i, _1, _2; - zval *this_ptr = getThis(); - - - - i = 0; _2 = 10; _1 = 1; @@ -2154,12 +1853,10 @@ PHP_METHOD(Stub_Flow, testFor38) zval v; zend_long i, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&v); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); i = 0; _3 = 10; @@ -2193,12 +1890,10 @@ PHP_METHOD(Stub_Flow, testFor39) char _0; zend_long i; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); i = 0; ZEPHIR_INIT_VAR(&_2); @@ -2216,14 +1911,12 @@ PHP_METHOD(Stub_Flow, testFor40) zend_bool _0; zval a, b, _3$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_3$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_LONG(&b, 0); @@ -2258,15 +1951,13 @@ PHP_METHOD(Stub_Flow, testUnrechable1) double b; zend_long a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&d); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 0; - b = 0.0; + b = (0.0); c = 0; ZEPHIR_INIT_VAR(&d); ZVAL_STRING(&d, ""); @@ -2297,15 +1988,13 @@ PHP_METHOD(Stub_Flow, testUnrechable2) double b; zend_long a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&d); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 1; - b = 1.0; + b = (1.0); c = 1; ZEPHIR_INIT_VAR(&d); ZVAL_STRING(&d, "hello"); @@ -2341,11 +2030,6 @@ PHP_METHOD(Stub_Flow, testUnrechable2) PHP_METHOD(Stub_Flow, testUnrechable3) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - if (3 < 1) { if (1 > 2) { a = 0; diff --git a/ext/stub/flow.zep.h b/ext/stub/flow.zep.h index a999bf1759..d84aeabeff 100644 --- a/ext/stub/flow.zep.h +++ b/ext/stub/flow.zep.h @@ -323,337 +323,81 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_flow_testunrechable3, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_flow_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf1, arginfo_stub_flow_testif1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf2, arginfo_stub_flow_testif2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf3, arginfo_stub_flow_testif3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf4, arginfo_stub_flow_testif4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf5, arginfo_stub_flow_testif5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf6, arginfo_stub_flow_testif6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf7, arginfo_stub_flow_testif7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf8, arginfo_stub_flow_testif8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf9, arginfo_stub_flow_testif9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf10, arginfo_stub_flow_testif10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf12, arginfo_stub_flow_testif12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf13, arginfo_stub_flow_testif13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf14, arginfo_stub_flow_testif14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf15, arginfo_stub_flow_testif15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf15, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testIf1, arginfo_stub_flow_testif1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf2, arginfo_stub_flow_testif2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf3, arginfo_stub_flow_testif3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf4, arginfo_stub_flow_testif4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf5, arginfo_stub_flow_testif5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf6, arginfo_stub_flow_testif6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf7, arginfo_stub_flow_testif7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf8, arginfo_stub_flow_testif8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf9, arginfo_stub_flow_testif9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf10, arginfo_stub_flow_testif10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf12, arginfo_stub_flow_testif12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf13, arginfo_stub_flow_testif13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf14, arginfo_stub_flow_testif14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf15, arginfo_stub_flow_testif15, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testIf16, arginfo_stub_flow_testif16, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testIf17, arginfo_stub_flow_testif17, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testLoop1, arginfo_stub_flow_testloop1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testLoop1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testLoop2, arginfo_stub_flow_testloop2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testLoop2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testLoop3, arginfo_stub_flow_testloop3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testLoop3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testLoop4, arginfo_stub_flow_testloop4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testLoop4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile1, arginfo_stub_flow_testwhile1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile2, arginfo_stub_flow_testwhile2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile3, arginfo_stub_flow_testwhile3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile4, arginfo_stub_flow_testwhile4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile5, arginfo_stub_flow_testwhile5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile6, arginfo_stub_flow_testwhile6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile7, arginfo_stub_flow_testwhile7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile8, arginfo_stub_flow_testwhile8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile9, arginfo_stub_flow_testwhile9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile9, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testLoop1, arginfo_stub_flow_testloop1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testLoop2, arginfo_stub_flow_testloop2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testLoop3, arginfo_stub_flow_testloop3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testLoop4, arginfo_stub_flow_testloop4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile1, arginfo_stub_flow_testwhile1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile2, arginfo_stub_flow_testwhile2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile3, arginfo_stub_flow_testwhile3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile4, arginfo_stub_flow_testwhile4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile5, arginfo_stub_flow_testwhile5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile6, arginfo_stub_flow_testwhile6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile7, arginfo_stub_flow_testwhile7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile8, arginfo_stub_flow_testwhile8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile9, arginfo_stub_flow_testwhile9, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testWhile10, arginfo_stub_flow_testwhile10, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testWhile11, arginfo_stub_flow_testwhile11, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile12, arginfo_stub_flow_testwhile12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile13, arginfo_stub_flow_testwhile13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testDoWhile1, arginfo_stub_flow_testdowhile1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testDoWhile1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testWhile12, arginfo_stub_flow_testwhile12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile13, arginfo_stub_flow_testwhile13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testDoWhile1, arginfo_stub_flow_testdowhile1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testWhileNextTest, arginfo_stub_flow_testwhilenexttest, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testWhileDoNextTest, arginfo_stub_flow_testwhiledonexttest, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor1, arginfo_stub_flow_testfor1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor2, arginfo_stub_flow_testfor2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor3, arginfo_stub_flow_testfor3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor4, arginfo_stub_flow_testfor4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor5, arginfo_stub_flow_testfor5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor6, arginfo_stub_flow_testfor6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor7, arginfo_stub_flow_testfor7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor8, arginfo_stub_flow_testfor8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor9, arginfo_stub_flow_testfor9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor10, arginfo_stub_flow_testfor10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor11, arginfo_stub_flow_testfor11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor12, arginfo_stub_flow_testfor12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor13, arginfo_stub_flow_testfor13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor14, arginfo_stub_flow_testfor14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor14, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testFor1, arginfo_stub_flow_testfor1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor2, arginfo_stub_flow_testfor2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor3, arginfo_stub_flow_testfor3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor4, arginfo_stub_flow_testfor4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor5, arginfo_stub_flow_testfor5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor6, arginfo_stub_flow_testfor6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor7, arginfo_stub_flow_testfor7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor8, arginfo_stub_flow_testfor8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor9, arginfo_stub_flow_testfor9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor10, arginfo_stub_flow_testfor10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor11, arginfo_stub_flow_testfor11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor12, arginfo_stub_flow_testfor12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor13, arginfo_stub_flow_testfor13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor14, arginfo_stub_flow_testfor14, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor15, arginfo_stub_flow_testfor15, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor16, arginfo_stub_flow_testfor16, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor16, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor17, arginfo_stub_flow_testfor17, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor17, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor18, arginfo_stub_flow_testfor18, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor18, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor19, arginfo_stub_flow_testfor19, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor19, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor20, arginfo_stub_flow_testfor20, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor20, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor21, arginfo_stub_flow_testfor21, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor21, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor22, arginfo_stub_flow_testfor22, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor22, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor23, arginfo_stub_flow_testfor23, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor23, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor24, arginfo_stub_flow_testfor24, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor24, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor30, arginfo_stub_flow_testfor30, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor30, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor31, arginfo_stub_flow_testfor31, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor31, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testFor16, arginfo_stub_flow_testfor16, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor17, arginfo_stub_flow_testfor17, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor18, arginfo_stub_flow_testfor18, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor19, arginfo_stub_flow_testfor19, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor20, arginfo_stub_flow_testfor20, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor21, arginfo_stub_flow_testfor21, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor22, arginfo_stub_flow_testfor22, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor23, arginfo_stub_flow_testfor23, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor24, arginfo_stub_flow_testfor24, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor30, arginfo_stub_flow_testfor30, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor31, arginfo_stub_flow_testfor31, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor32, arginfo_stub_flow_testfor32, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor33, arginfo_stub_flow_testfor33, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor34, arginfo_stub_flow_testfor34, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor35Aux, arginfo_stub_flow_testfor35aux, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor35, arginfo_stub_flow_testfor35, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor35, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testFor35, arginfo_stub_flow_testfor35, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor36Aux, arginfo_stub_flow_testfor36aux, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor36, arginfo_stub_flow_testfor36, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor36, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor37, arginfo_stub_flow_testfor37, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor37, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor38, arginfo_stub_flow_testfor38, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor38, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor39, arginfo_stub_flow_testfor39, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor39, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor40, arginfo_stub_flow_testfor40, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor40, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testUnrechable1, arginfo_stub_flow_testunrechable1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testUnrechable1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testUnrechable2, arginfo_stub_flow_testunrechable2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testUnrechable2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testUnrechable3, arginfo_stub_flow_testunrechable3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testUnrechable3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testFor36, arginfo_stub_flow_testfor36, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor37, arginfo_stub_flow_testfor37, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor38, arginfo_stub_flow_testfor38, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor39, arginfo_stub_flow_testfor39, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor40, arginfo_stub_flow_testfor40, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testUnrechable1, arginfo_stub_flow_testunrechable1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testUnrechable2, arginfo_stub_flow_testunrechable2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testUnrechable3, arginfo_stub_flow_testunrechable3, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/flow/switchflow.zep.c b/ext/stub/flow/switchflow.zep.c index 64f686349f..2952fef9a2 100644 --- a/ext/stub/flow/switchflow.zep.c +++ b/ext/stub/flow/switchflow.zep.c @@ -28,11 +28,6 @@ ZEPHIR_INIT_CLASS(Stub_Flow_SwitchFlow) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch1) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 10; RETURN_LONG(a); } @@ -40,11 +35,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch1) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch2) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 10; do { if (a == 10) { @@ -58,11 +48,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch2) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch3) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 10; do { if (a == 5) { @@ -76,11 +61,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch3) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch4) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 10; do { if (a == 5) { @@ -95,11 +75,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch4) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch5) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 10; do { if (a == 10) { @@ -114,11 +89,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch5) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch6) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 10; do { if (a == 10 || a == 4) { @@ -132,11 +102,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch6) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch7) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 4; do { if (a == 10 || a == 4) { @@ -150,11 +115,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch7) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch8) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 5; do { if (a == 10 || a == 4) { @@ -168,11 +128,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch8) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch9) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 5; do { if (a == 3 || a == 4) { @@ -189,11 +144,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch9) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch10) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 5; do { if (a == 3 || a == 4) { @@ -210,11 +160,6 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch10) PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch11) { zend_long a = 0; - zval *this_ptr = getThis(); - - - - a = 1; do { if (a == 2) { @@ -229,22 +174,14 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch12) { zend_bool _0, _1, _2; zval *var1, var1_sub, *var2, var2_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&var1_sub); ZVAL_UNDEF(&var2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(var1) Z_PARAM_ZVAL(var2) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &var1, &var2); - - do { _0 = 1; _1 = ZEPHIR_GT(var1, var2); @@ -272,27 +209,19 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch13) zend_long ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, _0, _1, _2; long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); - a = zephir_get_intval(a_param); - - ZVAL_LONG(&_0, 1); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_FUNCTION(&_2, "mt_rand", NULL, 31, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "mt_rand", NULL, 32, &_0, &_1); zephir_check_call_status(); do { if (ZEPHIR_IS_LONG(&_2, 100)) { @@ -308,29 +237,22 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch14) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *result_type = NULL, result_type_sub, ret, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&result_type_sub); ZVAL_UNDEF(&ret); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(result_type) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &result_type); if (!result_type) { result_type = &result_type_sub; ZEPHIR_INIT_VAR(result_type); ZVAL_LONG(result_type, 1); } - - do { ZEPHIR_INIT_VAR(&_0); ZEPHIR_GET_CONSTANT(&_0, "MYSQL_ASSOC"); diff --git a/ext/stub/flow/switchflow.zep.h b/ext/stub/flow/switchflow.zep.h index 6ad791d370..e08126c64d 100644 --- a/ext/stub/flow/switchflow.zep.h +++ b/ext/stub/flow/switchflow.zep.h @@ -75,11 +75,7 @@ ZEPHIR_INIT_FUNCS(stub_flow_switchflow_method_entry) { PHP_ME(Stub_Flow_SwitchFlow, testSwitch8, arginfo_stub_flow_switchflow_testswitch8, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch9, arginfo_stub_flow_switchflow_testswitch9, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch10, arginfo_stub_flow_switchflow_testswitch10, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow_SwitchFlow, testSwitch11, arginfo_stub_flow_switchflow_testswitch11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow_SwitchFlow, testSwitch11, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow_SwitchFlow, testSwitch11, arginfo_stub_flow_switchflow_testswitch11, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch12, arginfo_stub_flow_switchflow_testswitch12, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch13, arginfo_stub_flow_switchflow_testswitch13, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch14, arginfo_stub_flow_switchflow_testswitch14, ZEND_ACC_PUBLIC) diff --git a/ext/stub/fortytwo.zep.c b/ext/stub/fortytwo.zep.c index 748b36e859..58c9f2da7f 100644 --- a/ext/stub/fortytwo.zep.c +++ b/ext/stub/fortytwo.zep.c @@ -37,7 +37,6 @@ PHP_METHOD(Stub_FortyTwo, proof) zval box, side, _1, *_2, _3, _7$$4, _11$$7; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, i = 0, j = 0, _5$$3, _6$$3, _9$$6, _10$$6; - zval *this_ptr = getThis(); ZVAL_UNDEF(&box); ZVAL_UNDEF(&side); @@ -46,9 +45,8 @@ PHP_METHOD(Stub_FortyTwo, proof) ZVAL_UNDEF(&_7$$4); ZVAL_UNDEF(&_11$$7); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&box); zephir_create_array(&box, 15, 0); diff --git a/ext/stub/functional.zep.c b/ext/stub/functional.zep.c index 390e0b834a..4c3d1241c3 100644 --- a/ext/stub/functional.zep.c +++ b/ext/stub/functional.zep.c @@ -31,24 +31,17 @@ PHP_METHOD(Stub_Functional, map1) zend_long ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, _0, _1; zval a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); zephir_get_arrval(&a, a_param); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); zephir_create_closure_ex(&_0, NULL, stub_11__closure_ce, SL("__invoke")); @@ -63,25 +56,18 @@ PHP_METHOD(Stub_Functional, map2) zend_long ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, *b, b_sub, _0; zval a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a_param, &b); zephir_get_arrval(&a, a_param); - - ZEPHIR_CALL_FUNCTION(&_0, "array_map", NULL, 8, b, &a); zephir_check_call_status(); RETURN_CCTOR(&_0); diff --git a/ext/stub/functionexists.zep.c b/ext/stub/functionexists.zep.c index 8c43503813..9bc1140528 100644 --- a/ext/stub/functionexists.zep.c +++ b/ext/stub/functionexists.zep.c @@ -31,22 +31,15 @@ PHP_METHOD(Stub_FunctionExists, testWithPassedName) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *func_param = NULL; zval func; - zval *this_ptr = getThis(); ZVAL_UNDEF(&func); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(func) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &func_param); zephir_get_strval(&func, func_param); - - RETURN_MM_BOOL((zephir_function_exists(&func) == SUCCESS)); } @@ -56,7 +49,6 @@ PHP_METHOD(Stub_FunctionExists, testBuiltInFunctions) zval func, _0, *_1, _2, _3$$3, _4$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&func); ZVAL_UNDEF(&_0); @@ -65,9 +57,8 @@ PHP_METHOD(Stub_FunctionExists, testBuiltInFunctions) ZVAL_UNDEF(&_4$$4); ZVAL_UNDEF(&result); ZVAL_UNDEF(&functions); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&result); array_init(&result); @@ -131,9 +122,6 @@ PHP_METHOD(Stub_FunctionExists, testBuiltInFunctions) PHP_METHOD(Stub_FunctionExists, testWithString) { - zval *this_ptr = getThis(); - - RETURN_BOOL((zephir_function_exists_ex(ZEND_STRL("substr")) == SUCCESS)); } diff --git a/ext/stub/functions.zep.c b/ext/stub/functions.zep.c index 1d429d3c2b..23147cb73f 100644 --- a/ext/stub/functions.zep.c +++ b/ext/stub/functions.zep.c @@ -33,21 +33,19 @@ PHP_METHOD(Stub_Functions, filterVar1) zval ret, _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&ret); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&ret); ZVAL_STRING(&ret, "0"); ZVAL_LONG(&_0, 259); ZVAL_LONG(&_1, 20480); - ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 43, &ret, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 44, &ret, &_0, &_1); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_FALSE_IDENTICAL(&_2)); } @@ -60,21 +58,19 @@ PHP_METHOD(Stub_Functions, filterVar2) zval ret, _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&ret); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&ret); ZVAL_STRING(&ret, "0"); ZVAL_LONG(&_0, 259); ZVAL_LONG(&_1, 20480); - ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 43, &ret, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 44, &ret, &_0, &_1); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_FALSE(&_2)); } diff --git a/ext/stub/geometry.zep.c b/ext/stub/geometry.zep.c index 8caa3fca86..c3cb8b5ef3 100644 --- a/ext/stub/geometry.zep.c +++ b/ext/stub/geometry.zep.c @@ -34,7 +34,6 @@ PHP_METHOD(Stub_Geometry, run) zend_long count, ZEPHIR_LAST_CALL_STATUS, i; zval *list_param = NULL, *count_param = NULL, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, _7$$3, _8$$3; zval list; - zval *this_ptr = getThis(); ZVAL_UNDEF(&list); ZVAL_UNDEF(&_1$$3); @@ -45,21 +44,14 @@ PHP_METHOD(Stub_Geometry, run) ZVAL_UNDEF(&_6$$3); ZVAL_UNDEF(&_7$$3); ZVAL_UNDEF(&_8$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(list) Z_PARAM_LONG(count) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &list_param, &count_param); zephir_get_arrval(&list, list_param); - count = zephir_get_intval(count_param); - - i = 0; while (1) { if (!(i < count)) { @@ -87,7 +79,6 @@ PHP_METHOD(Stub_Geometry, runOptimize) zend_long count, ZEPHIR_LAST_CALL_STATUS, i; zval *list_param = NULL, *count_param = NULL, item, _1$$3, _2$$3, _3$$3, _4$$3; zval list; - zval *this_ptr = getThis(); ZVAL_UNDEF(&list); ZVAL_UNDEF(&item); @@ -95,21 +86,14 @@ PHP_METHOD(Stub_Geometry, runOptimize) ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(list) Z_PARAM_LONG(count) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &list_param, &count_param); zephir_get_arrval(&list, list_param); - count = zephir_get_intval(count_param); - - i = 0; while (1) { if (!(i < count)) { @@ -132,27 +116,19 @@ PHP_METHOD(Stub_Geometry, distanceStatic) { zval *x1_param = NULL, *y1_param = NULL, *x2_param = NULL, *y2_param = NULL, _0; double x1, y1, x2, y2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(4, 4) Z_PARAM_ZVAL(x1) Z_PARAM_ZVAL(y1) Z_PARAM_ZVAL(x2) Z_PARAM_ZVAL(y2) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(4, 0, &x1_param, &y1_param, &x2_param, &y2_param); x1 = zephir_get_doubleval(x1_param); y1 = zephir_get_doubleval(y1_param); x2 = zephir_get_doubleval(x2_param); y2 = zephir_get_doubleval(y2_param); - - ZVAL_DOUBLE(&_0, ((((x1 - x2)) * ((x1 - x2))) + (((y1 - y2)) * ((y1 - y2))))); RETURN_DOUBLE(sqrt(((((x1 - x2)) * ((x1 - x2))) + (((y1 - y2)) * ((y1 - y2)))))); } diff --git a/ext/stub/globals.zep.c b/ext/stub/globals.zep.c index 6f79b795a2..6ec87aa7a6 100644 --- a/ext/stub/globals.zep.c +++ b/ext/stub/globals.zep.c @@ -27,60 +27,36 @@ ZEPHIR_INIT_CLASS(Stub_Globals) PHP_METHOD(Stub_Globals, setBoolValueUsingDotNotation) { zval *value, value_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &value); - - ZEPHIR_GLOBAL(db).my_setting_1 = zend_is_true(value); } PHP_METHOD(Stub_Globals, setIntValueUsingDotNotation) { zval *value, value_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &value); - - ZEPHIR_GLOBAL(db).my_setting_2 = zval_get_long(value); } PHP_METHOD(Stub_Globals, setCharValue) { zval *value, value_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &value); - - ZEPHIR_GLOBAL(my_setting_4) = (Z_TYPE_P(value) == IS_STRING ? (Z_STRLEN_P(value) ? Z_STRVAL_P(value)[0] : NULL) : zval_get_long(value)); } @@ -89,22 +65,15 @@ PHP_METHOD(Stub_Globals, setStringValue) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *value_param = NULL; zval value; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &value_param); zephir_get_strval(&value, value_param); - - ZEPHIR_GLOBAL(my_setting_5) = ZSTR_VAL(zval_get_string(&value)); ZEPHIR_MM_RESTORE(); } @@ -112,40 +81,24 @@ PHP_METHOD(Stub_Globals, setStringValue) PHP_METHOD(Stub_Globals, setBoolValue) { zval *value, value_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &value); - - ZEPHIR_GLOBAL(my_setting_1) = zend_is_true(value); } PHP_METHOD(Stub_Globals, setDefaultGlobalsOrmCacheLevel) { zval *value, value_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &value); - - ZEPHIR_GLOBAL(orm).cache_level = zval_get_long(value); } @@ -154,22 +107,15 @@ PHP_METHOD(Stub_Globals, setDefaultGlobalsOrmCachePrefix) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *value_param = NULL; zval value; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &value_param); zephir_get_strval(&value, value_param); - - ZEPHIR_GLOBAL(orm).cache_prefix = ZSTR_VAL(zval_get_string(&value)); ZEPHIR_MM_RESTORE(); } @@ -179,9 +125,6 @@ PHP_METHOD(Stub_Globals, setDefaultGlobalsOrmCachePrefix) */ PHP_METHOD(Stub_Globals, getDefaultGlobals1) { - zval *this_ptr = getThis(); - - RETURN_BOOL(ZEPHIR_GLOBAL(db).my_setting_1); } @@ -191,9 +134,6 @@ PHP_METHOD(Stub_Globals, getDefaultGlobals1) */ PHP_METHOD(Stub_Globals, getDefaultGlobals2) { - zval *this_ptr = getThis(); - - RETURN_LONG(ZEPHIR_GLOBAL(db).my_setting_2); } @@ -203,9 +143,6 @@ PHP_METHOD(Stub_Globals, getDefaultGlobals2) */ PHP_METHOD(Stub_Globals, getDefaultGlobals3) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(ZEPHIR_GLOBAL(db).my_setting_3); } @@ -215,9 +152,6 @@ PHP_METHOD(Stub_Globals, getDefaultGlobals3) */ PHP_METHOD(Stub_Globals, getDefaultGlobals4) { - zval *this_ptr = getThis(); - - RETURN_BOOL(ZEPHIR_GLOBAL(my_setting_1)); } @@ -227,9 +161,6 @@ PHP_METHOD(Stub_Globals, getDefaultGlobals4) */ PHP_METHOD(Stub_Globals, getDefaultGlobals5) { - zval *this_ptr = getThis(); - - RETURN_LONG(ZEPHIR_GLOBAL(my_setting_2)); } @@ -239,9 +170,6 @@ PHP_METHOD(Stub_Globals, getDefaultGlobals5) */ PHP_METHOD(Stub_Globals, getDefaultGlobals6) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(ZEPHIR_GLOBAL(my_setting_3)); } @@ -251,9 +179,6 @@ PHP_METHOD(Stub_Globals, getDefaultGlobals6) */ PHP_METHOD(Stub_Globals, getDefaultGlobals7) { - zval *this_ptr = getThis(); - - RETURN_LONG(ZEPHIR_GLOBAL(my_setting_4)); } @@ -263,9 +188,6 @@ PHP_METHOD(Stub_Globals, getDefaultGlobals7) */ PHP_METHOD(Stub_Globals, getDefaultGlobals8) { - zval *this_ptr = getThis(); - - RETURN_STRING(ZEPHIR_GLOBAL(my_setting_5)); } @@ -275,9 +197,6 @@ PHP_METHOD(Stub_Globals, getDefaultGlobals8) */ PHP_METHOD(Stub_Globals, getDefaultGlobalsOrmCacheLevel) { - zval *this_ptr = getThis(); - - RETURN_LONG(ZEPHIR_GLOBAL(orm).cache_level); } @@ -287,9 +206,6 @@ PHP_METHOD(Stub_Globals, getDefaultGlobalsOrmCacheLevel) */ PHP_METHOD(Stub_Globals, getDefaultGlobalsOrmCachePrefix) { - zval *this_ptr = getThis(); - - RETURN_STRING(ZEPHIR_GLOBAL(orm).cache_prefix); } diff --git a/ext/stub/globals.zep.h b/ext/stub/globals.zep.h index c27a3126af..f33b4d4215 100644 --- a/ext/stub/globals.zep.h +++ b/ext/stub/globals.zep.h @@ -94,55 +94,15 @@ ZEPHIR_INIT_FUNCS(stub_globals_method_entry) { PHP_ME(Stub_Globals, setBoolValue, arginfo_stub_globals_setboolvalue, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals, setDefaultGlobalsOrmCacheLevel, arginfo_stub_globals_setdefaultglobalsormcachelevel, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals, setDefaultGlobalsOrmCachePrefix, arginfo_stub_globals_setdefaultglobalsormcacheprefix, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals1, arginfo_stub_globals_getdefaultglobals1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals2, arginfo_stub_globals_getdefaultglobals2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals3, arginfo_stub_globals_getdefaultglobals3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals4, arginfo_stub_globals_getdefaultglobals4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals5, arginfo_stub_globals_getdefaultglobals5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals6, arginfo_stub_globals_getdefaultglobals6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals7, arginfo_stub_globals_getdefaultglobals7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals8, arginfo_stub_globals_getdefaultglobals8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobalsOrmCacheLevel, arginfo_stub_globals_getdefaultglobalsormcachelevel, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobalsOrmCacheLevel, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobalsOrmCachePrefix, arginfo_stub_globals_getdefaultglobalsormcacheprefix, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobalsOrmCachePrefix, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Globals, getDefaultGlobals1, arginfo_stub_globals_getdefaultglobals1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals2, arginfo_stub_globals_getdefaultglobals2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals3, arginfo_stub_globals_getdefaultglobals3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals4, arginfo_stub_globals_getdefaultglobals4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals5, arginfo_stub_globals_getdefaultglobals5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals6, arginfo_stub_globals_getdefaultglobals6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals7, arginfo_stub_globals_getdefaultglobals7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals8, arginfo_stub_globals_getdefaultglobals8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobalsOrmCacheLevel, arginfo_stub_globals_getdefaultglobalsormcachelevel, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobalsOrmCachePrefix, arginfo_stub_globals_getdefaultglobalsormcacheprefix, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/globals/env.zep.c b/ext/stub/globals/env.zep.c index c4586c9c22..a4cff5c6af 100644 --- a/ext/stub/globals/env.zep.c +++ b/ext/stub/globals/env.zep.c @@ -30,29 +30,24 @@ PHP_METHOD(Stub_Globals_Env, read) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *name_param = NULL, _ENV, _0; zval name; - zval *this_ptr = getThis(); ZVAL_UNDEF(&name); ZVAL_UNDEF(&_ENV); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_ENV, SL("_ENV")); zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(&name, name_param); - - ZEPHIR_INIT_VAR(&_0); if (zephir_array_isset(&_ENV, &name)) { + ZEPHIR_OBS_NVAR(&_0); zephir_array_fetch(&_0, &_ENV, &name, PH_NOISY, "stub/globals/env.zep", 8); } else { + ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, 0); } RETURN_CCTOR(&_0); diff --git a/ext/stub/globals/post.zep.c b/ext/stub/globals/post.zep.c index 168f13fe55..50f34f6058 100644 --- a/ext/stub/globals/post.zep.c +++ b/ext/stub/globals/post.zep.c @@ -35,24 +35,17 @@ PHP_METHOD(Stub_Globals_Post, hasValue) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *name_param = NULL, _POST; zval name; - zval *this_ptr = getThis(); ZVAL_UNDEF(&name); ZVAL_UNDEF(&_POST); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_POST, SL("_POST")); zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(&name, name_param); - - RETURN_MM_BOOL(zephir_array_isset(&_POST, &name)); } diff --git a/ext/stub/globals/server.zep.c b/ext/stub/globals/server.zep.c index 3d7e2a603d..d8d0400cbe 100644 --- a/ext/stub/globals/server.zep.c +++ b/ext/stub/globals/server.zep.c @@ -38,9 +38,8 @@ PHP_METHOD(Stub_Globals_Server, f1) ZVAL_UNDEF(&_SERVER); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_SERVER, SL("_SERVER")); zephir_array_fetch_string(&_0, &_SERVER, SL("PHP_SELF"), PH_NOISY | PH_READONLY, "stub/globals/server.zep", 10); @@ -55,12 +54,9 @@ PHP_METHOD(Stub_Globals_Server, f1) PHP_METHOD(Stub_Globals_Server, f2) { zval _SERVER, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_SERVER); ZVAL_UNDEF(&_0); - - zephir_get_global(&_SERVER, SL("_SERVER")); zephir_array_fetch_string(&_0, &_SERVER, SL("SCRIPT_NAME"), PH_NOISY | PH_READONLY, "stub/globals/server.zep", 17); @@ -73,12 +69,9 @@ PHP_METHOD(Stub_Globals_Server, f2) PHP_METHOD(Stub_Globals_Server, check) { zval _SERVER, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_SERVER); ZVAL_UNDEF(&_0); - - zephir_get_global(&_SERVER, SL("_SERVER")); zephir_array_fetch_string(&_0, &_SERVER, SL("HTTP_USER_AGENT"), PH_NOISY | PH_READONLY, "stub/globals/server.zep", 25); diff --git a/ext/stub/globals/server.zep.h b/ext/stub/globals/server.zep.h index d2e0a123ad..95dc2c3e91 100644 --- a/ext/stub/globals/server.zep.h +++ b/ext/stub/globals/server.zep.h @@ -19,10 +19,6 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_globals_server_method_entry) { PHP_ME(Stub_Globals_Server, f1, arginfo_stub_globals_server_f1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals_Server, f2, arginfo_stub_globals_server_f2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals_Server, check, arginfo_stub_globals_server_check, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals_Server, check, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Globals_Server, check, arginfo_stub_globals_server_check, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/globals/serverrequestfactory.zep.c b/ext/stub/globals/serverrequestfactory.zep.c index ad48f36a19..c4409290d8 100644 --- a/ext/stub/globals/serverrequestfactory.zep.c +++ b/ext/stub/globals/serverrequestfactory.zep.c @@ -58,7 +58,6 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load) ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 5) Z_PARAM_OPTIONAL @@ -68,10 +67,8 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load) Z_PARAM_ARRAY_OR_NULL(cookies) Z_PARAM_ARRAY_OR_NULL(files) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_SERVER, SL("_SERVER")); zephir_get_global(&_POST, SL("_POST")); zephir_get_global(&_GET, SL("_GET")); @@ -103,8 +100,6 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load) } else { zephir_get_arrval(&files, files_param); } - - ZEPHIR_INIT_VAR(&globalCookies); array_init(&globalCookies); ZEPHIR_INIT_VAR(&globalFiles); @@ -130,19 +125,19 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load) if (!(ZEPHIR_IS_EMPTY(&_SERVER))) { ZEPHIR_CPY_WRT(&globalServer, &_SERVER); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checknullarray", &_1, 44, &server, &globalServer); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "checknullarray", &_1, 45, &server, &globalServer); zephir_check_call_status(); ZEPHIR_CPY_WRT(&server, &_0); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "checknullarray", &_1, 44, &files, &globalFiles); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "checknullarray", &_1, 45, &files, &globalFiles); zephir_check_call_status(); ZEPHIR_CPY_WRT(&files, &_2); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "checknullarray", &_1, 44, &cookies, &globalCookies); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "checknullarray", &_1, 45, &cookies, &globalCookies); zephir_check_call_status(); ZEPHIR_CPY_WRT(&cookies, &_3); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "checknullarray", &_1, 44, &get, &globalGet); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "checknullarray", &_1, 45, &get, &globalGet); zephir_check_call_status(); ZEPHIR_CPY_WRT(&get, &_4); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "checknullarray", &_1, 44, &post, &globalPost); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "checknullarray", &_1, 45, &post, &globalPost); zephir_check_call_status(); ZEPHIR_CPY_WRT(&post, &_5); zephir_create_array(return_value, 5, 0); @@ -163,24 +158,17 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, checkNullArray) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval super; zval *source, source_sub, *super_param = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&source_sub); ZVAL_UNDEF(&super); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(source) Z_PARAM_ARRAY(super) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &source, &super_param); zephir_get_arrval(&super, super_param); - - if (UNEXPECTED(Z_TYPE_P(source) == IS_NULL)) { RETURN_CTOR(&super); } diff --git a/ext/stub/globals/serverrequestfactory.zep.h b/ext/stub/globals/serverrequestfactory.zep.h index ad22f9b253..1e4873d494 100644 --- a/ext/stub/globals/serverrequestfactory.zep.h +++ b/ext/stub/globals/serverrequestfactory.zep.h @@ -7,31 +7,11 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load); PHP_METHOD(Stub_Globals_ServerRequestFactory, checkNullArray); ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_globals_serverrequestfactory_load, 0, 0, IS_ARRAY, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, server, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, server, 1) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, get, 1) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, post, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, post, 1) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cookies, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, cookies, 1) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, files, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, files, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, server, IS_ARRAY, 1, "[]") +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get, IS_ARRAY, 1, "[]") +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, post, IS_ARRAY, 1, "[]") +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cookies, IS_ARRAY, 1, "[]") +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, files, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_globals_serverrequestfactory_checknullarray, 0, 2, IS_ARRAY, 0) diff --git a/ext/stub/globals/session/base.zep.c b/ext/stub/globals/session/base.zep.c index 698bcd6647..50abeddde5 100644 --- a/ext/stub/globals/session/base.zep.c +++ b/ext/stub/globals/session/base.zep.c @@ -31,26 +31,19 @@ PHP_METHOD(Stub_Globals_Session_Base, set) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *index_param = NULL, *value, value_sub, _SESSION; zval index; - zval *this_ptr = getThis(); ZVAL_UNDEF(&index); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_SESSION); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_SESSION, SL("_SESSION")); zephir_fetch_params(1, 2, 0, &index_param, &value); zephir_get_strval(&index, index_param); - - zephir_array_update_zval(&_SESSION, &index, value, PH_COPY | PH_SEPARATE); RETVAL_ZVAL(&_SESSION, 1, 0); RETURN_MM(); @@ -61,24 +54,17 @@ PHP_METHOD(Stub_Globals_Session_Base, remove) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *index_param = NULL, _SESSION; zval index; - zval *this_ptr = getThis(); ZVAL_UNDEF(&index); ZVAL_UNDEF(&_SESSION); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_SESSION, SL("_SESSION")); zephir_fetch_params(1, 1, 0, &index_param); zephir_get_strval(&index, index_param); - - zephir_array_unset(&_SESSION, &index, PH_SEPARATE); ZEPHIR_MM_RESTORE(); } @@ -93,20 +79,14 @@ PHP_METHOD(Stub_Globals_Session_Base, __set) ZVAL_UNDEF(&index); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &index_param, &value); zephir_get_strval(&index, index_param); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "set", NULL, 0, &index, value); zephir_check_call_status(); RETURN_MM(); @@ -121,19 +101,13 @@ PHP_METHOD(Stub_Globals_Session_Base, __unset) zval *this_ptr = getThis(); ZVAL_UNDEF(&index); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &index_param); zephir_get_strval(&index, index_param); - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "remove", NULL, 0, &index); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -146,15 +120,13 @@ PHP_METHOD(Stub_Globals_Session_Base, removeSessionData) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval _SESSION, key, _0, *_1, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_SESSION); ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_SESSION, SL("_SESSION")); ZEPHIR_INIT_VAR(&_0); diff --git a/ext/stub/globals/session/base.zep.h b/ext/stub/globals/session/base.zep.h index d1bad5eb87..d6392cbcdc 100644 --- a/ext/stub/globals/session/base.zep.h +++ b/ext/stub/globals/session/base.zep.h @@ -35,10 +35,6 @@ ZEPHIR_INIT_FUNCS(stub_globals_session_base_method_entry) { PHP_ME(Stub_Globals_Session_Base, remove, arginfo_stub_globals_session_base_remove, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals_Session_Base, __set, arginfo_stub_globals_session_base___set, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals_Session_Base, __unset, arginfo_stub_globals_session_base___unset, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals_Session_Base, removeSessionData, arginfo_stub_globals_session_base_removesessiondata, ZEND_ACC_PROTECTED) -#else - PHP_ME(Stub_Globals_Session_Base, removeSessionData, NULL, ZEND_ACC_PROTECTED) -#endif +PHP_ME(Stub_Globals_Session_Base, removeSessionData, arginfo_stub_globals_session_base_removesessiondata, ZEND_ACC_PROTECTED) PHP_FE_END }; diff --git a/ext/stub/globals/session/child.zep.c b/ext/stub/globals/session/child.zep.c index 68414871a2..d57cf6df47 100644 --- a/ext/stub/globals/session/child.zep.c +++ b/ext/stub/globals/session/child.zep.c @@ -29,10 +29,8 @@ PHP_METHOD(Stub_Globals_Session_Child, destroy) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "removesessiondata", NULL, 0); zephir_check_call_status(); diff --git a/ext/stub/globals/session/child.zep.h b/ext/stub/globals/session/child.zep.h index d490cd0a8e..249376ad73 100644 --- a/ext/stub/globals/session/child.zep.h +++ b/ext/stub/globals/session/child.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_globals_session_child_destroy, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_globals_session_child_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals_Session_Child, destroy, arginfo_stub_globals_session_child_destroy, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals_Session_Child, destroy, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Globals_Session_Child, destroy, arginfo_stub_globals_session_child_destroy, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/instance.zep.c b/ext/stub/instance.zep.c index 2df0a1fbb5..96a81b9dc7 100644 --- a/ext/stub/instance.zep.c +++ b/ext/stub/instance.zep.c @@ -32,7 +32,6 @@ ZEPHIR_INIT_CLASS(Stub_Instance) PHP_METHOD(Stub_Instance, __construct) { zval *a1, a1_sub, *a2, a2_sub, *a3, a3_sub, *a4, a4_sub, *a5, a5_sub, *a6, a6_sub, *a7, a7_sub, *a8, a8_sub, *a9, a9_sub, *a10, a10_sub, *a11, a11_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a1_sub); ZVAL_UNDEF(&a2_sub); @@ -45,8 +44,6 @@ PHP_METHOD(Stub_Instance, __construct) ZVAL_UNDEF(&a9_sub); ZVAL_UNDEF(&a10_sub); ZVAL_UNDEF(&a11_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(11, 11) Z_PARAM_OBJECT_OF_CLASS(a1, stub_arithmetic_ce) Z_PARAM_OBJECT_OF_CLASS(a2, stub_arrayobject_ce) @@ -60,12 +57,7 @@ PHP_METHOD(Stub_Instance, __construct) Z_PARAM_OBJECT_OF_CLASS(a10, stub_compare_ce) Z_PARAM_OBJECT_OF_CLASS(a11, stub_concat_ce) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(11, 0, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9, &a10, &a11); - - } PHP_METHOD(Stub_Instance, testIssue1339) @@ -73,13 +65,11 @@ PHP_METHOD(Stub_Instance, testIssue1339) zval parameters, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶meters); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(¶meters); zephir_create_array(¶meters, 11, 0); @@ -93,7 +83,7 @@ PHP_METHOD(Stub_Instance, testIssue1339) zephir_array_fast_append(¶meters, &_0); ZEPHIR_INIT_NVAR(&_0); object_init_ex(&_0, stub_arrayobject_ce); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 45); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 46); zephir_check_call_status(); zephir_array_fast_append(¶meters, &_0); ZEPHIR_INIT_NVAR(&_0); @@ -181,22 +171,15 @@ PHP_METHOD(Stub_Instance, testInstanceCreate) zend_long ZEPHIR_LAST_CALL_STATUS; zval *className_param = NULL; zval className; - zval *this_ptr = getThis(); ZVAL_UNDEF(&className); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(className) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &className_param); zephir_get_strval(&className, className_param); - - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(return_value, &className); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/stub/instanceoff.zep.c b/ext/stub/instanceoff.zep.c index a13582d99c..1c920a2121 100644 --- a/ext/stub/instanceoff.zep.c +++ b/ext/stub/instanceoff.zep.c @@ -32,12 +32,10 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf1) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); object_init(&a); @@ -49,12 +47,10 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf2) zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); object_init_ex(&a, stub_instanceoff_ce); @@ -70,12 +66,10 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf3) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); object_init(&a); @@ -85,20 +79,12 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf3) PHP_METHOD(Stub_Instanceoff, testInstanceOf4) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - if (zephir_zval_is_traversable(a)) { RETURN_BOOL(1); } @@ -111,17 +97,10 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf5) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - if (zephir_instance_of_ev(a, stub_instanceoff_ce)) { RETURN_BOOL(1); } @@ -133,12 +112,10 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf6) zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); object_init_ex(&a, stub_instanceoff_ce); @@ -153,20 +130,12 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf6) PHP_METHOD(Stub_Instanceoff, testInstanceOf7) { zval *test, test_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&test_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT(test) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &test); - - RETURN_BOOL(zephir_instance_of_ev(test, stub_instanceoff_ce)); } @@ -176,23 +145,16 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf8) zend_long ZEPHIR_LAST_CALL_STATUS; zval *test_param = NULL, a; zval test; - zval *this_ptr = getThis(); ZVAL_UNDEF(&test); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(test) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &test_param); zephir_get_strval(&test, test_param); - - ZEPHIR_INIT_VAR(&a); object_init_ex(&a, stub_instanceoff_ce); if (zephir_has_constructor(&a)) { @@ -208,24 +170,17 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf9) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval test; zval *a, a_sub, *test_param = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&test); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_OBJECT(a) Z_PARAM_STR(test) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &test_param); zephir_get_strval(&test, test_param); - - RETURN_MM_BOOL(zephir_is_instance_of(a, Z_STRVAL_P(&test), Z_STRLEN_P(&test))); } diff --git a/ext/stub/interfaces/implementint.zep.c b/ext/stub/interfaces/implementint.zep.c index b9d582d74f..2c94400671 100644 --- a/ext/stub/interfaces/implementint.zep.c +++ b/ext/stub/interfaces/implementint.zep.c @@ -13,8 +13,8 @@ #include "kernel/main.h" #include "kernel/object.h" -#include "kernel/memory.h" #include "kernel/operators.h" +#include "kernel/memory.h" ZEPHIR_INIT_CLASS(Stub_Interfaces_ImplementInt) @@ -33,28 +33,17 @@ PHP_METHOD(Stub_Interfaces_ImplementInt, set) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val_param); - val = zephir_get_intval(val_param); - - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, val); zephir_update_property_zval(this_ptr, ZEND_STRL("val"), &_0); } PHP_METHOD(Stub_Interfaces_ImplementInt, get) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "val"); } diff --git a/ext/stub/interfaces/implementinterface.zep.c b/ext/stub/interfaces/implementinterface.zep.c index a893ad41ec..0d0fc12b97 100644 --- a/ext/stub/interfaces/implementinterface.zep.c +++ b/ext/stub/interfaces/implementinterface.zep.c @@ -31,21 +31,14 @@ PHP_METHOD(Stub_Interfaces_ImplementInterface, get) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *obj, obj_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(obj, stub_interfaces_interfaceint_ce) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &obj); - - ZEPHIR_RETURN_CALL_METHOD(obj, "get", NULL, 0); zephir_check_call_status(); RETURN_MM(); @@ -57,25 +50,15 @@ PHP_METHOD(Stub_Interfaces_ImplementInterface, getVoid) zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(obj, stub_interfaces_interfaceint_ce) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &obj); - - zephir_update_property_zval(this_ptr, ZEND_STRL("obj"), obj); } PHP_METHOD(Stub_Interfaces_ImplementInterface, getObj) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "obj"); } diff --git a/ext/stub/interfaces/interfacestaticmethod.zep.h b/ext/stub/interfaces/interfacestaticmethod.zep.h index e608428011..ef679c2b9a 100644 --- a/ext/stub/interfaces/interfacestaticmethod.zep.h +++ b/ext/stub/interfaces/interfacestaticmethod.zep.h @@ -7,10 +7,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_interfaces_interfacestaticmethod_reset, 0, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_interfaces_interfacestaticmethod_method_entry) { -#if PHP_VERSION_ID >= 80000 - ZEND_FENTRY(reset, NULL, arginfo_stub_interfaces_interfacestaticmethod_reset, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#else - ZEND_FENTRY(reset, NULL, NULL, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#endif +ZEND_FENTRY(reset, NULL, arginfo_stub_interfaces_interfacestaticmethod_reset, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/internalclasses.zep.c b/ext/stub/internalclasses.zep.c index 27bf835df0..7ef9207c14 100644 --- a/ext/stub/internalclasses.zep.c +++ b/ext/stub/internalclasses.zep.c @@ -29,11 +29,8 @@ PHP_METHOD(Stub_InternalClasses, testStaticCall) zend_class_entry *_0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); _0 = zephir_fetch_class_str_ex(SL("Phalcon\\Di"), ZEND_FETCH_CLASS_AUTO); ZEPHIR_RETURN_CALL_CE_STATIC(_0, "getdefault", NULL, 0); @@ -43,9 +40,6 @@ PHP_METHOD(Stub_InternalClasses, testStaticCall) PHP_METHOD(Stub_InternalClasses, testStaticPropertyFetch) { - zval *this_ptr = getThis(); - - RETURN_LONG(303); } diff --git a/ext/stub/internalclasses.zep.h b/ext/stub/internalclasses.zep.h index 1148679325..b17fd43426 100644 --- a/ext/stub/internalclasses.zep.h +++ b/ext/stub/internalclasses.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_internalclasses_teststaticpropertyfetch, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_internalclasses_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_InternalClasses, testStaticCall, arginfo_stub_internalclasses_teststaticcall, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_InternalClasses, testStaticCall, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_InternalClasses, testStaticPropertyFetch, arginfo_stub_internalclasses_teststaticpropertyfetch, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_InternalClasses, testStaticPropertyFetch, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_InternalClasses, testStaticCall, arginfo_stub_internalclasses_teststaticcall, ZEND_ACC_PUBLIC) +PHP_ME(Stub_InternalClasses, testStaticPropertyFetch, arginfo_stub_internalclasses_teststaticpropertyfetch, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/internalinterfaces.zep.c b/ext/stub/internalinterfaces.zep.c index 807b0cab46..ec629ea1a7 100644 --- a/ext/stub/internalinterfaces.zep.c +++ b/ext/stub/internalinterfaces.zep.c @@ -25,9 +25,6 @@ ZEPHIR_INIT_CLASS(Stub_InternalInterfaces) PHP_METHOD(Stub_InternalInterfaces, count) { - zval *this_ptr = getThis(); - - RETURN_LONG(0); } diff --git a/ext/stub/invoke.zep.c b/ext/stub/invoke.zep.c index d9fc449852..64bf4694c1 100644 --- a/ext/stub/invoke.zep.c +++ b/ext/stub/invoke.zep.c @@ -32,9 +32,8 @@ PHP_METHOD(Stub_Invoke, __construct) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); @@ -49,9 +48,6 @@ PHP_METHOD(Stub_Invoke, __invoke) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_property(&_0, this_ptr, ZEND_STRL("a"), PH_NOISY_CC | PH_READONLY); zephir_gettype(return_value, &_0); return; @@ -62,16 +58,14 @@ PHP_METHOD(Stub_Invoke, test) zval func; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&func); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&func); object_init_ex(&func, stub_invoke_ce); - ZEPHIR_CALL_METHOD(NULL, &func, "__construct", NULL, 46); + ZEPHIR_CALL_METHOD(NULL, &func, "__construct", NULL, 47); zephir_check_call_status(); ZEPHIR_RETURN_CALL_ZVAL_FUNCTION(&func, NULL, 0); zephir_check_call_status(); diff --git a/ext/stub/invoke.zep.h b/ext/stub/invoke.zep.h index 523313d408..03b45af256 100644 --- a/ext/stub/invoke.zep.h +++ b/ext/stub/invoke.zep.h @@ -17,11 +17,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_invoke_test, 0, 0, IS_STRIN ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_invoke_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Invoke, __construct, arginfo_stub_invoke___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Invoke, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Invoke, __construct, arginfo_stub_invoke___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Invoke, __invoke, arginfo_stub_invoke___invoke, ZEND_ACC_PUBLIC) PHP_ME(Stub_Invoke, test, arginfo_stub_invoke_test, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END diff --git a/ext/stub/invokes/abstractinvoker.zep.c b/ext/stub/invokes/abstractinvoker.zep.c index 0b3515f6e3..322331a6bd 100644 --- a/ext/stub/invokes/abstractinvoker.zep.c +++ b/ext/stub/invokes/abstractinvoker.zep.c @@ -32,9 +32,8 @@ PHP_METHOD(Stub_Invokes_AbstractInvoker, __toString) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_read_property(&_0, this_ptr, ZEND_STRL("text"), PH_NOISY_CC | PH_READONLY); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderarrayelements", NULL, 0, &_0); @@ -45,9 +44,6 @@ PHP_METHOD(Stub_Invokes_AbstractInvoker, __toString) PHP_METHOD(Stub_Invokes_AbstractInvoker, __invoke) { zval *this_ptr = getThis(); - - - RETURN_THISW(); } diff --git a/ext/stub/invokes/abstractinvoker.zep.h b/ext/stub/invokes/abstractinvoker.zep.h index 4c0eb0c35a..9aa02b8f12 100644 --- a/ext/stub/invokes/abstractinvoker.zep.h +++ b/ext/stub/invokes/abstractinvoker.zep.h @@ -6,22 +6,14 @@ ZEPHIR_INIT_CLASS(Stub_Invokes_AbstractInvoker); PHP_METHOD(Stub_Invokes_AbstractInvoker, __toString); PHP_METHOD(Stub_Invokes_AbstractInvoker, __invoke); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_invokes_abstractinvoker___tostring, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_invokes_abstractinvoker___tostring, 0, 0, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_invokes_abstractinvoker___invoke, 0, 0, Stub\\Invokes\\AbstractInvoker, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_invokes_abstractinvoker_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Invokes_AbstractInvoker, __toString, arginfo_stub_invokes_abstractinvoker___tostring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Invokes_AbstractInvoker, __toString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Invokes_AbstractInvoker, __toString, arginfo_stub_invokes_abstractinvoker___tostring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Invokes_AbstractInvoker, __invoke, arginfo_stub_invokes_abstractinvoker___invoke, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/invokes/abstractinvokercomplex.zep.c b/ext/stub/invokes/abstractinvokercomplex.zep.c index bc6b0df5f2..3a650429a8 100644 --- a/ext/stub/invokes/abstractinvokercomplex.zep.c +++ b/ext/stub/invokes/abstractinvokercomplex.zep.c @@ -32,9 +32,8 @@ PHP_METHOD(Stub_Invokes_AbstractInvokerComplex, __toString) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_read_property(&_0, this_ptr, ZEND_STRL("text"), PH_NOISY_CC | PH_READONLY); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "renderarrayelementscomplex", NULL, 0, &_0); @@ -45,9 +44,6 @@ PHP_METHOD(Stub_Invokes_AbstractInvokerComplex, __toString) PHP_METHOD(Stub_Invokes_AbstractInvokerComplex, __invoke) { zval *this_ptr = getThis(); - - - RETURN_THISW(); } diff --git a/ext/stub/invokes/abstractinvokercomplex.zep.h b/ext/stub/invokes/abstractinvokercomplex.zep.h index f32ec8339b..dcdce85182 100644 --- a/ext/stub/invokes/abstractinvokercomplex.zep.h +++ b/ext/stub/invokes/abstractinvokercomplex.zep.h @@ -6,22 +6,14 @@ ZEPHIR_INIT_CLASS(Stub_Invokes_AbstractInvokerComplex); PHP_METHOD(Stub_Invokes_AbstractInvokerComplex, __toString); PHP_METHOD(Stub_Invokes_AbstractInvokerComplex, __invoke); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_invokes_abstractinvokercomplex___tostring, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_invokes_abstractinvokercomplex___tostring, 0, 0, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_invokes_abstractinvokercomplex___invoke, 0, 0, Stub\\Invokes\\AbstractInvoker, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_invokes_abstractinvokercomplex_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Invokes_AbstractInvokerComplex, __toString, arginfo_stub_invokes_abstractinvokercomplex___tostring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Invokes_AbstractInvokerComplex, __toString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Invokes_AbstractInvokerComplex, __toString, arginfo_stub_invokes_abstractinvokercomplex___tostring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Invokes_AbstractInvokerComplex, __invoke, arginfo_stub_invokes_abstractinvokercomplex___invoke, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/invokes/abstractprotected.zep.c b/ext/stub/invokes/abstractprotected.zep.c index 566816b694..8ced3199e3 100644 --- a/ext/stub/invokes/abstractprotected.zep.c +++ b/ext/stub/invokes/abstractprotected.zep.c @@ -33,24 +33,17 @@ PHP_METHOD(Stub_Invokes_AbstractProtected, protectedMethod1) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *text_param = NULL, ret; zval text, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&text); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&ret); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &text_param); zephir_get_strval(&text, text_param); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_VS(&_0, &text, "1"); ZEPHIR_CPY_WRT(&ret, &_0); @@ -62,24 +55,17 @@ PHP_METHOD(Stub_Invokes_AbstractProtected, protectedMethod2) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *text_param = NULL, ret; zval text, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&text); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&ret); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &text_param); zephir_get_strval(&text, text_param); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_VS(&_0, &text, "2"); ZEPHIR_CPY_WRT(&ret, &_0); @@ -99,19 +85,13 @@ PHP_METHOD(Stub_Invokes_AbstractProtected, renderArrayElements) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &text_param); zephir_get_strval(&text, text_param); - - ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 2, 0); zephir_array_fast_append(&_0, this_ptr); @@ -151,19 +131,13 @@ PHP_METHOD(Stub_Invokes_AbstractProtected, renderArrayElementsComplex) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_6$$3); ZVAL_UNDEF(&_10$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &text_param); zephir_get_strval(&text, text_param); - - ZEPHIR_INIT_VAR(&result); ZEPHIR_INIT_VAR(&elements); zephir_create_array(&elements, 2, 0); diff --git a/ext/stub/invokes/invokeprotected.zep.c b/ext/stub/invokes/invokeprotected.zep.c index 4e5f18259d..3ab667916c 100644 --- a/ext/stub/invokes/invokeprotected.zep.c +++ b/ext/stub/invokes/invokeprotected.zep.c @@ -32,19 +32,13 @@ PHP_METHOD(Stub_Invokes_InvokeProtected, __construct) zval *this_ptr = getThis(); ZVAL_UNDEF(&text); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &text_param); zephir_get_strval(&text, text_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("text"), &text); ZEPHIR_MM_RESTORE(); } diff --git a/ext/stub/invokes/invokeprotectedcomplex.zep.c b/ext/stub/invokes/invokeprotectedcomplex.zep.c index afe0f35d9f..4bc256ca29 100644 --- a/ext/stub/invokes/invokeprotectedcomplex.zep.c +++ b/ext/stub/invokes/invokeprotectedcomplex.zep.c @@ -32,19 +32,13 @@ PHP_METHOD(Stub_Invokes_InvokeProtectedComplex, __construct) zval *this_ptr = getThis(); ZVAL_UNDEF(&text); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &text_param); zephir_get_strval(&text, text_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("text"), &text); ZEPHIR_MM_RESTORE(); } diff --git a/ext/stub/issettest.zep.c b/ext/stub/issettest.zep.c index c5b5d69e31..b3d775c286 100644 --- a/ext/stub/issettest.zep.c +++ b/ext/stub/issettest.zep.c @@ -34,22 +34,14 @@ ZEPHIR_INIT_CLASS(Stub_IssetTest) PHP_METHOD(Stub_IssetTest, testIssetArray1) { zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - RETURN_BOOL(zephir_array_isset(a, b)); } @@ -57,22 +49,13 @@ PHP_METHOD(Stub_IssetTest, testIssetArray2) { zend_long b; zval *a, a_sub, *b_param = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b_param); - b = zephir_get_intval(b_param); - - RETURN_BOOL(zephir_array_isset_long(a, b)); } @@ -81,126 +64,79 @@ PHP_METHOD(Stub_IssetTest, testIssetArray3) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval b; zval *a, a_sub, *b_param = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_STR(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b_param); zephir_get_strval(&b, b_param); - - RETURN_MM_BOOL(zephir_array_isset(a, &b)); } PHP_METHOD(Stub_IssetTest, testIssetArray4) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(zephir_array_isset_long(a, 0)); } PHP_METHOD(Stub_IssetTest, testIssetArray5) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(zephir_array_isset_string(a, SL("a"))); } PHP_METHOD(Stub_IssetTest, testIssetProperty1) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(zephir_isset_property(a, SL("b"))); } PHP_METHOD(Stub_IssetTest, testIssetProperty2) { zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - RETURN_BOOL(zephir_isset_property_zval(a, b)); } PHP_METHOD(Stub_IssetTest, testIssetProperty3) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL((0 == 0)); } @@ -211,11 +147,10 @@ PHP_METHOD(Stub_IssetTest, testIssetDynamicProperty1) zval *this_ptr = getThis(); ZVAL_UNDEF(&g); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(&g); + zephir_memory_observe(&g); zephir_read_property(&g, this_ptr, ZEND_STRL("s"), PH_NOISY_CC); if (zephir_array_isset_string(&g, SL("a"))) { RETURN_MM_BOOL(1); @@ -227,23 +162,16 @@ PHP_METHOD(Stub_IssetTest, testIssetDynamicProperty2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *inp, inp_sub, g; - zval *this_ptr = getThis(); ZVAL_UNDEF(&inp_sub); ZVAL_UNDEF(&g); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(inp) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &inp); - - - ZEPHIR_OBS_VAR(&g); + zephir_memory_observe(&g); zephir_read_property(&g, inp, ZEND_STRL("s"), PH_NOISY_CC); if (zephir_array_isset_string(&g, SL("a"))) { RETURN_MM_BOOL(1); @@ -260,7 +188,8 @@ zend_object *zephir_init_properties_Stub_IssetTest(zend_class_entry *class_type) ZVAL_UNDEF(&_1$$3); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); { zval local_this_ptr, *this_ptr = &local_this_ptr; diff --git a/ext/stub/issettest.zep.h b/ext/stub/issettest.zep.h index dc9eca31d3..f191d1050f 100644 --- a/ext/stub/issettest.zep.h +++ b/ext/stub/issettest.zep.h @@ -70,11 +70,7 @@ ZEPHIR_INIT_FUNCS(stub_issettest_method_entry) { PHP_ME(Stub_IssetTest, testIssetProperty1, arginfo_stub_issettest_testissetproperty1, ZEND_ACC_PUBLIC) PHP_ME(Stub_IssetTest, testIssetProperty2, arginfo_stub_issettest_testissetproperty2, ZEND_ACC_PUBLIC) PHP_ME(Stub_IssetTest, testIssetProperty3, arginfo_stub_issettest_testissetproperty3, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_IssetTest, testIssetDynamicProperty1, arginfo_stub_issettest_testissetdynamicproperty1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_IssetTest, testIssetDynamicProperty1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_IssetTest, testIssetDynamicProperty1, arginfo_stub_issettest_testissetdynamicproperty1, ZEND_ACC_PUBLIC) PHP_ME(Stub_IssetTest, testIssetDynamicProperty2, arginfo_stub_issettest_testissetdynamicproperty2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/issue1134.zep.c b/ext/stub/issue1134.zep.c index 829e666c58..595f4ae867 100644 --- a/ext/stub/issue1134.zep.c +++ b/ext/stub/issue1134.zep.c @@ -36,16 +36,12 @@ PHP_METHOD(Stub_Issue1134, __construct) zval *this_ptr = getThis(); ZVAL_UNDEF(&config); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(config) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &config_param); if (!config_param) { ZEPHIR_INIT_VAR(&config); @@ -53,8 +49,6 @@ PHP_METHOD(Stub_Issue1134, __construct) } else { zephir_get_arrval(&config, config_param); } - - zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &config); ZEPHIR_MM_RESTORE(); } @@ -64,19 +58,14 @@ PHP_METHOD(Stub_Issue1134, arrayWithFilledDefaultValue) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *someDefaultData_param = NULL; zval someDefaultData; - zval *this_ptr = getThis(); ZVAL_UNDEF(&someDefaultData); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(someDefaultData) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &someDefaultData_param); if (!someDefaultData_param) { ZEPHIR_INIT_VAR(&someDefaultData); @@ -84,8 +73,6 @@ PHP_METHOD(Stub_Issue1134, arrayWithFilledDefaultValue) } else { zephir_get_arrval(&someDefaultData, someDefaultData_param); } - - RETURN_CTOR(&someDefaultData); } diff --git a/ext/stub/issue1134.zep.h b/ext/stub/issue1134.zep.h index 6c44ebc836..967e3622f9 100644 --- a/ext/stub/issue1134.zep.h +++ b/ext/stub/issue1134.zep.h @@ -7,19 +7,11 @@ PHP_METHOD(Stub_Issue1134, __construct); PHP_METHOD(Stub_Issue1134, arrayWithFilledDefaultValue); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1134___construct, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, config, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, config, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, config, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1134_arraywithfilleddefaultvalue, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someDefaultData, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, someDefaultData, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someDefaultData, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issue1134_method_entry) { diff --git a/ext/stub/issue1404.zep.c b/ext/stub/issue1404.zep.c index a8f8af956e..2a10e0ffe5 100644 --- a/ext/stub/issue1404.zep.c +++ b/ext/stub/issue1404.zep.c @@ -24,252 +24,168 @@ ZEPHIR_INIT_CLASS(Stub_Issue1404) PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsingInteger70000) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70000)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsingDouble70100) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70100)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsingLong70000) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(21474836470000)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsingString70000) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70000)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsingZero) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(0)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing50000) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(50000)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing50500) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(50500)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing50600) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(50600)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70101) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70101)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70102) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70102)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70103) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70103)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70104) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70104)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70105) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70105)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70106) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70106)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70107) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70107)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70108) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70108)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70109) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70109)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70110) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70110)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70111) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70111)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70112) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70112)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70113) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70113)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70114) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70114)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70115) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70115)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70116) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70116)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70117) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70117)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70100) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70100)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70200) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70200)); } PHP_METHOD(Stub_Issue1404, testIsPhpVersionUsing70300) { - zval *this_ptr = getThis(); - - RETURN_BOOL(zephir_is_php_version(70300)); } diff --git a/ext/stub/issue1521.zep.c b/ext/stub/issue1521.zep.c index a3b03301c0..796f4122df 100644 --- a/ext/stub/issue1521.zep.c +++ b/ext/stub/issue1521.zep.c @@ -32,9 +32,8 @@ PHP_METHOD(Stub_Issue1521, test) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 2, 0); diff --git a/ext/stub/issue1521.zep.h b/ext/stub/issue1521.zep.h index 518615b996..bee7d6fc02 100644 --- a/ext/stub/issue1521.zep.h +++ b/ext/stub/issue1521.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1521_test, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issue1521_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue1521, test, arginfo_stub_issue1521_test, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Issue1521, test, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Issue1521, test, arginfo_stub_issue1521_test, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/issue2165/issue.zep.c b/ext/stub/issue2165/issue.zep.c index fe042aa89b..5c7f6a4310 100644 --- a/ext/stub/issue2165/issue.zep.c +++ b/ext/stub/issue2165/issue.zep.c @@ -41,20 +41,15 @@ PHP_METHOD(Stub_Issue2165_Issue, build) zend_long ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, _0; zval a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &a_param); if (!a_param) { ZEPHIR_INIT_VAR(&a); @@ -62,11 +57,9 @@ PHP_METHOD(Stub_Issue2165_Issue, build) } else { zephir_get_arrval(&a, a_param); } - - object_init_ex(return_value, stub_issue2165_issue_ce); ZVAL_BOOL(&_0, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 47, &a, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 48, &a, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -121,32 +114,25 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZVAL_UNDEF(&_42$$15); ZVAL_UNDEF(&_43$$15); ZVAL_UNDEF(&_44$$15); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ARRAY(a) Z_PARAM_OPTIONAL Z_PARAM_BOOL(validate) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &a_param, &validate_param); zephir_get_arrval(&a, a_param); if (!validate_param) { validate = 1; } else { - validate = zephir_get_boolval(validate_param); - } - - + } m = zephir_fast_count_int(&a); - ZEPHIR_CALL_FUNCTION(&_0, "current", NULL, 42, &a); + ZEPHIR_CALL_FUNCTION(&_0, "current", NULL, 43, &a); zephir_check_call_status(); n = zephir_fast_count_int(&_0); if (validate) { - ZEPHIR_CALL_FUNCTION(&_1$$3, "array_values", &_2, 48, &a); + ZEPHIR_CALL_FUNCTION(&_1$$3, "array_values", &_2, 49, &a); zephir_check_call_status(); ZEPHIR_CPY_WRT(&a, &_1$$3); zephir_is_iterable(&a, 0, "stub/issue2165/issue.zep", 46); @@ -165,13 +151,13 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZEPHIR_INIT_NVAR(&_7$$5); object_init_ex(&_7$$5, spl_ce_InvalidArgumentException); ZVAL_LONG(&_8$$5, n); - ZEPHIR_CALL_FUNCTION(&_9$$5, "strval", &_10, 49, &_8$$5); + ZEPHIR_CALL_FUNCTION(&_9$$5, "strval", &_10, 50, &_8$$5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_11$$5); ZVAL_LONG(&_11$$5, zephir_fast_count_int(&rowA)); ZEPHIR_INIT_NVAR(&_12$$5); ZEPHIR_CONCAT_SSVSVSSVS(&_12$$5, "The number of columns", " must be equal for all rows, ", &_9$$5, " needed but ", &_11$$5, " given", " at row offset ", &i, "."); - ZEPHIR_CALL_METHOD(NULL, &_7$$5, "__construct", &_13, 50, &_12$$5); + ZEPHIR_CALL_METHOD(NULL, &_7$$5, "__construct", &_13, 51, &_12$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_7$$5, "stub/issue2165/issue.zep", 33); ZEPHIR_MM_RESTORE(); @@ -185,7 +171,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZVAL_COPY(&valueA, _14$$4); _16$$6 = !(Z_TYPE_P(&valueA) == IS_LONG); if (_16$$6) { - ZEPHIR_CALL_FUNCTION(&_17$$6, "is_float", &_18, 51, &valueA); + ZEPHIR_CALL_FUNCTION(&_17$$6, "is_float", &_18, 52, &valueA); zephir_check_call_status(); _16$$6 = !zephir_is_true(&_17$$6); } @@ -196,7 +182,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_gettype(&_20$$7, &valueA); ZEPHIR_INIT_NVAR(&_21$$7); ZEPHIR_CONCAT_SSVS(&_21$$7, "Matrix element must", " be an integer or floating point number, ", &_20$$7, " given."); - ZEPHIR_CALL_METHOD(NULL, &_19$$7, "__construct", &_13, 50, &_21$$7); + ZEPHIR_CALL_METHOD(NULL, &_19$$7, "__construct", &_13, 51, &_21$$7); zephir_check_call_status(); zephir_throw_exception_debug(&_19$$7, "stub/issue2165/issue.zep", 40); ZEPHIR_MM_RESTORE(); @@ -216,7 +202,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_check_call_status(); _22$$8 = !(Z_TYPE_P(&valueA) == IS_LONG); if (_22$$8) { - ZEPHIR_CALL_FUNCTION(&_23$$8, "is_float", &_18, 51, &valueA); + ZEPHIR_CALL_FUNCTION(&_23$$8, "is_float", &_18, 52, &valueA); zephir_check_call_status(); _22$$8 = !zephir_is_true(&_23$$8); } @@ -227,7 +213,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_gettype(&_25$$9, &valueA); ZEPHIR_INIT_NVAR(&_26$$9); ZEPHIR_CONCAT_SSVS(&_26$$9, "Matrix element must", " be an integer or floating point number, ", &_25$$9, " given."); - ZEPHIR_CALL_METHOD(NULL, &_24$$9, "__construct", &_13, 50, &_26$$9); + ZEPHIR_CALL_METHOD(NULL, &_24$$9, "__construct", &_13, 51, &_26$$9); zephir_check_call_status(); zephir_throw_exception_debug(&_24$$9, "stub/issue2165/issue.zep", 40); ZEPHIR_MM_RESTORE(); @@ -238,7 +224,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) } } ZEPHIR_INIT_NVAR(&valueA); - ZEPHIR_CALL_FUNCTION(&_27$$4, "array_values", &_2, 48, &rowA); + ZEPHIR_CALL_FUNCTION(&_27$$4, "array_values", &_2, 49, &rowA); zephir_check_call_status(); zephir_array_append(&rowA, &_27$$4, PH_SEPARATE, "stub/issue2165/issue.zep", 44); } ZEND_HASH_FOREACH_END(); @@ -259,13 +245,13 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZEPHIR_INIT_NVAR(&_28$$11); object_init_ex(&_28$$11, spl_ce_InvalidArgumentException); ZVAL_LONG(&_29$$11, n); - ZEPHIR_CALL_FUNCTION(&_30$$11, "strval", &_10, 49, &_29$$11); + ZEPHIR_CALL_FUNCTION(&_30$$11, "strval", &_10, 50, &_29$$11); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_31$$11); ZVAL_LONG(&_31$$11, zephir_fast_count_int(&rowA)); ZEPHIR_INIT_NVAR(&_32$$11); ZEPHIR_CONCAT_SSVSVSSVS(&_32$$11, "The number of columns", " must be equal for all rows, ", &_30$$11, " needed but ", &_31$$11, " given", " at row offset ", &i, "."); - ZEPHIR_CALL_METHOD(NULL, &_28$$11, "__construct", &_13, 50, &_32$$11); + ZEPHIR_CALL_METHOD(NULL, &_28$$11, "__construct", &_13, 51, &_32$$11); zephir_check_call_status(); zephir_throw_exception_debug(&_28$$11, "stub/issue2165/issue.zep", 33); ZEPHIR_MM_RESTORE(); @@ -279,7 +265,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZVAL_COPY(&valueA, _33$$10); _35$$12 = !(Z_TYPE_P(&valueA) == IS_LONG); if (_35$$12) { - ZEPHIR_CALL_FUNCTION(&_36$$12, "is_float", &_18, 51, &valueA); + ZEPHIR_CALL_FUNCTION(&_36$$12, "is_float", &_18, 52, &valueA); zephir_check_call_status(); _35$$12 = !zephir_is_true(&_36$$12); } @@ -290,7 +276,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_gettype(&_38$$13, &valueA); ZEPHIR_INIT_NVAR(&_39$$13); ZEPHIR_CONCAT_SSVS(&_39$$13, "Matrix element must", " be an integer or floating point number, ", &_38$$13, " given."); - ZEPHIR_CALL_METHOD(NULL, &_37$$13, "__construct", &_13, 50, &_39$$13); + ZEPHIR_CALL_METHOD(NULL, &_37$$13, "__construct", &_13, 51, &_39$$13); zephir_check_call_status(); zephir_throw_exception_debug(&_37$$13, "stub/issue2165/issue.zep", 40); ZEPHIR_MM_RESTORE(); @@ -310,7 +296,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_check_call_status(); _40$$14 = !(Z_TYPE_P(&valueA) == IS_LONG); if (_40$$14) { - ZEPHIR_CALL_FUNCTION(&_41$$14, "is_float", &_18, 51, &valueA); + ZEPHIR_CALL_FUNCTION(&_41$$14, "is_float", &_18, 52, &valueA); zephir_check_call_status(); _40$$14 = !zephir_is_true(&_41$$14); } @@ -321,7 +307,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_gettype(&_43$$15, &valueA); ZEPHIR_INIT_NVAR(&_44$$15); ZEPHIR_CONCAT_SSVS(&_44$$15, "Matrix element must", " be an integer or floating point number, ", &_43$$15, " given."); - ZEPHIR_CALL_METHOD(NULL, &_42$$15, "__construct", &_13, 50, &_44$$15); + ZEPHIR_CALL_METHOD(NULL, &_42$$15, "__construct", &_13, 51, &_44$$15); zephir_check_call_status(); zephir_throw_exception_debug(&_42$$15, "stub/issue2165/issue.zep", 40); ZEPHIR_MM_RESTORE(); @@ -332,7 +318,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) } } ZEPHIR_INIT_NVAR(&valueA); - ZEPHIR_CALL_FUNCTION(&_45$$10, "array_values", &_2, 48, &rowA); + ZEPHIR_CALL_FUNCTION(&_45$$10, "array_values", &_2, 49, &rowA); zephir_check_call_status(); zephir_array_append(&rowA, &_45$$10, PH_SEPARATE, "stub/issue2165/issue.zep", 44); ZEPHIR_CALL_METHOD(NULL, &a, "next", NULL, 0); @@ -343,10 +329,10 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZEPHIR_INIT_NVAR(&i); } zephir_update_property_zval(this_ptr, ZEND_STRL("a"), &a); - ZEPHIR_INIT_ZVAL_NREF(_46); + ZVAL_UNDEF(&_46); ZVAL_LONG(&_46, m); zephir_update_property_zval(this_ptr, ZEND_STRL("m"), &_46); - ZEPHIR_INIT_ZVAL_NREF(_46); + ZVAL_UNDEF(&_46); ZVAL_LONG(&_46, n); zephir_update_property_zval(this_ptr, ZEND_STRL("n"), &_46); ZEPHIR_MM_RESTORE(); @@ -358,20 +344,15 @@ PHP_METHOD(Stub_Issue2165_Issue, quick) zend_long ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, _0; zval a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &a_param); if (!a_param) { ZEPHIR_INIT_VAR(&a); @@ -379,11 +360,9 @@ PHP_METHOD(Stub_Issue2165_Issue, quick) } else { zephir_get_arrval(&a, a_param); } - - object_init_ex(return_value, stub_issue2165_issue_ce); ZVAL_BOOL(&_0, 0); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 47, &a, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 48, &a, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -393,26 +372,17 @@ PHP_METHOD(Stub_Issue2165_Issue, ones) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *m_param = NULL, *n_param = NULL, _0, _1, _2; zend_long m, n, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(m) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &m_param, &n_param); - m = zephir_get_intval(m_param); - n = zephir_get_intval(n_param); - - ZVAL_LONG(&_0, 1); ZVAL_LONG(&_1, m); ZVAL_LONG(&_2, n); @@ -428,7 +398,6 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) zephir_fcall_cache_entry *_8 = NULL, *_17 = NULL; zend_long m, n, ZEPHIR_LAST_CALL_STATUS; zval *value, value_sub, *m_param = NULL, *n_param = NULL, _1, _14, _15, _16, _18, _2$$3, _3$$3, _4$$3, _5$$4, _6$$4, _7$$4, _9$$4, _10$$5, _11$$5, _12$$5, _13$$5; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_1); @@ -447,25 +416,17 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) ZVAL_UNDEF(&_11$$5); ZVAL_UNDEF(&_12$$5); ZVAL_UNDEF(&_13$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(value) Z_PARAM_LONG(m) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 3, 0, &value, &m_param, &n_param); - m = zephir_get_intval(m_param); - n = zephir_get_intval(n_param); - - _0 = !(Z_TYPE_P(value) == IS_LONG); if (_0) { - ZEPHIR_CALL_FUNCTION(&_1, "is_float", NULL, 51, value); + ZEPHIR_CALL_FUNCTION(&_1, "is_float", NULL, 52, value); zephir_check_call_status(); _0 = !zephir_is_true(&_1); } @@ -476,7 +437,7 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) zephir_gettype(&_3$$3, value); ZEPHIR_INIT_VAR(&_4$$3); ZEPHIR_CONCAT_SSVS(&_4$$3, "Value must be an", " integer or floating point number, ", &_3$$3, " given."); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 50, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 51, &_4$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_2$$3, "stub/issue2165/issue.zep", 68); ZEPHIR_MM_RESTORE(); @@ -486,11 +447,11 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) ZEPHIR_INIT_VAR(&_5$$4); object_init_ex(&_5$$4, spl_ce_InvalidArgumentException); ZVAL_LONG(&_6$$4, m); - ZEPHIR_CALL_FUNCTION(&_7$$4, "strval", &_8, 49, &_6$$4); + ZEPHIR_CALL_FUNCTION(&_7$$4, "strval", &_8, 50, &_6$$4); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9$$4); ZEPHIR_CONCAT_SSVS(&_9$$4, "M must be", " greater than 0, ", &_7$$4, " given."); - ZEPHIR_CALL_METHOD(NULL, &_5$$4, "__construct", NULL, 50, &_9$$4); + ZEPHIR_CALL_METHOD(NULL, &_5$$4, "__construct", NULL, 51, &_9$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_5$$4, "stub/issue2165/issue.zep", 73); ZEPHIR_MM_RESTORE(); @@ -500,11 +461,11 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) ZEPHIR_INIT_VAR(&_10$$5); object_init_ex(&_10$$5, spl_ce_InvalidArgumentException); ZVAL_LONG(&_11$$5, n); - ZEPHIR_CALL_FUNCTION(&_12$$5, "strval", &_8, 49, &_11$$5); + ZEPHIR_CALL_FUNCTION(&_12$$5, "strval", &_8, 50, &_11$$5); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_13$$5); ZEPHIR_CONCAT_SSVS(&_13$$5, "N must be", " greater than 0, ", &_12$$5, " given."); - ZEPHIR_CALL_METHOD(NULL, &_10$$5, "__construct", NULL, 50, &_13$$5); + ZEPHIR_CALL_METHOD(NULL, &_10$$5, "__construct", NULL, 51, &_13$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_10$$5, "stub/issue2165/issue.zep", 78); ZEPHIR_MM_RESTORE(); @@ -533,9 +494,8 @@ PHP_METHOD(Stub_Issue2165_Issue, reciprocal) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_read_property(&_1, this_ptr, ZEND_STRL("m"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_2, this_ptr, ZEND_STRL("n"), PH_NOISY_CC | PH_READONLY); @@ -552,22 +512,15 @@ PHP_METHOD(Stub_Issue2165_Issue, divideMatrix) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(b, stub_issue2165_issue_ce) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &b); - - ZEPHIR_INIT_VAR(&c); array_init(&c); ZEPHIR_RETURN_CALL_SELF("quick", NULL, 0, &c); diff --git a/ext/stub/issue2165/issue.zep.h b/ext/stub/issue2165/issue.zep.h index 350ac1d298..a959a69e69 100644 --- a/ext/stub/issue2165/issue.zep.h +++ b/ext/stub/issue2165/issue.zep.h @@ -12,11 +12,7 @@ PHP_METHOD(Stub_Issue2165_Issue, reciprocal); PHP_METHOD(Stub_Issue2165_Issue, divideMatrix); ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_build, 0, 0, Stub\\Issue2165\\Issue, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, a, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue2165_issue___construct, 0, 0, 1) @@ -25,11 +21,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue2165_issue___construct, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_quick, 0, 0, Stub\\Issue2165\\Issue, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, a, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_ones, 0, 2, Stub\\Issue2165\\Issue, 0) diff --git a/ext/stub/issue663.zep.c b/ext/stub/issue663.zep.c index d4862a44c6..caa6f3f215 100644 --- a/ext/stub/issue663.zep.c +++ b/ext/stub/issue663.zep.c @@ -33,21 +33,14 @@ PHP_METHOD(Stub_Issue663, is_array_assoc) zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_1 = NULL; zval *arr, arr_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(arr) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &arr); - - _0 = !(Z_TYPE_P(arr) == IS_ARRAY); if (!(_0)) { _0 = ZEPHIR_IS_EMPTY(arr); @@ -55,7 +48,7 @@ PHP_METHOD(Stub_Issue663, is_array_assoc) if (_0) { RETURN_MM_BOOL(0); } - ZEPHIR_RETURN_CALL_STATIC("is_array_assoc_internal", &_1, 52, arr); + ZEPHIR_RETURN_CALL_STATIC("is_array_assoc_internal", &_1, 53, arr); zephir_check_call_status(); RETURN_MM(); } @@ -67,22 +60,15 @@ PHP_METHOD(Stub_Issue663, is_array_assoc_internal) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *arr_param = NULL; zval arr; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(arr) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &arr_param); zephir_get_arrval(&arr, arr_param); - - count = zephir_fast_count_int(&arr); _2 = (count - 1); _1 = 0; @@ -113,22 +99,15 @@ PHP_METHOD(Stub_Issue663, is_array_indexed) zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_2 = NULL; zval *arr, arr_sub, _1; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr_sub); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(arr) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &arr); - - _0 = !(Z_TYPE_P(arr) == IS_ARRAY); if (!(_0)) { _0 = ZEPHIR_IS_EMPTY(arr); @@ -136,7 +115,7 @@ PHP_METHOD(Stub_Issue663, is_array_indexed) if (_0) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_STATIC(&_1, "is_array_assoc_internal", &_2, 52, arr); + ZEPHIR_CALL_STATIC(&_1, "is_array_assoc_internal", &_2, 53, arr); zephir_check_call_status(); RETURN_MM_BOOL(!zephir_is_true(&_1)); } diff --git a/ext/stub/issue820.zep.c b/ext/stub/issue820.zep.c deleted file mode 100644 index 473d97dafd..0000000000 --- a/ext/stub/issue820.zep.c +++ /dev/null @@ -1,72 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include "../ext_config.h" -#endif - -#include -#include "../php_ext.h" -#include "../ext.h" - -#include -#include -#include - -#include "kernel/main.h" -#include "kernel/memory.h" -#include "kernel/iterator.h" -#include "kernel/array.h" -#include "kernel/object.h" - - -ZEPHIR_INIT_CLASS(Stub_Issue820) { - - ZEPHIR_REGISTER_CLASS(Stub, Issue820, stub, issue820, stub_issue820_method_entry, 0); - - return SUCCESS; - -} - -/** - * @issue https://github.com/zephir-lang/zephir/issues/820 - */ -PHP_METHOD(Stub_Issue820, iterate) { - - zend_object_iterator *_0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *obj, obj_sub, k, v, arr; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&obj_sub); - ZVAL_UNDEF(&k); - ZVAL_UNDEF(&v); - ZVAL_UNDEF(&arr); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(obj) - ZEND_PARSE_PARAMETERS_END(); - -#endif - - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &obj); - - - - ZEPHIR_INIT_VAR(&arr); - array_init(&arr); - _0 = zephir_get_iterator(obj); - _0->funcs->rewind(_0); - for (;_0->funcs->valid(_0) == SUCCESS && !EG(exception); _0->funcs->move_forward(_0)) { - ZEPHIR_GET_IMKEY(k, _0); - { - ZEPHIR_ITERATOR_COPY(&v, _0); - } - zephir_array_update_zval(&arr, &k, &v, PH_COPY | PH_SEPARATE); - } - zend_iterator_dtor(_0); - RETURN_CCTOR(&arr); - -} - diff --git a/ext/stub/issue820.zep.h b/ext/stub/issue820.zep.h deleted file mode 100644 index 9fa0cbd93d..0000000000 --- a/ext/stub/issue820.zep.h +++ /dev/null @@ -1,15 +0,0 @@ - -extern zend_class_entry *stub_issue820_ce; - -ZEPHIR_INIT_CLASS(Stub_Issue820); - -PHP_METHOD(Stub_Issue820, iterate); - -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue820_iterate, 0, 0, 1) - ZEND_ARG_INFO(0, obj) -ZEND_END_ARG_INFO() - -ZEPHIR_INIT_FUNCS(stub_issue820_method_entry) { - PHP_ME(Stub_Issue820, iterate, arginfo_stub_issue820_iterate, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_FE_END -}; diff --git a/ext/stub/issue887.zep.c b/ext/stub/issue887.zep.c index 1fa818d024..32ae199025 100644 --- a/ext/stub/issue887.zep.c +++ b/ext/stub/issue887.zep.c @@ -35,9 +35,8 @@ PHP_METHOD(Stub_Issue887, __construct) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -52,26 +51,16 @@ PHP_METHOD(Stub_Issue887, add) ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(key) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &key, &value); - - zephir_update_property_array(this_ptr, SL("data"), key, value); } PHP_METHOD(Stub_Issue887, fetch_array) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "data"); } @@ -83,11 +72,10 @@ PHP_METHOD(Stub_Issue887, fetch_object) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC); zephir_convert_to_object(&_0); RETURN_CCTOR(&_0); diff --git a/ext/stub/issue887.zep.h b/ext/stub/issue887.zep.h index e83bdd3431..5bd0aa3da4 100644 --- a/ext/stub/issue887.zep.h +++ b/ext/stub/issue887.zep.h @@ -23,21 +23,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887_fetch_object, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issue887_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue887, __construct, arginfo_stub_issue887___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Issue887, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Issue887, __construct, arginfo_stub_issue887___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Issue887, add, arginfo_stub_issue887_add, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue887, fetch_array, arginfo_stub_issue887_fetch_array, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Issue887, fetch_array, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue887, fetch_object, arginfo_stub_issue887_fetch_object, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Issue887, fetch_object, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Issue887, fetch_array, arginfo_stub_issue887_fetch_array, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Issue887, fetch_object, arginfo_stub_issue887_fetch_object, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/issue914.zep.c b/ext/stub/issue914.zep.c index 8dc74b582e..323c873352 100644 --- a/ext/stub/issue914.zep.c +++ b/ext/stub/issue914.zep.c @@ -28,11 +28,8 @@ PHP_METHOD(Stub_Issue914, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_CALL_PARENT(NULL, stub_issue914_ce, getThis(), "__construct", NULL, 0); zephir_check_call_status(); diff --git a/ext/stub/issue914.zep.h b/ext/stub/issue914.zep.h index 6d7521eca8..312f0d8ed4 100644 --- a/ext/stub/issue914.zep.h +++ b/ext/stub/issue914.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue914___construct, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issue914_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue914, __construct, arginfo_stub_issue914___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Issue914, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Issue914, __construct, arginfo_stub_issue914___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_FE_END }; diff --git a/ext/stub/issues.zep.c b/ext/stub/issues.zep.c index bb99ee8142..b740ee6a3d 100644 --- a/ext/stub/issues.zep.c +++ b/ext/stub/issues.zep.c @@ -31,17 +31,10 @@ PHP_METHOD(Stub_Issues, setAdapter) zval *this_ptr = getThis(); ZVAL_UNDEF(&adapter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(adapter) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &adapter); - - zephir_update_property_zval(this_ptr, ZEND_STRL("adapter"), adapter); } @@ -54,18 +47,12 @@ PHP_METHOD(Stub_Issues, someMethod) ZVAL_UNDEF(&methodName_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(methodName) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &methodName); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("adapter"), PH_NOISY_CC | PH_READONLY); ZEPHIR_RETURN_CALL_METHOD_ZVAL(&_0, methodName, NULL, 0); zephir_check_call_status(); @@ -74,9 +61,6 @@ PHP_METHOD(Stub_Issues, someMethod) PHP_METHOD(Stub_Issues, test) { - zval *this_ptr = getThis(); - - php_printf("%s", "test"); } diff --git a/ext/stub/issues.zep.h b/ext/stub/issues.zep.h index d9cd5f2551..1432b9064b 100644 --- a/ext/stub/issues.zep.h +++ b/ext/stub/issues.zep.h @@ -21,10 +21,6 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issues_method_entry) { PHP_ME(Stub_Issues, setAdapter, arginfo_stub_issues_setadapter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Issues, someMethod, arginfo_stub_issues_somemethod, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issues, test, arginfo_stub_issues_test, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Issues, test, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Issues, test, arginfo_stub_issues_test, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/json.zep.c b/ext/stub/json.zep.c index 61f5139b87..e32e124cb8 100644 --- a/ext/stub/json.zep.c +++ b/ext/stub/json.zep.c @@ -30,12 +30,10 @@ PHP_METHOD(Stub_Json, testEncodeObject) { zval obj; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&obj); zephir_create_array(&obj, 3, 0); @@ -50,13 +48,11 @@ PHP_METHOD(Stub_Json, testEncodeArray) { zval arr, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&arr); zephir_create_array(&arr, 3, 0); @@ -77,14 +73,12 @@ PHP_METHOD(Stub_Json, testEncodeOptions) { zval arr, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&arr); zephir_create_array(&arr, 4, 0); @@ -109,12 +103,10 @@ PHP_METHOD(Stub_Json, testDecodeObject) { zval obj; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&obj); ZVAL_STRING(&obj, "{\"a\":\"hello\",\"b\":\"world\",\"c\":128}"); @@ -126,13 +118,11 @@ PHP_METHOD(Stub_Json, testDecodeObject2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$true, obj; - zval *this_ptr = getThis(); ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&obj); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&obj); ZVAL_STRING(&obj, "{\"a\":\"hello\",\"b\":\"world\",\"c\":128}"); @@ -144,12 +134,10 @@ PHP_METHOD(Stub_Json, testDecodeArray) { zval arr; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&arr); ZVAL_STRING(&arr, "[1,2,3]"); diff --git a/ext/stub/json.zep.h b/ext/stub/json.zep.h index 1b30db4d7e..6c00495d72 100644 --- a/ext/stub/json.zep.h +++ b/ext/stub/json.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_json_testdecodearray, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_json_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testEncodeObject, arginfo_stub_json_testencodeobject, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testEncodeObject, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testEncodeArray, arginfo_stub_json_testencodearray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testEncodeArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testEncodeOptions, arginfo_stub_json_testencodeoptions, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testEncodeOptions, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testDecodeObject, arginfo_stub_json_testdecodeobject, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testDecodeObject, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testDecodeObject2, arginfo_stub_json_testdecodeobject2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testDecodeObject2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testDecodeArray, arginfo_stub_json_testdecodearray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testDecodeArray, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Json, testEncodeObject, arginfo_stub_json_testencodeobject, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testEncodeArray, arginfo_stub_json_testencodearray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testEncodeOptions, arginfo_stub_json_testencodeoptions, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testDecodeObject, arginfo_stub_json_testdecodeobject, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testDecodeObject2, arginfo_stub_json_testdecodeobject2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testDecodeArray, arginfo_stub_json_testdecodearray, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/logical.zep.c b/ext/stub/logical.zep.c index ef408d57bb..20a2a9c38e 100644 --- a/ext/stub/logical.zep.c +++ b/ext/stub/logical.zep.c @@ -32,11 +32,6 @@ ZEPHIR_INIT_CLASS(Stub_Logical) PHP_METHOD(Stub_Logical, testAnd1) { zend_bool _0; - zval *this_ptr = getThis(); - - - - _0 = ((0) ? 1 : 0); if (_0) { _0 = ((0) ? 1 : 0); @@ -47,11 +42,6 @@ PHP_METHOD(Stub_Logical, testAnd1) PHP_METHOD(Stub_Logical, testAnd2) { zend_bool _0; - zval *this_ptr = getThis(); - - - - _0 = ((0) ? 1 : 0); if (_0) { _0 = ((1.5 != 0.0) ? 1 : 0); @@ -62,11 +52,6 @@ PHP_METHOD(Stub_Logical, testAnd2) PHP_METHOD(Stub_Logical, testAnd3) { zend_bool _0, _1; - zval *this_ptr = getThis(); - - - - _0 = ((0) ? 1 : 0); if (_0) { _0 = ((1.5 != 0.0) ? 1 : 0); @@ -81,11 +66,6 @@ PHP_METHOD(Stub_Logical, testAnd3) PHP_METHOD(Stub_Logical, testAnd4) { zend_bool _0, _1; - zval *this_ptr = getThis(); - - - - _0 = ((1) ? 1 : 0); if (_0) { _0 = ((0) ? 1 : 0); @@ -102,23 +82,14 @@ PHP_METHOD(Stub_Logical, testAnd9) zend_bool _0; zend_long b; zval *a, a_sub, *b_param = NULL, _1$$3; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_1$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b_param); - b = zephir_get_intval(b_param); - - _0 = Z_TYPE_P(a) == IS_ARRAY; if (_0) { _0 = zephir_array_isset_long(a, b); @@ -133,11 +104,6 @@ PHP_METHOD(Stub_Logical, testAnd9) PHP_METHOD(Stub_Logical, testOr1) { zend_bool _0; - zval *this_ptr = getThis(); - - - - _0 = ((0) ? 1 : 0); if (!(_0)) { _0 = ((1) ? 1 : 0); @@ -148,11 +114,6 @@ PHP_METHOD(Stub_Logical, testOr1) PHP_METHOD(Stub_Logical, testOr2) { zend_bool _0; - zval *this_ptr = getThis(); - - - - _0 = ((0) ? 1 : 0); if (!(_0)) { _0 = 1; @@ -164,11 +125,6 @@ PHP_METHOD(Stub_Logical, testMixed1) { zend_bool _0, _1; zend_long first = 0, second = 0; - zval *this_ptr = getThis(); - - - - first = 0; second = 1; _0 = ((first) ? 1 : 0); @@ -190,23 +146,15 @@ PHP_METHOD(Stub_Logical, testMixed2) { zend_bool _0, _1; zval *match, match_sub, *minLength, minLength_sub, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&match_sub); ZVAL_UNDEF(&minLength_sub); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(match) Z_PARAM_ZVAL(minLength) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &match, &minLength); - - _0 = Z_TYPE_P(match) == IS_ARRAY; if (_0) { _0 = zephir_fast_count_int(match) == 2; @@ -225,11 +173,6 @@ PHP_METHOD(Stub_Logical, testMixed2) PHP_METHOD(Stub_Logical, testMixed3) { zend_bool a = 0, b = 0, _0, _1, _2, _3; - zval *this_ptr = getThis(); - - - - _0 = ((0) ? 1 : 0); if (_0) { _0 = ((1) ? 1 : 0); @@ -255,22 +198,12 @@ PHP_METHOD(Stub_Logical, testMixed4) { zval *a_param = NULL, *b_param = NULL; zend_bool a, b, _0, _1, _2; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_BOOL(a) Z_PARAM_BOOL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); - a = zephir_get_boolval(a_param); - b = zephir_get_boolval(b_param); - - _0 = !a; if (_0) { _0 = !b; diff --git a/ext/stub/logical.zep.h b/ext/stub/logical.zep.h index 94b84df967..654f6ed011 100644 --- a/ext/stub/logical.zep.h +++ b/ext/stub/logical.zep.h @@ -55,48 +55,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_logical_testmixed4, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_logical_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testAnd1, arginfo_stub_logical_testand1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testAnd1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testAnd2, arginfo_stub_logical_testand2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testAnd2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testAnd3, arginfo_stub_logical_testand3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testAnd3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testAnd4, arginfo_stub_logical_testand4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testAnd4, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Logical, testAnd1, arginfo_stub_logical_testand1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testAnd2, arginfo_stub_logical_testand2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testAnd3, arginfo_stub_logical_testand3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testAnd4, arginfo_stub_logical_testand4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Logical, testAnd9, arginfo_stub_logical_testand9, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testOr1, arginfo_stub_logical_testor1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testOr1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testOr2, arginfo_stub_logical_testor2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testOr2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testMixed1, arginfo_stub_logical_testmixed1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testMixed1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Logical, testOr1, arginfo_stub_logical_testor1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testOr2, arginfo_stub_logical_testor2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testMixed1, arginfo_stub_logical_testmixed1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Logical, testMixed2, arginfo_stub_logical_testmixed2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testMixed3, arginfo_stub_logical_testmixed3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testMixed3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Logical, testMixed3, arginfo_stub_logical_testmixed3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Logical, testMixed4, arginfo_stub_logical_testmixed4, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index 485b8b5164..86661f0dde 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -33,27 +33,18 @@ ZEPHIR_INIT_CLASS(Stub_Mcall) PHP_METHOD(Stub_Mcall, testMethod1) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello public"); } PHP_METHOD(Stub_Mcall, testMethod2) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello protected"); } PHP_METHOD(Stub_Mcall, testMethod3) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello private"); } @@ -61,22 +52,14 @@ PHP_METHOD(Stub_Mcall, testMethod3) PHP_METHOD(Stub_Mcall, testMethod4) { zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - zephir_add_function(return_value, a, b); return; } @@ -84,22 +67,14 @@ PHP_METHOD(Stub_Mcall, testMethod4) PHP_METHOD(Stub_Mcall, testMethod5) { zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - zephir_add_function(return_value, a, b); return; } @@ -107,31 +82,20 @@ PHP_METHOD(Stub_Mcall, testMethod5) PHP_METHOD(Stub_Mcall, testMethod6) { zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - zephir_add_function(return_value, a, b); return; } PHP_METHOD(Stub_Mcall, testMethod7) { - zval *this_ptr = getThis(); - - object_init(return_value); return; @@ -142,10 +106,8 @@ PHP_METHOD(Stub_Mcall, testCall1) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod1", NULL, 0); zephir_check_call_status(); @@ -157,10 +119,8 @@ PHP_METHOD(Stub_Mcall, testCall2) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod2", NULL, 0); zephir_check_call_status(); @@ -172,12 +132,10 @@ PHP_METHOD(Stub_Mcall, testCall3) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 53); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 54); zephir_check_call_status(); RETURN_MM(); } @@ -191,19 +149,13 @@ PHP_METHOD(Stub_Mcall, testCall4) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod4", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); @@ -218,19 +170,13 @@ PHP_METHOD(Stub_Mcall, testCall5) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod5", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); @@ -245,20 +191,14 @@ PHP_METHOD(Stub_Mcall, testCall6) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 54, a, b); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 55, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -275,19 +215,13 @@ PHP_METHOD(Stub_Mcall, testCall7) ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod4", &_1, 0, a, b); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_2, this_ptr, "testmethod4", &_1, 0, a, b); @@ -308,19 +242,13 @@ PHP_METHOD(Stub_Mcall, testCall8) ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod5", &_1, 0, a, b); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_2, this_ptr, "testmethod5", &_1, 0, a, b); @@ -340,20 +268,14 @@ PHP_METHOD(Stub_Mcall, testCall9) ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod6", NULL, 54, a, b); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod6", NULL, 55, a, b); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1, this_ptr, "testmethod5", NULL, 0, a, b); zephir_check_call_status(); @@ -366,10 +288,8 @@ PHP_METHOD(Stub_Mcall, testCall10) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod1", NULL, 0); zephir_check_call_status(); @@ -381,10 +301,8 @@ PHP_METHOD(Stub_Mcall, testCall11) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod2", NULL, 0); zephir_check_call_status(); @@ -396,12 +314,10 @@ PHP_METHOD(Stub_Mcall, testCall12) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 53); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 54); zephir_check_call_status(); RETURN_MM(); } @@ -415,19 +331,13 @@ PHP_METHOD(Stub_Mcall, testCall13) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod4", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); @@ -442,19 +352,13 @@ PHP_METHOD(Stub_Mcall, testCall14) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod5", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); @@ -469,20 +373,14 @@ PHP_METHOD(Stub_Mcall, testCall15) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 54, a, b); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 55, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -496,19 +394,13 @@ PHP_METHOD(Stub_Mcall, testCall16) ZVAL_UNDEF(&c_sub); ZVAL_UNDEF(&d_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(c) Z_PARAM_ZVAL(d) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &c, &d); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod4", NULL, 0, c, d); zephir_check_call_status(); RETURN_MM(); @@ -523,19 +415,13 @@ PHP_METHOD(Stub_Mcall, testCall17) ZVAL_UNDEF(&c_sub); ZVAL_UNDEF(&d_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(c) Z_PARAM_ZVAL(d) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &c, &d); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod4", NULL, 0, c, d); zephir_check_call_status(); RETURN_MM(); @@ -546,12 +432,10 @@ PHP_METHOD(Stub_Mcall, testCall18) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod7", NULL, 55); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod7", NULL, 56); zephir_check_call_status(); RETURN_MM(); } @@ -560,22 +444,12 @@ PHP_METHOD(Stub_Mcall, testMethod19) { zval *a_param = NULL, *b_param = NULL; long a, b; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - RETURN_LONG((a + b)); } @@ -591,20 +465,13 @@ PHP_METHOD(Stub_Mcall, testCall20) ZVAL_UNDEF(&p_sub); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(k) Z_PARAM_ZVAL(p) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &k_param, &p); - k = zephir_get_intval(k_param); - - j = 0; _2 = k; _1 = 1; @@ -632,22 +499,12 @@ PHP_METHOD(Stub_Mcall, testMethod21) { zval *a_param = NULL, *b_param = NULL; long a, b; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - RETURN_LONG((a + b)); } @@ -663,20 +520,13 @@ PHP_METHOD(Stub_Mcall, testCall22) ZVAL_UNDEF(&p_sub); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(k) Z_PARAM_ZVAL(p) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &k_param, &p); - k = zephir_get_intval(k_param); - - j = 0; _2 = k; _1 = 1; @@ -692,7 +542,7 @@ PHP_METHOD(Stub_Mcall, testCall22) _0 = 1; } i = _1; - ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "testmethod21", &_4, 56, p, p); + ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "testmethod21", &_4, 57, p, p); zephir_check_call_status(); j += zephir_get_numberval(&_3$$3); } @@ -705,18 +555,13 @@ PHP_METHOD(Stub_Mcall, optionalRequereString) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *param_param = NULL; zval param; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, ¶m_param); if (UNEXPECTED(Z_TYPE_P(param_param) != IS_STRING && Z_TYPE_P(param_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'param' must be of the type string")); @@ -727,8 +572,6 @@ PHP_METHOD(Stub_Mcall, optionalRequereString) } else { ZEPHIR_INIT_VAR(¶m); } - - RETURN_CTOR(¶m); } @@ -737,19 +580,14 @@ PHP_METHOD(Stub_Mcall, optionalParameterString) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *param_param = NULL; zval param; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, ¶m_param); if (!param_param) { ZEPHIR_INIT_VAR(¶m); @@ -757,8 +595,6 @@ PHP_METHOD(Stub_Mcall, optionalParameterString) } else { zephir_get_strval(¶m, param_param); } - - RETURN_CTOR(¶m); } @@ -767,27 +603,21 @@ PHP_METHOD(Stub_Mcall, optionalParameterStringNull) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *param_param = NULL; zval param; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, ¶m_param); if (!param_param) { ZEPHIR_INIT_VAR(¶m); } else { zephir_get_strval(¶m, param_param); } - - RETURN_CTOR(¶m); } @@ -795,51 +625,35 @@ PHP_METHOD(Stub_Mcall, optionalParameterInt) { zval *param_param = NULL; zend_long param; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_LONG(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶m_param); if (!param_param) { param = 2; } else { - param = zephir_get_intval(param_param); - } - - + } RETURN_LONG(param); } PHP_METHOD(Stub_Mcall, optionalParameterVar) { zval *param = NULL, param_sub, __$null; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶m); if (!param) { param = ¶m_sub; param = &__$null; } - - RETVAL_ZVAL(param, 1, 0); return; } @@ -848,25 +662,16 @@ PHP_METHOD(Stub_Mcall, optionalParameterBoolTrue) { zval *param_param = NULL; zend_bool param; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶m_param); if (!param_param) { param = 1; } else { - param = zephir_get_boolval(param_param); - } - - + } RETURN_BOOL(param); } @@ -874,25 +679,16 @@ PHP_METHOD(Stub_Mcall, optionalParameterBoolFalse) { zval *param_param = NULL; zend_bool param; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶m_param); if (!param_param) { param = 0; } else { - param = zephir_get_boolval(param_param); - } - - + } RETURN_BOOL(param); } @@ -900,17 +696,11 @@ PHP_METHOD(Stub_Mcall, optionalParameterBoolean) { zval *start_param = NULL; zend_bool start; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(start) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, &start_param); if (!start_param) { start = 1; @@ -921,8 +711,6 @@ PHP_METHOD(Stub_Mcall, optionalParameterBoolean) } start = (Z_TYPE_P(start_param) == IS_TRUE); } - - RETURN_BOOL(start); } @@ -930,17 +718,12 @@ PHP_METHOD(Stub_Mcall, optionalParameterBooleanNull) { zval *value_param = NULL; zend_bool value; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL_OR_NULL(value, is_null_true) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, &value_param); if (!value_param) { value = 0; @@ -951,8 +734,6 @@ PHP_METHOD(Stub_Mcall, optionalParameterBooleanNull) } value = (Z_TYPE_P(value_param) == IS_TRUE); } - - RETURN_BOOL(value); } @@ -964,19 +745,14 @@ PHP_METHOD(Stub_Mcall, testArrayParamWithDefaultEmptyArray) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *driverOptions_param = NULL; zval driverOptions; - zval *this_ptr = getThis(); ZVAL_UNDEF(&driverOptions); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(driverOptions) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &driverOptions_param); if (!driverOptions_param) { ZEPHIR_INIT_VAR(&driverOptions); @@ -984,8 +760,6 @@ PHP_METHOD(Stub_Mcall, testArrayParamWithDefaultEmptyArray) } else { zephir_get_arrval(&driverOptions, driverOptions_param); } - - RETURN_CTOR(&driverOptions); } @@ -994,27 +768,21 @@ PHP_METHOD(Stub_Mcall, testArrayParamWithDefaultNullValue) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *driverOptions_param = NULL; zval driverOptions; - zval *this_ptr = getThis(); ZVAL_UNDEF(&driverOptions); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(driverOptions) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &driverOptions_param); if (!driverOptions_param) { ZEPHIR_INIT_VAR(&driverOptions); } else { zephir_get_arrval(&driverOptions, driverOptions_param); } - - RETURN_CTOR(&driverOptions); } @@ -1023,42 +791,27 @@ PHP_METHOD(Stub_Mcall, testArrayParam) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *driverOptions_param = NULL; zval driverOptions; - zval *this_ptr = getThis(); ZVAL_UNDEF(&driverOptions); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(driverOptions) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &driverOptions_param); zephir_get_arrval(&driverOptions, driverOptions_param); - - RETURN_CTOR(&driverOptions); } PHP_METHOD(Stub_Mcall, testObjectParamCastStdClass) { zval *param, param_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(param, zend_standard_class_def) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m); - - RETVAL_ZVAL(param, 1, 0); return; } @@ -1066,29 +819,18 @@ PHP_METHOD(Stub_Mcall, testObjectParamCastStdClass) PHP_METHOD(Stub_Mcall, testObjectParamCastOoParam) { zval *param, param_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(param, stub_oo_param_ce) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m); - - RETVAL_ZVAL(param, 1, 0); return; } PHP_METHOD(Stub_Mcall, bb) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello"); } @@ -1098,13 +840,11 @@ PHP_METHOD(Stub_Mcall, testCallablePass) zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); object_init_ex(&a, stub_oo_ooparams_ce); @@ -1116,7 +856,7 @@ PHP_METHOD(Stub_Mcall, testCallablePass) ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); zephir_create_closure_ex(&_0, NULL, stub_12__closure_ce, SL("__invoke")); - ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 57, &_0); + ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 58, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -1132,9 +872,8 @@ PHP_METHOD(Stub_Mcall, testCallableArrayThisMethodPass) ZVAL_UNDEF(&a); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); object_init_ex(&a, stub_oo_ooparams_ce); @@ -1149,7 +888,7 @@ PHP_METHOD(Stub_Mcall, testCallableArrayThisMethodPass) ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "bb"); zephir_array_fast_append(&_0, &_1); - ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 57, &_0); + ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 58, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -1159,12 +898,10 @@ PHP_METHOD(Stub_Mcall, aa) zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); object_init_ex(&a, stub_mcall_ce); @@ -1173,7 +910,7 @@ PHP_METHOD(Stub_Mcall, aa) zephir_check_call_status(); } - ZEPHIR_RETURN_CALL_METHOD(&a, "bb", NULL, 58); + ZEPHIR_RETURN_CALL_METHOD(&a, "bb", NULL, 59); zephir_check_call_status(); RETURN_MM(); } @@ -1186,16 +923,14 @@ PHP_METHOD(Stub_Mcall, issue1136) zval _finfo, _0, _1, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_finfo); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_GET_CONSTANT(&_0, "PHP_VERSION"); @@ -1203,7 +938,7 @@ PHP_METHOD(Stub_Mcall, issue1136) ZVAL_STRING(&_1, "8.0.0"); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, ">="); - ZEPHIR_CALL_FUNCTION(&_3, "version_compare", NULL, 59, &_0, &_1, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "version_compare", NULL, 60, &_0, &_1, &_2); zephir_check_call_status(); if (zephir_is_true(&_3)) { ZEPHIR_INIT_VAR(&_finfo); @@ -1211,7 +946,7 @@ PHP_METHOD(Stub_Mcall, issue1136) ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); zephir_check_call_status(); } else { - ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 60); + ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 61); zephir_check_call_status(); } RETURN_CCTOR(&_finfo); @@ -1220,26 +955,19 @@ PHP_METHOD(Stub_Mcall, issue1136) PHP_METHOD(Stub_Mcall, issue2245VarArgumentNullable) { zval *param = NULL, param_sub, __$null; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶m); if (!param) { param = ¶m_sub; param = &__$null; } - - RETVAL_ZVAL(param, 1, 0); return; } diff --git a/ext/stub/mcall.zep.h b/ext/stub/mcall.zep.h index d3a376be10..781f28c894 100644 --- a/ext/stub/mcall.zep.h +++ b/ext/stub/mcall.zep.h @@ -213,19 +213,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_optionalparameterbooleannull, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparamwithdefaultemptyarray, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, driverOptions, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparamwithdefaultnullvalue, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, driverOptions, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparam, 0, 0, 1) @@ -233,7 +225,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparam, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testobjectparamcaststdclass, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, param, StdClass, 0) + ZEND_ARG_OBJ_INFO(0, param, stdClass, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testobjectparamcastooparam, 0, 0, 1) @@ -260,71 +252,31 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_issue2245varargumentnullable, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_mcall_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testMethod1, arginfo_stub_mcall_testmethod1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testMethod1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testMethod2, arginfo_stub_mcall_testmethod2, ZEND_ACC_PROTECTED) -#else - PHP_ME(Stub_Mcall, testMethod2, NULL, ZEND_ACC_PROTECTED) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testMethod3, arginfo_stub_mcall_testmethod3, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_Mcall, testMethod3, NULL, ZEND_ACC_PRIVATE) -#endif +PHP_ME(Stub_Mcall, testMethod1, arginfo_stub_mcall_testmethod1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testMethod2, arginfo_stub_mcall_testmethod2, ZEND_ACC_PROTECTED) +PHP_ME(Stub_Mcall, testMethod3, arginfo_stub_mcall_testmethod3, ZEND_ACC_PRIVATE) PHP_ME(Stub_Mcall, testMethod4, arginfo_stub_mcall_testmethod4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testMethod5, arginfo_stub_mcall_testmethod5, ZEND_ACC_PROTECTED) PHP_ME(Stub_Mcall, testMethod6, arginfo_stub_mcall_testmethod6, ZEND_ACC_PRIVATE) PHP_ME(Stub_Mcall, testMethod7, arginfo_stub_mcall_testmethod7, ZEND_ACC_PRIVATE) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall1, arginfo_stub_mcall_testcall1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall2, arginfo_stub_mcall_testcall2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall3, arginfo_stub_mcall_testcall3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Mcall, testCall1, arginfo_stub_mcall_testcall1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCall2, arginfo_stub_mcall_testcall2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCall3, arginfo_stub_mcall_testcall3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall4, arginfo_stub_mcall_testcall4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall5, arginfo_stub_mcall_testcall5, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall6, arginfo_stub_mcall_testcall6, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall7, arginfo_stub_mcall_testcall7, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall8, arginfo_stub_mcall_testcall8, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall9, arginfo_stub_mcall_testcall9, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall10, arginfo_stub_mcall_testcall10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall11, arginfo_stub_mcall_testcall11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall12, arginfo_stub_mcall_testcall12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall12, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Mcall, testCall10, arginfo_stub_mcall_testcall10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCall11, arginfo_stub_mcall_testcall11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCall12, arginfo_stub_mcall_testcall12, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall13, arginfo_stub_mcall_testcall13, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall14, arginfo_stub_mcall_testcall14, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall15, arginfo_stub_mcall_testcall15, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall16, arginfo_stub_mcall_testcall16, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall17, arginfo_stub_mcall_testcall17, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall18, arginfo_stub_mcall_testcall18, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall18, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Mcall, testCall18, arginfo_stub_mcall_testcall18, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testMethod19, arginfo_stub_mcall_testmethod19, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall20, arginfo_stub_mcall_testcall20, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testMethod21, arginfo_stub_mcall_testmethod21, ZEND_ACC_PRIVATE) @@ -343,31 +295,11 @@ ZEPHIR_INIT_FUNCS(stub_mcall_method_entry) { PHP_ME(Stub_Mcall, testArrayParam, arginfo_stub_mcall_testarrayparam, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testObjectParamCastStdClass, arginfo_stub_mcall_testobjectparamcaststdclass, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testObjectParamCastOoParam, arginfo_stub_mcall_testobjectparamcastooparam, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, bb, arginfo_stub_mcall_bb, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_Mcall, bb, NULL, ZEND_ACC_PRIVATE) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCallablePass, arginfo_stub_mcall_testcallablepass, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCallablePass, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCallableArrayThisMethodPass, arginfo_stub_mcall_testcallablearraythismethodpass, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCallableArrayThisMethodPass, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, aa, arginfo_stub_mcall_aa, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, aa, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, issue1136, arginfo_stub_mcall_issue1136, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, issue1136, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Mcall, bb, arginfo_stub_mcall_bb, ZEND_ACC_PRIVATE) +PHP_ME(Stub_Mcall, testCallablePass, arginfo_stub_mcall_testcallablepass, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCallableArrayThisMethodPass, arginfo_stub_mcall_testcallablearraythismethodpass, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, aa, arginfo_stub_mcall_aa, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, issue1136, arginfo_stub_mcall_issue1136, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, issue2245VarArgumentNullable, arginfo_stub_mcall_issue2245varargumentnullable, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/mcall/caller.zep.c b/ext/stub/mcall/caller.zep.c index 34671d4553..a410c8a126 100644 --- a/ext/stub/mcall/caller.zep.c +++ b/ext/stub/mcall/caller.zep.c @@ -29,21 +29,14 @@ PHP_METHOD(Stub_Mcall_Caller, start) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *f, f_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&f_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(f) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &f); - - ZEPHIR_RETURN_CALL_ZVAL_FUNCTION(f, NULL, 0); zephir_check_call_status(); RETURN_MM(); @@ -51,9 +44,6 @@ PHP_METHOD(Stub_Mcall_Caller, start) PHP_METHOD(Stub_Mcall_Caller, perform) { - zval *this_ptr = getThis(); - - RETURN_STRING("Caller:perform"); } diff --git a/ext/stub/mcallchained.zep.c b/ext/stub/mcallchained.zep.c index 19b772a6e5..4013d642fd 100644 --- a/ext/stub/mcallchained.zep.c +++ b/ext/stub/mcallchained.zep.c @@ -31,27 +31,18 @@ ZEPHIR_INIT_CLASS(Stub_McallChained) PHP_METHOD(Stub_McallChained, testMethod1) { zval *this_ptr = getThis(); - - - RETURN_THISW(); } PHP_METHOD(Stub_McallChained, testMethod2) { zval *this_ptr = getThis(); - - - RETURN_THISW(); } PHP_METHOD(Stub_McallChained, testMethod3) { zval *this_ptr = getThis(); - - - RETURN_THISW(); } @@ -63,9 +54,8 @@ PHP_METHOD(Stub_McallChained, testChained1) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod1", NULL, 0); zephir_check_call_status(); @@ -83,9 +73,8 @@ PHP_METHOD(Stub_McallChained, testChained2) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod1", NULL, 0); zephir_check_call_status(); @@ -105,11 +94,10 @@ PHP_METHOD(Stub_McallChained, testChained3) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod3", NULL, 61); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod3", NULL, 62); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1, &_0, "testmethod2", NULL, 0); zephir_check_call_status(); @@ -127,9 +115,8 @@ PHP_METHOD(Stub_McallChained, testChained4) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_update_property_zval(this_ptr, ZEND_STRL("temp"), this_ptr); zephir_read_property(&_0, this_ptr, ZEND_STRL("temp"), PH_NOISY_CC | PH_READONLY); diff --git a/ext/stub/mcallchained.zep.h b/ext/stub/mcallchained.zep.h index f090ac8d60..c538fcafd9 100644 --- a/ext/stub/mcallchained.zep.h +++ b/ext/stub/mcallchained.zep.h @@ -33,40 +33,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcallchained_testchained4, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_mcallchained_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testMethod1, arginfo_stub_mcallchained_testmethod1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testMethod1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testMethod2, arginfo_stub_mcallchained_testmethod2, ZEND_ACC_PROTECTED) -#else - PHP_ME(Stub_McallChained, testMethod2, NULL, ZEND_ACC_PROTECTED) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testMethod3, arginfo_stub_mcallchained_testmethod3, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_McallChained, testMethod3, NULL, ZEND_ACC_PRIVATE) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testChained1, arginfo_stub_mcallchained_testchained1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testChained1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testChained2, arginfo_stub_mcallchained_testchained2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testChained2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testChained3, arginfo_stub_mcallchained_testchained3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testChained3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testChained4, arginfo_stub_mcallchained_testchained4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testChained4, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_McallChained, testMethod1, arginfo_stub_mcallchained_testmethod1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallChained, testMethod2, arginfo_stub_mcallchained_testmethod2, ZEND_ACC_PROTECTED) +PHP_ME(Stub_McallChained, testMethod3, arginfo_stub_mcallchained_testmethod3, ZEND_ACC_PRIVATE) +PHP_ME(Stub_McallChained, testChained1, arginfo_stub_mcallchained_testchained1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallChained, testChained2, arginfo_stub_mcallchained_testchained2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallChained, testChained3, arginfo_stub_mcallchained_testchained3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallChained, testChained4, arginfo_stub_mcallchained_testchained4, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/mcalldynamic.zep.c b/ext/stub/mcalldynamic.zep.c index 44fb317fe3..e950c69837 100644 --- a/ext/stub/mcalldynamic.zep.c +++ b/ext/stub/mcalldynamic.zep.c @@ -31,9 +31,6 @@ ZEPHIR_INIT_CLASS(Stub_McallDynamic) PHP_METHOD(Stub_McallDynamic, testMethod1) { - zval *this_ptr = getThis(); - - RETURN_LONG(1); } @@ -47,9 +44,8 @@ PHP_METHOD(Stub_McallDynamic, testMagicCall1) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_CALL_METHOD(&_0, this_ptr, "method1", NULL, 0); zephir_check_call_status(); @@ -69,19 +65,13 @@ PHP_METHOD(Stub_McallDynamic, __call) ZVAL_UNDEF(&method_sub); ZVAL_UNDEF(&arguments_sub); ZVAL_UNDEF(&realMethod); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(method) Z_PARAM_ZVAL(arguments) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &method, &arguments); - - ZEPHIR_INIT_VAR(&realMethod); ZEPHIR_CONCAT_SV(&realMethod, "test", method); ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, &realMethod, NULL, 0); @@ -94,22 +84,19 @@ PHP_METHOD(Stub_McallDynamic, __call) */ PHP_METHOD(Stub_McallDynamic, testCallAnonymousFunctionWithContext) { - zval result, _1; + zval result, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZVAL_UNDEF(&_0); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_INIT_NVAR(&_1); - zephir_create_closure_ex(&_1, NULL, stub_13__closure_ce, SL("__invoke")); - ZEPHIR_CALL_CE_STATIC(&result, stub_mcall_caller_ce, "start", &_0, 0, &_1); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_INIT_NVAR(&_0); + zephir_create_closure_ex(&_0, NULL, stub_13__closure_ce, SL("__invoke")); + ZEPHIR_CALL_CE_STATIC(&result, stub_mcall_caller_ce, "start", NULL, 0, &_0); zephir_check_call_status(); RETURN_CCTOR(&result); } diff --git a/ext/stub/mcalldynamic.zep.h b/ext/stub/mcalldynamic.zep.h index b0eecbaa09..a8df47f9eb 100644 --- a/ext/stub/mcalldynamic.zep.h +++ b/ext/stub/mcalldynamic.zep.h @@ -23,21 +23,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcalldynamic_testcallanonymousfunctionwithco ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_mcalldynamic_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallDynamic, testMethod1, arginfo_stub_mcalldynamic_testmethod1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallDynamic, testMethod1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallDynamic, testMagicCall1, arginfo_stub_mcalldynamic_testmagiccall1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallDynamic, testMagicCall1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_McallDynamic, testMethod1, arginfo_stub_mcalldynamic_testmethod1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallDynamic, testMagicCall1, arginfo_stub_mcalldynamic_testmagiccall1, ZEND_ACC_PUBLIC) PHP_ME(Stub_McallDynamic, __call, arginfo_stub_mcalldynamic___call, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallDynamic, testCallAnonymousFunctionWithContext, arginfo_stub_mcalldynamic_testcallanonymousfunctionwithcontext, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallDynamic, testCallAnonymousFunctionWithContext, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_McallDynamic, testCallAnonymousFunctionWithContext, arginfo_stub_mcalldynamic_testcallanonymousfunctionwithcontext, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/mcallinternal.zep.c b/ext/stub/mcallinternal.zep.c index 8d9dd305f0..957303df3e 100644 --- a/ext/stub/mcallinternal.zep.c +++ b/ext/stub/mcallinternal.zep.c @@ -34,9 +34,8 @@ void zep_Stub_McallInternal_a(int ht, zend_execute_data *execute_data, zval *ret zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello"); @@ -48,44 +47,26 @@ void zep_Stub_McallInternal_b(int ht, zend_execute_data *execute_data, zval *ret zval *a, a_sub, *b, b_sub; ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - a = a_ext; b = b_ext; - - - } void zep_Stub_McallInternal_c(int ht, zend_execute_data *execute_data, zval *return_value, zval *this_ptr, int return_value_used, zval *a_param_ext, zval *b_param_ext) { zval *a_param = NULL, *b_param = NULL; long a, b; -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - a_param = a_param_ext; b_param = b_param_ext; - - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - RETURN_LONG((a + b)); } @@ -93,12 +74,10 @@ PHP_METHOD(Stub_McallInternal, e) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello"); @@ -114,9 +93,8 @@ PHP_METHOD(Stub_McallInternal, d) zval *this_ptr = getThis(); ZVAL_UNDEF(&_3$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 0; _2 = 1000000; @@ -151,9 +129,8 @@ PHP_METHOD(Stub_McallInternal, f) zval *this_ptr = getThis(); ZVAL_UNDEF(&_3$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 0; _2 = 1000000; @@ -190,9 +167,8 @@ PHP_METHOD(Stub_McallInternal, g) ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); ZVAL_UNDEF(&_5$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 0; _2 = 1000; @@ -223,23 +199,13 @@ void zep_Stub_McallInternal_other(int ht, zend_execute_data *execute_data, zval { zval *a_param = NULL, *b_param = NULL; long a, b; -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - a_param = a_param_ext; b_param = b_param_ext; - - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - RETURN_DOUBLE(zephir_safe_div_long_long(a, b)); } @@ -256,9 +222,8 @@ PHP_METHOD(Stub_McallInternal, callFibonacci) ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); ZVAL_UNDEF(&_5$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); p = (double) (0); i = 0; @@ -280,7 +245,7 @@ PHP_METHOD(Stub_McallInternal, callFibonacci) ZVAL_LONG(&_5$$3, (i + 1)); ZEPHIR_CALL_INTERNAL_METHOD_P2(&_3$$3, this_ptr, zep_Stub_McallInternal_other, &_4$$3, &_5$$3); zephir_check_call_status(); - p += zephir_get_doubleval(&_3$$3); + p += (zephir_get_doubleval(&_3$$3)); } } RETURN_MM_DOUBLE(p); @@ -289,8 +254,6 @@ PHP_METHOD(Stub_McallInternal, callFibonacci) void zep_Stub_McallInternal_test1956(int ht, zend_execute_data *execute_data, zval *return_value, zval *this_ptr, int return_value_used) { - - RETURN_THISW(); } @@ -299,10 +262,8 @@ PHP_METHOD(Stub_McallInternal, issue1956) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_INTERNAL_METHOD_P0(this_ptr, zep_Stub_McallInternal_test1956); zephir_check_call_status(); diff --git a/ext/stub/mcallinternal.zep.h b/ext/stub/mcallinternal.zep.h index 55d3ad272b..2f14cd511e 100644 --- a/ext/stub/mcallinternal.zep.h +++ b/ext/stub/mcallinternal.zep.h @@ -55,26 +55,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_mcallinternal_issue1956, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_mcallinternal_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallInternal, e, arginfo_stub_mcallinternal_e, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallInternal, e, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallInternal, d, arginfo_stub_mcallinternal_d, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallInternal, d, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallInternal, f, arginfo_stub_mcallinternal_f, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallInternal, f, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallInternal, g, arginfo_stub_mcallinternal_g, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallInternal, g, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_McallInternal, e, arginfo_stub_mcallinternal_e, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallInternal, d, arginfo_stub_mcallinternal_d, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallInternal, f, arginfo_stub_mcallinternal_f, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallInternal, g, arginfo_stub_mcallinternal_g, ZEND_ACC_PUBLIC) PHP_ME(Stub_McallInternal, callFibonacci, arginfo_stub_mcallinternal_callfibonacci, ZEND_ACC_PUBLIC) PHP_ME(Stub_McallInternal, issue1956, arginfo_stub_mcallinternal_issue1956, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/methodabstract.zep.c b/ext/stub/methodabstract.zep.c index 6521fc92c8..0655eafb25 100644 --- a/ext/stub/methodabstract.zep.c +++ b/ext/stub/methodabstract.zep.c @@ -30,10 +30,8 @@ PHP_METHOD(Stub_MethodAbstract, testInterfaceMetho) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_CALL_METHOD(NULL, this_ptr, "testmethod", NULL, 0); zephir_check_call_status(); diff --git a/ext/stub/methodabstract.zep.h b/ext/stub/methodabstract.zep.h index 7ce2010185..9dc7a8c2a2 100644 --- a/ext/stub/methodabstract.zep.h +++ b/ext/stub/methodabstract.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_methodabstract_testinterfacemetho, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_methodabstract_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_MethodAbstract, testInterfaceMetho, arginfo_stub_methodabstract_testinterfacemetho, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_MethodAbstract, testInterfaceMetho, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_MethodAbstract, testInterfaceMetho, arginfo_stub_methodabstract_testinterfacemetho, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/methodargs.zep.c b/ext/stub/methodargs.zep.c index ca807e4031..87f8a25efc 100644 --- a/ext/stub/methodargs.zep.c +++ b/ext/stub/methodargs.zep.c @@ -41,17 +41,10 @@ PHP_METHOD(Stub_MethodArgs, setCallable) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - zephir_update_property_zval(this_ptr, ZEND_STRL("a"), a); } @@ -61,17 +54,10 @@ PHP_METHOD(Stub_MethodArgs, setObject) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - zephir_update_property_zval(this_ptr, ZEND_STRL("a"), a); } @@ -81,21 +67,14 @@ PHP_METHOD(Stub_MethodArgs, setCallableStrict) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); if (UNEXPECTED(zephir_is_callable(a) != 1)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'a' must be of the type callable")); RETURN_NULL(); } - - zephir_update_property_zval(this_ptr, ZEND_STRL("a"), a); } @@ -105,21 +84,14 @@ PHP_METHOD(Stub_MethodArgs, setObjectStrict) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); if (UNEXPECTED(Z_TYPE_P(a) != IS_OBJECT)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'a' must be of the type object")); RETURN_NULL(); } - - zephir_update_property_zval(this_ptr, ZEND_STRL("a"), a); } @@ -129,21 +101,14 @@ PHP_METHOD(Stub_MethodArgs, setResourceStrict) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_RESOURCE(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); if (UNEXPECTED(Z_TYPE_P(a) != IS_RESOURCE)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'a' must be of the type resource")); RETURN_NULL(); } - - zephir_update_property_zval(this_ptr, ZEND_STRL("a"), a); } @@ -154,27 +119,20 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalValueWithDefaultStaticConstantAccess) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *method = NULL, method_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&method_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(method) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &method); if (!method) { method = &method_sub; ZEPHIR_INIT_VAR(method); ZVAL_STRING(method, "get"); } - - RETVAL_ZVAL(method, 1, 0); RETURN_MM(); } @@ -188,19 +146,14 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalStringValueWithDefaultStaticConstantAc zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *parameter_param = NULL; zval parameter; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶meter); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, ¶meter_param); if (!parameter_param) { ZEPHIR_INIT_VAR(¶meter); @@ -208,8 +161,6 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalStringValueWithDefaultStaticConstantAc } else { zephir_get_strval(¶meter, parameter_param); } - - RETURN_CTOR(¶meter); } @@ -221,25 +172,17 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalDoubleValueWithDefaultStaticConstantAc { zval *parameter_param = NULL; double parameter; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶meter_param); if (!parameter_param) { parameter = 1.32; } else { parameter = zephir_get_doubleval(parameter_param); } - - RETURN_DOUBLE(parameter); } @@ -251,25 +194,16 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalBoolValueWithDefaultStaticConstantAcce { zval *parameter_param = NULL; zend_bool parameter; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶meter_param); if (!parameter_param) { parameter = 1; } else { - parameter = zephir_get_boolval(parameter_param); - } - - + } RETURN_BOOL(parameter); } @@ -281,25 +215,16 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalIntValueWithDefaultStaticConstantAcces { zval *parameter_param = NULL; zend_long parameter; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_LONG(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, ¶meter_param); if (!parameter_param) { parameter = 12345; } else { - parameter = zephir_get_intval(parameter_param); - } - - + } RETURN_LONG(parameter); } diff --git a/ext/stub/namespaces/classentry.zep.c b/ext/stub/namespaces/classentry.zep.c index 347d7d32ae..06715cbba9 100644 --- a/ext/stub/namespaces/classentry.zep.c +++ b/ext/stub/namespaces/classentry.zep.c @@ -26,20 +26,12 @@ ZEPHIR_INIT_CLASS(Stub_Namespaces_ClassEntry) PHP_METHOD(Stub_Namespaces_ClassEntry, setParam) { zval *param, param_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(param, stub_namespaces_a_b_sub_ce) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m); - - RETVAL_ZVAL(param, 1, 0); return; } @@ -47,20 +39,12 @@ PHP_METHOD(Stub_Namespaces_ClassEntry, setParam) PHP_METHOD(Stub_Namespaces_ClassEntry, setParamImported) { zval *param, param_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(param, stub_namespaces_a_b_sub_ce) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m); - - RETVAL_ZVAL(param, 1, 0); return; } diff --git a/ext/stub/nativearray.zep.c b/ext/stub/nativearray.zep.c index 5b2082a793..8fa90993d9 100644 --- a/ext/stub/nativearray.zep.c +++ b/ext/stub/nativearray.zep.c @@ -34,12 +34,10 @@ PHP_METHOD(Stub_NativeArray, testArray1) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -50,13 +48,11 @@ PHP_METHOD(Stub_NativeArray, testArray2) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -76,13 +72,11 @@ PHP_METHOD(Stub_NativeArray, testArray3) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -102,14 +96,12 @@ PHP_METHOD(Stub_NativeArray, testArray4) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$false, __$true, a; - zval *this_ptr = getThis(); ZVAL_BOOL(&__$false, 0); ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -123,13 +115,11 @@ PHP_METHOD(Stub_NativeArray, testArray5) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -143,13 +133,11 @@ PHP_METHOD(Stub_NativeArray, testArray6) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -170,13 +158,11 @@ PHP_METHOD(Stub_NativeArray, testArray7) zend_long a = 0, b = 0, c = 0; zval d, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&d); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 1; b = 2; @@ -200,13 +186,11 @@ PHP_METHOD(Stub_NativeArray, testArray8) double a = 0, b = 0, c = 0; zval d, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&d); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = (double) (1); b = (double) (2); @@ -230,13 +214,11 @@ PHP_METHOD(Stub_NativeArray, testArray9) zend_bool a = 0, b = 0, c = 0; zval d, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&d); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 1; b = 0; @@ -260,15 +242,13 @@ PHP_METHOD(Stub_NativeArray, testArray10) zval a, b, c; zval d; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&d); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "hello1"); @@ -288,15 +268,13 @@ PHP_METHOD(Stub_NativeArray, testArray11) { zval a, b, c, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -331,15 +309,13 @@ PHP_METHOD(Stub_NativeArray, testArray12) { zval a, b, c, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -365,12 +341,10 @@ PHP_METHOD(Stub_NativeArray, testArray13) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -384,12 +358,10 @@ PHP_METHOD(Stub_NativeArray, testArray14) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -403,14 +375,12 @@ PHP_METHOD(Stub_NativeArray, testArray15) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$true, __$false, a; - zval *this_ptr = getThis(); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -424,12 +394,10 @@ PHP_METHOD(Stub_NativeArray, testArray16) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -443,13 +411,11 @@ PHP_METHOD(Stub_NativeArray, testArray17) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -463,12 +429,10 @@ PHP_METHOD(Stub_NativeArray, testArray18) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -482,14 +446,12 @@ PHP_METHOD(Stub_NativeArray, testArray19) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$true, __$false, a; - zval *this_ptr = getThis(); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -503,12 +465,10 @@ PHP_METHOD(Stub_NativeArray, testArray20) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -522,13 +482,11 @@ PHP_METHOD(Stub_NativeArray, testArray21) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -542,12 +500,10 @@ PHP_METHOD(Stub_NativeArray, testArray22) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -562,13 +518,11 @@ PHP_METHOD(Stub_NativeArray, testArray23) zend_long b = 0; zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); b = 0; ZEPHIR_INIT_VAR(&a); @@ -590,15 +544,13 @@ PHP_METHOD(Stub_NativeArray, testArray24) double b = 0; zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - b = 0.0; + b = (0.0); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); ZEPHIR_INIT_VAR(&_0); @@ -618,13 +570,11 @@ PHP_METHOD(Stub_NativeArray, testArray25) zend_bool b = 0; zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); b = 0; ZEPHIR_INIT_VAR(&a); @@ -645,13 +595,11 @@ PHP_METHOD(Stub_NativeArray, testArray26) { zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_NULL(&b); @@ -668,13 +616,11 @@ PHP_METHOD(Stub_NativeArray, testArray27) zval b; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "hello"); @@ -691,13 +637,11 @@ PHP_METHOD(Stub_NativeArray, testArray28) zval b; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "hello"); @@ -714,12 +658,10 @@ PHP_METHOD(Stub_NativeArray, testArray29) long b = 0; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); b = 1; ZEPHIR_INIT_VAR(&a); @@ -733,13 +675,11 @@ PHP_METHOD(Stub_NativeArray, testArray30) zval b; zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "hello"); @@ -753,14 +693,12 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess1) { zval a, b, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -773,29 +711,29 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess1) ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); zephir_array_fast_append(&a, &_0); - zephir_array_fetch_long(&b, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 245); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch_long(&b, &a, 0, PH_NOISY, "stub/nativearray.zep", 245); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess2) { zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); - zephir_array_fetch_string(&b, &a, SL("a"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 255); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch_string(&b, &a, SL("a"), PH_NOISY, "stub/nativearray.zep", 255); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess3) @@ -803,14 +741,12 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess3) long c = 0; zval a, b, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -824,8 +760,9 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess3) ZVAL_LONG(&_0, 3); zephir_array_fast_append(&a, &_0); c = 0; - zephir_array_fetch_long(&b, &a, c, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 267); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch_long(&b, &a, c, PH_NOISY, "stub/nativearray.zep", 267); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess4) @@ -833,14 +770,12 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess4) zval c; zval a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -849,22 +784,21 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess4) add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); - zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 279); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch(&b, &a, &c, PH_NOISY, "stub/nativearray.zep", 279); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess5) { zval a, b, c; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -873,23 +807,22 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess5) add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); - zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 290); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch(&b, &a, &c, PH_NOISY, "stub/nativearray.zep", 290); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess6) { zval a, b, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -908,15 +841,13 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess1) zval _0; zval a, b, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0); @@ -926,8 +857,9 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess1) add_index_stringl(&_0, 1, SL("b")); zephir_array_update_long(&a, 0, &_0, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_fetch_long(&_1, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 310); - zephir_array_fetch_long(&b, &_1, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 310); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch_long(&b, &_1, 0, PH_NOISY, "stub/nativearray.zep", 310); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess2) @@ -935,16 +867,14 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess2) zval _0; zval a, b, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0); @@ -958,8 +888,9 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess2) zephir_array_fast_append(&_0, &_1); zephir_array_fast_append(&a, &_0); zephir_array_fetch_long(&_2, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 320); - zephir_array_fetch_long(&b, &_2, 1, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 320); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch_long(&b, &_2, 1, PH_NOISY, "stub/nativearray.zep", 320); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess3) @@ -967,7 +898,6 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess3) zval _0, _1; zval a, b, _2, _3, _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); @@ -976,9 +906,8 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess3) ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0); @@ -996,8 +925,9 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess3) zephir_array_fast_append(&a, &_0); zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 330); zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 330); - zephir_array_fetch_long(&b, &_4, 1, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 330); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch_long(&b, &_4, 1, PH_NOISY, "stub/nativearray.zep", 330); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess4) @@ -1005,7 +935,6 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess4) zval _0, _1; zval a, b, _2, _3, _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); @@ -1014,9 +943,8 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess4) ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0); @@ -1034,8 +962,9 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess4) zephir_array_fast_append(&a, &_0); zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 340); zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 340); - zephir_array_fetch_long(&b, &_4, 1, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 340); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch_long(&b, &_4, 1, PH_NOISY, "stub/nativearray.zep", 340); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess5) @@ -1043,7 +972,6 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess5) zval _0, _1; zval a, b, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); @@ -1051,9 +979,8 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess5) ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0); @@ -1067,21 +994,20 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess5) zephir_array_update_string(&a, SL("a"), &_0, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_2, &a, SL("a"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 350); zephir_array_fetch_string(&_3, &_2, SL("b"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 350); - zephir_array_fetch_string(&b, &_3, SL("c"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 350); - RETURN_CTOR(&b); + zephir_memory_observe(&b); + zephir_array_fetch_string(&b, &_3, SL("c"), PH_NOISY, "stub/nativearray.zep", 350); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayUpdate1) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -1105,13 +1031,11 @@ PHP_METHOD(Stub_NativeArray, testArrayUpdate2) zend_long b = 0; zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -1136,14 +1060,12 @@ PHP_METHOD(Stub_NativeArray, testArrayUpdate3) zend_long b = 0; zval a, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -1171,13 +1093,11 @@ PHP_METHOD(Stub_NativeArray, testArrayUpdate4) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -1195,16 +1115,14 @@ PHP_METHOD(Stub_NativeArray, testArrayUpdate5) zval _1, _2, _3; zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 3, 0); @@ -1261,15 +1179,13 @@ PHP_METHOD(Stub_NativeArray, testArrayAppend1) zval _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a, _0; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1309,23 +1225,21 @@ PHP_METHOD(Stub_NativeArray, testArrayAppend2) zval b; zval a, c, g, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&c); ZVAL_UNDEF(&g); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "hello"); ZEPHIR_INIT_VAR(&c); ZVAL_NULL(&c); d = 0; - e = 1.10; + e = (1.10); f = 5; ZEPHIR_INIT_VAR(&g); zephir_create_array(&g, 3, 0); @@ -1359,13 +1273,11 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1377,13 +1289,11 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1395,13 +1305,11 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate3) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1413,13 +1321,11 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate4) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1431,13 +1337,11 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate5) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1449,13 +1353,11 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate6) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1467,14 +1369,12 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate7) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$true, __$false, a; - zval *this_ptr = getThis(); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1487,15 +1387,13 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate8) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$true, __$false, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1509,15 +1407,13 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate9) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$true, __$false, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1531,15 +1427,13 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate10) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$true, __$false, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1553,15 +1447,13 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate11) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a, b, c; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "y"); @@ -1577,16 +1469,14 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate12) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a, b, c, d; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); ZVAL_UNDEF(&c); ZVAL_UNDEF(&d); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&b); ZVAL_STRING(&b, "y"); @@ -1605,7 +1495,6 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate13) zval b, c, d, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$false, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); @@ -1614,9 +1503,8 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayUpdate13) ZVAL_UNDEF(&c); ZVAL_UNDEF(&d); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&d); zephir_create_array(&d, 3, 0); @@ -1646,14 +1534,12 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayAppend1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a, b; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1669,14 +1555,12 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayAppend2) zend_long b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, a; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_UNDEF(&a); ZVAL_UNDEF(&x); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1692,7 +1576,6 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayAppend3) zval _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$null, __$false, a, b, _0, _1, _3; - zval *this_ptr = getThis(); ZVAL_NULL(&__$null); ZVAL_BOOL(&__$false, 0); @@ -1702,9 +1585,8 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayAppend3) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -1736,20 +1618,12 @@ PHP_METHOD(Stub_NativeArray, testMultipleArrayAppend3) PHP_METHOD(Stub_NativeArray, testArrayKeys) { zval *param, param_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m); - - zephir_array_keys(return_value, param); return; } @@ -1758,22 +1632,15 @@ PHP_METHOD(Stub_NativeArray, testImplodeArray) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *param, param_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, ¶m); - - ZEPHIR_INIT_VAR(&_0); zephir_array_keys(&_0, param); zephir_fast_join_str(return_value, SL("|"), &_0); @@ -1787,13 +1654,11 @@ PHP_METHOD(Stub_NativeArray, issue110) { zval byteUnits, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&byteUnits); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&byteUnits); zephir_create_array(&byteUnits, 9, 0); @@ -1817,22 +1682,15 @@ PHP_METHOD(Stub_NativeArray, issue264) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *tokens_param = NULL; zval tokens; - zval *this_ptr = getThis(); ZVAL_UNDEF(&tokens); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(tokens) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &tokens_param); zephir_get_arrval(&tokens, tokens_param); - - RETURN_MM_BOOL(!(zephir_array_isset_long(&tokens, 1))); } @@ -1841,23 +1699,16 @@ PHP_METHOD(Stub_NativeArray, issue743a) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *current743a_param = NULL, _0; zval current743a; - zval *this_ptr = getThis(); ZVAL_UNDEF(¤t743a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(current743a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, ¤t743a_param); zephir_get_arrval(¤t743a, current743a_param); - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "ok"); zephir_array_update_multi(¤t743a, &_0, SL("ls"), 3, 42, SL("str")); @@ -1869,23 +1720,16 @@ PHP_METHOD(Stub_NativeArray, issue743b) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *current_param = NULL, _0; zval current; - zval *this_ptr = getThis(); ZVAL_UNDEF(¤t); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(current) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, ¤t_param); zephir_get_arrval(¤t, current_param); - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "ok"); zephir_array_update_multi(¤t, &_0, SL("sl"), 3, SL("str"), 42); @@ -1897,24 +1741,17 @@ PHP_METHOD(Stub_NativeArray, issue743c) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *current_param = NULL, key, _0; zval current; - zval *this_ptr = getThis(); ZVAL_UNDEF(¤t); ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(current) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, ¤t_param); zephir_get_arrval(¤t, current_param); - - ZEPHIR_INIT_VAR(&key); ZVAL_STRING(&key, "hey"); ZEPHIR_INIT_VAR(&_0); @@ -1933,16 +1770,14 @@ PHP_METHOD(Stub_NativeArray, issue709) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, _1, _2; zephir_fcall_cache_entry *_6 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&c); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); ZVAL_UNDEF(&_5$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); works = 1; _2 = 50; @@ -1968,7 +1803,7 @@ PHP_METHOD(Stub_NativeArray, issue709) ZEPHIR_INIT_NVAR(&_3$$3); ZVAL_LONG(&_3$$3, 2); zephir_array_fast_append(&arr, &_3$$3); - ZEPHIR_CALL_FUNCTION(&_5$$3, "array_rand", &_6, 62, &arr); + ZEPHIR_CALL_FUNCTION(&_5$$3, "array_rand", &_6, 63, &arr); zephir_check_call_status(); zephir_array_fetch(&_4$$3, &arr, &_5$$3, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 626); ZEPHIR_CPY_WRT(&arr, &_4$$3); @@ -1998,21 +1833,15 @@ PHP_METHOD(Stub_NativeArray, Issue1140) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_1$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(prefix) Z_PARAM_STR(baseDir) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &prefix_param, &baseDir_param); zephir_get_strval(&prefix, prefix_param); zephir_get_strval(&baseDir, baseDir_param); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("prefixes"), PH_NOISY_CC | PH_READONLY); if (!(zephir_array_isset(&_0, &prefix))) { ZEPHIR_INIT_VAR(&_1$$3); @@ -2022,7 +1851,7 @@ PHP_METHOD(Stub_NativeArray, Issue1140) zephir_read_property(&_2, this_ptr, ZEND_STRL("prefixes"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch(&_3, &_2, &prefix, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 639); ZEPHIR_MAKE_REF(&_3); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", NULL, 63, &_3, &baseDir); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", NULL, 64, &_3, &baseDir); ZEPHIR_UNREF(&_3); zephir_check_call_status(); RETURN_MM_MEMBER(getThis(), "prefixes"); @@ -2032,13 +1861,11 @@ PHP_METHOD(Stub_NativeArray, Issue1159) { zval myvar, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&myvar); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&myvar); ZVAL_LONG(&myvar, 1); @@ -2057,7 +1884,8 @@ zend_object *zephir_init_properties_Stub_NativeArray(zend_class_entry *class_typ ZVAL_UNDEF(&_1$$3); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); { zval local_this_ptr, *this_ptr = &local_this_ptr; diff --git a/ext/stub/nativearray.zep.h b/ext/stub/nativearray.zep.h index adea753285..7154aee39f 100644 --- a/ext/stub/nativearray.zep.h +++ b/ext/stub/nativearray.zep.h @@ -386,10 +386,6 @@ ZEPHIR_INIT_FUNCS(stub_nativearray_method_entry) { PHP_ME(Stub_NativeArray, issue743c, arginfo_stub_nativearray_issue743c, ZEND_ACC_PUBLIC) PHP_ME(Stub_NativeArray, issue709, arginfo_stub_nativearray_issue709, ZEND_ACC_PUBLIC) PHP_ME(Stub_NativeArray, Issue1140, arginfo_stub_nativearray_issue1140, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_NativeArray, Issue1159, arginfo_stub_nativearray_issue1159, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_NativeArray, Issue1159, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_NativeArray, Issue1159, arginfo_stub_nativearray_issue1159, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo.zep.c b/ext/stub/oo.zep.c index 73d5dc903f..b23305aa5a 100644 --- a/ext/stub/oo.zep.c +++ b/ext/stub/oo.zep.c @@ -33,12 +33,10 @@ PHP_METHOD(Stub_Oo, testInstance1) { zval o; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&o); object_init(&o); @@ -50,16 +48,14 @@ PHP_METHOD(Stub_Oo, testInstance2) zval o; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_ooconstruct_ce); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 64); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -69,12 +65,10 @@ PHP_METHOD(Stub_Oo, testInstance3) zval o; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_oonoconstruct_ce); @@ -91,14 +85,12 @@ PHP_METHOD(Stub_Oo, testInstance4) zval o, a, b; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); ZVAL_UNDEF(&a); ZVAL_UNDEF(&b); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "a"); @@ -106,7 +98,7 @@ PHP_METHOD(Stub_Oo, testInstance4) ZVAL_STRING(&b, "b"); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_ooconstructparams_ce); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &a, &b); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 66, &a, &b); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -116,14 +108,12 @@ PHP_METHOD(Stub_Oo, testInstance5) zval o, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_ooconstructparams_ce); @@ -131,7 +121,7 @@ PHP_METHOD(Stub_Oo, testInstance5) ZVAL_STRING(&_0, "a"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "b"); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 66, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -141,20 +131,18 @@ PHP_METHOD(Stub_Oo, testInstance6) zval o, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_ooconstructparams_ce); ZVAL_LONG(&_0, 1); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 66, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -164,20 +152,18 @@ PHP_METHOD(Stub_Oo, testInstance7) zval o, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_ooconstructparams_ce); ZVAL_BOOL(&_0, 0); ZVAL_BOOL(&_1, 1); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 66, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -187,20 +173,18 @@ PHP_METHOD(Stub_Oo, testInstance8) zval o, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_ooconstructparams_ce); ZVAL_DOUBLE(&_0, 1.2); ZVAL_DOUBLE(&_1, 7.30); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 66, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -210,15 +194,12 @@ PHP_METHOD(Stub_Oo, testInstance9) zval o; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamica_ce, "getnew", &_0, 0); + ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamica_ce, "getnew", NULL, 0); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -228,15 +209,12 @@ PHP_METHOD(Stub_Oo, testInstance10) zval o; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamicb_ce, "getnew", &_0, 0); + ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamicb_ce, "getnew", NULL, 0); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -246,20 +224,18 @@ PHP_METHOD(Stub_Oo, testInstance11) zval o, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_ooconstructparams_ce); ZVAL_LONG(&_0, 1); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 66, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -269,15 +245,12 @@ PHP_METHOD(Stub_Oo, testInstance12) zval o; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&o); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamica_ce, "call1", &_0, 0); + ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamica_ce, "call1", NULL, 0); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -289,7 +262,6 @@ PHP_METHOD(Stub_Oo, createInstancesInLoop) zval className, instance, fqcn, _1, *_2, _3, _4$$3, _6$$3, _7$$3, _8$$4, _10$$4, _11$$4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&className); ZVAL_UNDEF(&instance); @@ -304,9 +276,8 @@ PHP_METHOD(Stub_Oo, createInstancesInLoop) ZVAL_UNDEF(&_11$$4); ZVAL_UNDEF(&result); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&result); array_init(&result); diff --git a/ext/stub/oo.zep.h b/ext/stub/oo.zep.h index 33a50a44b2..e28e6fe0b9 100644 --- a/ext/stub/oo.zep.h +++ b/ext/stub/oo.zep.h @@ -57,66 +57,18 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_createinstancesinloop, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance1, arginfo_stub_oo_testinstance1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance2, arginfo_stub_oo_testinstance2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance3, arginfo_stub_oo_testinstance3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance4, arginfo_stub_oo_testinstance4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance5, arginfo_stub_oo_testinstance5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance6, arginfo_stub_oo_testinstance6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance7, arginfo_stub_oo_testinstance7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance8, arginfo_stub_oo_testinstance8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance9, arginfo_stub_oo_testinstance9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance10, arginfo_stub_oo_testinstance10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance11, arginfo_stub_oo_testinstance11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance12, arginfo_stub_oo_testinstance12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance12, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo, testInstance1, arginfo_stub_oo_testinstance1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance2, arginfo_stub_oo_testinstance2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance3, arginfo_stub_oo_testinstance3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance4, arginfo_stub_oo_testinstance4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance5, arginfo_stub_oo_testinstance5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance6, arginfo_stub_oo_testinstance6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance7, arginfo_stub_oo_testinstance7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance8, arginfo_stub_oo_testinstance8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance9, arginfo_stub_oo_testinstance9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance10, arginfo_stub_oo_testinstance10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance11, arginfo_stub_oo_testinstance11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance12, arginfo_stub_oo_testinstance12, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo, createInstancesInLoop, arginfo_stub_oo_createinstancesinloop, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/abstractclass.zep.h b/ext/stub/oo/abstractclass.zep.h index 137e96b858..44d7936ef4 100644 --- a/ext/stub/oo/abstractclass.zep.h +++ b/ext/stub/oo/abstractclass.zep.h @@ -41,19 +41,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_abstractclass_testabstra ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_abstractclass_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_AbstractClass, testMethodDeclaration, arginfo_stub_oo_abstractclass_testmethoddeclaration, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_AbstractClass, testMethodDeclaration, NULL, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_AbstractClass, testMethodDeclaration, arginfo_stub_oo_abstractclass_testmethoddeclaration, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testMethodDeclarationWithReturnType, arginfo_stub_oo_abstractclass_testmethoddeclarationwithreturntype, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testMethodDeclarationWithParameter, arginfo_stub_oo_abstractclass_testmethoddeclarationwithparameter, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testMethodDeclarationWithParameterAndReturnType, arginfo_stub_oo_abstractclass_testmethoddeclarationwithparameterandreturntype, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclaration, arginfo_stub_oo_abstractclass_testabstractmethoddeclaration, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclaration, NULL, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclaration, arginfo_stub_oo_abstractclass_testabstractmethoddeclaration, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclarationWithReturnType, arginfo_stub_oo_abstractclass_testabstractmethoddeclarationwithreturntype, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclarationWithParameter, arginfo_stub_oo_abstractclass_testabstractmethoddeclarationwithparameter, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclarationWithParameterAndReturnType, arginfo_stub_oo_abstractclass_testabstractmethoddeclarationwithparameterandreturntype, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) diff --git a/ext/stub/oo/abstractstatic.zep.c b/ext/stub/oo/abstractstatic.zep.c index c80a1699f7..af06789809 100644 --- a/ext/stub/oo/abstractstatic.zep.c +++ b/ext/stub/oo/abstractstatic.zep.c @@ -24,9 +24,6 @@ ZEPHIR_INIT_CLASS(Stub_Oo_AbstractStatic) PHP_METHOD(Stub_Oo_AbstractStatic, getCalledClass) { - zval *this_ptr = getThis(); - - zephir_get_called_class(return_value); return; diff --git a/ext/stub/oo/concretestatic.zep.c b/ext/stub/oo/concretestatic.zep.c index dcd1700de9..1ba0c62a8c 100644 --- a/ext/stub/oo/concretestatic.zep.c +++ b/ext/stub/oo/concretestatic.zep.c @@ -26,9 +26,6 @@ ZEPHIR_INIT_CLASS(Stub_Oo_ConcreteStatic) PHP_METHOD(Stub_Oo_ConcreteStatic, parentFunction) { - zval *this_ptr = getThis(); - - RETURN_STRING("ConcreteStatic:parentFunction"); } @@ -37,11 +34,8 @@ PHP_METHOD(Stub_Oo_ConcreteStatic, childFunction) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_SELF("parentfunction", NULL, 0); zephir_check_call_status(); @@ -52,23 +46,16 @@ PHP_METHOD(Stub_Oo_ConcreteStatic, callParentFunction) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_PARENT(stub_oo_concretestatic_ce, getThis(), "getcalledclass", &_0, 0); + ZEPHIR_RETURN_CALL_PARENT(stub_oo_concretestatic_ce, getThis(), "getcalledclass", NULL, 0); zephir_check_call_status(); RETURN_MM(); } PHP_METHOD(Stub_Oo_ConcreteStatic, simpleStaticIntReturn) { - zval *this_ptr = getThis(); - - RETURN_LONG(1337); } diff --git a/ext/stub/oo/concretestatic.zep.h b/ext/stub/oo/concretestatic.zep.h index e2e2f17be8..d1b9de9364 100644 --- a/ext/stub/oo/concretestatic.zep.h +++ b/ext/stub/oo/concretestatic.zep.h @@ -21,16 +21,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_concretestatic_simplesta ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_concretestatic_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConcreteStatic, parentFunction, arginfo_stub_oo_concretestatic_parentfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_ConcreteStatic, parentFunction, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConcreteStatic, childFunction, arginfo_stub_oo_concretestatic_childfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_ConcreteStatic, childFunction, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Oo_ConcreteStatic, parentFunction, arginfo_stub_oo_concretestatic_parentfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Oo_ConcreteStatic, childFunction, arginfo_stub_oo_concretestatic_childfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Oo_ConcreteStatic, callParentFunction, arginfo_stub_oo_concretestatic_callparentfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Oo_ConcreteStatic, simpleStaticIntReturn, arginfo_stub_oo_concretestatic_simplestaticintreturn, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END diff --git a/ext/stub/oo/constantsinterface.zep.c b/ext/stub/oo/constantsinterface.zep.c index 0695e3dfd7..0ea5c92e66 100644 --- a/ext/stub/oo/constantsinterface.zep.c +++ b/ext/stub/oo/constantsinterface.zep.c @@ -29,54 +29,36 @@ ZEPHIR_INIT_CLASS(Stub_Oo_ConstantsInterface) PHP_METHOD(Stub_Oo_ConstantsInterface, testReadInterfaceConstant1) { - zval *this_ptr = getThis(); - - RETURN_NULL(); } PHP_METHOD(Stub_Oo_ConstantsInterface, testReadInterfaceConstant2) { - zval *this_ptr = getThis(); - - RETURN_BOOL(0); } PHP_METHOD(Stub_Oo_ConstantsInterface, testReadInterfaceConstant3) { - zval *this_ptr = getThis(); - - RETURN_BOOL(1); } PHP_METHOD(Stub_Oo_ConstantsInterface, testReadInterfaceConstant4) { - zval *this_ptr = getThis(); - - RETURN_LONG(10); } PHP_METHOD(Stub_Oo_ConstantsInterface, testReadInterfaceConstant5) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(10.25); } PHP_METHOD(Stub_Oo_ConstantsInterface, testReadInterfaceConstant6) { - zval *this_ptr = getThis(); - - RETURN_STRING("test"); } diff --git a/ext/stub/oo/constantsinterface.zep.h b/ext/stub/oo/constantsinterface.zep.h index f6c552dca8..2d8bd3dd36 100644 --- a/ext/stub/oo/constantsinterface.zep.h +++ b/ext/stub/oo/constantsinterface.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_constantsinterface_testreadinterfaceconst ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_constantsinterface_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant1, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant2, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant3, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant4, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant5, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant6, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant1, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant2, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant3, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant4, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant5, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant6, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/deprecatedmethods.zep.c b/ext/stub/oo/deprecatedmethods.zep.c index a7213f1622..299dbf1684 100644 --- a/ext/stub/oo/deprecatedmethods.zep.c +++ b/ext/stub/oo/deprecatedmethods.zep.c @@ -26,9 +26,6 @@ ZEPHIR_INIT_CLASS(Stub_Oo_DeprecatedMethods) PHP_METHOD(Stub_Oo_DeprecatedMethods, publicDeprecated) { - zval *this_ptr = getThis(); - - RETURN_BOOL(1); } @@ -38,21 +35,16 @@ PHP_METHOD(Stub_Oo_DeprecatedMethods, normalMethod) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "privatedeprecated", NULL, 66); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "privatedeprecated", NULL, 67); zephir_check_call_status(); RETURN_MM(); } PHP_METHOD(Stub_Oo_DeprecatedMethods, privateDeprecated) { - zval *this_ptr = getThis(); - - RETURN_BOOL(1); } diff --git a/ext/stub/oo/deprecatedmethods.zep.h b/ext/stub/oo/deprecatedmethods.zep.h index 0ffa7652bc..67fe030525 100644 --- a/ext/stub/oo/deprecatedmethods.zep.h +++ b/ext/stub/oo/deprecatedmethods.zep.h @@ -17,20 +17,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_deprecatedmethods_privatedeprecated, 0, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_deprecatedmethods_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DeprecatedMethods, publicDeprecated, arginfo_stub_oo_deprecatedmethods_publicdeprecated, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) -#else - PHP_ME(Stub_Oo_DeprecatedMethods, publicDeprecated, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DeprecatedMethods, normalMethod, arginfo_stub_oo_deprecatedmethods_normalmethod, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_DeprecatedMethods, normalMethod, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DeprecatedMethods, privateDeprecated, arginfo_stub_oo_deprecatedmethods_privatedeprecated, ZEND_ACC_PRIVATE|ZEND_ACC_DEPRECATED) -#else - PHP_ME(Stub_Oo_DeprecatedMethods, privateDeprecated, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_DEPRECATED) -#endif +PHP_ME(Stub_Oo_DeprecatedMethods, publicDeprecated, arginfo_stub_oo_deprecatedmethods_publicdeprecated, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) +PHP_ME(Stub_Oo_DeprecatedMethods, normalMethod, arginfo_stub_oo_deprecatedmethods_normalmethod, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_DeprecatedMethods, privateDeprecated, arginfo_stub_oo_deprecatedmethods_privatedeprecated, ZEND_ACC_PRIVATE|ZEND_ACC_DEPRECATED) PHP_FE_END }; diff --git a/ext/stub/oo/dynamicprop.zep.c b/ext/stub/oo/dynamicprop.zep.c index cf635b15f1..06980bafee 100644 --- a/ext/stub/oo/dynamicprop.zep.c +++ b/ext/stub/oo/dynamicprop.zep.c @@ -39,15 +39,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyInt) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -58,8 +54,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyInt) } else { ZEPHIR_INIT_VAR(&property); } - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, 10); zephir_update_property_zval_zval(this_ptr, &property, &_0); @@ -75,15 +69,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyBoolTrue) ZVAL_UNDEF(&property); ZVAL_BOOL(&__$true, 1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -94,8 +84,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyBoolTrue) } else { ZEPHIR_INIT_VAR(&property); } - - zephir_update_property_zval_zval(this_ptr, &property, &__$true); ZEPHIR_MM_RESTORE(); } @@ -109,15 +97,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyBoolFalse) ZVAL_UNDEF(&property); ZVAL_BOOL(&__$false, 0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -128,8 +112,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyBoolFalse) } else { ZEPHIR_INIT_VAR(&property); } - - zephir_update_property_zval_zval(this_ptr, &property, &__$false); ZEPHIR_MM_RESTORE(); } @@ -143,15 +125,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyString) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -162,8 +140,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyString) } else { ZEPHIR_INIT_VAR(&property); } - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "string"); zephir_update_property_zval_zval(this_ptr, &property, &_0); @@ -180,15 +156,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyChar) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -199,8 +171,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyChar) } else { ZEPHIR_INIT_VAR(&property); } - - a = 'A'; ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, a); @@ -218,15 +188,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyUChar) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -237,8 +203,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyUChar) } else { ZEPHIR_INIT_VAR(&property); } - - a = 'A'; ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, a); @@ -255,15 +219,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyNull) ZVAL_UNDEF(&property); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -274,8 +234,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyNull) } else { ZEPHIR_INIT_VAR(&property); } - - zephir_update_property_zval_zval(this_ptr, &property, &__$null); ZEPHIR_MM_RESTORE(); } @@ -290,15 +248,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableInt) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -309,8 +263,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableInt) } else { ZEPHIR_INIT_VAR(&property); } - - a = 10; ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, a); @@ -327,15 +279,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableString) ZVAL_UNDEF(&property); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -346,8 +294,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableString) } else { ZEPHIR_INIT_VAR(&property); } - - ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "test"); zephir_update_property_zval_zval(this_ptr, &property, &a); @@ -364,15 +310,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableBoolTrue) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -383,8 +325,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableBoolTrue) } else { ZEPHIR_INIT_VAR(&property); } - - a = 1; ZEPHIR_INIT_VAR(&_0); ZVAL_BOOL(&_0, a); @@ -402,15 +342,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableBoolFalse) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &property_param); if (UNEXPECTED(Z_TYPE_P(property_param) != IS_STRING && Z_TYPE_P(property_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'property' must be of the type string")); @@ -421,8 +357,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableBoolFalse) } else { ZEPHIR_INIT_VAR(&property); } - - a = 0; ZEPHIR_INIT_VAR(&_0); ZVAL_BOOL(&_0, a); @@ -437,9 +371,8 @@ PHP_METHOD(Stub_Oo_DynamicProp, setExistingStringProperty) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "works"); @@ -455,15 +388,11 @@ PHP_METHOD(Stub_Oo_DynamicProp, setExistingStringPropertyString) zval *this_ptr = getThis(); ZVAL_UNDEF(&value); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &value_param); if (UNEXPECTED(Z_TYPE_P(value_param) != IS_STRING && Z_TYPE_P(value_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'value' must be of the type string")); @@ -474,8 +403,6 @@ PHP_METHOD(Stub_Oo_DynamicProp, setExistingStringPropertyString) } else { ZEPHIR_INIT_VAR(&value); } - - zephir_update_property_zval(this_ptr, ZEND_STRL("eproperty"), &value); ZEPHIR_MM_RESTORE(); } @@ -487,9 +414,8 @@ PHP_METHOD(Stub_Oo_DynamicProp, setNonExistingStringProperty) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "works"); diff --git a/ext/stub/oo/dynamicprop.zep.h b/ext/stub/oo/dynamicprop.zep.h index 4daece4bc4..401bde56f3 100644 --- a/ext/stub/oo/dynamicprop.zep.h +++ b/ext/stub/oo/dynamicprop.zep.h @@ -84,16 +84,8 @@ ZEPHIR_INIT_FUNCS(stub_oo_dynamicprop_method_entry) { PHP_ME(Stub_Oo_DynamicProp, setPropertyVariableString, arginfo_stub_oo_dynamicprop_setpropertyvariablestring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_DynamicProp, setPropertyVariableBoolTrue, arginfo_stub_oo_dynamicprop_setpropertyvariablebooltrue, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_DynamicProp, setPropertyVariableBoolFalse, arginfo_stub_oo_dynamicprop_setpropertyvariableboolfalse, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DynamicProp, setExistingStringProperty, arginfo_stub_oo_dynamicprop_setexistingstringproperty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_DynamicProp, setExistingStringProperty, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_DynamicProp, setExistingStringProperty, arginfo_stub_oo_dynamicprop_setexistingstringproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_DynamicProp, setExistingStringPropertyString, arginfo_stub_oo_dynamicprop_setexistingstringpropertystring, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DynamicProp, setNonExistingStringProperty, arginfo_stub_oo_dynamicprop_setnonexistingstringproperty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_DynamicProp, setNonExistingStringProperty, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_DynamicProp, setNonExistingStringProperty, arginfo_stub_oo_dynamicprop_setnonexistingstringproperty, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/extendpdoclass.zep.c b/ext/stub/oo/extendpdoclass.zep.c index 7adbea3715..5989152c0d 100644 --- a/ext/stub/oo/extendpdoclass.zep.c +++ b/ext/stub/oo/extendpdoclass.zep.c @@ -34,7 +34,6 @@ PHP_METHOD(Stub_Oo_ExtendPdoClass, __construct) zend_long ZEPHIR_LAST_CALL_STATUS; zval *dsn_param = NULL, *username_param = NULL, *password_param = NULL, *attrs = NULL, attrs_sub, _1; zval dsn, username, password; - zval *this_ptr = getThis(); ZVAL_UNDEF(&dsn); ZVAL_UNDEF(&username); @@ -42,7 +41,6 @@ PHP_METHOD(Stub_Oo_ExtendPdoClass, __construct) ZVAL_UNDEF(&attrs_sub); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_STR(dsn) @@ -51,10 +49,8 @@ PHP_METHOD(Stub_Oo_ExtendPdoClass, __construct) Z_PARAM_STR_OR_NULL(password) Z_PARAM_ZVAL(attrs) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 3, &dsn_param, &username_param, &password_param, &attrs); zephir_get_strval(&dsn, dsn_param); if (!username_param) { @@ -74,8 +70,6 @@ PHP_METHOD(Stub_Oo_ExtendPdoClass, __construct) } else { ZEPHIR_SEPARATE_PARAM(attrs); } - - ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 1, 0); ZEPHIR_INIT_VAR(&_1); diff --git a/ext/stub/oo/ooconstruct.zep.c b/ext/stub/oo/ooconstruct.zep.c index 39a1b85888..491b25439f 100644 --- a/ext/stub/oo/ooconstruct.zep.c +++ b/ext/stub/oo/ooconstruct.zep.c @@ -27,9 +27,6 @@ ZEPHIR_INIT_CLASS(Stub_Oo_OoConstruct) PHP_METHOD(Stub_Oo_OoConstruct, __construct) { - zval *this_ptr = getThis(); - - } diff --git a/ext/stub/oo/ooconstruct.zep.h b/ext/stub/oo/ooconstruct.zep.h index 8cebd6a463..cf1b3ee82e 100644 --- a/ext/stub/oo/ooconstruct.zep.h +++ b/ext/stub/oo/ooconstruct.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooconstruct___construct, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_ooconstruct_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoConstruct, __construct, arginfo_stub_oo_ooconstruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Oo_OoConstruct, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Oo_OoConstruct, __construct, arginfo_stub_oo_ooconstruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_FE_END }; diff --git a/ext/stub/oo/ooconstructparams.zep.c b/ext/stub/oo/ooconstructparams.zep.c index 439939bb35..7f22d360f3 100644 --- a/ext/stub/oo/ooconstructparams.zep.c +++ b/ext/stub/oo/ooconstructparams.zep.c @@ -35,36 +35,23 @@ PHP_METHOD(Stub_Oo_OoConstructParams, __construct) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - zephir_update_property_zval(this_ptr, ZEND_STRL("a"), a); zephir_update_property_zval(this_ptr, ZEND_STRL("b"), b); } PHP_METHOD(Stub_Oo_OoConstructParams, getA) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "a"); } PHP_METHOD(Stub_Oo_OoConstructParams, getB) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "b"); } diff --git a/ext/stub/oo/ooconstructparams.zep.h b/ext/stub/oo/ooconstructparams.zep.h index 2d97ecad9a..2c9698e7bb 100644 --- a/ext/stub/oo/ooconstructparams.zep.h +++ b/ext/stub/oo/ooconstructparams.zep.h @@ -20,15 +20,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_ooconstructparams_method_entry) { PHP_ME(Stub_Oo_OoConstructParams, __construct, arginfo_stub_oo_ooconstructparams___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoConstructParams, getA, arginfo_stub_oo_ooconstructparams_geta, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoConstructParams, getA, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoConstructParams, getB, arginfo_stub_oo_ooconstructparams_getb, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoConstructParams, getB, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoConstructParams, getA, arginfo_stub_oo_ooconstructparams_geta, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_OoConstructParams, getB, arginfo_stub_oo_ooconstructparams_getb, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/oodestruct.zep.c b/ext/stub/oo/oodestruct.zep.c index 6b1185966f..e20803e54a 100644 --- a/ext/stub/oo/oodestruct.zep.c +++ b/ext/stub/oo/oodestruct.zep.c @@ -69,18 +69,12 @@ ZEPHIR_INIT_CLASS(Stub_Oo_OoDestruct) */ PHP_METHOD(Stub_Oo_OoDestruct, getHeight) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "height"); } PHP_METHOD(Stub_Oo_OoDestruct, getImage) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "image"); } @@ -90,18 +84,12 @@ PHP_METHOD(Stub_Oo_OoDestruct, getImage) */ PHP_METHOD(Stub_Oo_OoDestruct, getMime) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "mime"); } PHP_METHOD(Stub_Oo_OoDestruct, getRealpath) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "realpath"); } @@ -115,9 +103,6 @@ PHP_METHOD(Stub_Oo_OoDestruct, getRealpath) */ PHP_METHOD(Stub_Oo_OoDestruct, getType) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "type"); } @@ -127,9 +112,6 @@ PHP_METHOD(Stub_Oo_OoDestruct, getType) */ PHP_METHOD(Stub_Oo_OoDestruct, getWidth) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "width"); } @@ -184,7 +166,6 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) ZVAL_UNDEF(&_31$$14); ZVAL_UNDEF(&_33$$14); ZVAL_UNDEF(&_34$$14); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_STR(file) @@ -192,10 +173,8 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) Z_PARAM_LONG_OR_NULL(width, is_null_true) Z_PARAM_LONG_OR_NULL(height, is_null_true) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 2, &file_param, &width_param, &height_param); if (UNEXPECTED(Z_TYPE_P(file_param) != IS_STRING && Z_TYPE_P(file_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'file' must be of the type string")); @@ -209,15 +188,11 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) if (!width_param) { width = 0; } else { - width = zephir_get_intval(width_param); - } + } if (!height_param) { height = 0; } else { - height = zephir_get_intval(height_param); - } - - + } zephir_read_static_property_ce(&_0, stub_oo_oodestruct_ce, SL("checked"), PH_NOISY_CC | PH_READONLY); if (!(zephir_is_true(&_0))) { ZEPHIR_CALL_SELF(NULL, "check", NULL, 0); @@ -227,11 +202,11 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) zephir_read_property(&_1, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); if ((zephir_file_exists(&_1) == SUCCESS)) { zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_3$$4, "realpath", NULL, 67, &_2$$4); + ZEPHIR_CALL_FUNCTION(&_3$$4, "realpath", NULL, 68, &_2$$4); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("realpath"), &_3$$4); zephir_read_property(&_4$$4, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&imageinfo, "getimagesize", NULL, 68, &_4$$4); + ZEPHIR_CALL_FUNCTION(&imageinfo, "getimagesize", NULL, 69, &_4$$4); zephir_check_call_status(); if (zephir_is_true(&imageinfo)) { zephir_array_fetch_long(&_5$$5, &imageinfo, 0, PH_NOISY | PH_READONLY, "stub/oo/oodestruct.zep", 62); @@ -349,7 +324,7 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &_37$$13); zephir_read_property(&_35$$13, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 69, &_35$$13, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 70, &_35$$13, &__$true); zephir_check_call_status(); zephir_read_property(&_36$$13, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_BOOL(&_38$$13, 1); @@ -357,13 +332,13 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) zephir_check_call_status(); zephir_read_property(&_38$$13, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("realpath"), &_38$$13); - ZEPHIR_INIT_ZVAL_NREF(_39$$13); + ZVAL_UNDEF(&_39$$13); ZVAL_LONG(&_39$$13, width); zephir_update_property_zval(this_ptr, ZEND_STRL("width"), &_39$$13); - ZEPHIR_INIT_ZVAL_NREF(_39$$13); + ZVAL_UNDEF(&_39$$13); ZVAL_LONG(&_39$$13, height); zephir_update_property_zval(this_ptr, ZEND_STRL("height"), &_39$$13); - ZEPHIR_INIT_ZVAL_NREF(_39$$13); + ZVAL_UNDEF(&_39$$13); ZVAL_LONG(&_39$$13, 3); zephir_update_property_zval(this_ptr, ZEND_STRL("type"), &_39$$13); ZEPHIR_INIT_VAR(&_40$$13); @@ -383,9 +358,8 @@ PHP_METHOD(Stub_Oo_OoDestruct, __destruct) ZVAL_UNDEF(&image); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_read_property(&_0, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&image, &_0); @@ -402,7 +376,6 @@ PHP_METHOD(Stub_Oo_OoDestruct, check) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$true, version, _0, _4, _5, _6, _10, _1$$4, _3$$4, _7$$5, _9$$5; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&version); @@ -415,9 +388,8 @@ PHP_METHOD(Stub_Oo_OoDestruct, check) ZVAL_UNDEF(&_3$$4); ZVAL_UNDEF(&_7$$5); ZVAL_UNDEF(&_9$$5); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_read_static_property_ce(&_0, stub_oo_oodestruct_ce, SL("checked"), PH_NOISY_CC | PH_READONLY); if (zephir_is_true(&_0)) { @@ -446,7 +418,7 @@ PHP_METHOD(Stub_Oo_OoDestruct, check) ZVAL_STRING(&_4, "2.0.1"); ZEPHIR_INIT_VAR(&_5); ZVAL_STRING(&_5, ">="); - ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 59, &version, &_4, &_5); + ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 60, &version, &_4, &_5); zephir_check_call_status(); if (UNEXPECTED(!zephir_is_true(&_6))) { ZEPHIR_INIT_VAR(&_7$$5); @@ -476,7 +448,6 @@ PHP_METHOD(Stub_Oo_OoDestruct, getVersion) zval version, info, matches, _3, _4, _0$$3, _2$$3, _5$$5, _6$$5, _7$$5, _8$$5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&version); ZVAL_UNDEF(&info); @@ -489,9 +460,8 @@ PHP_METHOD(Stub_Oo_OoDestruct, getVersion) ZVAL_UNDEF(&_6$$5); ZVAL_UNDEF(&_7$$5); ZVAL_UNDEF(&_8$$5); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); if (UNEXPECTED(!((zephir_function_exists_ex(ZEND_STRL("gd_info")) == SUCCESS)))) { ZEPHIR_INIT_VAR(&_0$$3); @@ -514,13 +484,13 @@ PHP_METHOD(Stub_Oo_OoDestruct, getVersion) ZVAL_NULL(&version); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "GD_VERSION"); - ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 70, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 71, &_3); zephir_check_call_status(); if (zephir_is_true(&_4)) { ZEPHIR_INIT_NVAR(&version); ZEPHIR_GET_CONSTANT(&version, "GD_VERSION"); } else { - ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 71); + ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 72); zephir_check_call_status(); ZEPHIR_INIT_VAR(&matches); ZVAL_NULL(&matches); diff --git a/ext/stub/oo/oodestruct.zep.h b/ext/stub/oo/oodestruct.zep.h index 478daeadd3..2da8d24122 100644 --- a/ext/stub/oo/oodestruct.zep.h +++ b/ext/stub/oo/oodestruct.zep.h @@ -49,25 +49,13 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_oodestruct_method_entry) { PHP_ME(Stub_Oo_OoDestruct, getHeight, arginfo_stub_oo_oodestruct_getheight, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDestruct, getImage, arginfo_stub_oo_oodestruct_getimage, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDestruct, getImage, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoDestruct, getImage, arginfo_stub_oo_oodestruct_getimage, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoDestruct, getMime, arginfo_stub_oo_oodestruct_getmime, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDestruct, getRealpath, arginfo_stub_oo_oodestruct_getrealpath, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDestruct, getRealpath, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoDestruct, getRealpath, arginfo_stub_oo_oodestruct_getrealpath, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoDestruct, getType, arginfo_stub_oo_oodestruct_gettype, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoDestruct, getWidth, arginfo_stub_oo_oodestruct_getwidth, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoDestruct, __construct, arginfo_stub_oo_oodestruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDestruct, __destruct, arginfo_stub_oo_oodestruct___destruct, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) -#else - PHP_ME(Stub_Oo_OoDestruct, __destruct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) -#endif +PHP_ME(Stub_Oo_OoDestruct, __destruct, arginfo_stub_oo_oodestruct___destruct, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) PHP_ME(Stub_Oo_OoDestruct, check, arginfo_stub_oo_oodestruct_check, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Oo_OoDestruct, getVersion, arginfo_stub_oo_oodestruct_getversion, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END diff --git a/ext/stub/oo/oodynamica.zep.c b/ext/stub/oo/oodynamica.zep.c index 79eb86f615..a1e14d5340 100644 --- a/ext/stub/oo/oodynamica.zep.c +++ b/ext/stub/oo/oodynamica.zep.c @@ -34,14 +34,12 @@ PHP_METHOD(Stub_Oo_OoDynamicA, getNew) zval className, fullClassName, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&className); ZVAL_UNDEF(&fullClassName); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&className); zephir_get_called_class(&className); @@ -65,11 +63,8 @@ PHP_METHOD(Stub_Oo_OoDynamicA, call2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_SELF("getnew", NULL, 0); zephir_check_call_status(); @@ -80,11 +75,8 @@ PHP_METHOD(Stub_Oo_OoDynamicA, call1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_SELF("call2", NULL, 0); zephir_check_call_status(); @@ -93,18 +85,12 @@ PHP_METHOD(Stub_Oo_OoDynamicA, call1) PHP_METHOD(Stub_Oo_OoDynamicA, execute) { - zval *this_ptr = getThis(); - - RETURN_STRING("A"); } PHP_METHOD(Stub_Oo_OoDynamicA, execute2) { - zval *this_ptr = getThis(); - - RETURN_STRING("AA"); } diff --git a/ext/stub/oo/oodynamica.zep.h b/ext/stub/oo/oodynamica.zep.h index c96fa916fb..3c855f9ed9 100644 --- a/ext/stub/oo/oodynamica.zep.h +++ b/ext/stub/oo/oodynamica.zep.h @@ -25,30 +25,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oodynamica_execute2, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_oodynamica_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, getNew, arginfo_stub_oo_oodynamica_getnew, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, getNew, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, call2, arginfo_stub_oo_oodynamica_call2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, call2, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, call1, arginfo_stub_oo_oodynamica_call1, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, call1, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, execute, arginfo_stub_oo_oodynamica_execute, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, execute, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, execute2, arginfo_stub_oo_oodynamica_execute2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, execute2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoDynamicA, getNew, arginfo_stub_oo_oodynamica_getnew, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Oo_OoDynamicA, call2, arginfo_stub_oo_oodynamica_call2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Oo_OoDynamicA, call1, arginfo_stub_oo_oodynamica_call1, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Oo_OoDynamicA, execute, arginfo_stub_oo_oodynamica_execute, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_OoDynamicA, execute2, arginfo_stub_oo_oodynamica_execute2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/oodynamicb.zep.c b/ext/stub/oo/oodynamicb.zep.c index 1c606c8496..e7e8632e45 100644 --- a/ext/stub/oo/oodynamicb.zep.c +++ b/ext/stub/oo/oodynamicb.zep.c @@ -27,18 +27,12 @@ ZEPHIR_INIT_CLASS(Stub_Oo_OoDynamicB) PHP_METHOD(Stub_Oo_OoDynamicB, execute) { - zval *this_ptr = getThis(); - - RETURN_STRING("B"); } PHP_METHOD(Stub_Oo_OoDynamicB, execute2) { - zval *this_ptr = getThis(); - - RETURN_STRING("BB"); } diff --git a/ext/stub/oo/oodynamicb.zep.h b/ext/stub/oo/oodynamicb.zep.h index a003c816de..0a39d3ebe6 100644 --- a/ext/stub/oo/oodynamicb.zep.h +++ b/ext/stub/oo/oodynamicb.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oodynamicb_execute2, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_oodynamicb_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicB, execute, arginfo_stub_oo_oodynamicb_execute, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDynamicB, execute, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicB, execute2, arginfo_stub_oo_oodynamicb_execute2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDynamicB, execute2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoDynamicB, execute, arginfo_stub_oo_oodynamicb_execute, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_OoDynamicB, execute2, arginfo_stub_oo_oodynamicb_execute2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/oonativeimplements.zep.c b/ext/stub/oo/oonativeimplements.zep.c index ca47fe0c27..602484046e 100644 --- a/ext/stub/oo/oonativeimplements.zep.c +++ b/ext/stub/oo/oonativeimplements.zep.c @@ -36,73 +36,46 @@ ZEPHIR_INIT_CLASS(Stub_Oo_OoNativeImplements) PHP_METHOD(Stub_Oo_OoNativeImplements, count) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, current) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, key) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, next) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, rewind) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, valid) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, getInnerIterator) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, getChildren) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, hasChildren) { - zval *this_ptr = getThis(); - - } @@ -110,113 +83,66 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, seek) { zval *position_param = NULL; zend_long position; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &position_param); - position = zephir_get_intval(position_param); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, getIterator) { - zval *this_ptr = getThis(); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, offsetExists) { zval *offset, offset_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &offset); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, offsetGet) { zval *offset, offset_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &offset); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, offsetSet) { zval *offset, offset_sub, *value, value_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(offset) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &offset, &value); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, offsetUnset) { zval *offset, offset_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &offset); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, serialize) { - zval *this_ptr = getThis(); - - } @@ -225,29 +151,19 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, unserialize) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *serialized_param = NULL; zval serialized; - zval *this_ptr = getThis(); ZVAL_UNDEF(&serialized); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(serialized) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &serialized_param); zephir_get_strval(&serialized, serialized_param); - - } PHP_METHOD(Stub_Oo_OoNativeImplements, __serialize) { - zval *this_ptr = getThis(); - - array_init(return_value); return; @@ -258,21 +174,14 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, __unserialize) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *data_param = NULL; zval data; - zval *this_ptr = getThis(); ZVAL_UNDEF(&data); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(data) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &data_param); zephir_get_arrval(&data, data_param); - - } diff --git a/ext/stub/oo/oonativeimplements.zep.h b/ext/stub/oo/oonativeimplements.zep.h index bf1f69343a..dc29ca4604 100644 --- a/ext/stub/oo/oonativeimplements.zep.h +++ b/ext/stub/oo/oonativeimplements.zep.h @@ -26,18 +26,10 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, __unserialize); ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_current, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_current, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_key, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_key, 0, 0, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_next, 0, 0, IS_VOID, 0) @@ -86,15 +78,10 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_serialize, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0) -ZEND_END_ARG_INFO() -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) + + ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/ext/stub/oo/ooparams.zep.c b/ext/stub/oo/ooparams.zep.c index 7f2c6be9ce..367ced1259 100644 --- a/ext/stub/oo/ooparams.zep.c +++ b/ext/stub/oo/ooparams.zep.c @@ -34,11 +34,8 @@ PHP_METHOD(Stub_Oo_OoParams, createThisClassWithoutWriteCurrentNamespace) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); object_init_ex(return_value, stub_oo_ooparams_ce); if (zephir_has_constructor(return_value)) { @@ -53,11 +50,8 @@ PHP_METHOD(Stub_Oo_OoParams, createOtherClassWithoutWriteCurrentNamespace) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); object_init_ex(return_value, stub_oo_oodynamica_ce); if (zephir_has_constructor(return_value)) { @@ -72,20 +66,11 @@ PHP_METHOD(Stub_Oo_OoParams, setAge) { zval *age_param = NULL; zend_long age; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(age) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &age_param); - age = zephir_get_intval(age_param); - - RETURN_LONG(age); } @@ -93,20 +78,12 @@ PHP_METHOD(Stub_Oo_OoParams, setAverage) { zval *average_param = NULL; double average; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(average) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &average_param); average = zephir_get_doubleval(average_param); - - RETURN_DOUBLE(average); } @@ -115,22 +92,15 @@ PHP_METHOD(Stub_Oo_OoParams, setName) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *name_param = NULL; zval name; - zval *this_ptr = getThis(); ZVAL_UNDEF(&name); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(&name, name_param); - - RETURN_CTOR(&name); } @@ -138,20 +108,11 @@ PHP_METHOD(Stub_Oo_OoParams, setEnabled) { zval *enabled_param = NULL; zend_bool enabled; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(enabled) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &enabled_param); - enabled = zephir_get_boolval(enabled_param); - - RETURN_BOOL(enabled); } @@ -160,22 +121,15 @@ PHP_METHOD(Stub_Oo_OoParams, setList) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *someList_param = NULL; zval someList; - zval *this_ptr = getThis(); ZVAL_UNDEF(&someList); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(someList) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &someList_param); zephir_get_arrval(&someList, someList_param); - - RETURN_CTOR(&someList); } @@ -183,24 +137,16 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictAge) { zval *age_param = NULL; zend_long age; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(age) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &age_param); if (UNEXPECTED(Z_TYPE_P(age_param) != IS_LONG)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'age' must be of the type int")); RETURN_NULL(); } age = Z_LVAL_P(age_param); - - RETURN_LONG(age); } @@ -208,24 +154,16 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictAverage) { zval *average_param = NULL; double average; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(average) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &average_param); if (UNEXPECTED(Z_TYPE_P(average_param) != IS_DOUBLE)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'average' must be of the type double")); RETURN_NULL(); } average = Z_DVAL_P(average_param); - - RETURN_DOUBLE(average); } @@ -237,9 +175,8 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictNameFromZephirLand) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 12345); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "setstrictname", NULL, 0, &_0); @@ -252,18 +189,13 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictName) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *name_param = NULL; zval name; - zval *this_ptr = getThis(); ZVAL_UNDEF(&name); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &name_param); if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); @@ -274,8 +206,6 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictName) } else { ZEPHIR_INIT_VAR(&name); } - - RETURN_CTOR(&name); } @@ -283,20 +213,11 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictEnabled) { zval *enabled_param = NULL; zend_bool enabled; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(enabled) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &enabled_param); - enabled = zephir_get_boolval(enabled_param); - - RETURN_BOOL(enabled); } @@ -305,22 +226,15 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictList) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *someList_param = NULL; zval someList; - zval *this_ptr = getThis(); ZVAL_UNDEF(&someList); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(someList) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &someList_param); ZEPHIR_OBS_COPY_OR_DUP(&someList, someList_param); - - RETURN_CTOR(&someList); } @@ -328,25 +242,16 @@ PHP_METHOD(Stub_Oo_OoParams, setAgeDefault) { zval *age_param = NULL; zend_long age; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_LONG(age) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, &age_param); if (!age_param) { age = 25; } else { - age = zephir_get_intval(age_param); - } - - + } RETURN_LONG(age); } @@ -354,25 +259,17 @@ PHP_METHOD(Stub_Oo_OoParams, setAverageDefault) { zval *average_param = NULL; double average; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(average) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, &average_param); if (!average_param) { average = (double) 25; } else { average = zephir_get_doubleval(average_param); } - - RETURN_DOUBLE(average); } @@ -381,19 +278,14 @@ PHP_METHOD(Stub_Oo_OoParams, setNameDefault) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *name_param = NULL; zval name; - zval *this_ptr = getThis(); ZVAL_UNDEF(&name); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &name_param); if (!name_param) { ZEPHIR_INIT_VAR(&name); @@ -401,8 +293,6 @@ PHP_METHOD(Stub_Oo_OoParams, setNameDefault) } else { zephir_get_strval(&name, name_param); } - - RETURN_CTOR(&name); } @@ -410,25 +300,16 @@ PHP_METHOD(Stub_Oo_OoParams, setEnabledDefault) { zval *enabled_param = NULL; zend_bool enabled; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(enabled) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, &enabled_param); if (!enabled_param) { enabled = 0; } else { - enabled = zephir_get_boolval(enabled_param); - } - - + } RETURN_BOOL(enabled); } @@ -437,19 +318,14 @@ PHP_METHOD(Stub_Oo_OoParams, setListDefault) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *someList_param = NULL; zval someList; - zval *this_ptr = getThis(); ZVAL_UNDEF(&someList); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(someList) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &someList_param); if (!someList_param) { ZEPHIR_INIT_VAR(&someList); @@ -457,8 +333,6 @@ PHP_METHOD(Stub_Oo_OoParams, setListDefault) } else { zephir_get_arrval(&someList, someList_param); } - - RETURN_CTOR(&someList); } @@ -466,20 +340,11 @@ PHP_METHOD(Stub_Oo_OoParams, setConstAge) { zval *age_param = NULL; zend_long age; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(age) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &age_param); - age = zephir_get_intval(age_param); - - RETURN_LONG(age); } @@ -487,40 +352,24 @@ PHP_METHOD(Stub_Oo_OoParams, setConstAverage) { zval *average_param = NULL; double average; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(average) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &average_param); average = zephir_get_doubleval(average_param); - - RETURN_DOUBLE(average); } PHP_METHOD(Stub_Oo_OoParams, setObject) { zval *obj, obj_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT(obj) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &obj); - - RETVAL_ZVAL(obj, 1, 0); return; } @@ -528,20 +377,12 @@ PHP_METHOD(Stub_Oo_OoParams, setObject) PHP_METHOD(Stub_Oo_OoParams, setCallable) { zval *obj, obj_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(obj) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &obj); - - RETVAL_ZVAL(obj, 1, 0); return; } @@ -549,20 +390,12 @@ PHP_METHOD(Stub_Oo_OoParams, setCallable) PHP_METHOD(Stub_Oo_OoParams, setResource) { zval *obj, obj_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_RESOURCE(obj) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &obj); - - RETVAL_ZVAL(obj, 1, 0); return; } @@ -570,21 +403,70 @@ PHP_METHOD(Stub_Oo_OoParams, setResource) PHP_METHOD(Stub_Oo_OoParams, setObjectClassCast) { zval *parameter, parameter_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶meter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(parameter, stub_oo_param_ce) ZEND_PARSE_PARAMETERS_END(); -#endif + zephir_fetch_params_without_memory_grow(1, 0, ¶meter); + RETVAL_ZVAL(parameter, 1, 0); + return; +} +PHP_METHOD(Stub_Oo_OoParams, getDefaultParamValue) +{ + zval *i_param = NULL; + zend_long i; - zephir_fetch_params_without_memory_grow(1, 0, ¶meter); + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(i) + ZEND_PARSE_PARAMETERS_END(); + zephir_fetch_params_without_memory_grow(0, 1, &i_param); + if (!i_param) { + i = 0; + } else { + } + RETURN_LONG(i); +} +PHP_METHOD(Stub_Oo_OoParams, getDefaultParamValue1) +{ + zval *i_param = NULL; + zend_long i; - RETVAL_ZVAL(parameter, 1, 0); - return; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(i) + ZEND_PARSE_PARAMETERS_END(); + zephir_fetch_params_without_memory_grow(0, 1, &i_param); + if (!i_param) { + i = 1; + } else { + } + RETURN_LONG(i); +} + +PHP_METHOD(Stub_Oo_OoParams, getDefaultParamValueStr) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *str_param = NULL; + zval str; + + ZVAL_UNDEF(&str); + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR(str) + ZEND_PARSE_PARAMETERS_END(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); + zephir_fetch_params(1, 0, 1, &str_param); + if (!str_param) { + ZEPHIR_INIT_VAR(&str); + ZVAL_STRING(&str, "default"); + } else { + zephir_get_strval(&str, str_param); + } + RETURN_CTOR(&str); } diff --git a/ext/stub/oo/ooparams.zep.h b/ext/stub/oo/ooparams.zep.h index 61d77c2103..2b0da8b11e 100644 --- a/ext/stub/oo/ooparams.zep.h +++ b/ext/stub/oo/ooparams.zep.h @@ -27,6 +27,9 @@ PHP_METHOD(Stub_Oo_OoParams, setObject); PHP_METHOD(Stub_Oo_OoParams, setCallable); PHP_METHOD(Stub_Oo_OoParams, setResource); PHP_METHOD(Stub_Oo_OoParams, setObjectClassCast); +PHP_METHOD(Stub_Oo_OoParams, getDefaultParamValue); +PHP_METHOD(Stub_Oo_OoParams, getDefaultParamValue1); +PHP_METHOD(Stub_Oo_OoParams, getDefaultParamValueStr); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_createthisclasswithoutwritecurrentnamespace, 0, 0, 0) ZEND_END_ARG_INFO() @@ -94,11 +97,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setenableddefault, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setlistdefault, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someList, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, someList, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someList, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setconstage, 0, 0, 1) @@ -125,17 +124,21 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setobjectclasscast, 0, 0, 1) ZEND_ARG_OBJ_INFO(0, parameter, Stub\\Oo\\Param, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_getdefaultparamvalue, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, i, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_getdefaultparamvalue1, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, i, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_getdefaultparamvaluestr, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_oo_ooparams_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoParams, createThisClassWithoutWriteCurrentNamespace, arginfo_stub_oo_ooparams_createthisclasswithoutwritecurrentnamespace, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoParams, createThisClassWithoutWriteCurrentNamespace, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoParams, createOtherClassWithoutWriteCurrentNamespace, arginfo_stub_oo_ooparams_createotherclasswithoutwritecurrentnamespace, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoParams, createOtherClassWithoutWriteCurrentNamespace, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoParams, createThisClassWithoutWriteCurrentNamespace, arginfo_stub_oo_ooparams_createthisclasswithoutwritecurrentnamespace, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_OoParams, createOtherClassWithoutWriteCurrentNamespace, arginfo_stub_oo_ooparams_createotherclasswithoutwritecurrentnamespace, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setAge, arginfo_stub_oo_ooparams_setage, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setAverage, arginfo_stub_oo_ooparams_setaverage, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setName, arginfo_stub_oo_ooparams_setname, ZEND_ACC_PUBLIC) @@ -143,11 +146,7 @@ ZEPHIR_INIT_FUNCS(stub_oo_ooparams_method_entry) { PHP_ME(Stub_Oo_OoParams, setList, arginfo_stub_oo_ooparams_setlist, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictAge, arginfo_stub_oo_ooparams_setstrictage, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictAverage, arginfo_stub_oo_ooparams_setstrictaverage, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoParams, setStrictNameFromZephirLand, arginfo_stub_oo_ooparams_setstrictnamefromzephirland, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoParams, setStrictNameFromZephirLand, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoParams, setStrictNameFromZephirLand, arginfo_stub_oo_ooparams_setstrictnamefromzephirland, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictName, arginfo_stub_oo_ooparams_setstrictname, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictEnabled, arginfo_stub_oo_ooparams_setstrictenabled, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictList, arginfo_stub_oo_ooparams_setstrictlist, ZEND_ACC_PUBLIC) @@ -162,5 +161,8 @@ ZEPHIR_INIT_FUNCS(stub_oo_ooparams_method_entry) { PHP_ME(Stub_Oo_OoParams, setCallable, arginfo_stub_oo_ooparams_setcallable, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setResource, arginfo_stub_oo_ooparams_setresource, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setObjectClassCast, arginfo_stub_oo_ooparams_setobjectclasscast, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Oo_OoParams, getDefaultParamValue, arginfo_stub_oo_ooparams_getdefaultparamvalue, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Oo_OoParams, getDefaultParamValue1, arginfo_stub_oo_ooparams_getdefaultparamvalue1, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Oo_OoParams, getDefaultParamValueStr, arginfo_stub_oo_ooparams_getdefaultparamvaluestr, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/propertyaccess.zep.c b/ext/stub/oo/propertyaccess.zep.c index acbbd1e0b0..9df13a7228 100644 --- a/ext/stub/oo/propertyaccess.zep.c +++ b/ext/stub/oo/propertyaccess.zep.c @@ -47,9 +47,8 @@ PHP_METHOD(Stub_Oo_PropertyAccess, __construct) ZVAL_UNDEF(&_10); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_6); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&test); object_init(&test); @@ -80,7 +79,7 @@ PHP_METHOD(Stub_Oo_PropertyAccess, __construct) ZEPHIR_INIT_VAR(&_6); zephir_create_array(&_6, 4, 0); zephir_read_property(&_7, &test, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&_8); + zephir_memory_observe(&_8); zephir_array_fetch_long(&_8, &_7, 1, PH_NOISY, "stub/oo/propertyaccess.zep", 19); zephir_array_fast_append(&_6, &_8); ZEPHIR_INIT_NVAR(&_1); @@ -97,7 +96,8 @@ PHP_METHOD(Stub_Oo_PropertyAccess, __construct) zephir_read_property(&_9, this_ptr, ZEND_STRL("a"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_10, &_9, ZEND_STRL("test2"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("b"), &_10); - zephir_read_property(&test1, this_ptr, ZEND_STRL("a"), PH_NOISY_CC | PH_READONLY); + zephir_memory_observe(&test1); + zephir_read_property(&test1, this_ptr, ZEND_STRL("a"), PH_NOISY_CC); ZEPHIR_MM_RESTORE(); } @@ -110,17 +110,10 @@ PHP_METHOD(Stub_Oo_PropertyAccess, setPrivatevariable) zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &value); - - zephir_update_property_zval(this_ptr, ZEND_STRL("privateVariable"), value); RETURN_THISW(); } @@ -130,9 +123,6 @@ PHP_METHOD(Stub_Oo_PropertyAccess, setPrivatevariable) */ PHP_METHOD(Stub_Oo_PropertyAccess, getPrivatevariable) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "privateVariable"); } diff --git a/ext/stub/oo/propertyaccess.zep.h b/ext/stub/oo/propertyaccess.zep.h index 396ffb1c75..24b7119d1b 100644 --- a/ext/stub/oo/propertyaccess.zep.h +++ b/ext/stub/oo/propertyaccess.zep.h @@ -18,16 +18,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_propertyaccess_getprivatevariable, 0, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_propertyaccess_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_PropertyAccess, __construct, arginfo_stub_oo_propertyaccess___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Oo_PropertyAccess, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Oo_PropertyAccess, __construct, arginfo_stub_oo_propertyaccess___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Oo_PropertyAccess, setPrivatevariable, arginfo_stub_oo_propertyaccess_setprivatevariable, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_PropertyAccess, getPrivatevariable, arginfo_stub_oo_propertyaccess_getprivatevariable, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_PropertyAccess, getPrivatevariable, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_PropertyAccess, getPrivatevariable, arginfo_stub_oo_propertyaccess_getprivatevariable, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/scopes/abstractclass.zep.c b/ext/stub/oo/scopes/abstractclass.zep.c index db0a61fafa..e1dda42688 100644 --- a/ext/stub/oo/scopes/abstractclass.zep.c +++ b/ext/stub/oo/scopes/abstractclass.zep.c @@ -35,38 +35,26 @@ PHP_METHOD(Stub_Oo_Scopes_AbstractClass, setProperty) ZVAL_UNDEF(&name); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(name) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &name_param, &value); zephir_get_strval(&name, name_param); - - zephir_update_property_zval_zval(this_ptr, &name, value); RETURN_THIS(); } PHP_METHOD(Stub_Oo_Scopes_AbstractClass, getPrivateProperty2) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "privateProperty2"); } PHP_METHOD(Stub_Oo_Scopes_AbstractClass, getProtectedProperty2) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "protectedProperty2"); } diff --git a/ext/stub/oo/scopes/abstractclass.zep.h b/ext/stub/oo/scopes/abstractclass.zep.h index 37f2604910..53459bd219 100644 --- a/ext/stub/oo/scopes/abstractclass.zep.h +++ b/ext/stub/oo/scopes/abstractclass.zep.h @@ -20,15 +20,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_scopes_abstractclass_method_entry) { PHP_ME(Stub_Oo_Scopes_AbstractClass, setProperty, arginfo_stub_oo_scopes_abstractclass_setproperty, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_Scopes_AbstractClass, getPrivateProperty2, arginfo_stub_oo_scopes_abstractclass_getprivateproperty2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_Scopes_AbstractClass, getPrivateProperty2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_Scopes_AbstractClass, getProtectedProperty2, arginfo_stub_oo_scopes_abstractclass_getprotectedproperty2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_Scopes_AbstractClass, getProtectedProperty2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_Scopes_AbstractClass, getPrivateProperty2, arginfo_stub_oo_scopes_abstractclass_getprivateproperty2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_Scopes_AbstractClass, getProtectedProperty2, arginfo_stub_oo_scopes_abstractclass_getprotectedproperty2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/scopes/abstractclassmagic.zep.c b/ext/stub/oo/scopes/abstractclassmagic.zep.c index 384bf61af4..887fcafcbd 100644 --- a/ext/stub/oo/scopes/abstractclassmagic.zep.c +++ b/ext/stub/oo/scopes/abstractclassmagic.zep.c @@ -39,23 +39,17 @@ PHP_METHOD(Stub_Oo_Scopes_AbstractClassMagic, __set) ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(name) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &name_param, &value); zephir_get_strval(&name, name_param); - - zephir_update_property_zval_zval(this_ptr, &name, value); zephir_read_property(&_0, this_ptr, ZEND_STRL("setCount"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_ZVAL_NREF(_1); + ZVAL_UNDEF(&_1); ZVAL_LONG(&_1, (zephir_get_numberval(&_0) + 1)); zephir_update_property_zval(this_ptr, ZEND_STRL("setCount"), &_1); ZEPHIR_MM_RESTORE(); @@ -70,20 +64,14 @@ PHP_METHOD(Stub_Oo_Scopes_AbstractClassMagic, __get) ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(&name, name_param); - - - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_property_zval(&_0, this_ptr, &name, PH_NOISY_CC); RETURN_CCTOR(&_0); } diff --git a/ext/stub/oo/scopes/hasprivatemethod.zep.c b/ext/stub/oo/scopes/hasprivatemethod.zep.c index 66f1ba723c..f24a21cc92 100644 --- a/ext/stub/oo/scopes/hasprivatemethod.zep.c +++ b/ext/stub/oo/scopes/hasprivatemethod.zep.c @@ -29,10 +29,8 @@ PHP_METHOD(Stub_Oo_Scopes_HasPrivateMethod, callPrivateMethod) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "isprivate", NULL, 1); zephir_check_call_status(); @@ -41,9 +39,6 @@ PHP_METHOD(Stub_Oo_Scopes_HasPrivateMethod, callPrivateMethod) PHP_METHOD(Stub_Oo_Scopes_HasPrivateMethod, isPrivate) { - zval *this_ptr = getThis(); - - RETURN_STRING("isPrivate"); } diff --git a/ext/stub/oo/scopes/privatescopetester.zep.c b/ext/stub/oo/scopes/privatescopetester.zep.c index f442dc765f..68baa73b4b 100644 --- a/ext/stub/oo/scopes/privatescopetester.zep.c +++ b/ext/stub/oo/scopes/privatescopetester.zep.c @@ -31,10 +31,8 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, run) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "callprivatemethod", NULL, 0); zephir_check_call_status(); @@ -49,30 +47,23 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, setPropertyObj) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval property; zval *obj, obj_sub, *property_param = NULL, *value, value_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&property); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(obj) Z_PARAM_STR(property) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 3, 0, &obj, &property_param, &value); ZEPHIR_SEPARATE_PARAM(obj); zephir_get_strval(&property, property_param); - - zephir_update_property_zval_zval(obj, &property, value); - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_property_zval(&_0, obj, &property, PH_NOISY_CC); RETURN_CCTOR(&_0); } @@ -86,28 +77,21 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, setPropertyNew) zend_long ZEPHIR_LAST_CALL_STATUS; zval *className_param = NULL, *property_param = NULL, *value, value_sub, obj; zval className, property; - zval *this_ptr = getThis(); ZVAL_UNDEF(&className); ZVAL_UNDEF(&property); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&obj); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_STR(className) Z_PARAM_STR(property) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 3, 0, &className_param, &property_param, &value); zephir_get_strval(&className, className_param); zephir_get_strval(&property, property_param); - - ZEPHIR_INIT_VAR(&obj); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&obj, &className); zephir_check_call_status(); @@ -123,22 +107,15 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, getObjVars) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *obj, obj_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(obj) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &obj); - - - ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 72, obj); + ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 73, obj); zephir_check_call_status(); RETURN_MM(); } @@ -156,19 +133,13 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, getNewVars) ZVAL_UNDEF(&className); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(className) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &className_param); zephir_get_strval(&className, className_param); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&_0, &className); zephir_check_call_status(); diff --git a/ext/stub/openssl.zep.c b/ext/stub/openssl.zep.c new file mode 100644 index 0000000000..1212cde035 --- /dev/null +++ b/ext/stub/openssl.zep.c @@ -0,0 +1,121 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/fcall.h" +#include "kernel/operators.h" +#include "kernel/memory.h" +#include "kernel/object.h" +#include "kernel/array.h" + + +ZEPHIR_INIT_CLASS(Stub_Openssl) +{ + ZEPHIR_REGISTER_CLASS(Stub, Openssl, stub, openssl, stub_openssl_method_entry, 0); + + return SUCCESS; +} + +PHP_METHOD(Stub_Openssl, randomPseudoBytes) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *length_param = NULL, _0; + zend_long length, ZEPHIR_LAST_CALL_STATUS; + + ZVAL_UNDEF(&_0); + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(length) + ZEND_PARSE_PARAMETERS_END(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); + zephir_fetch_params(1, 1, 0, &length_param); + ZVAL_LONG(&_0, length); + ZEPHIR_RETURN_CALL_FUNCTION("openssl_random_pseudo_bytes", NULL, 74, &_0); + zephir_check_call_status(); + RETURN_MM(); +} + +PHP_METHOD(Stub_Openssl, randomPseudoBytesLoop) +{ + zend_bool _0; + zval arr, i, _3$$3, _4$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, _1, _2; + zephir_fcall_cache_entry *_5 = NULL; + + ZVAL_UNDEF(&arr); + ZVAL_UNDEF(&i); + ZVAL_UNDEF(&_3$$3); + ZVAL_UNDEF(&_4$$3); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); + + ZEPHIR_INIT_VAR(&i); + ZVAL_LONG(&i, 0); + ZEPHIR_INIT_VAR(&arr); + array_init(&arr); + _2 = 10; + _1 = 1; + _0 = 0; + if (_1 <= _2) { + while (1) { + if (_0) { + _1++; + if (!(_1 <= _2)) { + break; + } + } else { + _0 = 1; + } + ZEPHIR_INIT_NVAR(&i); + ZVAL_LONG(&i, _1); + ZVAL_LONG(&_3$$3, 10); + ZEPHIR_CALL_FUNCTION(&_4$$3, "openssl_random_pseudo_bytes", &_5, 74, &_3$$3); + zephir_check_call_status(); + zephir_array_append(&arr, &_4$$3, PH_SEPARATE, "stub/openssl.zep", 16); + } + } + RETURN_CCTOR(&arr); +} + +PHP_METHOD(Stub_Openssl, opensslEncrypt) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *data_param = NULL, _0, _1, _2, _3; + zval data; + + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_STR(data) + ZEND_PARSE_PARAMETERS_END(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); + zephir_fetch_params(1, 1, 0, &data_param); + zephir_get_strval(&data, data_param); + ZEPHIR_INIT_VAR(&_0); + ZVAL_STRING(&_0, "AES-256-CBC"); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "passphrase"); + ZVAL_LONG(&_2, 1); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "1234567890123456"); + ZEPHIR_RETURN_CALL_FUNCTION("openssl_encrypt", NULL, 75, &data, &_0, &_1, &_2, &_3); + zephir_check_call_status(); + RETURN_MM(); +} + diff --git a/ext/stub/openssl.zep.h b/ext/stub/openssl.zep.h new file mode 100644 index 0000000000..dd64f7a12d --- /dev/null +++ b/ext/stub/openssl.zep.h @@ -0,0 +1,26 @@ + +extern zend_class_entry *stub_openssl_ce; + +ZEPHIR_INIT_CLASS(Stub_Openssl); + +PHP_METHOD(Stub_Openssl, randomPseudoBytes); +PHP_METHOD(Stub_Openssl, randomPseudoBytesLoop); +PHP_METHOD(Stub_Openssl, opensslEncrypt); + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_openssl_randompseudobytes, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_openssl_randompseudobytesloop, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_openssl_opensslencrypt, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_openssl_method_entry) { + PHP_ME(Stub_Openssl, randomPseudoBytes, arginfo_stub_openssl_randompseudobytes, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Openssl, randomPseudoBytesLoop, arginfo_stub_openssl_randompseudobytesloop, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Openssl, opensslEncrypt, arginfo_stub_openssl_opensslencrypt, ZEND_ACC_PUBLIC) + PHP_FE_END +}; diff --git a/ext/stub/operator.zep.c b/ext/stub/operator.zep.c index 5919ab865e..7bd17196cc 100644 --- a/ext/stub/operator.zep.c +++ b/ext/stub/operator.zep.c @@ -29,22 +29,14 @@ ZEPHIR_INIT_CLASS(Stub_Operator) PHP_METHOD(Stub_Operator, testIdentical) { zval *param1, param1_sub, *param2, param2_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1_sub); ZVAL_UNDEF(¶m2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(param1) Z_PARAM_ZVAL(param2) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, ¶m1, ¶m2); - - RETURN_BOOL(ZEPHIR_IS_IDENTICAL(param1, param2)); } @@ -53,23 +45,16 @@ PHP_METHOD(Stub_Operator, testIdenticalIfComplex) zend_bool b = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *input, input_sub, a, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&input_sub); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(input) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &input); - - ZEPHIR_INIT_VAR(&a); zephir_create_array(&a, 1, 0); zephir_array_update_string(&a, SL("1"), input, PH_COPY | PH_SEPARATE); @@ -84,40 +69,24 @@ PHP_METHOD(Stub_Operator, testIdenticalIfComplex) PHP_METHOD(Stub_Operator, testIdenticalVarFalse) { zval *param, param_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m); - - RETURN_BOOL(ZEPHIR_IS_FALSE_IDENTICAL(param)); } PHP_METHOD(Stub_Operator, testIdenticalFalseVar) { zval *param, param_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m); - - RETURN_BOOL(ZEPHIR_IS_FALSE_IDENTICAL(param)); } @@ -126,24 +95,17 @@ PHP_METHOD(Stub_Operator, testBoolComparison) zend_bool var1, var2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *varTrue, varTrue_sub, *varFalse, varFalse_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&varTrue_sub); ZVAL_UNDEF(&varFalse_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(varTrue) Z_PARAM_ZVAL(varFalse) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &varTrue, &varFalse); - - var1 = 1; var2 = 0; zephir_create_array(return_value, 8, 0); @@ -180,22 +142,15 @@ PHP_METHOD(Stub_Operator, testNewInstanceOperator) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *className, className_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&className_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(className) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &className); - - zephir_fetch_safe_class(&_0, className); _1 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_0), Z_STRLEN_P(&_0), ZEND_FETCH_CLASS_AUTO); if(!_1) { diff --git a/ext/stub/optimizers/acos.zep.c b/ext/stub/optimizers/acos.zep.c index 5371416dea..171a7a19d9 100644 --- a/ext/stub/optimizers/acos.zep.c +++ b/ext/stub/optimizers/acos.zep.c @@ -30,12 +30,8 @@ PHP_METHOD(Stub_Optimizers_ACos, testInt) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 1; ZVAL_LONG(&_0, a); RETURN_DOUBLE(acos(a)); @@ -45,12 +41,8 @@ PHP_METHOD(Stub_Optimizers_ACos, testVar) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 1; ZVAL_LONG(&_0, a); RETURN_DOUBLE(acos(a)); @@ -59,12 +51,8 @@ PHP_METHOD(Stub_Optimizers_ACos, testVar) PHP_METHOD(Stub_Optimizers_ACos, testIntValue1) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 0); RETURN_DOUBLE(acos(0)); } @@ -73,21 +61,12 @@ PHP_METHOD(Stub_Optimizers_ACos, testIntParameter) { zval *a_param = NULL, _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a_param); - a = zephir_get_intval(a_param); - - ZVAL_LONG(&_0, a); RETURN_DOUBLE(acos(a)); } @@ -95,20 +74,12 @@ PHP_METHOD(Stub_Optimizers_ACos, testIntParameter) PHP_METHOD(Stub_Optimizers_ACos, testVarParameter) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_DOUBLE(zephir_acos(a)); } diff --git a/ext/stub/optimizers/acos.zep.h b/ext/stub/optimizers/acos.zep.h index b2c9fd88af..e2ffa8f34c 100644 --- a/ext/stub/optimizers/acos.zep.h +++ b/ext/stub/optimizers/acos.zep.h @@ -27,21 +27,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_acos_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_acos_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ACos, testInt, arginfo_stub_optimizers_acos_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ACos, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ACos, testVar, arginfo_stub_optimizers_acos_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ACos, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ACos, testIntValue1, arginfo_stub_optimizers_acos_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ACos, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_ACos, testInt, arginfo_stub_optimizers_acos_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_ACos, testVar, arginfo_stub_optimizers_acos_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_ACos, testIntValue1, arginfo_stub_optimizers_acos_testintvalue1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_ACos, testIntParameter, arginfo_stub_optimizers_acos_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_ACos, testVarParameter, arginfo_stub_optimizers_acos_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/arraymerge.zep.c b/ext/stub/optimizers/arraymerge.zep.c index 8a4bbc453f..625944f2ac 100644 --- a/ext/stub/optimizers/arraymerge.zep.c +++ b/ext/stub/optimizers/arraymerge.zep.c @@ -30,25 +30,18 @@ PHP_METHOD(Stub_Optimizers_ArrayMerge, mergeTwoRequiredArrays) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *arr1_param = NULL, *arr2_param = NULL; zval arr1, arr2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr1); ZVAL_UNDEF(&arr2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(arr1) Z_PARAM_ARRAY(arr2) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &arr1_param, &arr2_param); zephir_get_arrval(&arr1, arr1_param); zephir_get_arrval(&arr2, arr2_param); - - zephir_fast_array_merge(return_value, &arr1, &arr2); RETURN_MM(); } diff --git a/ext/stub/optimizers/asin.zep.c b/ext/stub/optimizers/asin.zep.c index fe81b5d609..9ba7f7ac4c 100644 --- a/ext/stub/optimizers/asin.zep.c +++ b/ext/stub/optimizers/asin.zep.c @@ -30,12 +30,8 @@ PHP_METHOD(Stub_Optimizers_ASin, testInt) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 1; ZVAL_LONG(&_0, a); RETURN_DOUBLE(asin(a)); @@ -45,12 +41,8 @@ PHP_METHOD(Stub_Optimizers_ASin, testVar) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 1; ZVAL_LONG(&_0, a); RETURN_DOUBLE(asin(a)); @@ -59,12 +51,8 @@ PHP_METHOD(Stub_Optimizers_ASin, testVar) PHP_METHOD(Stub_Optimizers_ASin, testIntValue1) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 0); RETURN_DOUBLE(asin(0)); } @@ -73,21 +61,12 @@ PHP_METHOD(Stub_Optimizers_ASin, testIntParameter) { zval *a_param = NULL, _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a_param); - a = zephir_get_intval(a_param); - - ZVAL_LONG(&_0, a); RETURN_DOUBLE(asin(a)); } @@ -95,20 +74,12 @@ PHP_METHOD(Stub_Optimizers_ASin, testIntParameter) PHP_METHOD(Stub_Optimizers_ASin, testVarParameter) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_DOUBLE(zephir_asin(a)); } diff --git a/ext/stub/optimizers/asin.zep.h b/ext/stub/optimizers/asin.zep.h index 0d005332bb..d92501abd9 100644 --- a/ext/stub/optimizers/asin.zep.h +++ b/ext/stub/optimizers/asin.zep.h @@ -27,21 +27,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_asin_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_asin_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ASin, testInt, arginfo_stub_optimizers_asin_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ASin, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ASin, testVar, arginfo_stub_optimizers_asin_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ASin, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ASin, testIntValue1, arginfo_stub_optimizers_asin_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ASin, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_ASin, testInt, arginfo_stub_optimizers_asin_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_ASin, testVar, arginfo_stub_optimizers_asin_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_ASin, testIntValue1, arginfo_stub_optimizers_asin_testintvalue1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_ASin, testIntParameter, arginfo_stub_optimizers_asin_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_ASin, testVarParameter, arginfo_stub_optimizers_asin_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/cos.zep.c b/ext/stub/optimizers/cos.zep.c index 974c32428d..9139cb7f36 100644 --- a/ext/stub/optimizers/cos.zep.c +++ b/ext/stub/optimizers/cos.zep.c @@ -30,12 +30,8 @@ PHP_METHOD(Stub_Optimizers_Cos, testInt) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 4; ZVAL_LONG(&_0, a); RETURN_DOUBLE(cos(a)); @@ -45,12 +41,8 @@ PHP_METHOD(Stub_Optimizers_Cos, testVar) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 4; ZVAL_LONG(&_0, a); RETURN_DOUBLE(cos(a)); @@ -59,12 +51,8 @@ PHP_METHOD(Stub_Optimizers_Cos, testVar) PHP_METHOD(Stub_Optimizers_Cos, testIntValue1) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 4); RETURN_DOUBLE(cos(4)); } @@ -72,12 +60,8 @@ PHP_METHOD(Stub_Optimizers_Cos, testIntValue1) PHP_METHOD(Stub_Optimizers_Cos, testIntValue2) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 16); RETURN_DOUBLE(cos(16)); } @@ -86,21 +70,12 @@ PHP_METHOD(Stub_Optimizers_Cos, testIntParameter) { zval *a_param = NULL, _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a_param); - a = zephir_get_intval(a_param); - - ZVAL_LONG(&_0, a); RETURN_DOUBLE(cos(a)); } @@ -108,20 +83,12 @@ PHP_METHOD(Stub_Optimizers_Cos, testIntParameter) PHP_METHOD(Stub_Optimizers_Cos, testVarParameter) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_DOUBLE(zephir_cos(a)); } diff --git a/ext/stub/optimizers/cos.zep.h b/ext/stub/optimizers/cos.zep.h index f0d22dd5d0..f261d2718d 100644 --- a/ext/stub/optimizers/cos.zep.h +++ b/ext/stub/optimizers/cos.zep.h @@ -31,26 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_cos_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_cos_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Cos, testInt, arginfo_stub_optimizers_cos_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Cos, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Cos, testVar, arginfo_stub_optimizers_cos_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Cos, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Cos, testIntValue1, arginfo_stub_optimizers_cos_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Cos, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Cos, testIntValue2, arginfo_stub_optimizers_cos_testintvalue2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Cos, testIntValue2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Cos, testInt, arginfo_stub_optimizers_cos_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Cos, testVar, arginfo_stub_optimizers_cos_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Cos, testIntValue1, arginfo_stub_optimizers_cos_testintvalue1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Cos, testIntValue2, arginfo_stub_optimizers_cos_testintvalue2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Cos, testIntParameter, arginfo_stub_optimizers_cos_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Cos, testVarParameter, arginfo_stub_optimizers_cos_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/createarray.zep.c b/ext/stub/optimizers/createarray.zep.c index e81ebd146a..f622bac1cd 100644 --- a/ext/stub/optimizers/createarray.zep.c +++ b/ext/stub/optimizers/createarray.zep.c @@ -28,11 +28,6 @@ ZEPHIR_INIT_CLASS(Stub_Optimizers_CreateArray) PHP_METHOD(Stub_Optimizers_CreateArray, createNoSize) { zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - zephir_create_array(return_value, 0, 1); return; } @@ -41,21 +36,12 @@ PHP_METHOD(Stub_Optimizers_CreateArray, createSize) { zval *n_param = NULL, _0; zend_long n, ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &n_param); - n = zephir_get_intval(n_param); - - ZVAL_LONG(&_0, n); zephir_create_array(return_value, zephir_get_intval(&_0), 1); return; diff --git a/ext/stub/optimizers/createarray.zep.h b/ext/stub/optimizers/createarray.zep.h index af6e783edd..be494beac1 100644 --- a/ext/stub/optimizers/createarray.zep.h +++ b/ext/stub/optimizers/createarray.zep.h @@ -14,11 +14,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_createarray_createsize, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_createarray_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_CreateArray, createNoSize, arginfo_stub_optimizers_createarray_createnosize, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_CreateArray, createNoSize, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_CreateArray, createNoSize, arginfo_stub_optimizers_createarray_createnosize, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_CreateArray, createSize, arginfo_stub_optimizers_createarray_createsize, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/optimizers/isscalar.zep.c b/ext/stub/optimizers/isscalar.zep.c index 60e8860926..396fd24fed 100644 --- a/ext/stub/optimizers/isscalar.zep.c +++ b/ext/stub/optimizers/isscalar.zep.c @@ -27,12 +27,8 @@ PHP_METHOD(Stub_Optimizers_IsScalar, testIntVar) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 1; ZVAL_LONG(&_0, a); RETURN_BOOL(zephir_is_scalar(&_0)); @@ -42,12 +38,8 @@ PHP_METHOD(Stub_Optimizers_IsScalar, testDoubleVar) { zval _0; double a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = (double) (1); ZVAL_DOUBLE(&_0, a); RETURN_BOOL(zephir_is_scalar(&_0)); @@ -57,12 +49,8 @@ PHP_METHOD(Stub_Optimizers_IsScalar, testBoolVar) { zval _0; zend_bool a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 1; ZVAL_BOOL(&_0, (a ? 1 : 0)); RETURN_BOOL(zephir_is_scalar(&_0)); @@ -72,12 +60,10 @@ PHP_METHOD(Stub_Optimizers_IsScalar, testStringVar) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "test string"); @@ -88,12 +74,10 @@ PHP_METHOD(Stub_Optimizers_IsScalar, testEmptyArrayVar) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); array_init(&a); @@ -104,12 +88,8 @@ PHP_METHOD(Stub_Optimizers_IsScalar, testVar) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 1; ZVAL_LONG(&_0, a); RETURN_BOOL(zephir_is_scalar(&_0)); @@ -118,20 +98,12 @@ PHP_METHOD(Stub_Optimizers_IsScalar, testVar) PHP_METHOD(Stub_Optimizers_IsScalar, testVarParameter) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_BOOL(zephir_is_scalar(a)); } diff --git a/ext/stub/optimizers/ldexp.zep.c b/ext/stub/optimizers/ldexp.zep.c index 1bd155f09b..e0212e351e 100644 --- a/ext/stub/optimizers/ldexp.zep.c +++ b/ext/stub/optimizers/ldexp.zep.c @@ -29,13 +29,9 @@ PHP_METHOD(Stub_Optimizers_Ldexp, testInt) { zval _0, _1; zend_long x, exponent; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - x = 2; exponent = 3; ZVAL_LONG(&_0, x); @@ -48,14 +44,10 @@ PHP_METHOD(Stub_Optimizers_Ldexp, testDoubleInt) zval _0, _1; zend_long exponent; double x; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - - x = 2.0; + x = (2.0); exponent = 3; ZVAL_DOUBLE(&_0, x); ZVAL_LONG(&_1, exponent); @@ -66,15 +58,11 @@ PHP_METHOD(Stub_Optimizers_Ldexp, testDouble) { zval _0, _1; double x, exponent; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - - x = 2.0; - exponent = 3.0; + x = (2.0); + exponent = (3.0); ZVAL_DOUBLE(&_0, x); ZVAL_DOUBLE(&_1, exponent); RETURN_DOUBLE(zephir_ldexp(&_0, &_1)); @@ -84,13 +72,9 @@ PHP_METHOD(Stub_Optimizers_Ldexp, testVar) { zval _0, _1; zend_long x, exponent; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - x = 2; exponent = 3; ZVAL_LONG(&_0, x); @@ -101,13 +85,9 @@ PHP_METHOD(Stub_Optimizers_Ldexp, testVar) PHP_METHOD(Stub_Optimizers_Ldexp, testIntValue1) { zval _0, _1; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZVAL_LONG(&_0, 2); ZVAL_LONG(&_1, 3); RETURN_DOUBLE(zephir_ldexp(&_0, &_1)); @@ -117,24 +97,14 @@ PHP_METHOD(Stub_Optimizers_Ldexp, testIntParameter) { zval *x_param = NULL, *exponent_param = NULL, _0, _1; zend_long x, exponent; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(x) Z_PARAM_LONG(exponent) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &x_param, &exponent_param); - x = zephir_get_intval(x_param); - exponent = zephir_get_intval(exponent_param); - - ZVAL_LONG(&_0, x); ZVAL_LONG(&_1, exponent); RETURN_DOUBLE(zephir_ldexp(&_0, &_1)); @@ -143,22 +113,14 @@ PHP_METHOD(Stub_Optimizers_Ldexp, testIntParameter) PHP_METHOD(Stub_Optimizers_Ldexp, testVarParameter) { zval *x, x_sub, *exponent, exponent_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&x_sub); ZVAL_UNDEF(&exponent_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(x) Z_PARAM_ZVAL(exponent) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &x, &exponent); - - RETURN_DOUBLE(zephir_ldexp(x, exponent)); } diff --git a/ext/stub/optimizers/ldexp.zep.h b/ext/stub/optimizers/ldexp.zep.h index a6f5e681a7..e0fe4971b6 100644 --- a/ext/stub/optimizers/ldexp.zep.h +++ b/ext/stub/optimizers/ldexp.zep.h @@ -37,31 +37,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_ldexp_testvarparameter, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_ldexp_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testInt, arginfo_stub_optimizers_ldexp_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testDoubleInt, arginfo_stub_optimizers_ldexp_testdoubleint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testDoubleInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testDouble, arginfo_stub_optimizers_ldexp_testdouble, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testDouble, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testVar, arginfo_stub_optimizers_ldexp_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testIntValue1, arginfo_stub_optimizers_ldexp_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Ldexp, testInt, arginfo_stub_optimizers_ldexp_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Ldexp, testDoubleInt, arginfo_stub_optimizers_ldexp_testdoubleint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Ldexp, testDouble, arginfo_stub_optimizers_ldexp_testdouble, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Ldexp, testVar, arginfo_stub_optimizers_ldexp_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Ldexp, testIntValue1, arginfo_stub_optimizers_ldexp_testintvalue1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Ldexp, testIntParameter, arginfo_stub_optimizers_ldexp_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Ldexp, testVarParameter, arginfo_stub_optimizers_ldexp_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/sin.zep.c b/ext/stub/optimizers/sin.zep.c index eda01e722c..295a08cd79 100644 --- a/ext/stub/optimizers/sin.zep.c +++ b/ext/stub/optimizers/sin.zep.c @@ -30,12 +30,8 @@ PHP_METHOD(Stub_Optimizers_Sin, testInt) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 4; ZVAL_LONG(&_0, a); RETURN_DOUBLE(sin(a)); @@ -45,12 +41,8 @@ PHP_METHOD(Stub_Optimizers_Sin, testVar) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 4; ZVAL_LONG(&_0, a); RETURN_DOUBLE(sin(a)); @@ -59,12 +51,8 @@ PHP_METHOD(Stub_Optimizers_Sin, testVar) PHP_METHOD(Stub_Optimizers_Sin, testIntValue1) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 4); RETURN_DOUBLE(sin(4)); } @@ -72,12 +60,8 @@ PHP_METHOD(Stub_Optimizers_Sin, testIntValue1) PHP_METHOD(Stub_Optimizers_Sin, testIntValue2) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 16); RETURN_DOUBLE(sin(16)); } @@ -86,21 +70,12 @@ PHP_METHOD(Stub_Optimizers_Sin, testIntParameter) { zval *a_param = NULL, _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a_param); - a = zephir_get_intval(a_param); - - ZVAL_LONG(&_0, a); RETURN_DOUBLE(sin(a)); } @@ -108,20 +83,12 @@ PHP_METHOD(Stub_Optimizers_Sin, testIntParameter) PHP_METHOD(Stub_Optimizers_Sin, testVarParameter) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_DOUBLE(zephir_sin(a)); } diff --git a/ext/stub/optimizers/sin.zep.h b/ext/stub/optimizers/sin.zep.h index 48216e6c96..90be245b37 100644 --- a/ext/stub/optimizers/sin.zep.h +++ b/ext/stub/optimizers/sin.zep.h @@ -31,26 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_sin_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_sin_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sin, testInt, arginfo_stub_optimizers_sin_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sin, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sin, testVar, arginfo_stub_optimizers_sin_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sin, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sin, testIntValue1, arginfo_stub_optimizers_sin_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sin, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sin, testIntValue2, arginfo_stub_optimizers_sin_testintvalue2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sin, testIntValue2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Sin, testInt, arginfo_stub_optimizers_sin_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sin, testVar, arginfo_stub_optimizers_sin_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sin, testIntValue1, arginfo_stub_optimizers_sin_testintvalue1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sin, testIntValue2, arginfo_stub_optimizers_sin_testintvalue2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Sin, testIntParameter, arginfo_stub_optimizers_sin_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Sin, testVarParameter, arginfo_stub_optimizers_sin_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/sqrt.zep.c b/ext/stub/optimizers/sqrt.zep.c index 22d9bbd37f..0f97dea2d0 100644 --- a/ext/stub/optimizers/sqrt.zep.c +++ b/ext/stub/optimizers/sqrt.zep.c @@ -30,12 +30,8 @@ PHP_METHOD(Stub_Optimizers_Sqrt, testInt) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 4; ZVAL_LONG(&_0, a); RETURN_DOUBLE(sqrt(a)); @@ -45,12 +41,8 @@ PHP_METHOD(Stub_Optimizers_Sqrt, testVar) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 4; ZVAL_LONG(&_0, a); RETURN_DOUBLE(sqrt(a)); @@ -59,12 +51,8 @@ PHP_METHOD(Stub_Optimizers_Sqrt, testVar) PHP_METHOD(Stub_Optimizers_Sqrt, testIntValue1) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 4); RETURN_DOUBLE(sqrt(4)); } @@ -72,12 +60,8 @@ PHP_METHOD(Stub_Optimizers_Sqrt, testIntValue1) PHP_METHOD(Stub_Optimizers_Sqrt, testIntValue2) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 16); RETURN_DOUBLE(sqrt(16)); } @@ -86,21 +70,12 @@ PHP_METHOD(Stub_Optimizers_Sqrt, testIntParameter) { zval *a_param = NULL, _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a_param); - a = zephir_get_intval(a_param); - - ZVAL_LONG(&_0, a); RETURN_DOUBLE(sqrt(a)); } @@ -108,20 +83,12 @@ PHP_METHOD(Stub_Optimizers_Sqrt, testIntParameter) PHP_METHOD(Stub_Optimizers_Sqrt, testVarParameter) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_DOUBLE(zephir_sqrt(a)); } diff --git a/ext/stub/optimizers/sqrt.zep.h b/ext/stub/optimizers/sqrt.zep.h index c4f7fc76e0..d093b250c6 100644 --- a/ext/stub/optimizers/sqrt.zep.h +++ b/ext/stub/optimizers/sqrt.zep.h @@ -31,26 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_sqrt_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_sqrt_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sqrt, testInt, arginfo_stub_optimizers_sqrt_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sqrt, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sqrt, testVar, arginfo_stub_optimizers_sqrt_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sqrt, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sqrt, testIntValue1, arginfo_stub_optimizers_sqrt_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sqrt, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sqrt, testIntValue2, arginfo_stub_optimizers_sqrt_testintvalue2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sqrt, testIntValue2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Sqrt, testInt, arginfo_stub_optimizers_sqrt_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sqrt, testVar, arginfo_stub_optimizers_sqrt_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sqrt, testIntValue1, arginfo_stub_optimizers_sqrt_testintvalue1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sqrt, testIntValue2, arginfo_stub_optimizers_sqrt_testintvalue2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Sqrt, testIntParameter, arginfo_stub_optimizers_sqrt_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Sqrt, testVarParameter, arginfo_stub_optimizers_sqrt_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/strreplace.zep.c b/ext/stub/optimizers/strreplace.zep.c index 8ddc9bccdd..ce7fbba702 100644 --- a/ext/stub/optimizers/strreplace.zep.c +++ b/ext/stub/optimizers/strreplace.zep.c @@ -34,15 +34,13 @@ PHP_METHOD(Stub_Optimizers_StrReplace, issue1055) zval _1, _3; zval _0, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 1, 0); @@ -65,15 +63,13 @@ PHP_METHOD(Stub_Optimizers_StrReplace, issue1087) { zval filtered, sanitize, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&filtered); ZVAL_UNDEF(&sanitize); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&filtered); ZVAL_STRING(&filtered, "test_test"); @@ -117,15 +113,13 @@ PHP_METHOD(Stub_Optimizers_StrReplace, issue732A) zval _0; zval search, replace; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&search); ZVAL_UNDEF(&replace); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&subject); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&search); zephir_create_array(&search, 5, 0); @@ -175,15 +169,13 @@ PHP_METHOD(Stub_Optimizers_StrReplace, issue732B) zval patterns, replacements; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&patterns); ZVAL_UNDEF(&replacements); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&subject); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&patterns); zephir_create_array(&patterns, 3, 0); @@ -209,7 +201,7 @@ PHP_METHOD(Stub_Optimizers_StrReplace, issue732B) zephir_array_fast_append(&replacements, &_0); ZEPHIR_INIT_VAR(&subject); ZVAL_STRING(&subject, "The quick brown fox jumped over the lazy dog."); - ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 73, &patterns, &replacements, &subject); + ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 76, &patterns, &replacements, &subject); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/optimizers/strreplace.zep.h b/ext/stub/optimizers/strreplace.zep.h index 3ba4c7d920..2a0b361f92 100644 --- a/ext/stub/optimizers/strreplace.zep.h +++ b/ext/stub/optimizers/strreplace.zep.h @@ -21,25 +21,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_strreplace_issue732b, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_strreplace_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_StrReplace, issue1055, arginfo_stub_optimizers_strreplace_issue1055, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_StrReplace, issue1055, NULL, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_StrReplace, issue1087, arginfo_stub_optimizers_strreplace_issue1087, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_StrReplace, issue1087, NULL, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_StrReplace, issue732A, arginfo_stub_optimizers_strreplace_issue732a, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_StrReplace, issue732A, NULL, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_StrReplace, issue732B, arginfo_stub_optimizers_strreplace_issue732b, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_StrReplace, issue732B, NULL, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_StrReplace, issue1055, arginfo_stub_optimizers_strreplace_issue1055, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_StrReplace, issue1087, arginfo_stub_optimizers_strreplace_issue1087, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_StrReplace, issue732A, arginfo_stub_optimizers_strreplace_issue732a, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_StrReplace, issue732B, arginfo_stub_optimizers_strreplace_issue732b, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/optimizers/substr.zep.c b/ext/stub/optimizers/substr.zep.c index 251762c431..42d277a7ba 100644 --- a/ext/stub/optimizers/substr.zep.c +++ b/ext/stub/optimizers/substr.zep.c @@ -28,22 +28,14 @@ ZEPHIR_INIT_CLASS(Stub_Optimizers_Substr) PHP_METHOD(Stub_Optimizers_Substr, testTwoArguments) { zval *str, str_sub, *start, start_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&start_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(start) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &str, &start); - - zephir_substr(return_value, str, zephir_get_intval(start), 0, ZEPHIR_SUBSTR_NO_LENGTH); return; } @@ -51,24 +43,16 @@ PHP_METHOD(Stub_Optimizers_Substr, testTwoArguments) PHP_METHOD(Stub_Optimizers_Substr, testThreeArguments) { zval *str, str_sub, *start, start_sub, *offset, offset_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&start_sub); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(start) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(3, 0, &str, &start, &offset); - - zephir_substr(return_value, str, zephir_get_intval(start), zephir_get_intval(offset), 0); return; } diff --git a/ext/stub/optimizers/tan.zep.c b/ext/stub/optimizers/tan.zep.c index 80c945a3cd..8206af7726 100644 --- a/ext/stub/optimizers/tan.zep.c +++ b/ext/stub/optimizers/tan.zep.c @@ -30,12 +30,8 @@ PHP_METHOD(Stub_Optimizers_Tan, testInt) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 0; ZVAL_LONG(&_0, a); RETURN_DOUBLE(tan(a)); @@ -45,12 +41,8 @@ PHP_METHOD(Stub_Optimizers_Tan, testVar) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 0; ZVAL_LONG(&_0, a); RETURN_DOUBLE(tan(a)); @@ -60,12 +52,8 @@ PHP_METHOD(Stub_Optimizers_Tan, testVar2) { zval _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - a = 1; ZVAL_LONG(&_0, a); RETURN_DOUBLE(tan(a)); @@ -74,12 +62,8 @@ PHP_METHOD(Stub_Optimizers_Tan, testVar2) PHP_METHOD(Stub_Optimizers_Tan, testIntValue1) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 1); RETURN_DOUBLE(tan(1)); } @@ -87,12 +71,8 @@ PHP_METHOD(Stub_Optimizers_Tan, testIntValue1) PHP_METHOD(Stub_Optimizers_Tan, testIntValue2) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZVAL_LONG(&_0, 2); RETURN_DOUBLE(tan(2)); } @@ -101,21 +81,12 @@ PHP_METHOD(Stub_Optimizers_Tan, testIntParameter) { zval *a_param = NULL, _0; zend_long a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a_param); - a = zephir_get_intval(a_param); - - ZVAL_LONG(&_0, a); RETURN_DOUBLE(tan(a)); } @@ -123,20 +94,12 @@ PHP_METHOD(Stub_Optimizers_Tan, testIntParameter) PHP_METHOD(Stub_Optimizers_Tan, testVarParameter) { zval *a, a_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &a); - - RETURN_DOUBLE(zephir_tan(a)); } diff --git a/ext/stub/optimizers/tan.zep.h b/ext/stub/optimizers/tan.zep.h index 2d1c61c8f2..63a0757b7b 100644 --- a/ext/stub/optimizers/tan.zep.h +++ b/ext/stub/optimizers/tan.zep.h @@ -35,31 +35,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_tan_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_tan_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testInt, arginfo_stub_optimizers_tan_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testVar, arginfo_stub_optimizers_tan_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testVar2, arginfo_stub_optimizers_tan_testvar2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testVar2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testIntValue1, arginfo_stub_optimizers_tan_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testIntValue2, arginfo_stub_optimizers_tan_testintvalue2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testIntValue2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Tan, testInt, arginfo_stub_optimizers_tan_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Tan, testVar, arginfo_stub_optimizers_tan_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Tan, testVar2, arginfo_stub_optimizers_tan_testvar2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Tan, testIntValue1, arginfo_stub_optimizers_tan_testintvalue1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Tan, testIntValue2, arginfo_stub_optimizers_tan_testintvalue2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Tan, testIntParameter, arginfo_stub_optimizers_tan_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Tan, testVarParameter, arginfo_stub_optimizers_tan_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/pregmatch.zep.c b/ext/stub/pregmatch.zep.c index 6c9a9be178..0f2eeab924 100644 --- a/ext/stub/pregmatch.zep.c +++ b/ext/stub/pregmatch.zep.c @@ -31,16 +31,14 @@ PHP_METHOD(Stub_Pregmatch, testWithoutReturnAndMatches) { zval pattern, subject, _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&subject); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&pattern); ZVAL_STRING(&pattern, "/def$/"); @@ -58,15 +56,13 @@ PHP_METHOD(Stub_Pregmatch, testWithoutReturns) { zval pattern, subject, matches, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&subject); ZVAL_UNDEF(&matches); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&matches); ZVAL_NULL(&matches); @@ -83,15 +79,13 @@ PHP_METHOD(Stub_Pregmatch, testWithoutMatches) { zval pattern, subject, matched, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&subject); ZVAL_UNDEF(&matched); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&pattern); ZVAL_STRING(&pattern, "/def$/"); @@ -107,14 +101,12 @@ PHP_METHOD(Stub_Pregmatch, testPregMatchAll) { zval pattern, subject, results; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&subject); ZVAL_UNDEF(&results); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&pattern); ZVAL_STRING(&pattern, "/def$/"); @@ -130,14 +122,12 @@ PHP_METHOD(Stub_Pregmatch, testPregMatchFallback) { zval pattern, subject, matches; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&subject); ZVAL_UNDEF(&matches); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&matches); ZVAL_NULL(&matches); @@ -155,24 +145,17 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch2Params) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *pattern, pattern_sub, *subject, subject_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern_sub); ZVAL_UNDEF(&subject_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_ZVAL(subject) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &pattern, &subject); - - ZEPHIR_INIT_VAR(&_0); zephir_preg_match(return_value, pattern, subject, &_0, 0, 0 , 0 ); RETURN_MM(); @@ -181,24 +164,16 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch2Params) PHP_METHOD(Stub_Pregmatch, testPregMatch3Params) { zval *pattern, pattern_sub, *subject, subject_sub, *matches, matches_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern_sub); ZVAL_UNDEF(&subject_sub); ZVAL_UNDEF(&matches_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(pattern) Z_PARAM_ZVAL(subject) Z_PARAM_ZVAL(matches) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(3, 0, &pattern, &subject, &matches); - - zephir_preg_match(return_value, pattern, subject, matches, 0, 0 , 0 ); return; } @@ -206,26 +181,18 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch3Params) PHP_METHOD(Stub_Pregmatch, testPregMatch4Params) { zval *pattern, pattern_sub, *subject, subject_sub, *matches, matches_sub, *flags, flags_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern_sub); ZVAL_UNDEF(&subject_sub); ZVAL_UNDEF(&matches_sub); ZVAL_UNDEF(&flags_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(4, 4) Z_PARAM_ZVAL(pattern) Z_PARAM_ZVAL(subject) Z_PARAM_ZVAL(matches) Z_PARAM_ZVAL(flags) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(4, 0, &pattern, &subject, &matches, &flags); - - zephir_preg_match(return_value, pattern, subject, matches, 0, zephir_get_intval(flags) , 0 ); return; } @@ -233,15 +200,12 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch4Params) PHP_METHOD(Stub_Pregmatch, testPregMatch5Params) { zval *pattern, pattern_sub, *subject, subject_sub, *matches, matches_sub, *flags, flags_sub, *offset, offset_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern_sub); ZVAL_UNDEF(&subject_sub); ZVAL_UNDEF(&matches_sub); ZVAL_UNDEF(&flags_sub); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(5, 5) Z_PARAM_ZVAL(pattern) Z_PARAM_ZVAL(subject) @@ -249,12 +213,7 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch5Params) Z_PARAM_ZVAL(flags) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(5, 0, &pattern, &subject, &matches, &flags, &offset); - - zephir_preg_match(return_value, pattern, subject, matches, 0, zephir_get_intval(flags) , zephir_get_intval(offset) ); return; } @@ -267,27 +226,20 @@ PHP_METHOD(Stub_Pregmatch, testPregMatchSaveMatches) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, *pattern_param = NULL, matches, _0; zval str, pattern; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&matches); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(str) Z_PARAM_STR(pattern) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &str_param, &pattern_param); zephir_get_strval(&str, str_param); zephir_get_strval(&pattern, pattern_param); - - ZEPHIR_INIT_VAR(&matches); ZVAL_NULL(&matches); ZEPHIR_INIT_VAR(&_0); @@ -299,7 +251,6 @@ PHP_METHOD(Stub_Pregmatch, testMatchAll) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *flags, flags_sub, text, matches, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&flags_sub); ZVAL_UNDEF(&text); @@ -307,18 +258,12 @@ PHP_METHOD(Stub_Pregmatch, testMatchAll) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(flags) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &flags); - - ZEPHIR_INIT_VAR(&matches); array_init(&matches); ZEPHIR_INIT_VAR(&text); @@ -343,9 +288,8 @@ PHP_METHOD(Stub_Pregmatch, testMatchAllInZep) ZVAL_UNDEF(&m1); ZVAL_UNDEF(&m2); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 1); ZEPHIR_CALL_METHOD(&m1, this_ptr, "testmatchall", &_1, 0, &_0); diff --git a/ext/stub/pregmatch.zep.h b/ext/stub/pregmatch.zep.h index d6f813d60d..ea40bcd257 100644 --- a/ext/stub/pregmatch.zep.h +++ b/ext/stub/pregmatch.zep.h @@ -70,41 +70,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_pregmatch_testmatchallinzep, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_pregmatch_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testWithoutReturnAndMatches, arginfo_stub_pregmatch_testwithoutreturnandmatches, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testWithoutReturnAndMatches, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testWithoutReturns, arginfo_stub_pregmatch_testwithoutreturns, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testWithoutReturns, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testWithoutMatches, arginfo_stub_pregmatch_testwithoutmatches, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testWithoutMatches, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testPregMatchAll, arginfo_stub_pregmatch_testpregmatchall, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testPregMatchAll, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testPregMatchFallback, arginfo_stub_pregmatch_testpregmatchfallback, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testPregMatchFallback, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Pregmatch, testWithoutReturnAndMatches, arginfo_stub_pregmatch_testwithoutreturnandmatches, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Pregmatch, testWithoutReturns, arginfo_stub_pregmatch_testwithoutreturns, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Pregmatch, testWithoutMatches, arginfo_stub_pregmatch_testwithoutmatches, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Pregmatch, testPregMatchAll, arginfo_stub_pregmatch_testpregmatchall, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Pregmatch, testPregMatchFallback, arginfo_stub_pregmatch_testpregmatchfallback, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatch2Params, arginfo_stub_pregmatch_testpregmatch2params, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatch3Params, arginfo_stub_pregmatch_testpregmatch3params, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatch4Params, arginfo_stub_pregmatch_testpregmatch4params, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatch5Params, arginfo_stub_pregmatch_testpregmatch5params, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatchSaveMatches, arginfo_stub_pregmatch_testpregmatchsavematches, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testMatchAll, arginfo_stub_pregmatch_testmatchall, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testMatchAllInZep, arginfo_stub_pregmatch_testmatchallinzep, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testMatchAllInZep, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Pregmatch, testMatchAllInZep, arginfo_stub_pregmatch_testmatchallinzep, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/app.zep.c b/ext/stub/properties/app.zep.c index bb909926b8..b8af2f122c 100644 --- a/ext/stub/properties/app.zep.c +++ b/ext/stub/properties/app.zep.c @@ -30,9 +30,6 @@ ZEPHIR_INIT_CLASS(Stub_Properties_App) */ PHP_METHOD(Stub_Properties_App, getInstance) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "instance"); } @@ -42,15 +39,13 @@ PHP_METHOD(Stub_Properties_App, __construct) zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_1 = NULL; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_CALL_CE_STATIC(&_0, stub_properties_staticprivateproperties_ce, "getinstance", &_1, 0); + ZEPHIR_CALL_CE_STATIC(&_0, stub_properties_staticprivateproperties_ce, "getinstance", NULL, 0); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("instance"), &_0); ZEPHIR_MM_RESTORE(); diff --git a/ext/stub/properties/app.zep.h b/ext/stub/properties/app.zep.h index 22e9a1daa2..d13be1fd36 100644 --- a/ext/stub/properties/app.zep.h +++ b/ext/stub/properties/app.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_app___construct, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_app_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_App, getInstance, arginfo_stub_properties_app_getinstance, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_App, getInstance, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_App, __construct, arginfo_stub_properties_app___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Properties_App, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Properties_App, getInstance, arginfo_stub_properties_app_getinstance, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_App, __construct, arginfo_stub_properties_app___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_FE_END }; diff --git a/ext/stub/properties/extendspublicproperties.zep.c b/ext/stub/properties/extendspublicproperties.zep.c index a8c4ca6d47..4335b268ab 100644 --- a/ext/stub/properties/extendspublicproperties.zep.c +++ b/ext/stub/properties/extendspublicproperties.zep.c @@ -49,7 +49,8 @@ zend_object *zephir_init_properties_Stub_Properties_ExtendsPublicProperties(zend ZVAL_UNDEF(&_11$$7); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); { zval local_this_ptr, *this_ptr = &local_this_ptr; diff --git a/ext/stub/properties/getobjectvars.zep.c b/ext/stub/properties/getobjectvars.zep.c index b37947bdf1..79cdf286a4 100644 --- a/ext/stub/properties/getobjectvars.zep.c +++ b/ext/stub/properties/getobjectvars.zep.c @@ -35,12 +35,10 @@ PHP_METHOD(Stub_Properties_GetObjectVars, issue1245) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 72, this_ptr); + ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 73, this_ptr); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/properties/privateproperties.zep.c b/ext/stub/properties/privateproperties.zep.c index c76bed136a..de0eb029ff 100644 --- a/ext/stub/properties/privateproperties.zep.c +++ b/ext/stub/properties/privateproperties.zep.c @@ -52,63 +52,42 @@ ZEPHIR_INIT_CLASS(Stub_Properties_PrivateProperties) PHP_METHOD(Stub_Properties_PrivateProperties, getSomeNull) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someNull"); } PHP_METHOD(Stub_Properties_PrivateProperties, getSomeNullInitial) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someNullInitial"); } PHP_METHOD(Stub_Properties_PrivateProperties, getSomeFalse) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someFalse"); } PHP_METHOD(Stub_Properties_PrivateProperties, getSomeTrue) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someTrue"); } PHP_METHOD(Stub_Properties_PrivateProperties, getSomeInteger) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someInteger"); } PHP_METHOD(Stub_Properties_PrivateProperties, getSomeDouble) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someDouble"); } PHP_METHOD(Stub_Properties_PrivateProperties, getSomeString) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someString"); } diff --git a/ext/stub/properties/privateproperties.zep.h b/ext/stub/properties/privateproperties.zep.h index 598523ace7..9bbc4859b7 100644 --- a/ext/stub/properties/privateproperties.zep.h +++ b/ext/stub/properties/privateproperties.zep.h @@ -33,40 +33,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_privateproperties_getsomestring, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_privateproperties_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeNull, arginfo_stub_properties_privateproperties_getsomenull, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeNull, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeNullInitial, arginfo_stub_properties_privateproperties_getsomenullinitial, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeNullInitial, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeFalse, arginfo_stub_properties_privateproperties_getsomefalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeTrue, arginfo_stub_properties_privateproperties_getsometrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeInteger, arginfo_stub_properties_privateproperties_getsomeinteger, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeInteger, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeDouble, arginfo_stub_properties_privateproperties_getsomedouble, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeDouble, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeString, arginfo_stub_properties_privateproperties_getsomestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_PrivateProperties, getSomeNull, arginfo_stub_properties_privateproperties_getsomenull, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeNullInitial, arginfo_stub_properties_privateproperties_getsomenullinitial, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeFalse, arginfo_stub_properties_privateproperties_getsomefalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeTrue, arginfo_stub_properties_privateproperties_getsometrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeInteger, arginfo_stub_properties_privateproperties_getsomeinteger, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeDouble, arginfo_stub_properties_privateproperties_getsomedouble, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeString, arginfo_stub_properties_privateproperties_getsomestring, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/propertyarray.zep.c b/ext/stub/properties/propertyarray.zep.c index 9cef65335b..309ae7e943 100644 --- a/ext/stub/properties/propertyarray.zep.c +++ b/ext/stub/properties/propertyarray.zep.c @@ -52,9 +52,8 @@ PHP_METHOD(Stub_Properties_PropertyArray, __construct) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 1, 0); @@ -74,18 +73,12 @@ PHP_METHOD(Stub_Properties_PropertyArray, appendSome) ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &value); - - zephir_cast_to_string(&_0, value); zephir_update_property_array_append(this_ptr, SL("someArray"), &_0); ZEPHIR_MM_RESTORE(); @@ -97,25 +90,15 @@ PHP_METHOD(Stub_Properties_PropertyArray, setOtherArray) zval *this_ptr = getThis(); ZVAL_UNDEF(&arr_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(arr) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &arr); - - zephir_update_property_zval(this_ptr, ZEND_STRL("otherArray"), arr); } PHP_METHOD(Stub_Properties_PropertyArray, getOtherArray) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "otherArray"); } @@ -134,9 +117,8 @@ PHP_METHOD(Stub_Properties_PropertyArray, testIssues1831) ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_5$$5); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&headers); array_init(&headers); @@ -146,12 +128,12 @@ PHP_METHOD(Stub_Properties_PropertyArray, testIssues1831) } zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("otherArray"), PH_NOISY_CC | PH_READONLY); ZEPHIR_MAKE_REF(&_0$$3); - ZEPHIR_CALL_FUNCTION(&info, "array_shift", &_1, 74, &_0$$3); + ZEPHIR_CALL_FUNCTION(&info, "array_shift", &_1, 77, &_0$$3); ZEPHIR_UNREF(&_0$$3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRING(&_2$$3, "header"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "stripos", &_4, 75, &info, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "stripos", &_4, 78, &info, &_2$$3); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&_3$$3)) { zephir_array_append(&headers, &info, PH_SEPARATE, "stub/properties/propertyarray.zep", 51); @@ -159,7 +141,7 @@ PHP_METHOD(Stub_Properties_PropertyArray, testIssues1831) } else { zephir_read_property(&_5$$5, this_ptr, ZEND_STRL("otherArray"), PH_NOISY_CC | PH_READONLY); ZEPHIR_MAKE_REF(&_5$$5); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", &_6, 76, &_5$$5, &info); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", &_6, 79, &_5$$5, &info); ZEPHIR_UNREF(&_5$$5); zephir_check_call_status(); break; @@ -182,7 +164,8 @@ zend_object *zephir_init_properties_Stub_Properties_PropertyArray(zend_class_ent ZVAL_UNDEF(&_3$$4); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); { zval local_this_ptr, *this_ptr = &local_this_ptr; diff --git a/ext/stub/properties/propertyarray.zep.h b/ext/stub/properties/propertyarray.zep.h index 652ea134aa..c9e5276bea 100644 --- a/ext/stub/properties/propertyarray.zep.h +++ b/ext/stub/properties/propertyarray.zep.h @@ -31,22 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_propertyarray_zephir_init_propert ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_propertyarray_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PropertyArray, __construct, arginfo_stub_properties_propertyarray___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Properties_PropertyArray, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Properties_PropertyArray, __construct, arginfo_stub_properties_propertyarray___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Properties_PropertyArray, appendSome, arginfo_stub_properties_propertyarray_appendsome, ZEND_ACC_PUBLIC) PHP_ME(Stub_Properties_PropertyArray, setOtherArray, arginfo_stub_properties_propertyarray_setotherarray, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PropertyArray, getOtherArray, arginfo_stub_properties_propertyarray_getotherarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PropertyArray, getOtherArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PropertyArray, testIssues1831, arginfo_stub_properties_propertyarray_testissues1831, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PropertyArray, testIssues1831, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_PropertyArray, getOtherArray, arginfo_stub_properties_propertyarray_getotherarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PropertyArray, testIssues1831, arginfo_stub_properties_propertyarray_testissues1831, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/propertyupdate.zep.c b/ext/stub/properties/propertyupdate.zep.c index 3678955799..e7f318c90f 100644 --- a/ext/stub/properties/propertyupdate.zep.c +++ b/ext/stub/properties/propertyupdate.zep.c @@ -31,11 +31,10 @@ PHP_METHOD(Stub_Properties_PropertyUpdate, update1) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "aaa"); zephir_update_property_array_append(this_ptr, SL("p1"), &_0); diff --git a/ext/stub/properties/propertyupdate.zep.h b/ext/stub/properties/propertyupdate.zep.h index 3c4d182696..4275a18b13 100644 --- a/ext/stub/properties/propertyupdate.zep.h +++ b/ext/stub/properties/propertyupdate.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_propertyupdate_update1, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_propertyupdate_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PropertyUpdate, update1, arginfo_stub_properties_propertyupdate_update1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PropertyUpdate, update1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_PropertyUpdate, update1, arginfo_stub_properties_propertyupdate_update1, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/protectedproperties.zep.c b/ext/stub/properties/protectedproperties.zep.c index 820d70ae2b..11639eaad6 100644 --- a/ext/stub/properties/protectedproperties.zep.c +++ b/ext/stub/properties/protectedproperties.zep.c @@ -74,17 +74,10 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeVar) zval *this_ptr = getThis(); ZVAL_UNDEF(&someVar_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(someVar) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &someVar); - - zephir_update_property_zval(this_ptr, ZEND_STRL("someVar"), someVar); RETURN_THISW(); } @@ -93,9 +86,6 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeVar) */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeVar) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someVar"); } @@ -111,19 +101,13 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeArrayVar) zval *this_ptr = getThis(); ZVAL_UNDEF(&someArrayVar); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(someArrayVar) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &someArrayVar_param); zephir_get_arrval(&someArrayVar, someArrayVar_param); - - zephir_update_property_zval(this_ptr, ZEND_STRL("someArrayVar"), &someArrayVar); RETURN_THIS(); } @@ -133,9 +117,6 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeArrayVar) */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeArrayVar) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someArrayVar"); } @@ -145,9 +126,6 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeArrayVar) */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeNull) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someNull"); } @@ -161,17 +139,10 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeNull) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m); - - zephir_update_property_zval(this_ptr, ZEND_STRL("someNull"), param); } @@ -180,9 +151,6 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeNull) */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeNullInitial) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someNullInitial"); } @@ -192,9 +160,6 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeNullInitial) */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeFalse) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someFalse"); } @@ -204,9 +169,6 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeFalse) */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeTrue) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someTrue"); } @@ -216,9 +178,6 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeTrue) */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeInteger) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someInteger"); } @@ -228,9 +187,6 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeInteger) */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeDouble) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someDouble"); } @@ -240,9 +196,6 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeDouble) */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeString) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someString"); } @@ -255,7 +208,8 @@ zend_object *zephir_init_properties_Stub_Properties_ProtectedProperties(zend_cla ZVAL_UNDEF(&_1$$3); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); { zval local_this_ptr, *this_ptr = &local_this_ptr; diff --git a/ext/stub/properties/protectedproperties.zep.h b/ext/stub/properties/protectedproperties.zep.h index 7d18ddeec3..f99816ad31 100644 --- a/ext/stub/properties/protectedproperties.zep.h +++ b/ext/stub/properties/protectedproperties.zep.h @@ -61,48 +61,16 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_protectedproperties_method_entry) { PHP_ME(Stub_Properties_ProtectedProperties, setSomeVar, arginfo_stub_properties_protectedproperties_setsomevar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeVar, arginfo_stub_properties_protectedproperties_getsomevar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeVar, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_ProtectedProperties, getSomeVar, arginfo_stub_properties_protectedproperties_getsomevar, ZEND_ACC_PUBLIC) PHP_ME(Stub_Properties_ProtectedProperties, setSomeArrayVar, arginfo_stub_properties_protectedproperties_setsomearrayvar, ZEND_ACC_PUBLIC) PHP_ME(Stub_Properties_ProtectedProperties, getSomeArrayVar, arginfo_stub_properties_protectedproperties_getsomearrayvar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeNull, arginfo_stub_properties_protectedproperties_getsomenull, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeNull, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_ProtectedProperties, getSomeNull, arginfo_stub_properties_protectedproperties_getsomenull, ZEND_ACC_PUBLIC) PHP_ME(Stub_Properties_ProtectedProperties, setSomeNull, arginfo_stub_properties_protectedproperties_setsomenull, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeNullInitial, arginfo_stub_properties_protectedproperties_getsomenullinitial, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeNullInitial, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeFalse, arginfo_stub_properties_protectedproperties_getsomefalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeTrue, arginfo_stub_properties_protectedproperties_getsometrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeInteger, arginfo_stub_properties_protectedproperties_getsomeinteger, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeInteger, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeDouble, arginfo_stub_properties_protectedproperties_getsomedouble, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeDouble, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeString, arginfo_stub_properties_protectedproperties_getsomestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_ProtectedProperties, getSomeNullInitial, arginfo_stub_properties_protectedproperties_getsomenullinitial, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeFalse, arginfo_stub_properties_protectedproperties_getsomefalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeTrue, arginfo_stub_properties_protectedproperties_getsometrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeInteger, arginfo_stub_properties_protectedproperties_getsomeinteger, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeDouble, arginfo_stub_properties_protectedproperties_getsomedouble, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeString, arginfo_stub_properties_protectedproperties_getsomestring, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/publicproperties.zep.c b/ext/stub/properties/publicproperties.zep.c index 81bae5e641..8d79f41965 100644 --- a/ext/stub/properties/publicproperties.zep.c +++ b/ext/stub/properties/publicproperties.zep.c @@ -83,26 +83,16 @@ PHP_METHOD(Stub_Properties_PublicProperties, setSomeGetterSetterArray) zval *this_ptr = getThis(); ZVAL_UNDEF(&someGetterSetterArray_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(someGetterSetterArray) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &someGetterSetterArray); - - zephir_update_property_zval(this_ptr, ZEND_STRL("someGetterSetterArray"), someGetterSetterArray); RETURN_THISW(); } PHP_METHOD(Stub_Properties_PublicProperties, getSomeGetterSetterArray) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someGetterSetterArray"); } @@ -114,11 +104,10 @@ PHP_METHOD(Stub_Properties_PublicProperties, test394Issue) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_property(&_0, this_ptr, ZEND_STRL("someTrue"), PH_NOISY_CC); RETURN_CCTOR(&_0); } @@ -142,7 +131,8 @@ zend_object *zephir_init_properties_Stub_Properties_PublicProperties(zend_class_ ZVAL_UNDEF(&_8$$6); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); { zval local_this_ptr, *this_ptr = &local_this_ptr; diff --git a/ext/stub/properties/publicproperties.zep.h b/ext/stub/properties/publicproperties.zep.h index 59b09e0ffd..d4003232ea 100644 --- a/ext/stub/properties/publicproperties.zep.h +++ b/ext/stub/properties/publicproperties.zep.h @@ -23,15 +23,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_publicproperties_method_entry) { PHP_ME(Stub_Properties_PublicProperties, setSomeGetterSetterArray, arginfo_stub_properties_publicproperties_setsomegettersetterarray, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PublicProperties, getSomeGetterSetterArray, arginfo_stub_properties_publicproperties_getsomegettersetterarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PublicProperties, getSomeGetterSetterArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PublicProperties, test394Issue, arginfo_stub_properties_publicproperties_test394issue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PublicProperties, test394Issue, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_PublicProperties, getSomeGetterSetterArray, arginfo_stub_properties_publicproperties_getsomegettersetterarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PublicProperties, test394Issue, arginfo_stub_properties_publicproperties_test394issue, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/staticprivateproperties.zep.c b/ext/stub/properties/staticprivateproperties.zep.c index 857f63f907..b2a370da66 100644 --- a/ext/stub/properties/staticprivateproperties.zep.c +++ b/ext/stub/properties/staticprivateproperties.zep.c @@ -30,15 +30,13 @@ PHP_METHOD(Stub_Properties_StaticPrivateProperties, getInstance) zval localInstance, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&localInstance); ZVAL_UNDEF(&_0); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(&localInstance); + zephir_memory_observe(&localInstance); zephir_read_static_property_ce(&localInstance, stub_properties_staticprivateproperties_ce, SL("instance"), PH_NOISY_CC); if (UNEXPECTED(Z_TYPE_P(&localInstance) != IS_OBJECT)) { ZEPHIR_INIT_NVAR(&localInstance); diff --git a/ext/stub/properties/staticpropertyarray.zep.c b/ext/stub/properties/staticpropertyarray.zep.c index fa67a27f60..9a3947ef41 100644 --- a/ext/stub/properties/staticpropertyarray.zep.c +++ b/ext/stub/properties/staticpropertyarray.zep.c @@ -43,9 +43,8 @@ void zephir_init_static_properties_Stub_Properties_StaticPropertyArray() zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); zephir_create_array(&_0, 4, 0); diff --git a/ext/stub/properties/staticprotectedproperties.zep.c b/ext/stub/properties/staticprotectedproperties.zep.c index 0b3a75a4be..5d8c45021f 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.c +++ b/ext/stub/properties/staticprotectedproperties.zep.c @@ -59,26 +59,16 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, setSomeVar) zval *this_ptr = getThis(); ZVAL_UNDEF(&someVar_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(someVar) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &someVar); - - zephir_update_property_zval(this_ptr, ZEND_STRL("someVar"), someVar); RETURN_THISW(); } PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeVar) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "someVar"); } @@ -86,12 +76,8 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeVar) PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeNull) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someNull"), PH_NOISY_CC | PH_READONLY); RETURN_CTORW(&_0); } @@ -99,32 +85,20 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeNull) PHP_METHOD(Stub_Properties_StaticProtectedProperties, setSomeNull) { zval *param, param_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶m); - - zephir_update_static_property_ce(stub_properties_staticprotectedproperties_ce, ZEND_STRL("someNull"), param); } PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeNullInitial) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someNullInitial"), PH_NOISY_CC | PH_READONLY); RETURN_CTORW(&_0); } @@ -132,12 +106,8 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeNullInitial) PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeFalse) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someFalse"), PH_NOISY_CC | PH_READONLY); RETURN_CTORW(&_0); } @@ -145,12 +115,8 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeFalse) PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeTrue) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someTrue"), PH_NOISY_CC | PH_READONLY); RETURN_CTORW(&_0); } @@ -158,12 +124,8 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeTrue) PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeInteger) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someInteger"), PH_NOISY_CC | PH_READONLY); RETURN_CTORW(&_0); } @@ -171,12 +133,8 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeInteger) PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeDouble) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someDouble"), PH_NOISY_CC | PH_READONLY); RETURN_CTORW(&_0); } @@ -184,12 +142,8 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeDouble) PHP_METHOD(Stub_Properties_StaticProtectedProperties, getSomeString) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someString"), PH_NOISY_CC | PH_READONLY); RETURN_CTORW(&_0); } @@ -201,15 +155,13 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, compareStaticNull) { zval someNull, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&someNull); ZVAL_UNDEF(&_0); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someNull"), PH_NOISY_CC); ZEPHIR_CPY_WRT(&someNull, &_0); if (Z_TYPE_P(&someNull) == IS_NULL) { diff --git a/ext/stub/properties/staticprotectedproperties.zep.h b/ext/stub/properties/staticprotectedproperties.zep.h index 05205678d4..da3a02ca05 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.h +++ b/ext/stub/properties/staticprotectedproperties.zep.h @@ -52,47 +52,15 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_staticprotectedproperties_method_entry) { PHP_ME(Stub_Properties_StaticProtectedProperties, setSomeVar, arginfo_stub_properties_staticprotectedproperties_setsomevar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeVar, arginfo_stub_properties_staticprotectedproperties_getsomevar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNull, arginfo_stub_properties_staticprotectedproperties_getsomenull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNull, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeVar, arginfo_stub_properties_staticprotectedproperties_getsomevar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNull, arginfo_stub_properties_staticprotectedproperties_getsomenull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Properties_StaticProtectedProperties, setSomeNull, arginfo_stub_properties_staticprotectedproperties_setsomenull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNullInitial, arginfo_stub_properties_staticprotectedproperties_getsomenullinitial, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNullInitial, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeFalse, arginfo_stub_properties_staticprotectedproperties_getsomefalse, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeFalse, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeTrue, arginfo_stub_properties_staticprotectedproperties_getsometrue, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeTrue, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeInteger, arginfo_stub_properties_staticprotectedproperties_getsomeinteger, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeInteger, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeDouble, arginfo_stub_properties_staticprotectedproperties_getsomedouble, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeDouble, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeString, arginfo_stub_properties_staticprotectedproperties_getsomestring, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNullInitial, arginfo_stub_properties_staticprotectedproperties_getsomenullinitial, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeFalse, arginfo_stub_properties_staticprotectedproperties_getsomefalse, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeTrue, arginfo_stub_properties_staticprotectedproperties_getsometrue, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeInteger, arginfo_stub_properties_staticprotectedproperties_getsomeinteger, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeDouble, arginfo_stub_properties_staticprotectedproperties_getsomedouble, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeString, arginfo_stub_properties_staticprotectedproperties_getsomestring, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Properties_StaticProtectedProperties, compareStaticNull, arginfo_stub_properties_staticprotectedproperties_comparestaticnull, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/staticpublicproperties.zep.c b/ext/stub/properties/staticpublicproperties.zep.c index bc1f220b5d..ddddcccb63 100644 --- a/ext/stub/properties/staticpublicproperties.zep.c +++ b/ext/stub/properties/staticpublicproperties.zep.c @@ -56,36 +56,24 @@ ZEPHIR_INIT_CLASS(Stub_Properties_StaticPublicProperties) PHP_METHOD(Stub_Properties_StaticPublicProperties, setSomeString) { zval *val, val_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val); - - zephir_update_static_property_ce(stub_properties_staticpublicproperties_ce, ZEND_STRL("someString"), val); } PHP_METHOD(Stub_Properties_StaticPublicProperties, testAddAndSub) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_add_static_property_ce(stub_properties_staticpublicproperties_ce, ZEND_STRL("someAdd"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 1); zephir_sub_static_property_ce(stub_properties_staticpublicproperties_ce, ZEND_STRL("someSub"), &_0); } @@ -94,12 +82,10 @@ PHP_METHOD(Stub_Properties_StaticPublicProperties, testAddAndSub2) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); @@ -115,16 +101,12 @@ PHP_METHOD(Stub_Properties_StaticPublicProperties, testAddAndSub2) PHP_METHOD(Stub_Properties_StaticPublicProperties, testAddAndSub3) { zval _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_DOUBLE(&_0, 1.0); zephir_add_static_property_ce(stub_properties_staticpublicproperties_ce, ZEND_STRL("someAdd"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_DOUBLE(&_0, 1.0); zephir_sub_static_property_ce(stub_properties_staticpublicproperties_ce, ZEND_STRL("someSub"), &_0); } @@ -133,17 +115,13 @@ PHP_METHOD(Stub_Properties_StaticPublicProperties, testAddAndSub4) { zval _0; zend_long v = 0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - v = 1; - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, v); zephir_add_static_property_ce(stub_properties_staticpublicproperties_ce, ZEND_STRL("someAdd"), &_0); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, v); zephir_sub_static_property_ce(stub_properties_staticpublicproperties_ce, ZEND_STRL("someSub"), &_0); } @@ -152,12 +130,10 @@ PHP_METHOD(Stub_Properties_StaticPublicProperties, testAddAndSub5) { zval v; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&v); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&v); ZVAL_STRING(&v, "1"); diff --git a/ext/stub/properties/staticpublicproperties.zep.h b/ext/stub/properties/staticpublicproperties.zep.h index 446af459fb..002b5d1190 100644 --- a/ext/stub/properties/staticpublicproperties.zep.h +++ b/ext/stub/properties/staticpublicproperties.zep.h @@ -31,30 +31,10 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_staticpublicproperties_method_entry) { PHP_ME(Stub_Properties_StaticPublicProperties, setSomeString, arginfo_stub_properties_staticpublicproperties_setsomestring, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub, arginfo_stub_properties_staticpublicproperties_testaddandsub, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub2, arginfo_stub_properties_staticpublicproperties_testaddandsub2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub2, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub3, arginfo_stub_properties_staticpublicproperties_testaddandsub3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub3, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub4, arginfo_stub_properties_staticpublicproperties_testaddandsub4, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub4, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub5, arginfo_stub_properties_staticpublicproperties_testaddandsub5, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub5, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub, arginfo_stub_properties_staticpublicproperties_testaddandsub, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub2, arginfo_stub_properties_staticpublicproperties_testaddandsub2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub3, arginfo_stub_properties_staticpublicproperties_testaddandsub3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub4, arginfo_stub_properties_staticpublicproperties_testaddandsub4, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub5, arginfo_stub_properties_staticpublicproperties_testaddandsub5, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/ext/stub/quantum.zep.c b/ext/stub/quantum.zep.c index 945b36df41..4c3c966001 100644 --- a/ext/stub/quantum.zep.c +++ b/ext/stub/quantum.zep.c @@ -40,7 +40,6 @@ PHP_METHOD(Stub_Quantum, harmos) zend_long ZEPHIR_LAST_CALL_STATUS, i = 0, j = 0, n = 0, _13, _14, _16$$5, _17$$5, _35$$5, _36$$5; zval *x_param = NULL, psr, psi, p2, v, paramater, fp, tmp, _0, _1, _2$$4, _3$$4, _4$$4, _6$$4, _7$$4, _9$$4, _18$$6, _19$$6, _20$$6, _21$$6, _22$$6, _23$$6, _24$$6, _25$$6, _26$$6, _27$$6, _28$$6, _29$$6, _30$$6, _31$$6, _32$$6, _33$$6, _37$$7, _38$$7, _39$$7, _40$$7, _41$$7, _42$$7, _43$$7, _44$$7, _45$$7, _46$$7, _47$$7, _48$$7, _49$$7, _51$$9, _52$$9, _53$$9, _54$$9, _56$$8, _57$$10, _58$$10, _59$$10; double x, dt = 0, dx = 0, k0 = 0, item_psr = 0, item_psi = 0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&psr); ZVAL_UNDEF(&psi); @@ -97,22 +96,16 @@ PHP_METHOD(Stub_Quantum, harmos) ZVAL_UNDEF(&_8$$4); ZVAL_UNDEF(&_10$$4); ZVAL_UNDEF(&_11$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &x_param); x = zephir_get_doubleval(x_param); - - - dx = 0.02; - k0 = (3.0 * 3.14159265358979323846); - dt = zephir_safe_div_double_long((dx * dx), 4.0); + dx = (0.02); + k0 = ((3.0 * 3.14159265358979323846)); + dt = (zephir_safe_div_double_long((dx * dx), 4.0)); ZEPHIR_INIT_VAR(¶mater); zephir_create_array(¶mater, 4, 0); ZEPHIR_INIT_VAR(&_0); @@ -140,7 +133,7 @@ PHP_METHOD(Stub_Quantum, harmos) ZVAL_STRING(&_0, "harmos.txt"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "w"); - ZEPHIR_CALL_FUNCTION(&fp, "fopen", NULL, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&fp, "fopen", NULL, 33, &_0, &_1); zephir_check_call_status(); if (!(zephir_is_true(&fp))) { RETURN_MM_LONG(1); @@ -153,12 +146,12 @@ PHP_METHOD(Stub_Quantum, harmos) ZVAL_DOUBLE(&_3$$4, ((x * x) * 2.0)); ZEPHIR_CALL_FUNCTION(&_4$$4, "exp", &_5, 2, &_3$$4); zephir_check_call_status(); - item_psi = zephir_safe_div_double_zval(sin((k0 * x)), &_4$$4); + item_psi = (zephir_safe_div_double_zval(sin((k0 * x)), &_4$$4)); ZVAL_DOUBLE(&_3$$4, (k0 * x)); ZVAL_DOUBLE(&_6$$4, ((x * x) * 2.0)); ZEPHIR_CALL_FUNCTION(&_7$$4, "exp", &_5, 2, &_6$$4); zephir_check_call_status(); - item_psr = zephir_safe_div_double_zval(cos((k0 * x)), &_7$$4); + item_psr = (zephir_safe_div_double_zval(cos((k0 * x)), &_7$$4)); ZEPHIR_INIT_NVAR(&_8$$4); zephir_create_array(&_8$$4, 1, 0); ZEPHIR_INIT_NVAR(&_9$$4); @@ -177,7 +170,7 @@ PHP_METHOD(Stub_Quantum, harmos) ZVAL_DOUBLE(&_9$$4, (double) ((double) (5.0 * x) * x)); zephir_array_fast_append(&_11$$4, &_9$$4); zephir_array_update_long(&v, i, &_11$$4, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); - x = (x + dx); + x = ((x + dx)); i++; } i = 1; @@ -345,13 +338,13 @@ PHP_METHOD(Stub_Quantum, harmos) ZVAL_STRING(&_52$$9, "%16.8lf %16.8lf %16.8lf \n"); ZVAL_DOUBLE(&_53$$9, ((double) i * dx)); ZVAL_DOUBLE(&_54$$9, ((double) n * dt)); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 77, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 80, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); zephir_check_call_status(); i = (i + 10); } ZEPHIR_INIT_NVAR(&_56$$8); ZVAL_STRING(&_56$$8, "\n"); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 77, &fp, &_56$$8); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 80, &fp, &_56$$8); zephir_check_call_status(); } j = 1; diff --git a/ext/stub/range.zep.c b/ext/stub/range.zep.c index 09122154a1..6a620c55ec 100644 --- a/ext/stub/range.zep.c +++ b/ext/stub/range.zep.c @@ -34,19 +34,17 @@ PHP_METHOD(Stub_Range, inclusive1) zval _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 78, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 81, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); @@ -58,19 +56,17 @@ PHP_METHOD(Stub_Range, exclusive1) zval _0, _1, _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 78, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 81, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); diff --git a/ext/stub/range.zep.h b/ext/stub/range.zep.h index 7fdad5e842..b90e1ba2fb 100644 --- a/ext/stub/range.zep.h +++ b/ext/stub/range.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_range_exclusive1, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_range_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Range, inclusive1, arginfo_stub_range_inclusive1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Range, inclusive1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Range, exclusive1, arginfo_stub_range_exclusive1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Range, exclusive1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Range, inclusive1, arginfo_stub_range_inclusive1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Range, exclusive1, arginfo_stub_range_exclusive1, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/references.zep.c b/ext/stub/references.zep.c index 2a15316e50..0b44f87f72 100644 --- a/ext/stub/references.zep.c +++ b/ext/stub/references.zep.c @@ -24,9 +24,6 @@ ZEPHIR_INIT_CLASS(Stub_References) PHP_METHOD(Stub_References, assignByRef) { - zval *this_ptr = getThis(); - - } diff --git a/ext/stub/references.zep.h b/ext/stub/references.zep.h index b4c5d4d063..a3817ddfaf 100644 --- a/ext/stub/references.zep.h +++ b/ext/stub/references.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_references_assignbyref, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_references_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_References, assignByRef, arginfo_stub_references_assignbyref, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_References, assignByRef, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_References, assignByRef, arginfo_stub_references_assignbyref, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/reflection.zep.c b/ext/stub/reflection.zep.c index 2421e1f393..9e212d3da8 100644 --- a/ext/stub/reflection.zep.c +++ b/ext/stub/reflection.zep.c @@ -33,13 +33,12 @@ PHP_METHOD(Stub_Reflection, getReflectionClass) zval *this_ptr = getThis(); ZVAL_UNDEF(&r); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&r); object_init_ex(&r, zephir_get_internal_ce(SL("reflectionclass"))); - ZEPHIR_CALL_METHOD(NULL, &r, "__construct", NULL, 79, this_ptr); + ZEPHIR_CALL_METHOD(NULL, &r, "__construct", NULL, 82, this_ptr); zephir_check_call_status(); RETURN_CCTOR(&r); } @@ -49,19 +48,17 @@ PHP_METHOD(Stub_Reflection, getReflectionFunction) zval r, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&r); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&r); object_init_ex(&r, zephir_get_internal_ce(SL("reflectionfunction"))); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "abs"); - ZEPHIR_CALL_METHOD(NULL, &r, "__construct", NULL, 80, &_0); + ZEPHIR_CALL_METHOD(NULL, &r, "__construct", NULL, 83, &_0); zephir_check_call_status(); RETURN_CCTOR(&r); } @@ -72,26 +69,16 @@ PHP_METHOD(Stub_Reflection, setReflectionParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(¶meter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(parameter, zephir_get_internal_ce(SL("reflectionparameter"))) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, ¶meter); - - zephir_update_property_zval(this_ptr, ZEND_STRL("reflectionParameter"), parameter); RETURN_MEMBER(getThis(), "reflectionParameter"); } PHP_METHOD(Stub_Reflection, getReflectionParameter) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "reflectionParameter"); } diff --git a/ext/stub/regexdna.zep.c b/ext/stub/regexdna.zep.c index 5b386f0a97..fba938b101 100644 --- a/ext/stub/regexdna.zep.c +++ b/ext/stub/regexdna.zep.c @@ -39,7 +39,6 @@ PHP_METHOD(Stub_RegexDNA, process) zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; zval *path, path_sub, variants, vIUB, vIUBnew, stuffToRemove, contents, initialLength, regex, codeLength, discard, _0, _1, _2, *_4, _5, _6$$3, _7$$3, _8$$4, _9$$4; - zval *this_ptr = getThis(); ZVAL_UNDEF(&path_sub); ZVAL_UNDEF(&variants); @@ -59,18 +58,12 @@ PHP_METHOD(Stub_RegexDNA, process) ZVAL_UNDEF(&_7$$3); ZVAL_UNDEF(&_8$$4); ZVAL_UNDEF(&_9$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(path) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &path); - - ZEPHIR_INIT_VAR(&discard); ZVAL_NULL(&discard); ZEPHIR_INIT_VAR(&variants); @@ -184,7 +177,7 @@ PHP_METHOD(Stub_RegexDNA, process) ZEPHIR_CONCAT_SVS(&_1, "/", &stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, ""); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 73, &_1, &_0, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 76, &_1, &_0, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); ZEPHIR_INIT_VAR(&codeLength); @@ -228,7 +221,7 @@ PHP_METHOD(Stub_RegexDNA, process) } } ZEPHIR_INIT_NVAR(®ex); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 73, &vIUB, &vIUBnew, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 76, &vIUB, &vIUBnew, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); php_printf("%c", '\n'); diff --git a/ext/stub/requires.zep.c b/ext/stub/requires.zep.c index 87549b16ad..3932f8b87b 100644 --- a/ext/stub/requires.zep.c +++ b/ext/stub/requires.zep.c @@ -33,22 +33,15 @@ PHP_METHOD(Stub_Requires, requireExternal1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *path, path_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&path_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(path) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &path); - - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&_0); if (zephir_require_zval_ret(&_0, path) == FAILURE) { RETURN_MM_NULL(); @@ -59,20 +52,12 @@ PHP_METHOD(Stub_Requires, requireExternal1) PHP_METHOD(Stub_Requires, requireExternal2) { zval *path, path_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&path_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(path) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &path); - - if (zephir_require_zval(path) == FAILURE) { RETURN_NULL(); } @@ -89,18 +74,12 @@ PHP_METHOD(Stub_Requires, requireExternal3) ZVAL_UNDEF(&path_sub); ZVAL_UNDEF(&external3); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(path) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &path); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CREATE_SYMBOL_TABLE(); @@ -111,7 +90,7 @@ PHP_METHOD(Stub_Requires, requireExternal3) zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 81, path, this_ptr); + ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 84, path, this_ptr); zephir_check_call_status(); RETURN_MM_MEMBER(getThis(), "content"); } @@ -122,17 +101,10 @@ PHP_METHOD(Stub_Requires, setContent) zval *this_ptr = getThis(); ZVAL_UNDEF(&content_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(content) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &content); - - zephir_update_property_zval(this_ptr, ZEND_STRL("content"), content); } @@ -144,7 +116,6 @@ PHP_METHOD(Stub_Requires, renderTemplate) zend_long ZEPHIR_LAST_CALL_STATUS; zval *templatePath_param = NULL, *params, params_sub, _0, key, value, _7, *_1$$3, _2$$3, _5$$4, _6$$5; zval templatePath; - zval *this_ptr = getThis(); ZVAL_UNDEF(&templatePath); ZVAL_UNDEF(¶ms_sub); @@ -155,16 +126,12 @@ PHP_METHOD(Stub_Requires, renderTemplate) ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_5$$4); ZVAL_UNDEF(&_6$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(templatePath) Z_PARAM_ZVAL(params) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &templatePath_param, ¶ms); if (UNEXPECTED(Z_TYPE_P(templatePath_param) != IS_STRING && Z_TYPE_P(templatePath_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'templatePath' must be of the type string")); @@ -175,8 +142,6 @@ PHP_METHOD(Stub_Requires, renderTemplate) } else { ZEPHIR_INIT_VAR(&templatePath); } - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CREATE_SYMBOL_TABLE(); @@ -234,23 +199,16 @@ PHP_METHOD(Stub_Requires, requireOnce) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *path_param = NULL, _0; zval path; - zval *this_ptr = getThis(); ZVAL_UNDEF(&path); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(path) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &path_param); zephir_get_strval(&path, path_param); - - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&_0); if (zephir_require_once_zval_ret(&_0, &path) == FAILURE) { RETURN_MM_NULL(); diff --git a/ext/stub/requires/external3.zep.c b/ext/stub/requires/external3.zep.c index a3b08e842d..f694653d28 100644 --- a/ext/stub/requires/external3.zep.c +++ b/ext/stub/requires/external3.zep.c @@ -34,30 +34,23 @@ PHP_METHOD(Stub_Requires_External3, req) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *path, path_sub, *requires, requires_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&path_sub); ZVAL_UNDEF(&requires_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(path) Z_PARAM_ZVAL(requires) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &path, &requires); - - - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 82); + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 85); zephir_check_call_status(); if (zephir_require_zval(path) == FAILURE) { RETURN_MM_NULL(); } - ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 83); + ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 86); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, requires, "setcontent", NULL, 0, &_0); zephir_check_call_status(); diff --git a/ext/stub/resourcetest.zep.c b/ext/stub/resourcetest.zep.c index a224eef3b5..8e02c752fa 100644 --- a/ext/stub/resourcetest.zep.c +++ b/ext/stub/resourcetest.zep.c @@ -28,12 +28,10 @@ PHP_METHOD(Stub_ResourceTest, testLetStatementSTDIN) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZEPHIR_GET_CONSTANT(&a, "STDIN"); @@ -44,12 +42,10 @@ PHP_METHOD(Stub_ResourceTest, testLetStatementSTDOUT) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZEPHIR_GET_CONSTANT(&a, "STDOUT"); @@ -60,12 +56,10 @@ PHP_METHOD(Stub_ResourceTest, testLetStatementSTDERR) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZEPHIR_GET_CONSTANT(&a, "STDERR"); @@ -76,13 +70,11 @@ PHP_METHOD(Stub_ResourceTest, testTypeOffResource) { zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZEPHIR_GET_CONSTANT(&a, "STDIN"); @@ -95,12 +87,10 @@ PHP_METHOD(Stub_ResourceTest, testIsResource) { zval a; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZEPHIR_GET_CONSTANT(&a, "STDIN"); @@ -112,18 +102,16 @@ PHP_METHOD(Stub_ResourceTest, testFunctionsForSTDIN) zval a, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZEPHIR_GET_CONSTANT(&a, "STDIN"); ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 84, &a, &_0); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 87, &a, &_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } diff --git a/ext/stub/resourcetest.zep.h b/ext/stub/resourcetest.zep.h index 58f3a9622b..b44eaa804c 100644 --- a/ext/stub/resourcetest.zep.h +++ b/ext/stub/resourcetest.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_resourcetest_testfunctionsforstdin, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_resourcetest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testLetStatementSTDIN, arginfo_stub_resourcetest_testletstatementstdin, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testLetStatementSTDIN, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testLetStatementSTDOUT, arginfo_stub_resourcetest_testletstatementstdout, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testLetStatementSTDOUT, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testLetStatementSTDERR, arginfo_stub_resourcetest_testletstatementstderr, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testLetStatementSTDERR, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testTypeOffResource, arginfo_stub_resourcetest_testtypeoffresource, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testTypeOffResource, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testIsResource, arginfo_stub_resourcetest_testisresource, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testIsResource, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testFunctionsForSTDIN, arginfo_stub_resourcetest_testfunctionsforstdin, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testFunctionsForSTDIN, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ResourceTest, testLetStatementSTDIN, arginfo_stub_resourcetest_testletstatementstdin, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testLetStatementSTDOUT, arginfo_stub_resourcetest_testletstatementstdout, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testLetStatementSTDERR, arginfo_stub_resourcetest_testletstatementstderr, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testTypeOffResource, arginfo_stub_resourcetest_testtypeoffresource, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testIsResource, arginfo_stub_resourcetest_testisresource, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testFunctionsForSTDIN, arginfo_stub_resourcetest_testfunctionsforstdin, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/returns.zep.c b/ext/stub/returns.zep.c index 8b309060fd..3f9667bdcf 100644 --- a/ext/stub/returns.zep.c +++ b/ext/stub/returns.zep.c @@ -26,36 +26,24 @@ ZEPHIR_INIT_CLASS(Stub_Returns) PHP_METHOD(Stub_Returns, testReturnCast1) { - zval *this_ptr = getThis(); - - RETURN_LONG((int) 5.0); } PHP_METHOD(Stub_Returns, testReturnCast2) { - zval *this_ptr = getThis(); - - RETURN_LONG(1); } PHP_METHOD(Stub_Returns, testReturnCast3) { - zval *this_ptr = getThis(); - - RETURN_LONG(0); } PHP_METHOD(Stub_Returns, testReturnCast4) { - zval *this_ptr = getThis(); - - if (1) { RETURN_LONG(1); @@ -69,30 +57,20 @@ PHP_METHOD(Stub_Returns, returnWithParameter) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *parameter_param = NULL; zval parameter; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶meter); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, ¶meter_param); zephir_get_strval(¶meter, parameter_param); - - RETURN_MM_STRING("Return back"); } PHP_METHOD(Stub_Returns, returnWithoutParameter) { - zval *this_ptr = getThis(); - - RETURN_STRING("Return back"); } diff --git a/ext/stub/returns.zep.h b/ext/stub/returns.zep.h index 3d5dd2d644..02a7f82bc7 100644 --- a/ext/stub/returns.zep.h +++ b/ext/stub/returns.zep.h @@ -35,10 +35,6 @@ ZEPHIR_INIT_FUNCS(stub_returns_method_entry) { PHP_ME(Stub_Returns, testReturnCast3, arginfo_stub_returns_testreturncast3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Returns, testReturnCast4, arginfo_stub_returns_testreturncast4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Returns, returnWithParameter, arginfo_stub_returns_returnwithparameter, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Returns, returnWithoutParameter, arginfo_stub_returns_returnwithoutparameter, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Returns, returnWithoutParameter, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Returns, returnWithoutParameter, arginfo_stub_returns_returnwithoutparameter, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/ext/stub/router.zep.c b/ext/stub/router.zep.c index 9edea335b4..b5e2954eea 100644 --- a/ext/stub/router.zep.c +++ b/ext/stub/router.zep.c @@ -99,24 +99,17 @@ PHP_METHOD(Stub_Router, __construct) ZVAL_UNDEF(&_5$$3); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_4$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(defaultRoutes) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &defaultRoutes_param); if (!defaultRoutes_param) { defaultRoutes = 1; } else { - defaultRoutes = zephir_get_boolval(defaultRoutes_param); - } - - + } ZEPHIR_INIT_VAR(&routes); array_init(&routes); if (defaultRoutes == 1) { @@ -127,7 +120,7 @@ PHP_METHOD(Stub_Router, __construct) add_assoc_long_ex(&_1$$3, SL("controller"), 1); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "#^/([a-zA-Z0-9\\_\\-]+)[/]{0,1}$#"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 85, &_2$$3, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 88, &_2$$3, &_1$$3); zephir_check_call_status(); zephir_array_append(&routes, &_0$$3, PH_SEPARATE, "stub/router.zep", 89); ZEPHIR_INIT_NVAR(&_2$$3); @@ -139,7 +132,7 @@ PHP_METHOD(Stub_Router, __construct) add_assoc_long_ex(&_4$$3, SL("params"), 3); ZEPHIR_INIT_VAR(&_5$$3); ZVAL_STRING(&_5$$3, "#^/([a-zA-Z0-9\\_\\-]+)/([a-zA-Z0-9\\.\\_]+)(/.*)*$#"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 85, &_5$$3, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 88, &_5$$3, &_4$$3); zephir_check_call_status(); zephir_array_append(&routes, &_2$$3, PH_SEPARATE, "stub/router.zep", 95); } @@ -161,17 +154,10 @@ PHP_METHOD(Stub_Router, setDI) zval *this_ptr = getThis(); ZVAL_UNDEF(&dependencyInjector_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(dependencyInjector, stub_diinterface_ce) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &dependencyInjector); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_dependencyInjector"), dependencyInjector); } @@ -182,9 +168,6 @@ PHP_METHOD(Stub_Router, setDI) */ PHP_METHOD(Stub_Router, getDI) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_dependencyInjector"); } @@ -206,15 +189,14 @@ PHP_METHOD(Stub_Router, getRewriteUri) ZVAL_UNDEF(&urlParts); ZVAL_UNDEF(&realUri); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_get_global(&_SERVER, SL("_SERVER")); zephir_get_global(&_GET, SL("_GET")); zephir_read_property(&_0, this_ptr, ZEND_STRL("_uriSource"), PH_NOISY_CC | PH_READONLY); if (!(zephir_is_true(&_0))) { - ZEPHIR_OBS_VAR(&url); + zephir_memory_observe(&url); if (zephir_array_isset_string_fetch(&url, &_GET, SL("_url"), 0)) { if (!(zephir_is_true(&url))) { RETURN_CCTOR(&url); @@ -250,17 +232,10 @@ PHP_METHOD(Stub_Router, setUriSource) zval *this_ptr = getThis(); ZVAL_UNDEF(&uriSource_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(uriSource) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &uriSource); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_uriSource"), uriSource); RETURN_THISW(); } @@ -277,17 +252,10 @@ PHP_METHOD(Stub_Router, removeExtraSlashes) zval *this_ptr = getThis(); ZVAL_UNDEF(&remove_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(remove) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &remove); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_removeExtraSlashes"), remove); RETURN_THISW(); } @@ -304,17 +272,10 @@ PHP_METHOD(Stub_Router, setDefaultNamespace) zval *this_ptr = getThis(); ZVAL_UNDEF(&namespaceName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(namespaceName) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &namespaceName); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_defaultNamespace"), namespaceName); RETURN_THISW(); } @@ -331,17 +292,10 @@ PHP_METHOD(Stub_Router, setDefaultModule) zval *this_ptr = getThis(); ZVAL_UNDEF(&moduleName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(moduleName) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &moduleName); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_defaultModule"), moduleName); RETURN_THISW(); } @@ -358,17 +312,10 @@ PHP_METHOD(Stub_Router, setDefaultController) zval *this_ptr = getThis(); ZVAL_UNDEF(&controllerName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(controllerName) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &controllerName); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_defaultController"), controllerName); RETURN_THISW(); } @@ -385,17 +332,10 @@ PHP_METHOD(Stub_Router, setDefaultAction) zval *this_ptr = getThis(); ZVAL_UNDEF(&actionName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(actionName) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &actionName); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_defaultAction"), actionName); RETURN_THISW(); } @@ -425,17 +365,10 @@ PHP_METHOD(Stub_Router, setDefaults) ZVAL_UNDEF(&controller); ZVAL_UNDEF(&action); ZVAL_UNDEF(¶ms); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(defaults) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &defaults); - - if (Z_TYPE_P(defaults) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(stub_router_exception_ce, "Defaults must be an array", "stub/router.zep", 246); return; @@ -464,20 +397,12 @@ PHP_METHOD(Stub_Router, setDefaults) PHP_METHOD(Stub_Router, doRemoveExtraSlashes) { zval *route, route_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&route_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(route) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &route); - - RETVAL_ZVAL(route, 1, 0); return; } @@ -562,23 +487,18 @@ PHP_METHOD(Stub_Router, handle) ZVAL_UNDEF(&_29$$96); ZVAL_UNDEF(&_30$$96); ZVAL_UNDEF(&_31$$96); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(uri) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &uri); if (!uri) { uri = &uri_sub; uri = &__$null; } - - if (!(zephir_is_true(uri))) { ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); zephir_check_call_status(); @@ -952,7 +872,7 @@ PHP_METHOD(Stub_Router, handle) } } if (!(zephir_is_true(&routeFound))) { - ZEPHIR_OBS_VAR(¬FoundPaths); + zephir_memory_observe(¬FoundPaths); zephir_read_property(¬FoundPaths, this_ptr, ZEND_STRL("_notFoundPaths"), PH_NOISY_CC); if (Z_TYPE_P(¬FoundPaths) != IS_NULL) { ZEPHIR_CPY_WRT(&parts, ¬FoundPaths); @@ -961,7 +881,7 @@ PHP_METHOD(Stub_Router, handle) } } if (zephir_is_true(&routeFound)) { - ZEPHIR_OBS_VAR(&vnamespace); + zephir_memory_observe(&vnamespace); if (zephir_array_isset_string_fetch(&vnamespace, &parts, SL("namespace"), 0)) { if (!(zephir_is_numeric(&vnamespace))) { zephir_update_property_zval(this_ptr, ZEND_STRL("_namespace"), &vnamespace); @@ -971,7 +891,7 @@ PHP_METHOD(Stub_Router, handle) zephir_read_property(&_22$$82, this_ptr, ZEND_STRL("_defaultNamespace"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("_namespace"), &_22$$82); } - ZEPHIR_OBS_VAR(&module); + zephir_memory_observe(&module); if (zephir_array_isset_string_fetch(&module, &parts, SL("module"), 0)) { if (!(zephir_is_numeric(&module))) { zephir_update_property_zval(this_ptr, ZEND_STRL("_module"), &module); @@ -981,7 +901,7 @@ PHP_METHOD(Stub_Router, handle) zephir_read_property(&_23$$85, this_ptr, ZEND_STRL("_defaultModule"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("_module"), &_23$$85); } - ZEPHIR_OBS_VAR(&controller); + zephir_memory_observe(&controller); if (zephir_array_isset_string_fetch(&controller, &parts, SL("controller"), 0)) { if (!(zephir_is_numeric(&controller))) { zephir_update_property_zval(this_ptr, ZEND_STRL("_controller"), &controller); @@ -991,7 +911,7 @@ PHP_METHOD(Stub_Router, handle) zephir_read_property(&_24$$88, this_ptr, ZEND_STRL("_defaultController"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("_controller"), &_24$$88); } - ZEPHIR_OBS_VAR(&action); + zephir_memory_observe(&action); if (zephir_array_isset_string_fetch(&action, &parts, SL("action"), 0)) { if (!(zephir_is_numeric(&action))) { zephir_update_property_zval(this_ptr, ZEND_STRL("_action"), &action); @@ -1001,7 +921,7 @@ PHP_METHOD(Stub_Router, handle) zephir_read_property(&_25$$91, this_ptr, ZEND_STRL("_defaultAction"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("_action"), &_25$$91); } - ZEPHIR_OBS_VAR(¶msStr); + zephir_memory_observe(¶msStr); if (zephir_array_isset_string_fetch(¶msStr, &parts, SL("params"), 0)) { ZVAL_LONG(&_26$$92, 1); ZEPHIR_INIT_VAR(&strParams); @@ -1058,7 +978,6 @@ PHP_METHOD(Stub_Router, add) ZVAL_UNDEF(&httpMethods_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&route); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_ZVAL(pattern) @@ -1066,10 +985,8 @@ PHP_METHOD(Stub_Router, add) Z_PARAM_ZVAL_OR_NULL(paths) Z_PARAM_ZVAL_OR_NULL(httpMethods) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 2, &pattern, &paths, &httpMethods); if (!paths) { paths = &paths_sub; @@ -1079,11 +996,9 @@ PHP_METHOD(Stub_Router, add) httpMethods = &httpMethods_sub; httpMethods = &__$null; } - - ZEPHIR_INIT_VAR(&route); object_init_ex(&route, stub_router_route_ce); - ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 85, pattern, paths, httpMethods); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 88, pattern, paths, httpMethods); zephir_check_call_status(); zephir_update_property_array_append(this_ptr, SL("_routes"), &route); RETURN_CCTOR(&route); @@ -1107,24 +1022,19 @@ PHP_METHOD(Stub_Router, addGet) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &pattern, &paths); if (!paths) { paths = &paths_sub; paths = &__$null; } - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "GET"); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, pattern, paths, &_0); @@ -1150,24 +1060,19 @@ PHP_METHOD(Stub_Router, addPost) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &pattern, &paths); if (!paths) { paths = &paths_sub; paths = &__$null; } - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "POST"); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, pattern, paths, &_0); @@ -1193,24 +1098,19 @@ PHP_METHOD(Stub_Router, addPut) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &pattern, &paths); if (!paths) { paths = &paths_sub; paths = &__$null; } - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "PUT"); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, pattern, paths, &_0); @@ -1236,24 +1136,19 @@ PHP_METHOD(Stub_Router, addPatch) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &pattern, &paths); if (!paths) { paths = &paths_sub; paths = &__$null; } - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "PATCH"); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, pattern, paths, &_0); @@ -1279,24 +1174,19 @@ PHP_METHOD(Stub_Router, addDelete) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &pattern, &paths); if (!paths) { paths = &paths_sub; paths = &__$null; } - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "DELETE"); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, pattern, paths, &_0); @@ -1322,24 +1212,19 @@ PHP_METHOD(Stub_Router, addOptions) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &pattern, &paths); if (!paths) { paths = &paths_sub; paths = &__$null; } - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "OPTIONS"); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, pattern, paths, &_0); @@ -1365,24 +1250,19 @@ PHP_METHOD(Stub_Router, addHead) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &pattern, &paths); if (!paths) { paths = &paths_sub; paths = &__$null; } - - ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "HEAD"); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "add", NULL, 0, pattern, paths, &_0); @@ -1412,18 +1292,12 @@ PHP_METHOD(Stub_Router, mount) ZVAL_UNDEF(&_1$$5); ZVAL_UNDEF(&_3$$8); ZVAL_UNDEF(&_4$$11); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(group) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &group); - - if (Z_TYPE_P(group) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(stub_router_exception_ce, "The group of routes is not valid", "stub/router.zep", 677); return; @@ -1496,7 +1370,7 @@ PHP_METHOD(Stub_Router, mount) } ZEPHIR_INIT_NVAR(&route); } - ZEPHIR_OBS_VAR(&routes); + zephir_memory_observe(&routes); zephir_read_property(&routes, this_ptr, ZEND_STRL("_routes"), PH_NOISY_CC); if (Z_TYPE_P(&routes) == IS_ARRAY) { ZEPHIR_INIT_VAR(&_4$$11); @@ -1520,17 +1394,10 @@ PHP_METHOD(Stub_Router, notFound) zval *this_ptr = getThis(); ZVAL_UNDEF(&paths_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &paths); - - if (Z_TYPE_P(paths) != IS_ARRAY) { if (Z_TYPE_P(paths) != IS_STRING) { ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(stub_router_exception_ce, "The not-found paths must be an array or string", "stub/router.zep", 724); @@ -1551,9 +1418,8 @@ PHP_METHOD(Stub_Router, clear) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); @@ -1568,9 +1434,6 @@ PHP_METHOD(Stub_Router, clear) */ PHP_METHOD(Stub_Router, getNamespaceName) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_namespace"); } @@ -1582,9 +1445,6 @@ PHP_METHOD(Stub_Router, getNamespaceName) */ PHP_METHOD(Stub_Router, getModuleName) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_module"); } @@ -1596,9 +1456,6 @@ PHP_METHOD(Stub_Router, getModuleName) */ PHP_METHOD(Stub_Router, getControllerName) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_controller"); } @@ -1610,9 +1467,6 @@ PHP_METHOD(Stub_Router, getControllerName) */ PHP_METHOD(Stub_Router, getActionName) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_action"); } @@ -1624,9 +1478,6 @@ PHP_METHOD(Stub_Router, getActionName) */ PHP_METHOD(Stub_Router, getParams) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_params"); } @@ -1638,9 +1489,6 @@ PHP_METHOD(Stub_Router, getParams) */ PHP_METHOD(Stub_Router, getMatchedRoute) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_matchedRoute"); } @@ -1652,9 +1500,6 @@ PHP_METHOD(Stub_Router, getMatchedRoute) */ PHP_METHOD(Stub_Router, getMatches) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_matches"); } @@ -1666,9 +1511,6 @@ PHP_METHOD(Stub_Router, getMatches) */ PHP_METHOD(Stub_Router, wasMatched) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_wasMatched"); } @@ -1680,9 +1522,6 @@ PHP_METHOD(Stub_Router, wasMatched) */ PHP_METHOD(Stub_Router, getRoutes) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_routes"); } @@ -1706,18 +1545,12 @@ PHP_METHOD(Stub_Router, getRouteById) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(id) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &id); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("_routes"), PH_NOISY_CC | PH_READONLY); zephir_is_iterable(&_0, 0, "stub/router.zep", 844); if (Z_TYPE_P(&_0) == IS_ARRAY) { @@ -1774,18 +1607,12 @@ PHP_METHOD(Stub_Router, getRouteByName) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &name); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("_routes"), PH_NOISY_CC | PH_READONLY); zephir_is_iterable(&_0, 0, "stub/router.zep", 862); if (Z_TYPE_P(&_0) == IS_ARRAY) { diff --git a/ext/stub/router.zep.h b/ext/stub/router.zep.h index 0cff207b84..e7cda4f79d 100644 --- a/ext/stub/router.zep.h +++ b/ext/stub/router.zep.h @@ -179,16 +179,8 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_router_method_entry) { PHP_ME(Stub_Router, __construct, arginfo_stub_router___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Router, setDI, arginfo_stub_router_setdi, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getDI, arginfo_stub_router_getdi, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getDI, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getRewriteUri, arginfo_stub_router_getrewriteuri, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getRewriteUri, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router, getDI, arginfo_stub_router_getdi, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getRewriteUri, arginfo_stub_router_getrewriteuri, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, setUriSource, arginfo_stub_router_seturisource, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, removeExtraSlashes, arginfo_stub_router_removeextraslashes, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, setDefaultNamespace, arginfo_stub_router_setdefaultnamespace, ZEND_ACC_PUBLIC) @@ -208,56 +200,16 @@ ZEPHIR_INIT_FUNCS(stub_router_method_entry) { PHP_ME(Stub_Router, addHead, arginfo_stub_router_addhead, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, mount, arginfo_stub_router_mount, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, notFound, arginfo_stub_router_notfound, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, clear, arginfo_stub_router_clear, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, clear, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getNamespaceName, arginfo_stub_router_getnamespacename, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getNamespaceName, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getModuleName, arginfo_stub_router_getmodulename, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getModuleName, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getControllerName, arginfo_stub_router_getcontrollername, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getControllerName, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getActionName, arginfo_stub_router_getactionname, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getActionName, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getParams, arginfo_stub_router_getparams, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getParams, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getMatchedRoute, arginfo_stub_router_getmatchedroute, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getMatchedRoute, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getMatches, arginfo_stub_router_getmatches, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getMatches, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, wasMatched, arginfo_stub_router_wasmatched, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, wasMatched, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getRoutes, arginfo_stub_router_getroutes, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getRoutes, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router, clear, arginfo_stub_router_clear, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getNamespaceName, arginfo_stub_router_getnamespacename, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getModuleName, arginfo_stub_router_getmodulename, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getControllerName, arginfo_stub_router_getcontrollername, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getActionName, arginfo_stub_router_getactionname, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getParams, arginfo_stub_router_getparams, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getMatchedRoute, arginfo_stub_router_getmatchedroute, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getMatches, arginfo_stub_router_getmatches, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, wasMatched, arginfo_stub_router_wasmatched, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getRoutes, arginfo_stub_router_getroutes, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, getRouteById, arginfo_stub_router_getroutebyid, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, getRouteByName, arginfo_stub_router_getroutebyname, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/router/route.zep.c b/ext/stub/router/route.zep.c index e5f4af8a24..fb33f7447f 100644 --- a/ext/stub/router/route.zep.c +++ b/ext/stub/router/route.zep.c @@ -61,7 +61,6 @@ PHP_METHOD(Stub_Router_Route, __construct) ZVAL_UNDEF(&paths_sub); ZVAL_UNDEF(&httpMethods_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_ZVAL(pattern) @@ -69,10 +68,8 @@ PHP_METHOD(Stub_Router_Route, __construct) Z_PARAM_ZVAL_OR_NULL(paths) Z_PARAM_ZVAL_OR_NULL(httpMethods) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 2, &pattern, &paths, &httpMethods); if (!paths) { paths = &paths_sub; @@ -82,8 +79,6 @@ PHP_METHOD(Stub_Router_Route, __construct) httpMethods = &httpMethods_sub; httpMethods = &__$null; } - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "reconfigure", NULL, 0, pattern, paths); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("_methods"), httpMethods); @@ -100,7 +95,6 @@ PHP_METHOD(Stub_Router_Route, compilePattern) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *pattern = NULL, pattern_sub, idPattern, _0$$4, _1$$4, _2$$5, _3$$5, _4$$6, _5$$6, _6$$7, _7$$7, _8$$8, _9$$8, _10$$8, _11$$9, _12$$9, _13$$9; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern_sub); ZVAL_UNDEF(&idPattern); @@ -118,19 +112,13 @@ PHP_METHOD(Stub_Router_Route, compilePattern) ZVAL_UNDEF(&_11$$9); ZVAL_UNDEF(&_12$$9); ZVAL_UNDEF(&_13$$9); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(pattern) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &pattern); ZEPHIR_SEPARATE_PARAM(pattern); - - if (zephir_memnstr_str(pattern, SL(":"), "stub/router/route.zep", 56)) { ZEPHIR_INIT_VAR(&idPattern); ZVAL_STRING(&idPattern, "/([a-zA-Z0-9\\_\\-]+)"); @@ -210,17 +198,10 @@ PHP_METHOD(Stub_Router_Route, via) zval *this_ptr = getThis(); ZVAL_UNDEF(&httpMethods_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(httpMethods) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &httpMethods); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_methods"), httpMethods); RETURN_THISW(); } @@ -239,7 +220,6 @@ PHP_METHOD(Stub_Router_Route, extractNamedParams) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *pattern_param = NULL, matches, _1$$11, _2$$11, _3$$11, _18$$16, _19$$16, _20$$16, _22$$16, _23$$16, _27$$19, _28$$28; zval pattern, route, item, variable, regexp, _4$$11, _21$$16, _24$$16, _29$$29; - zval *this_ptr = getThis(); ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&route); @@ -261,19 +241,13 @@ PHP_METHOD(Stub_Router_Route, extractNamedParams) ZVAL_UNDEF(&_23$$16); ZVAL_UNDEF(&_27$$19); ZVAL_UNDEF(&_28$$28); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(pattern) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &pattern_param); zephir_get_strval(&pattern, pattern_param); - - notValid = 0; bracketCount = 0; parenthesesCount = 0; @@ -493,24 +467,19 @@ PHP_METHOD(Stub_Router_Route, reConfigure) ZVAL_UNDEF(&_1$$10); ZVAL_UNDEF(&_2$$19); ZVAL_UNDEF(&_3$$19); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &pattern, &paths); if (!paths) { paths = &paths_sub; paths = &__$null; } - - if (Z_TYPE_P(pattern) != IS_STRING) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(stub_router_exception_ce, "The pattern must be string", "stub/router/route.zep", 270); return; @@ -568,7 +537,7 @@ PHP_METHOD(Stub_Router_Route, reConfigure) ZEPHIR_CPY_WRT(&realClassName, &controllerName); } ZEPHIR_INIT_VAR(&_1$$10); - zephir_uncamelize(&_1$$10, &realClassName, NULL ); + zephir_uncamelize(&_1$$10, &realClassName, NULL ); zephir_array_update_string(&routePaths, SL("controller"), &_1$$10, PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(&actionName) != IS_NULL) { @@ -589,7 +558,7 @@ PHP_METHOD(Stub_Router_Route, reConfigure) if (zephir_memnstr_str(pattern, SL("{"), "stub/router/route.zep", 348)) { ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); zephir_check_call_status(); - ZEPHIR_OBS_VAR(&pcrePattern); + zephir_memory_observe(&pcrePattern); zephir_array_fetch_long(&pcrePattern, &extracted, 0, PH_NOISY, "stub/router/route.zep", 351); ZEPHIR_INIT_VAR(&_2$$19); zephir_array_fetch_long(&_3$$19, &extracted, 1, PH_NOISY | PH_READONLY, "stub/router/route.zep", 352); @@ -616,9 +585,6 @@ PHP_METHOD(Stub_Router_Route, reConfigure) */ PHP_METHOD(Stub_Router_Route, getName) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_name"); } @@ -641,17 +607,10 @@ PHP_METHOD(Stub_Router_Route, setName) zval *this_ptr = getThis(); ZVAL_UNDEF(&name_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(name) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &name); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_name"), name); RETURN_THISW(); } @@ -670,17 +629,10 @@ PHP_METHOD(Stub_Router_Route, beforeMatch) zval *this_ptr = getThis(); ZVAL_UNDEF(&callback_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(callback) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &callback); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_beforeMatch"), callback); RETURN_THISW(); } @@ -692,9 +644,6 @@ PHP_METHOD(Stub_Router_Route, beforeMatch) */ PHP_METHOD(Stub_Router_Route, getBeforeMatch) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_beforeMatch"); } @@ -706,9 +655,6 @@ PHP_METHOD(Stub_Router_Route, getBeforeMatch) */ PHP_METHOD(Stub_Router_Route, getRouteId) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_id"); } @@ -720,9 +666,6 @@ PHP_METHOD(Stub_Router_Route, getRouteId) */ PHP_METHOD(Stub_Router_Route, getPattern) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_pattern"); } @@ -734,9 +677,6 @@ PHP_METHOD(Stub_Router_Route, getPattern) */ PHP_METHOD(Stub_Router_Route, getCompiledPattern) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_compiledPattern"); } @@ -748,9 +688,6 @@ PHP_METHOD(Stub_Router_Route, getCompiledPattern) */ PHP_METHOD(Stub_Router_Route, getPaths) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_paths"); } @@ -774,9 +711,8 @@ PHP_METHOD(Stub_Router_Route, getReversedPaths) ZVAL_UNDEF(&position); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&reversed); array_init(&reversed); @@ -835,17 +771,10 @@ PHP_METHOD(Stub_Router_Route, setHttpMethods) zval *this_ptr = getThis(); ZVAL_UNDEF(&httpMethods_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(httpMethods) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &httpMethods); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_methods"), httpMethods); RETURN_THISW(); } @@ -857,9 +786,6 @@ PHP_METHOD(Stub_Router_Route, setHttpMethods) */ PHP_METHOD(Stub_Router_Route, getHttpMethods) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_methods"); } @@ -880,17 +806,10 @@ PHP_METHOD(Stub_Router_Route, setHostname) zval *this_ptr = getThis(); ZVAL_UNDEF(&hostname_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(hostname) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &hostname); - - zephir_update_property_zval(this_ptr, ZEND_STRL("_hostname"), hostname); RETURN_THISW(); } @@ -902,9 +821,6 @@ PHP_METHOD(Stub_Router_Route, setHostname) */ PHP_METHOD(Stub_Router_Route, getHostname) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_hostname"); } @@ -923,18 +839,11 @@ PHP_METHOD(Stub_Router_Route, convert) ZVAL_UNDEF(&name_sub); ZVAL_UNDEF(&converter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(name) Z_PARAM_ZVAL(converter) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &name, &converter); - - zephir_update_property_array(this_ptr, SL("_converters"), name, converter); RETURN_THISW(); } @@ -946,9 +855,6 @@ PHP_METHOD(Stub_Router_Route, convert) */ PHP_METHOD(Stub_Router_Route, getConverters) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "_converters"); } diff --git a/ext/stub/router/route.zep.h b/ext/stub/router/route.zep.h index a55bc0e79c..50a7eecf16 100644 --- a/ext/stub/router/route.zep.h +++ b/ext/stub/router/route.zep.h @@ -104,60 +104,20 @@ ZEPHIR_INIT_FUNCS(stub_router_route_method_entry) { PHP_ME(Stub_Router_Route, via, arginfo_stub_router_route_via, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, extractNamedParams, arginfo_stub_router_route_extractnamedparams, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, reConfigure, arginfo_stub_router_route_reconfigure, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getName, arginfo_stub_router_route_getname, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getName, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getName, arginfo_stub_router_route_getname, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, setName, arginfo_stub_router_route_setname, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, beforeMatch, arginfo_stub_router_route_beforematch, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getBeforeMatch, arginfo_stub_router_route_getbeforematch, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getBeforeMatch, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getRouteId, arginfo_stub_router_route_getrouteid, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getRouteId, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getPattern, arginfo_stub_router_route_getpattern, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getPattern, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getCompiledPattern, arginfo_stub_router_route_getcompiledpattern, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getCompiledPattern, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getPaths, arginfo_stub_router_route_getpaths, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getPaths, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getReversedPaths, arginfo_stub_router_route_getreversedpaths, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getReversedPaths, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getBeforeMatch, arginfo_stub_router_route_getbeforematch, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getRouteId, arginfo_stub_router_route_getrouteid, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getPattern, arginfo_stub_router_route_getpattern, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getCompiledPattern, arginfo_stub_router_route_getcompiledpattern, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getPaths, arginfo_stub_router_route_getpaths, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getReversedPaths, arginfo_stub_router_route_getreversedpaths, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, setHttpMethods, arginfo_stub_router_route_sethttpmethods, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getHttpMethods, arginfo_stub_router_route_gethttpmethods, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getHttpMethods, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getHttpMethods, arginfo_stub_router_route_gethttpmethods, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, setHostname, arginfo_stub_router_route_sethostname, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getHostname, arginfo_stub_router_route_gethostname, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getHostname, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getHostname, arginfo_stub_router_route_gethostname, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, convert, arginfo_stub_router_route_convert, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getConverters, arginfo_stub_router_route_getconverters, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getConverters, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getConverters, arginfo_stub_router_route_getconverters, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/scall.zep.c b/ext/stub/scall.zep.c index 679703f473..1ca54d6405 100644 --- a/ext/stub/scall.zep.c +++ b/ext/stub/scall.zep.c @@ -30,27 +30,18 @@ ZEPHIR_INIT_CLASS(Stub_Scall) PHP_METHOD(Stub_Scall, testMethod1) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello public"); } PHP_METHOD(Stub_Scall, testMethod2) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello protected"); } PHP_METHOD(Stub_Scall, testMethod3) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello private"); } @@ -58,22 +49,14 @@ PHP_METHOD(Stub_Scall, testMethod3) PHP_METHOD(Stub_Scall, testMethod4) { zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - zephir_add_function(return_value, a, b); return; } @@ -81,22 +64,14 @@ PHP_METHOD(Stub_Scall, testMethod4) PHP_METHOD(Stub_Scall, testMethod5) { zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - zephir_add_function(return_value, a, b); return; } @@ -104,31 +79,20 @@ PHP_METHOD(Stub_Scall, testMethod5) PHP_METHOD(Stub_Scall, testMethod6) { zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); - - zephir_add_function(return_value, a, b); return; } PHP_METHOD(Stub_Scall, testMethod7) { - zval *this_ptr = getThis(); - - object_init(return_value); return; @@ -138,11 +102,8 @@ PHP_METHOD(Stub_Scall, testCall1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_SELF("testmethod1", NULL, 0); zephir_check_call_status(); @@ -153,11 +114,8 @@ PHP_METHOD(Stub_Scall, testCall2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_SELF("testmethod2", NULL, 0); zephir_check_call_status(); @@ -169,13 +127,10 @@ PHP_METHOD(Stub_Scall, testCall3) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 86); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 89); zephir_check_call_status(); RETURN_MM(); } @@ -185,23 +140,16 @@ PHP_METHOD(Stub_Scall, testCall4) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_RETURN_CALL_SELF("testmethod4", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); @@ -212,23 +160,16 @@ PHP_METHOD(Stub_Scall, testCall5) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_RETURN_CALL_SELF("testmethod5", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); @@ -240,24 +181,17 @@ PHP_METHOD(Stub_Scall, testCall6) zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL; zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 87, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 90, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -266,11 +200,8 @@ PHP_METHOD(Stub_Scall, testCall7) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_SELF("testmethod1", NULL, 0); zephir_check_call_status(); @@ -281,11 +212,8 @@ PHP_METHOD(Stub_Scall, testCall8) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_SELF("testmethod2", NULL, 0); zephir_check_call_status(); @@ -297,13 +225,10 @@ PHP_METHOD(Stub_Scall, testCall9) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 86); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 89); zephir_check_call_status(); RETURN_MM(); } @@ -313,23 +238,16 @@ PHP_METHOD(Stub_Scall, testCall10) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_RETURN_CALL_SELF("testmethod4", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); @@ -340,23 +258,16 @@ PHP_METHOD(Stub_Scall, testCall11) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - ZEPHIR_RETURN_CALL_SELF("testmethod5", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); @@ -368,24 +279,17 @@ PHP_METHOD(Stub_Scall, testCall12) zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL; zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 87, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 90, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -394,14 +298,10 @@ PHP_METHOD(Stub_Scall, testCall13) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_PARENT(stub_scall_ce, getThis(), "testmethod1", &_0, 0); + ZEPHIR_RETURN_CALL_PARENT(stub_scall_ce, getThis(), "testmethod1", NULL, 0); zephir_check_call_status(); RETURN_MM(); } @@ -410,14 +310,10 @@ PHP_METHOD(Stub_Scall, testCall14) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_PARENT(stub_scall_ce, getThis(), "testmethod2", &_0, 0); + ZEPHIR_RETURN_CALL_PARENT(stub_scall_ce, getThis(), "testmethod2", NULL, 0); zephir_check_call_status(); RETURN_MM(); } @@ -426,11 +322,8 @@ PHP_METHOD(Stub_Scall, testCall15) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_SELF("testmethod7", NULL, 0); zephir_check_call_status(); @@ -441,22 +334,12 @@ PHP_METHOD(Stub_Scall, testMethod16) { zval *a_param = NULL, *b_param = NULL; long a, b; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - RETURN_LONG((a + b)); } @@ -468,24 +351,16 @@ PHP_METHOD(Stub_Scall, testCall17) zephir_fcall_cache_entry *_4 = NULL; zval *k_param = NULL, *p, p_sub, _3$$3; long k, i = 0, j, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&p_sub); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(k) Z_PARAM_ZVAL(p) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &k_param, &p); - k = zephir_get_intval(k_param); - - j = 0; _2 = k; _1 = 1; @@ -517,24 +392,16 @@ PHP_METHOD(Stub_Scall, testCall18) zephir_fcall_cache_entry *_4 = NULL; zval *k_param = NULL, *p, p_sub, _3$$3; long k, i = 0, j, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&p_sub); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(k) Z_PARAM_ZVAL(p) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &k_param, &p); - k = zephir_get_intval(k_param); - - j = 0; _2 = k; _1 = 1; @@ -560,9 +427,6 @@ PHP_METHOD(Stub_Scall, testCall18) PHP_METHOD(Stub_Scall, testMethodStatic) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello Scall"); } @@ -573,13 +437,11 @@ PHP_METHOD(Stub_Scall, interpolatedStaticReturn) zval className, methodName; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&className); ZVAL_UNDEF(&methodName); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&className); ZVAL_STRING(&className, "Stub\\Scall"); @@ -598,14 +460,12 @@ PHP_METHOD(Stub_Scall, interpolatedStaticEcho) zval className, methodName; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&className); ZVAL_UNDEF(&methodName); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&className); ZVAL_STRING(&className, "Stub\\Scall"); diff --git a/ext/stub/scall.zep.h b/ext/stub/scall.zep.h index e9a61d09bc..f339923fa0 100644 --- a/ext/stub/scall.zep.h +++ b/ext/stub/scall.zep.h @@ -148,57 +148,21 @@ ZEPHIR_INIT_FUNCS(stub_scall_method_entry) { PHP_ME(Stub_Scall, testMethod5, arginfo_stub_scall_testmethod5, ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) PHP_ME(Stub_Scall, testMethod6, arginfo_stub_scall_testmethod6, ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) PHP_ME(Stub_Scall, testMethod7, arginfo_stub_scall_testmethod7, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall1, arginfo_stub_scall_testcall1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall2, arginfo_stub_scall_testcall2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall3, arginfo_stub_scall_testcall3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Scall, testCall1, arginfo_stub_scall_testcall1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall2, arginfo_stub_scall_testcall2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall3, arginfo_stub_scall_testcall3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall4, arginfo_stub_scall_testcall4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall5, arginfo_stub_scall_testcall5, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall6, arginfo_stub_scall_testcall6, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall7, arginfo_stub_scall_testcall7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall8, arginfo_stub_scall_testcall8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall9, arginfo_stub_scall_testcall9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall9, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Scall, testCall7, arginfo_stub_scall_testcall7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall8, arginfo_stub_scall_testcall8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall9, arginfo_stub_scall_testcall9, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall10, arginfo_stub_scall_testcall10, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall11, arginfo_stub_scall_testcall11, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall12, arginfo_stub_scall_testcall12, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall13, arginfo_stub_scall_testcall13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall14, arginfo_stub_scall_testcall14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall15, arginfo_stub_scall_testcall15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall15, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Scall, testCall13, arginfo_stub_scall_testcall13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall14, arginfo_stub_scall_testcall14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall15, arginfo_stub_scall_testcall15, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testMethod16, arginfo_stub_scall_testmethod16, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Scall, testCall17, arginfo_stub_scall_testcall17, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Scall, testCall18, arginfo_stub_scall_testcall18, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) diff --git a/ext/stub/scalldynamic.zep.c b/ext/stub/scalldynamic.zep.c index 2317b8aa05..060377c920 100644 --- a/ext/stub/scalldynamic.zep.c +++ b/ext/stub/scalldynamic.zep.c @@ -29,27 +29,18 @@ ZEPHIR_INIT_CLASS(Stub_ScallDynamic) PHP_METHOD(Stub_ScallDynamic, testMethod1) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello public"); } PHP_METHOD(Stub_ScallDynamic, testMethod2) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello protected"); } PHP_METHOD(Stub_ScallDynamic, testMethod3) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello private"); } @@ -58,20 +49,12 @@ PHP_METHOD(Stub_ScallDynamic, selfDynamicCall1) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *methodName, methodName_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&methodName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(methodName) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &methodName); - - return; } diff --git a/ext/stub/scallexternal.zep.c b/ext/stub/scallexternal.zep.c index 1a4fb76a47..323a281bcb 100644 --- a/ext/stub/scallexternal.zep.c +++ b/ext/stub/scallexternal.zep.c @@ -33,14 +33,10 @@ PHP_METHOD(Stub_ScallExternal, testCall1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_CE_STATIC(stub_scall_ce, "testmethod1", &_0, 0); + ZEPHIR_RETURN_CALL_CE_STATIC(stub_scall_ce, "testmethod1", NULL, 0); zephir_check_call_status(); RETURN_MM(); } @@ -49,26 +45,18 @@ PHP_METHOD(Stub_ScallExternal, testCall2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *a, a_sub, *b, b_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &b); - - - ZEPHIR_RETURN_CALL_CE_STATIC(stub_scall_ce, "testmethod4", &_0, 0, a, b); + ZEPHIR_RETURN_CALL_CE_STATIC(stub_scall_ce, "testmethod4", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -77,22 +65,12 @@ PHP_METHOD(Stub_ScallExternal, testMethod3) { zval *a_param = NULL, *b_param = NULL; long a, b; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); - a = zephir_get_intval(a_param); - b = zephir_get_intval(b_param); - - RETURN_LONG((a + b)); } diff --git a/ext/stub/scallexternal.zep.h b/ext/stub/scallexternal.zep.h index ca8217a5af..4082998035 100644 --- a/ext/stub/scallexternal.zep.h +++ b/ext/stub/scallexternal.zep.h @@ -21,11 +21,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_scallexternal_testmethod3, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_scallexternal_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ScallExternal, testCall1, arginfo_stub_scallexternal_testcall1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ScallExternal, testCall1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ScallExternal, testCall1, arginfo_stub_scallexternal_testcall1, ZEND_ACC_PUBLIC) PHP_ME(Stub_ScallExternal, testCall2, arginfo_stub_scallexternal_testcall2, ZEND_ACC_PUBLIC) PHP_ME(Stub_ScallExternal, testMethod3, arginfo_stub_scallexternal_testmethod3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END diff --git a/ext/stub/scalllateconstruct.zep.c b/ext/stub/scalllateconstruct.zep.c index 1d9862e771..34f091a45b 100644 --- a/ext/stub/scalllateconstruct.zep.c +++ b/ext/stub/scalllateconstruct.zep.c @@ -33,10 +33,8 @@ PHP_METHOD(Stub_ScallLateConstruct, __construct) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_CALL_METHOD(NULL, this_ptr, "testpublicinit", NULL, 0); zephir_check_call_status(); @@ -45,9 +43,6 @@ PHP_METHOD(Stub_ScallLateConstruct, __construct) PHP_METHOD(Stub_ScallLateConstruct, testStaticInit) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello public"); } @@ -60,9 +55,8 @@ PHP_METHOD(Stub_ScallLateConstruct, testPublicInit) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_CALL_SELF(&_0, "teststaticinit", NULL, 0); zephir_check_call_status(); @@ -72,9 +66,6 @@ PHP_METHOD(Stub_ScallLateConstruct, testPublicInit) PHP_METHOD(Stub_ScallLateConstruct, varValue) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "protectedVar"); } diff --git a/ext/stub/scalllateconstruct.zep.h b/ext/stub/scalllateconstruct.zep.h index 4c8a480459..78bc84d2b8 100644 --- a/ext/stub/scalllateconstruct.zep.h +++ b/ext/stub/scalllateconstruct.zep.h @@ -21,17 +21,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_scalllateconstruct_varvalue ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_scalllateconstruct_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ScallLateConstruct, __construct, arginfo_stub_scalllateconstruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_ScallLateConstruct, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_ScallLateConstruct, __construct, arginfo_stub_scalllateconstruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_ScallLateConstruct, testStaticInit, arginfo_stub_scalllateconstruct_teststaticinit, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ScallLateConstruct, testPublicInit, arginfo_stub_scalllateconstruct_testpublicinit, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ScallLateConstruct, testPublicInit, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ScallLateConstruct, testPublicInit, arginfo_stub_scalllateconstruct_testpublicinit, ZEND_ACC_PUBLIC) PHP_ME(Stub_ScallLateConstruct, varValue, arginfo_stub_scalllateconstruct_varvalue, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/scallparent.zep.c b/ext/stub/scallparent.zep.c index 7c8cbe9faa..020e853d70 100644 --- a/ext/stub/scallparent.zep.c +++ b/ext/stub/scallparent.zep.c @@ -29,18 +29,12 @@ ZEPHIR_INIT_CLASS(Stub_ScallParent) PHP_METHOD(Stub_ScallParent, testMethod1) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello parent public"); } PHP_METHOD(Stub_ScallParent, testMethod2) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello parent protected"); } @@ -49,11 +43,8 @@ PHP_METHOD(Stub_ScallParent, testCallStatic) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_RETURN_CALL_STATIC("testmethodstatic", NULL, 0); zephir_check_call_status(); @@ -62,9 +53,6 @@ PHP_METHOD(Stub_ScallParent, testCallStatic) PHP_METHOD(Stub_ScallParent, testMethodStatic) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello ScallParent"); } diff --git a/ext/stub/scope.zep.c b/ext/stub/scope.zep.c index f25467d03a..4d1e033ac0 100644 --- a/ext/stub/scope.zep.c +++ b/ext/stub/scope.zep.c @@ -29,9 +29,6 @@ ZEPHIR_INIT_CLASS(Stub_Scope) PHP_METHOD(Stub_Scope, getStr) { - zval *this_ptr = getThis(); - - RETURN_STRING("internal_string"); } @@ -41,22 +38,14 @@ PHP_METHOD(Stub_Scope, getDyStr) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *g_param = NULL, _0; zend_long g; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(g) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &g_param); - g = zephir_get_intval(g_param); - - ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, g); ZEPHIR_CONCAT_SV(return_value, "internal_", &_0); @@ -69,18 +58,16 @@ PHP_METHOD(Stub_Scope, test1) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, r; zephir_fcall_cache_entry *_0 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&ret); ZVAL_UNDEF(&k); ZVAL_UNDEF(&k$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&ret); ZVAL_STRING(&ret, ""); - ZEPHIR_CALL_SELF(&k, "getstr", &_0, 88); + ZEPHIR_CALL_SELF(&k, "getstr", &_0, 91); zephir_check_call_status(); r = 1; if (r == 1) { @@ -98,16 +85,14 @@ PHP_METHOD(Stub_Scope, test2) zval k, c, _5, _3$$3, _4$$3; zend_long p, _1, _2, p$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&k); ZVAL_UNDEF(&c); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); p = 15; ZEPHIR_INIT_VAR(&k); @@ -150,14 +135,12 @@ PHP_METHOD(Stub_Scope, test3) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, _1, _2; zephir_fcall_cache_entry *_3 = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&k); ZVAL_UNDEF(&c); ZVAL_UNDEF(&str$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&k); ZVAL_STRING(&k, ""); @@ -176,7 +159,7 @@ PHP_METHOD(Stub_Scope, test3) } ZEPHIR_INIT_NVAR(&c); ZVAL_LONG(&c, _1); - ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 89, &c); + ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 92, &c); zephir_check_call_status(); zephir_concat_self(&k, &str$$3); } diff --git a/ext/stub/scope.zep.h b/ext/stub/scope.zep.h index 5b4b68e810..87a825ae27 100644 --- a/ext/stub/scope.zep.h +++ b/ext/stub/scope.zep.h @@ -26,26 +26,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_scope_test3, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_scope_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scope, getStr, arginfo_stub_scope_getstr, ZEND_ACC_PRIVATE|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Scope, getStr, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Scope, getStr, arginfo_stub_scope_getstr, ZEND_ACC_PRIVATE|ZEND_ACC_STATIC) PHP_ME(Stub_Scope, getDyStr, arginfo_stub_scope_getdystr, ZEND_ACC_PRIVATE|ZEND_ACC_STATIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scope, test1, arginfo_stub_scope_test1, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Scope, test1, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scope, test2, arginfo_stub_scope_test2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Scope, test2, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scope, test3, arginfo_stub_scope_test3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Scope, test3, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Scope, test1, arginfo_stub_scope_test1, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Scope, test2, arginfo_stub_scope_test2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Scope, test3, arginfo_stub_scope_test3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/ext/stub/sort.zep.c b/ext/stub/sort.zep.c index 993f4dffc0..406ad82633 100644 --- a/ext/stub/sort.zep.c +++ b/ext/stub/sort.zep.c @@ -47,24 +47,18 @@ PHP_METHOD(Stub_Sort, quick) ZVAL_UNDEF(&_4$$4); ZVAL_UNDEF(&_5$$5); ZVAL_UNDEF(&_6$$6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(arr) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &arr_param); zephir_get_arrval(&arr, arr_param); - - length = zephir_fast_count_int(&arr); if (length <= 1) { RETURN_CTOR(&arr); } - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_array_fetch_long(&_0, &arr, 0, PH_NOISY, "stub/sort.zep", 18); pivot = zephir_get_intval(&_0); ZEPHIR_INIT_VAR(&left); @@ -99,16 +93,16 @@ PHP_METHOD(Stub_Sort, quick) } } } - ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 90, &left); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 93, &left); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9); zephir_create_array(&_9, 1, 0); ZEPHIR_INIT_VAR(&_10); ZVAL_LONG(&_10, pivot); zephir_array_fast_append(&_9, &_10); - ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 90, &right); + ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 93, &right); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 91, &_7, &_9, &_11); + ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 94, &_7, &_9, &_11); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/spectralnorm.zep.c b/ext/stub/spectralnorm.zep.c index b9f902de3b..3b306b0cb5 100644 --- a/ext/stub/spectralnorm.zep.c +++ b/ext/stub/spectralnorm.zep.c @@ -36,25 +36,18 @@ PHP_METHOD(Stub_SpectralNorm, Ax) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *i, i_sub, *j, j_sub, _0, _1; - zval *this_ptr = getThis(); ZVAL_UNDEF(&i_sub); ZVAL_UNDEF(&j_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(i) Z_PARAM_ZVAL(j) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &i, &j); - - ZEPHIR_INIT_VAR(&_0); zephir_add_function(&_0, i, j); ZEPHIR_INIT_VAR(&_1); @@ -80,21 +73,14 @@ PHP_METHOD(Stub_SpectralNorm, Au) ZVAL_UNDEF(&_8$$4); ZVAL_UNDEF(&_10$$4); ZVAL_UNDEF(&_12$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_LONG(n) Z_PARAM_OBJECT_OF_CLASS(u, spl_ce_SplFixedArray) Z_PARAM_OBJECT_OF_CLASS(v, spl_ce_SplFixedArray) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 3, 0, &n_param, &u, &v); - n = zephir_get_intval(n_param); - - _2 = (n - 1); _1 = 0; _0 = 0; @@ -126,7 +112,7 @@ PHP_METHOD(Stub_SpectralNorm, Au) j = _4$$3; ZVAL_LONG(&_7$$4, i); ZVAL_LONG(&_8$$4, j); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 92, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 95, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -163,21 +149,14 @@ PHP_METHOD(Stub_SpectralNorm, Atu) ZVAL_UNDEF(&_8$$4); ZVAL_UNDEF(&_10$$4); ZVAL_UNDEF(&_12$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_LONG(n) Z_PARAM_OBJECT_OF_CLASS(u, spl_ce_SplFixedArray) Z_PARAM_OBJECT_OF_CLASS(v, spl_ce_SplFixedArray) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 3, 0, &n_param, &u, &v); - n = zephir_get_intval(n_param); - - _2 = (n - 1); _1 = 0; _0 = 0; @@ -209,7 +188,7 @@ PHP_METHOD(Stub_SpectralNorm, Atu) j = _4$$3; ZVAL_LONG(&_7$$4, j); ZVAL_LONG(&_8$$4, i); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 92, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 95, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -239,24 +218,18 @@ PHP_METHOD(Stub_SpectralNorm, AtAu) ZVAL_UNDEF(&u_sub); ZVAL_UNDEF(&v_sub); ZVAL_UNDEF(&w_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(4, 4) Z_PARAM_ZVAL(n) Z_PARAM_ZVAL(u) Z_PARAM_ZVAL(v) Z_PARAM_ZVAL(w) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 4, 0, &n, &u, &v, &w); - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 93, n, u, w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 96, n, u, w); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 94, n, w, v); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 97, n, w, v); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -282,35 +255,28 @@ PHP_METHOD(Stub_SpectralNorm, process) ZVAL_UNDEF(&_18$$5); ZVAL_UNDEF(&_19$$5); ZVAL_UNDEF(&_20$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &n_param); - n = zephir_get_intval(n_param); - - vv = 0; vBv = 0; ZEPHIR_INIT_VAR(&u); object_init_ex(&u, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 95, &_0); + ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 98, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&v); object_init_ex(&v, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 95, &_0); + ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 98, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&w); object_init_ex(&w, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 95, &_0); + ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 98, &_0); zephir_check_call_status(); _3 = (n - 1); _2 = 0; @@ -328,15 +294,15 @@ PHP_METHOD(Stub_SpectralNorm, process) i = _2; ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 96, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 99, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 96, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 99, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 96, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 99, &_4$$3, &_5$$3); zephir_check_call_status(); } } @@ -355,10 +321,10 @@ PHP_METHOD(Stub_SpectralNorm, process) } i = _8; ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 97, &_10$$4, &u, &v, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 100, &_10$$4, &u, &v, &w); zephir_check_call_status(); ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 97, &_10$$4, &v, &u, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 100, &_10$$4, &v, &u, &w); zephir_check_call_status(); } } @@ -377,19 +343,19 @@ PHP_METHOD(Stub_SpectralNorm, process) } i = _13; ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 98, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 101, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 98, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 101, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_19$$5); mul_function(&_19$$5, &_15$$5, &_18$$5); vBv += zephir_get_numberval(&_19$$5); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 98, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 101, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 98, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 101, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_20$$5); mul_function(&_20$$5, &_15$$5, &_18$$5); diff --git a/ext/stub/spl.zep.c b/ext/stub/spl.zep.c index 070a9ca251..ed4c33e3d2 100644 --- a/ext/stub/spl.zep.c +++ b/ext/stub/spl.zep.c @@ -35,24 +35,17 @@ PHP_METHOD(Stub_Spl, issue1212) zend_long ZEPHIR_LAST_CALL_STATUS; zval *file_param = NULL; zval file; - zval *this_ptr = getThis(); ZVAL_UNDEF(&file); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(file) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &file_param); zephir_get_strval(&file, file_param); - - object_init_ex(return_value, spl_ce_SplFileObject); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 99, &file); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 102, &file); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/spropertyaccess.zep.c b/ext/stub/spropertyaccess.zep.c index a7f504409e..9694f7348c 100644 --- a/ext/stub/spropertyaccess.zep.c +++ b/ext/stub/spropertyaccess.zep.c @@ -42,18 +42,16 @@ PHP_METHOD(Stub_SPropertyAccess, __construct) { zval _0, _1, _2, _3, _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - - ZEPHIR_MM_GROW(); - - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "abc"); zephir_update_static_property_ce(stub_spropertyaccess_ce, ZEND_STRL("a"), &_0); @@ -63,7 +61,7 @@ PHP_METHOD(Stub_SPropertyAccess, __construct) ZEPHIR_INIT_VAR(&_3); zephir_substr(&_3, &_0, 0 , 1 , 0); zephir_update_static_property_ce(stub_spropertyaccess_ce, ZEND_STRL("b"), &_3); - ZEPHIR_OBS_VAR(&_4); + zephir_memory_observe(&_4); zephir_read_static_property_ce(&_4, stub_spropertyaccess_ce, SL("b"), PH_NOISY_CC); zephir_update_static_property_ce(stub_scallexternal_ce, ZEND_STRL("sproperty"), &_4); ZEPHIR_OBS_NVAR(&_4); @@ -76,20 +74,16 @@ PHP_METHOD(Stub_SPropertyAccess, testArgumentWithUnderscore) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *delimiter = NULL, delimiter_sub, __$null; - zval *this_ptr = getThis(); ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &delimiter); if (!delimiter) { delimiter = &delimiter_sub; @@ -97,8 +91,6 @@ PHP_METHOD(Stub_SPropertyAccess, testArgumentWithUnderscore) } else { ZEPHIR_SEPARATE_PARAM(delimiter); } - - if (ZEPHIR_IS_EMPTY(delimiter)) { ZEPHIR_OBS_NVAR(delimiter); zephir_read_static_property_ce(delimiter, stub_spropertyaccess_ce, SL("_delimiterWithUnderscore"), PH_NOISY_CC); @@ -111,21 +103,17 @@ PHP_METHOD(Stub_SPropertyAccess, testArgument) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *delimiter = NULL, delimiter_sub, __$null, _0$$3; - zval *this_ptr = getThis(); ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0$$3); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &delimiter); if (!delimiter) { delimiter = &delimiter_sub; @@ -133,10 +121,8 @@ PHP_METHOD(Stub_SPropertyAccess, testArgument) } else { ZEPHIR_SEPARATE_PARAM(delimiter); } - - if (ZEPHIR_IS_EMPTY(delimiter)) { - ZEPHIR_OBS_VAR(&_0$$3); + zephir_memory_observe(&_0$$3); zephir_read_static_property_ce(&_0$$3, stub_spropertyaccess_ce, SL("delimiter"), PH_NOISY_CC); ZEPHIR_CPY_WRT(delimiter, &_0$$3); } @@ -150,15 +136,13 @@ PHP_METHOD(Stub_SPropertyAccess, mutateStringVarInsideCycle) zend_bool _0; zval i, _5, _3$$3, _4$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); _2 = 3; _1 = 0; @@ -195,13 +179,9 @@ PHP_METHOD(Stub_SPropertyAccess, mutateIntVarInsideCycle) zval _4, _3$$3; zend_bool _0; zend_long i = 0, _1, _2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_3$$3); - - - _2 = 3; _1 = 0; _0 = 0; @@ -217,7 +197,7 @@ PHP_METHOD(Stub_SPropertyAccess, mutateIntVarInsideCycle) } _1 = _1; i = 42; - ZEPHIR_INIT_ZVAL_NREF(_3$$3); + ZVAL_UNDEF(&_3$$3); ZVAL_LONG(&_3$$3, i); zephir_update_static_property_ce(stub_spropertyaccess_ce, ZEND_STRL("intVar"), &_3$$3); } @@ -235,13 +215,9 @@ PHP_METHOD(Stub_SPropertyAccess, mutateDoubleVarInsideCycle) zend_long _1, _2; zend_bool _0; double i = 0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_3$$3); - - - _2 = 3; _1 = 0; _0 = 0; @@ -256,8 +232,8 @@ PHP_METHOD(Stub_SPropertyAccess, mutateDoubleVarInsideCycle) _0 = 1; } _1 = _1; - i = 3.14; - ZEPHIR_INIT_ZVAL_NREF(_3$$3); + i = (3.14); + ZVAL_UNDEF(&_3$$3); ZVAL_DOUBLE(&_3$$3, i); zephir_update_static_property_ce(stub_spropertyaccess_ce, ZEND_STRL("doubleVar"), &_3$$3); } @@ -272,16 +248,14 @@ PHP_METHOD(Stub_SPropertyAccess, mutateArrayVarInsideCycle) zend_bool _0; zval i, j, _5, _3$$3, _4$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&i); ZVAL_UNDEF(&j); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); _2 = 3; _1 = 0; @@ -316,9 +290,8 @@ void zephir_init_static_properties_Stub_SPropertyAccess() zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); array_init(&_0); diff --git a/ext/stub/spropertyaccess.zep.h b/ext/stub/spropertyaccess.zep.h index 798cd7f4df..f6fda7dba6 100644 --- a/ext/stub/spropertyaccess.zep.h +++ b/ext/stub/spropertyaccess.zep.h @@ -39,11 +39,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_spropertyaccess_zephir_init_static_propertie ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_spropertyaccess_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_SPropertyAccess, __construct, arginfo_stub_spropertyaccess___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_SPropertyAccess, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_SPropertyAccess, __construct, arginfo_stub_spropertyaccess___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_SPropertyAccess, testArgumentWithUnderscore, arginfo_stub_spropertyaccess_testargumentwithunderscore, ZEND_ACC_PUBLIC) PHP_ME(Stub_SPropertyAccess, testArgument, arginfo_stub_spropertyaccess_testargument, ZEND_ACC_PUBLIC) PHP_ME(Stub_SPropertyAccess, mutateStringVarInsideCycle, arginfo_stub_spropertyaccess_mutatestringvarinsidecycle, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) diff --git a/ext/stub/statements.zep.c b/ext/stub/statements.zep.c index be99dc7bd9..fe6c63cc72 100644 --- a/ext/stub/statements.zep.c +++ b/ext/stub/statements.zep.c @@ -57,9 +57,8 @@ PHP_METHOD(Stub_Statements, testPropertyAcccessAvoidTmpReuse) ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_7); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_read_property(&_0, this_ptr, ZEND_STRL("tmp2"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, ZEND_STRL("tmp1"), PH_NOISY_CC | PH_READONLY); @@ -84,20 +83,11 @@ PHP_METHOD(Stub_Statements, testElseIf) { zval *num_param = NULL; zend_long num; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - if (num > 0) { RETURN_STRING("more"); } else if (num == 0) { @@ -113,20 +103,11 @@ PHP_METHOD(Stub_Statements, testElseIf1) { zval *num_param = NULL; zend_long num, total; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &num_param); - num = zephir_get_intval(num_param); - - total = 10; if (num < total) { RETURN_STRING("less"); @@ -141,22 +122,13 @@ PHP_METHOD(Stub_Statements, testElseIf2) { zval *num_param = NULL, *total, total_sub; zend_long num; - zval *this_ptr = getThis(); ZVAL_UNDEF(&total_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(num) Z_PARAM_ZVAL(total) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &num_param, &total); - num = zephir_get_intval(num_param); - - if (ZEPHIR_GT_LONG(total, num)) { RETURN_STRING("less"); } else if (ZEPHIR_IS_LONG(total, num)) { @@ -189,23 +161,17 @@ PHP_METHOD(Stub_Statements, test544Issue) ZVAL_UNDEF(&_13$$4); ZVAL_UNDEF(&_14$$5); ZVAL_UNDEF(&_15$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(step) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &step_param); if (UNEXPECTED(Z_TYPE_P(step_param) != IS_LONG)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be of the type int")); RETURN_MM_NULL(); } step = Z_LVAL_P(step_param); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("totalSteps"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, ZEND_STRL("totalSteps"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_GT_LONG(&_0, step)) { @@ -216,25 +182,25 @@ PHP_METHOD(Stub_Statements, test544Issue) unfilledWidth = (((zephir_get_numberval(&_4$$3) - 1)) - filledWidth); zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("filledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_6$$3, filledWidth); - ZEPHIR_CALL_FUNCTION(&_7$$3, "str_repeat", &_8, 20, &_5$$3, &_6$$3); + ZEPHIR_CALL_FUNCTION(&_7$$3, "str_repeat", &_8, 21, &_5$$3, &_6$$3); zephir_check_call_status(); zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("arrow"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_9$$3, this_ptr, ZEND_STRL("unfilledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_10$$3, unfilledWidth); - ZEPHIR_CALL_FUNCTION(&_11$$3, "str_repeat", &_8, 20, &_9$$3, &_10$$3); + ZEPHIR_CALL_FUNCTION(&_11$$3, "str_repeat", &_8, 21, &_9$$3, &_10$$3); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, &_7$$3, &_6$$3, &_11$$3); RETURN_MM(); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_1, step)) { zephir_read_property(&_12$$4, this_ptr, ZEND_STRL("filledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_13$$4, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 20, &_12$$4, &_13$$4); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 21, &_12$$4, &_13$$4); zephir_check_call_status(); RETURN_MM(); } else { zephir_read_property(&_14$$5, this_ptr, ZEND_STRL("unfilledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_15$$5, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 20, &_14$$5, &_15$$5); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 21, &_14$$5, &_15$$5); zephir_check_call_status(); RETURN_MM(); } @@ -261,23 +227,17 @@ PHP_METHOD(Stub_Statements, test544IssueWithVariable) ZVAL_UNDEF(&_11$$4); ZVAL_UNDEF(&_12$$5); ZVAL_UNDEF(&_13$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(step) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &step_param); if (UNEXPECTED(Z_TYPE_P(step_param) != IS_LONG)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be of the type int")); RETURN_MM_NULL(); } step = Z_LVAL_P(step_param); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("totalSteps"), PH_NOISY_CC | PH_READONLY); totalSteps = zephir_get_numberval(&_0); if (step < totalSteps) { @@ -287,25 +247,25 @@ PHP_METHOD(Stub_Statements, test544IssueWithVariable) unfilledWidth = (((zephir_get_numberval(&_2$$3) - 1)) - filledWidth); zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("filledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_4$$3, filledWidth); - ZEPHIR_CALL_FUNCTION(&_5$$3, "str_repeat", &_6, 20, &_3$$3, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "str_repeat", &_6, 21, &_3$$3, &_4$$3); zephir_check_call_status(); zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("arrow"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_7$$3, this_ptr, ZEND_STRL("unfilledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_8$$3, unfilledWidth); - ZEPHIR_CALL_FUNCTION(&_9$$3, "str_repeat", &_6, 20, &_7$$3, &_8$$3); + ZEPHIR_CALL_FUNCTION(&_9$$3, "str_repeat", &_6, 21, &_7$$3, &_8$$3); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, &_5$$3, &_4$$3, &_9$$3); RETURN_MM(); } else if (step == totalSteps) { zephir_read_property(&_10$$4, this_ptr, ZEND_STRL("filledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_11$$4, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 20, &_10$$4, &_11$$4); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 21, &_10$$4, &_11$$4); zephir_check_call_status(); RETURN_MM(); } else { zephir_read_property(&_12$$5, this_ptr, ZEND_STRL("unfilledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_13$$5, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 20, &_12$$5, &_13$$5); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 21, &_12$$5, &_13$$5); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/statements.zep.h b/ext/stub/statements.zep.h index fb266864d1..c4157250ac 100644 --- a/ext/stub/statements.zep.h +++ b/ext/stub/statements.zep.h @@ -35,11 +35,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_statements_test544issuewithvariable, 0, 0, 1 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_statements_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Statements, testPropertyAcccessAvoidTmpReuse, arginfo_stub_statements_testpropertyacccessavoidtmpreuse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Statements, testPropertyAcccessAvoidTmpReuse, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Statements, testPropertyAcccessAvoidTmpReuse, arginfo_stub_statements_testpropertyacccessavoidtmpreuse, ZEND_ACC_PUBLIC) PHP_ME(Stub_Statements, testElseIf, arginfo_stub_statements_testelseif, ZEND_ACC_PUBLIC) PHP_ME(Stub_Statements, testElseIf1, arginfo_stub_statements_testelseif1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Statements, testElseIf2, arginfo_stub_statements_testelseif2, ZEND_ACC_PUBLIC) diff --git a/ext/stub/strings.zep.c b/ext/stub/strings.zep.c index 456b5068b1..aae4f25fa6 100644 --- a/ext/stub/strings.zep.c +++ b/ext/stub/strings.zep.c @@ -35,31 +35,25 @@ PHP_METHOD(Stub_Strings, camelize) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, *delimiter = NULL, delimiter_sub, __$null; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &str_param, &delimiter); zephir_get_strval(&str, str_param); if (!delimiter) { delimiter = &delimiter_sub; delimiter = &__$null; } - - - zephir_camelize(return_value, &str, delimiter ); + zephir_camelize(return_value, &str, delimiter); RETURN_MM(); } @@ -68,51 +62,37 @@ PHP_METHOD(Stub_Strings, uncamelize) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *str_param = NULL, *delimiter = NULL, delimiter_sub, __$null; zval str; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, &str_param, &delimiter); zephir_get_strval(&str, str_param); if (!delimiter) { delimiter = &delimiter_sub; delimiter = &__$null; } - - - zephir_uncamelize(return_value, &str, delimiter ); + zephir_uncamelize(return_value, &str, delimiter); RETURN_MM(); } PHP_METHOD(Stub_Strings, testTrim) { zval *str, str_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &str); - - zephir_fast_trim(return_value, str, NULL , ZEPHIR_TRIM_BOTH); return; } @@ -120,20 +100,12 @@ PHP_METHOD(Stub_Strings, testTrim) PHP_METHOD(Stub_Strings, testRtrim) { zval *str, str_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &str); - - zephir_fast_trim(return_value, str, NULL , ZEPHIR_TRIM_RIGHT); return; } @@ -141,20 +113,12 @@ PHP_METHOD(Stub_Strings, testRtrim) PHP_METHOD(Stub_Strings, testLtrim) { zval *str, str_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &str); - - zephir_fast_trim(return_value, str, NULL , ZEPHIR_TRIM_LEFT); return; } @@ -162,22 +126,14 @@ PHP_METHOD(Stub_Strings, testLtrim) PHP_METHOD(Stub_Strings, testTrim2Params) { zval *str, str_sub, *charlist, charlist_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&charlist_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(charlist) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &str, &charlist); - - zephir_fast_trim(return_value, str, charlist, ZEPHIR_TRIM_BOTH); return; } @@ -185,22 +141,14 @@ PHP_METHOD(Stub_Strings, testTrim2Params) PHP_METHOD(Stub_Strings, testRtrim2Params) { zval *str, str_sub, *charlist, charlist_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&charlist_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(charlist) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &str, &charlist); - - zephir_fast_trim(return_value, str, charlist, ZEPHIR_TRIM_RIGHT); return; } @@ -208,22 +156,14 @@ PHP_METHOD(Stub_Strings, testRtrim2Params) PHP_METHOD(Stub_Strings, testLtrim2Params) { zval *str, str_sub, *charlist, charlist_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&charlist_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(charlist) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &str, &charlist); - - zephir_fast_trim(return_value, str, charlist, ZEPHIR_TRIM_LEFT); return; } @@ -231,22 +171,14 @@ PHP_METHOD(Stub_Strings, testLtrim2Params) PHP_METHOD(Stub_Strings, testImplode) { zval *glue, glue_sub, *pieces, pieces_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&glue_sub); ZVAL_UNDEF(&pieces_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(glue) Z_PARAM_ZVAL(pieces) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &glue, &pieces); - - zephir_fast_join(return_value, glue, pieces); return; } @@ -254,22 +186,14 @@ PHP_METHOD(Stub_Strings, testImplode) PHP_METHOD(Stub_Strings, testStrpos) { zval *haystack, haystack_sub, *needle, needle_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&haystack_sub); ZVAL_UNDEF(&needle_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(haystack) Z_PARAM_ZVAL(needle) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &haystack, &needle); - - zephir_fast_strpos(return_value, haystack, needle, 0 ); return; } @@ -278,25 +202,16 @@ PHP_METHOD(Stub_Strings, testStrposOffset) { zend_long offset; zval *haystack, haystack_sub, *needle, needle_sub, *offset_param = NULL, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&haystack_sub); ZVAL_UNDEF(&needle_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(haystack) Z_PARAM_ZVAL(needle) Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(3, 0, &haystack, &needle, &offset_param); - offset = zephir_get_intval(offset_param); - - ZVAL_LONG(&_0, offset); zephir_fast_strpos(return_value, haystack, needle, zephir_get_intval(&_0) ); return; @@ -305,22 +220,14 @@ PHP_METHOD(Stub_Strings, testStrposOffset) PHP_METHOD(Stub_Strings, testExplode) { zval *delimiter, delimiter_sub, *str, str_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&delimiter_sub); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(delimiter) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &delimiter, &str); - - zephir_fast_explode(return_value, delimiter, str, LONG_MAX); return; } @@ -328,20 +235,12 @@ PHP_METHOD(Stub_Strings, testExplode) PHP_METHOD(Stub_Strings, testExplodeStr) { zval *str, str_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &str); - - zephir_fast_explode_str(return_value, SL(","), str, LONG_MAX); return; } @@ -350,23 +249,14 @@ PHP_METHOD(Stub_Strings, testExplodeLimit) { zend_long limit; zval *str, str_sub, *limit_param = NULL, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_LONG(limit) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &str, &limit_param); - limit = zephir_get_intval(limit_param); - - ZVAL_LONG(&_0, limit); zephir_fast_explode_str(return_value, SL(","), str, zephir_get_intval(&_0) ); return; @@ -376,26 +266,16 @@ PHP_METHOD(Stub_Strings, testSubstr) { zend_long from, len; zval *str, str_sub, *from_param = NULL, *len_param = NULL, _0, _1; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(str) Z_PARAM_LONG(from) Z_PARAM_LONG(len) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(3, 0, &str, &from_param, &len_param); - from = zephir_get_intval(from_param); - len = zephir_get_intval(len_param); - - ZVAL_LONG(&_0, from); ZVAL_LONG(&_1, len); zephir_substr(return_value, str, zephir_get_intval(&_0), zephir_get_intval(&_1), 0); @@ -406,23 +286,14 @@ PHP_METHOD(Stub_Strings, testSubstr2) { zend_long from; zval *str, str_sub, *from_param = NULL, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_LONG(from) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &str, &from_param); - from = zephir_get_intval(from_param); - - ZVAL_LONG(&_0, from); zephir_substr(return_value, str, zephir_get_intval(&_0), 0, ZEPHIR_SUBSTR_NO_LENGTH); return; @@ -431,21 +302,13 @@ PHP_METHOD(Stub_Strings, testSubstr2) PHP_METHOD(Stub_Strings, testSubstr3) { zval *str, str_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &str); - - ZVAL_LONG(&_0, -1); zephir_substr(return_value, str, -1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); return; @@ -454,22 +317,14 @@ PHP_METHOD(Stub_Strings, testSubstr3) PHP_METHOD(Stub_Strings, testSubstr4) { zval *str, str_sub, _0, _1; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &str); - - ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, -1); zephir_substr(return_value, str, 0 , -1 , 0); @@ -479,20 +334,12 @@ PHP_METHOD(Stub_Strings, testSubstr4) PHP_METHOD(Stub_Strings, testAddslashes) { zval *str, str_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &str); - - zephir_addslashes(return_value, str); return; } @@ -500,20 +347,12 @@ PHP_METHOD(Stub_Strings, testAddslashes) PHP_METHOD(Stub_Strings, testStripslashes) { zval *str, str_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &str); - - zephir_stripslashes(return_value, str); return; } @@ -521,20 +360,12 @@ PHP_METHOD(Stub_Strings, testStripslashes) PHP_METHOD(Stub_Strings, testStripcslashes) { zval *str, str_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &str); - - zephir_stripcslashes(return_value, str); return; } @@ -542,39 +373,25 @@ PHP_METHOD(Stub_Strings, testStripcslashes) PHP_METHOD(Stub_Strings, testHashEquals) { zval *str1, str1_sub, *str2, str2_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&str1_sub); ZVAL_UNDEF(&str2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str1) Z_PARAM_ZVAL(str2) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &str1, &str2); - - RETURN_BOOL(zephir_hash_equals(str1, str2)); } PHP_METHOD(Stub_Strings, testHardcodedMultilineString) { - zval *this_ptr = getThis(); - - RETURN_STRING("\n Hello world\n "); } PHP_METHOD(Stub_Strings, testEchoMultilineString) { - zval *this_ptr = getThis(); - - php_printf("%s", "\n Hello world\n "); } @@ -583,12 +400,10 @@ PHP_METHOD(Stub_Strings, testTrimMultilineString) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "\n Hello world\n "); @@ -600,12 +415,10 @@ PHP_METHOD(Stub_Strings, testWellEscapedMultilineString) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "\n \\\"\\}\\$hello\\$\\\"\'\n "); @@ -615,9 +428,6 @@ PHP_METHOD(Stub_Strings, testWellEscapedMultilineString) PHP_METHOD(Stub_Strings, testInternedString1) { - zval *this_ptr = getThis(); - - RETURN_STRING("hello"); } @@ -626,13 +436,11 @@ PHP_METHOD(Stub_Strings, testInternedString2) { zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_VAR(&_1); @@ -649,7 +457,6 @@ PHP_METHOD(Stub_Strings, strToHex) zephir_fcall_cache_entry *_4 = NULL, *_6 = NULL; zval *value_param = NULL, _0, _2$$3, _3$$3, _5$$3; zval value, ret; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value); ZVAL_UNDEF(&ret); @@ -657,19 +464,13 @@ PHP_METHOD(Stub_Strings, strToHex) ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_5$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &value_param); zephir_get_strval(&value, value_param); - - i = 0; ZEPHIR_INIT_VAR(&ret); while (1) { @@ -679,7 +480,7 @@ PHP_METHOD(Stub_Strings, strToHex) _1$$3 = ZEPHIR_STRING_OFFSET(&value, i); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRINGL(&_2$$3, &_1$$3, 1); - ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 100, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 103, &_2$$3); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5$$3, "dechex", &_6, 11, &_3$$3); zephir_check_call_status(); @@ -696,7 +497,6 @@ PHP_METHOD(Stub_Strings, issue1267) zephir_fcall_cache_entry *_5 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *value = NULL, value_sub, x, _0, _2, _3, _4, _6, _7; - zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&x); @@ -707,19 +507,13 @@ PHP_METHOD(Stub_Strings, issue1267) ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_7); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &value); ZEPHIR_SEPARATE_PARAM(value); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_VAR(&_1); zephir_create_array(&_1, 3, 0); @@ -737,17 +531,17 @@ PHP_METHOD(Stub_Strings, issue1267) zephir_fast_str_replace(&_0, &_1, &_2, value); ZEPHIR_CPY_WRT(value, &_0); ZVAL_LONG(&_3, 516); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 43, value, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 44, value, &_3); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_4); ZEPHIR_INIT_NVAR(&_0); - ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 101, value); + ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 104, value); zephir_check_call_status(); zephir_stripslashes(&_0, &_4); ZEPHIR_INIT_VAR(&x); zephir_fast_trim(&x, &_0, NULL , ZEPHIR_TRIM_BOTH); ZEPHIR_INIT_VAR(&_6); - ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 101, value); + ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 104, value); zephir_check_call_status(); zephir_stripcslashes(&_6, &_7); zephir_fast_trim(return_value, &_6, NULL , ZEPHIR_TRIM_BOTH); @@ -759,27 +553,21 @@ PHP_METHOD(Stub_Strings, issue2186) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *val_param = NULL; zval val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &val_param); if (!val_param) { ZEPHIR_INIT_VAR(&val); } else { zephir_get_strval(&val, val_param); } - - RETURN_MM_BOOL(ZEPHIR_IS_NULL(&val)); } @@ -788,27 +576,21 @@ PHP_METHOD(Stub_Strings, issue2186SegFault) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *val_param = NULL; zval val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &val_param); if (!val_param) { ZEPHIR_INIT_VAR(&val); } else { zephir_get_strval(&val, val_param); } - - if (!(ZEPHIR_IS_EMPTY(&val))) { RETURN_MM_BOOL(1); } @@ -824,24 +606,19 @@ PHP_METHOD(Stub_Strings, issue2186SegFaultCall) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &val_param); if (!val_param) { ZEPHIR_INIT_VAR(&val); } else { zephir_get_strval(&val, val_param); } - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "issue2186child1", NULL, 0, &val); zephir_check_call_status(); RETURN_MM(); @@ -856,24 +633,19 @@ PHP_METHOD(Stub_Strings, issue2186Child1) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &val_param); if (!val_param) { ZEPHIR_INIT_VAR(&val); } else { zephir_get_strval(&val, val_param); } - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "issue2186child2", NULL, 0, &val); zephir_check_call_status(); RETURN_MM(); @@ -884,29 +656,23 @@ PHP_METHOD(Stub_Strings, issue2186Child2) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *val_param = NULL, output; zval val, _0$$3; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&output); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &val_param); if (!val_param) { ZEPHIR_INIT_VAR(&val); } else { zephir_get_strval(&val, val_param); } - - ZEPHIR_INIT_VAR(&output); ZVAL_STRING(&output, ""); if (!(ZEPHIR_IS_EMPTY(&val))) { @@ -925,19 +691,15 @@ PHP_METHOD(Stub_Strings, issue2234Strict) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *val_param = NULL; zval val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &val_param); if (!val_param) { ZEPHIR_INIT_VAR(&val); @@ -952,8 +714,6 @@ PHP_METHOD(Stub_Strings, issue2234Strict) ZEPHIR_INIT_VAR(&val); } } - - RETURN_MM_BOOL(ZEPHIR_IS_NULL(&val)); } @@ -969,16 +729,13 @@ PHP_METHOD(Stub_Strings, issue2234StrictParent) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &val_param); if (!val_param) { ZEPHIR_INIT_VAR(&val); @@ -993,8 +750,6 @@ PHP_METHOD(Stub_Strings, issue2234StrictParent) ZEPHIR_INIT_VAR(&val); } } - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "issue2234strictchild", NULL, 0, &val); zephir_check_call_status(); RETURN_MM(); @@ -1008,19 +763,15 @@ PHP_METHOD(Stub_Strings, issue2234StrictChild) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *val_param = NULL; zval val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &val_param); if (!val_param) { ZEPHIR_INIT_VAR(&val); @@ -1035,8 +786,6 @@ PHP_METHOD(Stub_Strings, issue2234StrictChild) ZEPHIR_INIT_VAR(&val); } } - - RETURN_CTOR(&val); } @@ -1048,19 +797,15 @@ PHP_METHOD(Stub_Strings, nullableStringReturnType) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *val_param = NULL; zval val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &val_param); if (!val_param) { ZEPHIR_INIT_VAR(&val); @@ -1075,8 +820,6 @@ PHP_METHOD(Stub_Strings, nullableStringReturnType) ZEPHIR_INIT_VAR(&val); } } - - if (!ZEPHIR_IS_NULL(&val)) { RETURN_CTOR(&val); } @@ -1091,27 +834,21 @@ PHP_METHOD(Stub_Strings, issue2299NullableStringCondition) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *roleName_param = NULL; zval roleName; - zval *this_ptr = getThis(); ZVAL_UNDEF(&roleName); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(roleName) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &roleName_param); if (!roleName_param) { ZEPHIR_INIT_VAR(&roleName); } else { zephir_get_strval(&roleName, roleName_param); } - - if (Z_TYPE_P(&roleName) != IS_NULL) { RETURN_CTOR(&roleName); } diff --git a/ext/stub/strings.zep.h b/ext/stub/strings.zep.h index 7c4fb6c8ed..3a885f8ff3 100644 --- a/ext/stub/strings.zep.h +++ b/ext/stub/strings.zep.h @@ -236,36 +236,12 @@ ZEPHIR_INIT_FUNCS(stub_strings_method_entry) { PHP_ME(Stub_Strings, testStripslashes, arginfo_stub_strings_teststripslashes, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, testStripcslashes, arginfo_stub_strings_teststripcslashes, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, testHashEquals, arginfo_stub_strings_testhashequals, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testHardcodedMultilineString, arginfo_stub_strings_testhardcodedmultilinestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testHardcodedMultilineString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testEchoMultilineString, arginfo_stub_strings_testechomultilinestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testEchoMultilineString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testTrimMultilineString, arginfo_stub_strings_testtrimmultilinestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testTrimMultilineString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testWellEscapedMultilineString, arginfo_stub_strings_testwellescapedmultilinestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testWellEscapedMultilineString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testInternedString1, arginfo_stub_strings_testinternedstring1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testInternedString1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testInternedString2, arginfo_stub_strings_testinternedstring2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testInternedString2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Strings, testHardcodedMultilineString, arginfo_stub_strings_testhardcodedmultilinestring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testEchoMultilineString, arginfo_stub_strings_testechomultilinestring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testTrimMultilineString, arginfo_stub_strings_testtrimmultilinestring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testWellEscapedMultilineString, arginfo_stub_strings_testwellescapedmultilinestring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testInternedString1, arginfo_stub_strings_testinternedstring1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testInternedString2, arginfo_stub_strings_testinternedstring2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, strToHex, arginfo_stub_strings_strtohex, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, issue1267, arginfo_stub_strings_issue1267, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, issue2186, arginfo_stub_strings_issue2186, ZEND_ACC_PUBLIC) diff --git a/ext/stub/stubs.zep.c b/ext/stub/stubs.zep.c index 278582d5dc..2b5801c064 100644 --- a/ext/stub/stubs.zep.c +++ b/ext/stub/stubs.zep.c @@ -48,9 +48,6 @@ ZEPHIR_INIT_CLASS(Stub_Stubs) */ PHP_METHOD(Stub_Stubs, testDockBlockAndReturnType) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propString"); } @@ -62,9 +59,6 @@ PHP_METHOD(Stub_Stubs, testDockBlockAndReturnType) */ PHP_METHOD(Stub_Stubs, testDocBlockAndReturnTypeDeclared) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "propStringProtected"); } @@ -81,27 +75,18 @@ PHP_METHOD(Stub_Stubs, testMixedInputParamsDocBlock) { zend_long number; zval *intOrString, intOrString_sub, *number_param = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&intOrString_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(intOrString) Z_PARAM_OPTIONAL Z_PARAM_LONG(number) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 1, &intOrString, &number_param); if (!number_param) { number = 1; } else { - number = zephir_get_intval(number_param); - } - - + } RETURN_LONG(number); } @@ -118,27 +103,18 @@ PHP_METHOD(Stub_Stubs, testMixedInputParamsDocBlockDeclared) { zend_long number; zval *intOrString, intOrString_sub, *number_param = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&intOrString_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(intOrString) Z_PARAM_OPTIONAL Z_PARAM_LONG(number) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 1, &intOrString, &number_param); if (!number_param) { number = 1; } else { - number = zephir_get_intval(number_param); - } - - + } RETURN_LONG(number); } @@ -151,14 +127,12 @@ PHP_METHOD(Stub_Stubs, testVariableLength) zval _0, _1; zval data; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&data); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&data); array_init(&data); @@ -172,9 +146,6 @@ PHP_METHOD(Stub_Stubs, testVariableLength) PHP_METHOD(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature1) { - zval *this_ptr = getThis(); - - array_init(return_value); return; @@ -182,18 +153,12 @@ PHP_METHOD(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature1) PHP_METHOD(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature2) { - zval *this_ptr = getThis(); - - RETURN_BOOL(0); } PHP_METHOD(Stub_Stubs, testMultiReturnTypeWithBool) { - zval *this_ptr = getThis(); - - RETURN_BOOL(0); } diff --git a/ext/stub/stubs.zep.h b/ext/stub/stubs.zep.h index 4362d6a02d..d73f315516 100644 --- a/ext/stub/stubs.zep.h +++ b/ext/stub/stubs.zep.h @@ -46,20 +46,8 @@ ZEPHIR_INIT_FUNCS(stub_stubs_method_entry) { PHP_ME(Stub_Stubs, testMixedInputParamsDocBlock, arginfo_stub_stubs_testmixedinputparamsdocblock, ZEND_ACC_PUBLIC) PHP_ME(Stub_Stubs, testMixedInputParamsDocBlockDeclared, arginfo_stub_stubs_testmixedinputparamsdocblockdeclared, ZEND_ACC_PUBLIC) PHP_ME(Stub_Stubs, testVariableLength, arginfo_stub_stubs_testvariablelength, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature1, arginfo_stub_stubs_testmultireturntypewithmixedindocandemptyinsignature1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature2, arginfo_stub_stubs_testmultireturntypewithmixedindocandemptyinsignature2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Stubs, testMultiReturnTypeWithBool, arginfo_stub_stubs_testmultireturntypewithbool, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Stubs, testMultiReturnTypeWithBool, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature1, arginfo_stub_stubs_testmultireturntypewithmixedindocandemptyinsignature1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature2, arginfo_stub_stubs_testmultireturntypewithmixedindocandemptyinsignature2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Stubs, testMultiReturnTypeWithBool, arginfo_stub_stubs_testmultireturntypewithbool, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/ternary.zep.c b/ext/stub/ternary.zep.c index 71e0384b22..6d2e4fe847 100644 --- a/ext/stub/ternary.zep.c +++ b/ext/stub/ternary.zep.c @@ -34,17 +34,17 @@ PHP_METHOD(Stub_Ternary, testTernary1) { zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); if (100) { + ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, (1 + 100)); } else { + ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, 0); } RETURN_CCTOR(&_0); @@ -55,26 +55,20 @@ PHP_METHOD(Stub_Ternary, testTernary2) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *b_param = NULL, _0; zend_bool b; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(b) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &b_param); - b = zephir_get_boolval(b_param); - - ZEPHIR_INIT_VAR(&_0); if (b) { + ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "foo"); } else { + ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "bar"); } RETURN_CCTOR(&_0); @@ -85,27 +79,21 @@ PHP_METHOD(Stub_Ternary, testTernaryComplex1) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub, *y, y_sub, _0, _1; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&y_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(y) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &y); - - ZEPHIR_INIT_VAR(&_0); if (100) { + ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, (1 + 100)); } else { ZEPHIR_CALL_METHOD(&_1, a, "y", NULL, 0); @@ -126,25 +114,18 @@ PHP_METHOD(Stub_Ternary, testTernaryComplex2) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub, *y, y_sub, _0, _1; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&y_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(y) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &a, &y); - - ZEPHIR_INIT_VAR(&_0); if (100) { ZEPHIR_INIT_NVAR(&_0); @@ -167,22 +148,15 @@ PHP_METHOD(Stub_Ternary, testTernaryComplex3) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a); - - ZEPHIR_INIT_VAR(&_0); if (Z_TYPE_P(a) == IS_RESOURCE) { ZEPHIR_INIT_NVAR(&_0); @@ -202,15 +176,13 @@ PHP_METHOD(Stub_Ternary, testTernaryWithPromotedTemporaryVariable) { zval var2, var3, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&var2); ZVAL_UNDEF(&var3); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&var2); zephir_create_array(&var2, 2, 0); @@ -240,12 +212,10 @@ PHP_METHOD(Stub_Ternary, testTernaryAfterLetVariable) { zval s; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&s); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&s); ZVAL_LONG(&s, 23); @@ -263,24 +233,18 @@ PHP_METHOD(Stub_Ternary, testShortTernary) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a); - - ZEPHIR_INIT_VAR(&_0); if (!(zephir_is_true(a))) { + ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, 0); } else { ZEPHIR_CPY_WRT(&_0, a); @@ -292,24 +256,17 @@ PHP_METHOD(Stub_Ternary, testShortTernaryComplex) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *left, left_sub, *value, value_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&left_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(left) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &left, &value); - - ZEPHIR_INIT_VAR(&_0); if (!(zephir_is_true(left))) { ZEPHIR_CPY_WRT(&_0, value); diff --git a/ext/stub/ternary.zep.h b/ext/stub/ternary.zep.h index 48e20926e5..4e80b013d5 100644 --- a/ext/stub/ternary.zep.h +++ b/ext/stub/ternary.zep.h @@ -50,25 +50,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_ternary_testshortternarycomplex, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_ternary_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Ternary, testTernary1, arginfo_stub_ternary_testternary1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Ternary, testTernary1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Ternary, testTernary1, arginfo_stub_ternary_testternary1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testTernary2, arginfo_stub_ternary_testternary2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testTernaryComplex1, arginfo_stub_ternary_testternarycomplex1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testTernaryComplex2, arginfo_stub_ternary_testternarycomplex2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testTernaryComplex3, arginfo_stub_ternary_testternarycomplex3, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Ternary, testTernaryWithPromotedTemporaryVariable, arginfo_stub_ternary_testternarywithpromotedtemporaryvariable, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Ternary, testTernaryWithPromotedTemporaryVariable, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Ternary, testTernaryAfterLetVariable, arginfo_stub_ternary_testternaryafterletvariable, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Ternary, testTernaryAfterLetVariable, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Ternary, testTernaryWithPromotedTemporaryVariable, arginfo_stub_ternary_testternarywithpromotedtemporaryvariable, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Ternary, testTernaryAfterLetVariable, arginfo_stub_ternary_testternaryafterletvariable, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testShortTernary, arginfo_stub_ternary_testshortternary, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testShortTernaryComplex, arginfo_stub_ternary_testshortternarycomplex, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/trytest.zep.c b/ext/stub/trytest.zep.c index 0eed207df1..7bcfd628e3 100644 --- a/ext/stub/trytest.zep.c +++ b/ext/stub/trytest.zep.c @@ -29,9 +29,6 @@ ZEPHIR_INIT_CLASS(Stub_TryTest) PHP_METHOD(Stub_TryTest, testThrow1) { - zval *this_ptr = getThis(); - - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(zend_ce_exception, "error", "stub/trytest.zep", 10); return; @@ -42,19 +39,17 @@ PHP_METHOD(Stub_TryTest, testThrow2) zval message, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&message); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&message); ZVAL_STRING(&message, "error"); ZEPHIR_INIT_VAR(&_0); object_init_ex(&_0, zend_ce_exception); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 28, &message); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 29, &message); zephir_check_call_status(); zephir_throw_exception_debug(&_0, "stub/trytest.zep", 16); ZEPHIR_MM_RESTORE(); @@ -63,14 +58,8 @@ PHP_METHOD(Stub_TryTest, testThrow2) PHP_METHOD(Stub_TryTest, testTry1) { - zval *this_ptr = getThis(); - - - /* try_start_1: */ - - try_end_1: zend_clear_exception(); @@ -81,27 +70,21 @@ PHP_METHOD(Stub_TryTest, testTry2) zval _0$$3, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); - - - ZEPHIR_MM_GROW(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); /* try_start_1: */ ZEPHIR_INIT_VAR(&_0$$3); object_init_ex(&_0$$3, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 28, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_1$$3); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$3, "stub/trytest.zep", 27); goto try_end_1; - - try_end_1: zend_clear_exception(); @@ -112,29 +95,23 @@ PHP_METHOD(Stub_TryTest, testTry3) zval _0$$3, _1$$3, _2, _3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); - - - ZEPHIR_MM_GROW(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); /* try_start_1: */ ZEPHIR_INIT_VAR(&_0$$3); object_init_ex(&_0$$3, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 28, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_1$$3); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$3, "stub/trytest.zep", 34); goto try_end_1; - - try_end_1: if (EG(exception)) { @@ -157,7 +134,6 @@ PHP_METHOD(Stub_TryTest, testTry4) zend_long ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, _0$$4, _1$$4, _2$$5, _3$$5, _4, _5, _6; zend_bool a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0$$4); ZVAL_UNDEF(&_1$$4); @@ -166,20 +142,12 @@ PHP_METHOD(Stub_TryTest, testTry4) ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); - a = zephir_get_boolval(a_param); - - - /* try_start_1: */ if (a) { @@ -187,7 +155,7 @@ PHP_METHOD(Stub_TryTest, testTry4) object_init_ex(&_0$$4, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 29, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "stub/trytest.zep", 46); goto try_end_1; @@ -197,7 +165,7 @@ PHP_METHOD(Stub_TryTest, testTry4) object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 102, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 105, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "stub/trytest.zep", 48); goto try_end_1; @@ -233,7 +201,6 @@ PHP_METHOD(Stub_TryTest, testTry5) zend_long ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, _0$$4, _1$$4, _2$$5, _3$$5, _4, _5; zend_bool a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0$$4); ZVAL_UNDEF(&_1$$4); @@ -241,20 +208,12 @@ PHP_METHOD(Stub_TryTest, testTry5) ZVAL_UNDEF(&_3$$5); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); - a = zephir_get_boolval(a_param); - - - /* try_start_1: */ if (a) { @@ -262,7 +221,7 @@ PHP_METHOD(Stub_TryTest, testTry5) object_init_ex(&_0$$4, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 29, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "stub/trytest.zep", 63); goto try_end_1; @@ -272,7 +231,7 @@ PHP_METHOD(Stub_TryTest, testTry5) object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 102, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 105, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "stub/trytest.zep", 65); goto try_end_1; @@ -307,7 +266,6 @@ PHP_METHOD(Stub_TryTest, testTry6) zend_long ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, e, _4, _0$$4, _1$$4, _2$$5, _3$$5; zend_bool a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&e); ZVAL_UNDEF(&_4); @@ -315,20 +273,12 @@ PHP_METHOD(Stub_TryTest, testTry6) ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$5); ZVAL_UNDEF(&_3$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); - a = zephir_get_boolval(a_param); - - - /* try_start_1: */ if (a) { @@ -336,7 +286,7 @@ PHP_METHOD(Stub_TryTest, testTry6) object_init_ex(&_0$$4, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 29, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "stub/trytest.zep", 80); goto try_end_1; @@ -346,7 +296,7 @@ PHP_METHOD(Stub_TryTest, testTry6) object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 102, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 105, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "stub/trytest.zep", 82); goto try_end_1; @@ -380,7 +330,6 @@ PHP_METHOD(Stub_TryTest, testTry7) zend_long ZEPHIR_LAST_CALL_STATUS; zval *a_param = NULL, e, _4, _0$$4, _1$$4, _2$$5, _3$$5; zend_bool a; - zval *this_ptr = getThis(); ZVAL_UNDEF(&e); ZVAL_UNDEF(&_4); @@ -388,20 +337,12 @@ PHP_METHOD(Stub_TryTest, testTry7) ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$5); ZVAL_UNDEF(&_3$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(a) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &a_param); - a = zephir_get_boolval(a_param); - - - /* try_start_1: */ if (a) { @@ -409,7 +350,7 @@ PHP_METHOD(Stub_TryTest, testTry7) object_init_ex(&_0$$4, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 29, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "stub/trytest.zep", 99); goto try_end_1; @@ -419,7 +360,7 @@ PHP_METHOD(Stub_TryTest, testTry7) object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 102, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 105, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "stub/trytest.zep", 101); goto try_end_1; @@ -451,27 +392,21 @@ PHP_METHOD(Stub_TryTest, testTry8) zval _0$$3, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&_1$$3); - - - ZEPHIR_MM_GROW(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); /* try_start_1: */ ZEPHIR_INIT_VAR(&_0$$3); object_init_ex(&_0$$3, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "error 1!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 28, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 29, &_1$$3); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$3, "stub/trytest.zep", 111); goto try_end_1; - - try_end_1: zend_clear_exception(); @@ -481,9 +416,6 @@ PHP_METHOD(Stub_TryTest, testTry8) PHP_METHOD(Stub_TryTest, someMethod1) { - zval *this_ptr = getThis(); - - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(spl_ce_RuntimeException, "some external exception", "stub/trytest.zep", 118); return; @@ -491,9 +423,6 @@ PHP_METHOD(Stub_TryTest, someMethod1) PHP_METHOD(Stub_TryTest, someMethod2) { - zval *this_ptr = getThis(); - - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(spl_ce_DomainException, "some external exception", "stub/trytest.zep", 123); return; @@ -508,14 +437,11 @@ PHP_METHOD(Stub_TryTest, testTry9) ZVAL_UNDEF(&e); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 103); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 106); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); @@ -543,14 +469,11 @@ PHP_METHOD(Stub_TryTest, testTry10) ZVAL_UNDEF(&e); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 104); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 107); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); @@ -573,15 +496,11 @@ PHP_METHOD(Stub_TryTest, testTry11) { zval ex, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&ex); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); - - + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); /* try_start_1: */ RETURN_MM_STRING("test"); diff --git a/ext/stub/trytest.zep.h b/ext/stub/trytest.zep.h index aa4e7f609b..7cc320c457 100644 --- a/ext/stub/trytest.zep.h +++ b/ext/stub/trytest.zep.h @@ -69,64 +69,20 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_trytest_testtry11, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_trytest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testThrow1, arginfo_stub_trytest_testthrow1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testThrow1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testThrow2, arginfo_stub_trytest_testthrow2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testThrow2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry1, arginfo_stub_trytest_testtry1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry2, arginfo_stub_trytest_testtry2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry3, arginfo_stub_trytest_testtry3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_TryTest, testThrow1, arginfo_stub_trytest_testthrow1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testThrow2, arginfo_stub_trytest_testthrow2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry1, arginfo_stub_trytest_testtry1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry2, arginfo_stub_trytest_testtry2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry3, arginfo_stub_trytest_testtry3, ZEND_ACC_PUBLIC) PHP_ME(Stub_TryTest, testTry4, arginfo_stub_trytest_testtry4, ZEND_ACC_PUBLIC) PHP_ME(Stub_TryTest, testTry5, arginfo_stub_trytest_testtry5, ZEND_ACC_PUBLIC) PHP_ME(Stub_TryTest, testTry6, arginfo_stub_trytest_testtry6, ZEND_ACC_PUBLIC) PHP_ME(Stub_TryTest, testTry7, arginfo_stub_trytest_testtry7, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry8, arginfo_stub_trytest_testtry8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, someMethod1, arginfo_stub_trytest_somemethod1, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_TryTest, someMethod1, NULL, ZEND_ACC_PRIVATE) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, someMethod2, arginfo_stub_trytest_somemethod2, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_TryTest, someMethod2, NULL, ZEND_ACC_PRIVATE) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry9, arginfo_stub_trytest_testtry9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry10, arginfo_stub_trytest_testtry10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry11, arginfo_stub_trytest_testtry11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry11, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_TryTest, testTry8, arginfo_stub_trytest_testtry8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, someMethod1, arginfo_stub_trytest_somemethod1, ZEND_ACC_PRIVATE) +PHP_ME(Stub_TryTest, someMethod2, arginfo_stub_trytest_somemethod2, ZEND_ACC_PRIVATE) +PHP_ME(Stub_TryTest, testTry9, arginfo_stub_trytest_testtry9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry10, arginfo_stub_trytest_testtry10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry11, arginfo_stub_trytest_testtry11, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/typehinting/testabstract.zep.h b/ext/stub/typehinting/testabstract.zep.h index 8ce152d978..d8eda05954 100644 --- a/ext/stub/typehinting/testabstract.zep.h +++ b/ext/stub/typehinting/testabstract.zep.h @@ -15,11 +15,7 @@ PHP_METHOD(Stub_TypeHinting_TestAbstract, returnBoolean); PHP_METHOD(Stub_TypeHinting_TestAbstract, returnChar); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_typehinting_testabstract_testfunc, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, text, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, text, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, text, IS_ARRAY, 0, "[]") ZEND_ARG_TYPE_INFO(0, text2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, flag, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, optional, IS_LONG, 1) @@ -54,11 +50,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_typehinting_testabstract_method_entry) { PHP_ME(Stub_TypeHinting_TestAbstract, testFunc, arginfo_stub_typehinting_testabstract_testfunc, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TypeHinting_TestAbstract, returnOneOfScalar, arginfo_stub_typehinting_testabstract_returnoneofscalar, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TypeHinting_TestAbstract, returnOneOfScalar, NULL, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_TypeHinting_TestAbstract, returnOneOfScalar, arginfo_stub_typehinting_testabstract_returnoneofscalar, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_TypeHinting_TestAbstract, returnInt, arginfo_stub_typehinting_testabstract_returnint, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_TypeHinting_TestAbstract, returnUint, arginfo_stub_typehinting_testabstract_returnuint, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_TypeHinting_TestAbstract, returnLong, arginfo_stub_typehinting_testabstract_returnlong, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) diff --git a/ext/stub/typeinstances.zep.c b/ext/stub/typeinstances.zep.c index 927cc858b2..86febcb95f 100644 --- a/ext/stub/typeinstances.zep.c +++ b/ext/stub/typeinstances.zep.c @@ -35,14 +35,12 @@ PHP_METHOD(Stub_TypeInstances, testInstanceOfString1) zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 24); ZEPHIR_CALL_FUNCTION(&_1, "create_string", NULL, 0, &_0); @@ -57,14 +55,12 @@ PHP_METHOD(Stub_TypeInstances, testInstanceOfString2) zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, -24); ZEPHIR_CALL_FUNCTION(&_1, "create_string", NULL, 0, &_0); @@ -79,14 +75,12 @@ PHP_METHOD(Stub_TypeInstances, testInstanceOfString3) zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZVAL_LONG(&_0, 0); ZEPHIR_CALL_FUNCTION(&_1, "create_string", NULL, 0, &_0); diff --git a/ext/stub/typeinstances.zep.h b/ext/stub/typeinstances.zep.h index 0ead29c972..fe13f28d3d 100644 --- a/ext/stub/typeinstances.zep.h +++ b/ext/stub/typeinstances.zep.h @@ -17,20 +17,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_typeinstances_testinstanceofstring3, 0, 0, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_typeinstances_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TypeInstances, testInstanceOfString1, arginfo_stub_typeinstances_testinstanceofstring1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TypeInstances, testInstanceOfString1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TypeInstances, testInstanceOfString2, arginfo_stub_typeinstances_testinstanceofstring2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TypeInstances, testInstanceOfString2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TypeInstances, testInstanceOfString3, arginfo_stub_typeinstances_testinstanceofstring3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TypeInstances, testInstanceOfString3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_TypeInstances, testInstanceOfString1, arginfo_stub_typeinstances_testinstanceofstring1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TypeInstances, testInstanceOfString2, arginfo_stub_typeinstances_testinstanceofstring2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TypeInstances, testInstanceOfString3, arginfo_stub_typeinstances_testinstanceofstring3, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/typeoff.zep.c b/ext/stub/typeoff.zep.c index 83da9a340c..a365e0b793 100644 --- a/ext/stub/typeoff.zep.c +++ b/ext/stub/typeoff.zep.c @@ -31,12 +31,10 @@ PHP_METHOD(Stub_Typeoff, testNativeStringFalse) { zval testVar; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&testVar); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&testVar); ZVAL_STRING(&testVar, "sdfsdf"); @@ -47,12 +45,10 @@ PHP_METHOD(Stub_Typeoff, testNativeStringTrue) { zval testVar; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&testVar); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&testVar); ZVAL_STRING(&testVar, "sdfsdf"); @@ -62,11 +58,6 @@ PHP_METHOD(Stub_Typeoff, testNativeStringTrue) PHP_METHOD(Stub_Typeoff, testNativeIntFalse) { zend_long testVar = 0; - zval *this_ptr = getThis(); - - - - testVar = 12345; RETURN_BOOL(1 == 0); } @@ -74,11 +65,6 @@ PHP_METHOD(Stub_Typeoff, testNativeIntFalse) PHP_METHOD(Stub_Typeoff, testNativeIntTrue) { zend_long testVar = 0; - zval *this_ptr = getThis(); - - - - testVar = 12345; RETURN_BOOL(1 == 1); } @@ -86,11 +72,6 @@ PHP_METHOD(Stub_Typeoff, testNativeIntTrue) PHP_METHOD(Stub_Typeoff, testNativeDoubleTrue) { double testVar = 0; - zval *this_ptr = getThis(); - - - - testVar = (double) (12345); RETURN_BOOL(1 == 1); } @@ -98,11 +79,6 @@ PHP_METHOD(Stub_Typeoff, testNativeDoubleTrue) PHP_METHOD(Stub_Typeoff, testNativeBoolTrue) { zend_bool testVar = 0; - zval *this_ptr = getThis(); - - - - testVar = 1; RETURN_BOOL(1 == 1); } @@ -111,12 +87,10 @@ PHP_METHOD(Stub_Typeoff, testNotBoolTrue) { zval testVar; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&testVar); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&testVar); ZVAL_STRING(&testVar, ""); @@ -128,11 +102,6 @@ PHP_METHOD(Stub_Typeoff, testNotBoolTrue) PHP_METHOD(Stub_Typeoff, testNativeBoolFalse) { zend_bool testVar = 0; - zval *this_ptr = getThis(); - - - - testVar = 0; RETURN_BOOL(1 == 0); } @@ -141,12 +110,10 @@ PHP_METHOD(Stub_Typeoff, testArrayFalse) { zval testVar; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&testVar); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&testVar); array_init(&testVar); @@ -157,12 +124,10 @@ PHP_METHOD(Stub_Typeoff, testArrayTrue) { zval testVar; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&testVar); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&testVar); array_init(&testVar); @@ -177,15 +142,14 @@ PHP_METHOD(Stub_Typeoff, testClassPropertyAccess) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "test string"); zephir_update_property_zval(this_ptr, ZEND_STRL("property"), &_0); - ZEPHIR_OBS_VAR(&_1); + zephir_memory_observe(&_1); zephir_read_property(&_1, this_ptr, ZEND_STRL("property"), PH_NOISY_CC); RETURN_MM_BOOL(Z_TYPE_P(&_1) == IS_STRING); } @@ -194,22 +158,15 @@ PHP_METHOD(Stub_Typeoff, testUnknownTypeOf) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *u, u_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&u_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(u) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &u); - - ZEPHIR_INIT_VAR(&_0); zephir_gettype(&_0, u); RETURN_CCTOR(&_0); @@ -218,20 +175,12 @@ PHP_METHOD(Stub_Typeoff, testUnknownTypeOf) PHP_METHOD(Stub_Typeoff, testCallableTypeOf) { zval *cb, cb_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&cb_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(cb) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &cb); - - RETURN_BOOL(zephir_is_callable(cb) == 1); } diff --git a/ext/stub/typeoff.zep.h b/ext/stub/typeoff.zep.h index fff8eb9b6a..032589a7a9 100644 --- a/ext/stub/typeoff.zep.h +++ b/ext/stub/typeoff.zep.h @@ -59,61 +59,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_typeoff_testcallabletypeof, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_typeoff_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeStringFalse, arginfo_stub_typeoff_testnativestringfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeStringFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeStringTrue, arginfo_stub_typeoff_testnativestringtrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeStringTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeIntFalse, arginfo_stub_typeoff_testnativeintfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeIntFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeIntTrue, arginfo_stub_typeoff_testnativeinttrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeIntTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeDoubleTrue, arginfo_stub_typeoff_testnativedoubletrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeDoubleTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeBoolTrue, arginfo_stub_typeoff_testnativebooltrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeBoolTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNotBoolTrue, arginfo_stub_typeoff_testnotbooltrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNotBoolTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeBoolFalse, arginfo_stub_typeoff_testnativeboolfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeBoolFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testArrayFalse, arginfo_stub_typeoff_testarrayfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testArrayFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testArrayTrue, arginfo_stub_typeoff_testarraytrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testArrayTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testClassPropertyAccess, arginfo_stub_typeoff_testclasspropertyaccess, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testClassPropertyAccess, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Typeoff, testNativeStringFalse, arginfo_stub_typeoff_testnativestringfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeStringTrue, arginfo_stub_typeoff_testnativestringtrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeIntFalse, arginfo_stub_typeoff_testnativeintfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeIntTrue, arginfo_stub_typeoff_testnativeinttrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeDoubleTrue, arginfo_stub_typeoff_testnativedoubletrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeBoolTrue, arginfo_stub_typeoff_testnativebooltrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNotBoolTrue, arginfo_stub_typeoff_testnotbooltrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeBoolFalse, arginfo_stub_typeoff_testnativeboolfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testArrayFalse, arginfo_stub_typeoff_testarrayfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testArrayTrue, arginfo_stub_typeoff_testarraytrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testClassPropertyAccess, arginfo_stub_typeoff_testclasspropertyaccess, ZEND_ACC_PUBLIC) PHP_ME(Stub_Typeoff, testUnknownTypeOf, arginfo_stub_typeoff_testunknowntypeof, ZEND_ACC_PUBLIC) PHP_ME(Stub_Typeoff, testCallableTypeOf, arginfo_stub_typeoff_testcallabletypeof, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/types/maybe.zep.c b/ext/stub/types/maybe.zep.c index 559628295d..be2c7a95f9 100644 --- a/ext/stub/types/maybe.zep.c +++ b/ext/stub/types/maybe.zep.c @@ -28,28 +28,16 @@ PHP_METHOD(Stub_Types_MayBe, gc) { zval *maxlifetime_param = NULL; zend_long maxlifetime; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(maxlifetime) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &maxlifetime_param); - maxlifetime = zephir_get_intval(maxlifetime_param); - - RETURN_LONG(1); } PHP_METHOD(Stub_Types_MayBe, gcFalse) { - zval *this_ptr = getThis(); - - RETURN_BOOL(0); } diff --git a/ext/stub/types/maybe.zep.h b/ext/stub/types/maybe.zep.h index 3730deddc8..1ff34a95ae 100644 --- a/ext/stub/types/maybe.zep.h +++ b/ext/stub/types/maybe.zep.h @@ -6,19 +6,11 @@ ZEPHIR_INIT_CLASS(Stub_Types_MayBe); PHP_METHOD(Stub_Types_MayBe, gc); PHP_METHOD(Stub_Types_MayBe, gcFalse); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_maybe_gc, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_maybe_gc, 0, 1, IS_LONG, 0) -#endif ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_maybe_gcfalse, 0, 0, MAY_BE_LONG|MAY_BE_FALSE) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_maybe_gcfalse, 0, 0, IS_LONG, 0) -#endif ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_types_maybe_method_entry) { diff --git a/ext/stub/types/mixedtype.zep.c b/ext/stub/types/mixedtype.zep.c index c7d26b7c01..e9a0565ea3 100644 --- a/ext/stub/types/mixedtype.zep.c +++ b/ext/stub/types/mixedtype.zep.c @@ -30,9 +30,6 @@ ZEPHIR_INIT_CLASS(Stub_Types_MixedType) */ PHP_METHOD(Stub_Types_MixedType, returnMixedObject) { - zval *this_ptr = getThis(); - - object_init(return_value); return; @@ -40,9 +37,6 @@ PHP_METHOD(Stub_Types_MixedType, returnMixedObject) PHP_METHOD(Stub_Types_MixedType, returnMixedArray) { - zval *this_ptr = getThis(); - - array_init(return_value); return; @@ -50,45 +44,30 @@ PHP_METHOD(Stub_Types_MixedType, returnMixedArray) PHP_METHOD(Stub_Types_MixedType, returnMixedString) { - zval *this_ptr = getThis(); - - RETURN_STRING("mixed string"); } PHP_METHOD(Stub_Types_MixedType, returnMixedInt) { - zval *this_ptr = getThis(); - - RETURN_LONG(1); } PHP_METHOD(Stub_Types_MixedType, returnMixedFloat) { - zval *this_ptr = getThis(); - - RETURN_DOUBLE(3.14); } PHP_METHOD(Stub_Types_MixedType, returnMixedBool) { - zval *this_ptr = getThis(); - - RETURN_BOOL(1); } PHP_METHOD(Stub_Types_MixedType, returnMixedNull) { - zval *this_ptr = getThis(); - - RETURN_NULL(); } @@ -97,25 +76,16 @@ PHP_METHOD(Stub_Types_MixedType, returnMixed74) { zval *diff_param = NULL; zend_bool diff; - zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(diff) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(0, 1, &diff_param); if (!diff_param) { diff = 0; } else { - diff = zephir_get_boolval(diff_param); - } - - + } if (diff) { RETURN_STRING("string"); } @@ -125,9 +95,6 @@ PHP_METHOD(Stub_Types_MixedType, returnMixed74) PHP_METHOD(Stub_Types_MixedType, returnMultiButAlwaysMixed) { - zval *this_ptr = getThis(); - - RETURN_STRING("ZEND_BEGIN_ARG_INFO_EX"); } @@ -139,20 +106,12 @@ PHP_METHOD(Stub_Types_MixedType, paramMixed) { zval val_sub; zval *val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val); - - RETVAL_ZVAL(val, 1, 0); return; } @@ -161,22 +120,14 @@ PHP_METHOD(Stub_Types_MixedType, paramMixedTwo) { zval val1_sub, val2_sub; zval *val1, *val2; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val1_sub); ZVAL_UNDEF(&val2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(val1) Z_PARAM_ZVAL(val2) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &val1, &val2); - - zephir_create_array(return_value, 2, 0); zephir_array_fast_append(return_value, val1); zephir_array_fast_append(return_value, val2); @@ -190,27 +141,19 @@ PHP_METHOD(Stub_Types_MixedType, paramMixedWithMulti) zval stringVal; zval *intVal_param = NULL, *stringVal_param = NULL, mixedVal_sub, _0; zend_long intVal; - zval *this_ptr = getThis(); ZVAL_UNDEF(&mixedVal_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&stringVal); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_LONG(intVal) Z_PARAM_STR(stringVal) Z_PARAM_ZVAL(mixedVal) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 3, 0, &intVal_param, &stringVal_param, &mixedVal); - intVal = zephir_get_intval(intVal_param); zephir_get_strval(&stringVal, stringVal_param); - - zephir_create_array(return_value, 3, 0); ZEPHIR_INIT_VAR(&_0); ZVAL_LONG(&_0, intVal); @@ -227,20 +170,12 @@ PHP_METHOD(Stub_Types_MixedType, paramAndReturnMixed) { zval val_sub; zval *val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val); - - RETVAL_ZVAL(val, 1, 0); return; } @@ -251,22 +186,15 @@ PHP_METHOD(Stub_Types_MixedType, castToStringMixedAndReturnMixed) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval val_sub; zval *val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &val); - - zephir_cast_to_string(&_0, val); RETURN_CTOR(&_0); } @@ -277,22 +205,15 @@ PHP_METHOD(Stub_Types_MixedType, castToStringInternallyMixedAndReturnMixed) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval val_sub; zval *val = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &val); - - zephir_cast_to_string(&_0, val); ZEPHIR_CPY_WRT(val, &_0); RETVAL_ZVAL(val, 1, 0); @@ -303,20 +224,12 @@ PHP_METHOD(Stub_Types_MixedType, castToIntMixedAndReturnMixed) { zval val_sub; zval *val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val); - - RETURN_LONG(zephir_get_intval(val)); } @@ -326,21 +239,14 @@ PHP_METHOD(Stub_Types_MixedType, castToIntInternallyMixedAndReturnMixed) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval val_sub; zval *val = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &val); - - _0 = zephir_get_intval(val); ZEPHIR_INIT_NVAR(val); ZVAL_LONG(val, _0); @@ -352,20 +258,12 @@ PHP_METHOD(Stub_Types_MixedType, castToBoolMixedAndReturnMixed) { zval val_sub; zval *val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val); - - RETURN_BOOL(zephir_get_boolval(val)); } @@ -375,21 +273,14 @@ PHP_METHOD(Stub_Types_MixedType, castToBoolInternallyMixedAndReturnMixed) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval val_sub; zval *val = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &val); - - _0 = zephir_get_boolval(val); ZEPHIR_INIT_NVAR(val); ZVAL_BOOL(val, _0); @@ -401,20 +292,12 @@ PHP_METHOD(Stub_Types_MixedType, castToFloatMixedAndReturnMixed) { zval val_sub; zval *val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val); - - RETURN_DOUBLE(zephir_get_doubleval(val)); } @@ -424,21 +307,14 @@ PHP_METHOD(Stub_Types_MixedType, castToFloatInternallyMixedAndReturnMixed) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval val_sub; zval *val = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &val); - - _0 = zephir_get_doubleval(val); ZEPHIR_INIT_NVAR(val); ZVAL_DOUBLE(val, _0); @@ -453,20 +329,12 @@ PHP_METHOD(Stub_Types_MixedType, mixedInCondition) { zval val_sub; zval *val; - zval *this_ptr = getThis(); ZVAL_UNDEF(&val_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(val) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &val); - - if (UNEXPECTED(zephir_is_true(val))) { } if (ZEPHIR_IS_LONG_IDENTICAL(val, 1)) { diff --git a/ext/stub/types/mixedtype.zep.h b/ext/stub/types/mixedtype.zep.h index ec7b8d6b5b..7f6ca6c0ad 100644 --- a/ext/stub/types/mixedtype.zep.h +++ b/ext/stub/types/mixedtype.zep.h @@ -26,60 +26,28 @@ PHP_METHOD(Stub_Types_MixedType, castToFloatMixedAndReturnMixed); PHP_METHOD(Stub_Types_MixedType, castToFloatInternallyMixedAndReturnMixed); PHP_METHOD(Stub_Types_MixedType, mixedInCondition); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedobject, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedobject, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedarray, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedarray, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedstring, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedstring, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedint, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedint, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedfloat, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedfloat, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedbool, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedbool, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixednull, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixednull, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixed74, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixed74, 0, 0, 0) -#endif ZEND_ARG_TYPE_INFO(0, diff, _IS_BOOL, 0) ZEND_END_ARG_INFO() @@ -101,75 +69,39 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_parammixedwithmulti, 0, 0, 3 ZEND_ARG_INFO(0, mixedVal) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_paramandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_paramandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringmixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttostringmixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttostringinternallymixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointmixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttointmixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttointinternallymixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolmixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttoboolmixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttoboolinternallymixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatmixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttofloatmixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttofloatinternallymixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() @@ -187,11 +119,7 @@ ZEPHIR_INIT_FUNCS(stub_types_mixedtype_method_entry) { PHP_ME(Stub_Types_MixedType, returnMixedBool, arginfo_stub_types_mixedtype_returnmixedbool, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, returnMixedNull, arginfo_stub_types_mixedtype_returnmixednull, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, returnMixed74, arginfo_stub_types_mixedtype_returnmixed74, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Types_MixedType, returnMultiButAlwaysMixed, arginfo_stub_types_mixedtype_returnmultibutalwaysmixed, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Types_MixedType, returnMultiButAlwaysMixed, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Types_MixedType, returnMultiButAlwaysMixed, arginfo_stub_types_mixedtype_returnmultibutalwaysmixed, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, paramMixed, arginfo_stub_types_mixedtype_parammixed, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, paramMixedTwo, arginfo_stub_types_mixedtype_parammixedtwo, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, paramMixedWithMulti, arginfo_stub_types_mixedtype_parammixedwithmulti, ZEND_ACC_PUBLIC) diff --git a/ext/stub/types/obj.zep.c b/ext/stub/types/obj.zep.c index c7c5aea67c..c3de88c394 100644 --- a/ext/stub/types/obj.zep.c +++ b/ext/stub/types/obj.zep.c @@ -24,18 +24,12 @@ ZEPHIR_INIT_CLASS(Stub_Types_Obj) PHP_METHOD(Stub_Types_Obj, nullableObjectReturnNull) { - zval *this_ptr = getThis(); - - RETURN_NULL(); } PHP_METHOD(Stub_Types_Obj, nullableObjectReturnObj) { - zval *this_ptr = getThis(); - - object_init(return_value); return; @@ -43,9 +37,6 @@ PHP_METHOD(Stub_Types_Obj, nullableObjectReturnObj) PHP_METHOD(Stub_Types_Obj, objectReturn) { - zval *this_ptr = getThis(); - - object_init(return_value); return; diff --git a/ext/stub/types/obj.zep.h b/ext/stub/types/obj.zep.h index a799f6ff68..195def6669 100644 --- a/ext/stub/types/obj.zep.h +++ b/ext/stub/types/obj.zep.h @@ -7,25 +7,13 @@ PHP_METHOD(Stub_Types_Obj, nullableObjectReturnNull); PHP_METHOD(Stub_Types_Obj, nullableObjectReturnObj); PHP_METHOD(Stub_Types_Obj, objectReturn); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_obj_nullableobjectreturnnull, 0, 0, MAY_BE_NULL|MAY_BE_OBJECT) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_obj_nullableobjectreturnnull, 0, 0, IS_OBJECT, 1) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_obj_nullableobjectreturnobj, 0, 0, MAY_BE_NULL|MAY_BE_OBJECT) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_obj_nullableobjectreturnobj, 0, 0, IS_OBJECT, 1) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_obj_objectreturn, 0, 0, MAY_BE_OBJECT) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_obj_objectreturn, 0, 0, IS_OBJECT, 0) -#endif ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_types_obj_method_entry) { diff --git a/ext/stub/unsettest.zep.c b/ext/stub/unsettest.zep.c index c638e61dc0..ad0125da48 100644 --- a/ext/stub/unsettest.zep.c +++ b/ext/stub/unsettest.zep.c @@ -31,9 +31,6 @@ ZEPHIR_INIT_CLASS(Stub_Unsettest) PHP_METHOD(Stub_Unsettest, getProperty) { - zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "property"); } @@ -45,17 +42,10 @@ PHP_METHOD(Stub_Unsettest, has) ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(key) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &key); - - zephir_read_property(&_0, this_ptr, ZEND_STRL("property"), PH_NOISY_CC | PH_READONLY); RETURN_BOOL(zephir_array_isset(&_0, key)); } @@ -67,18 +57,11 @@ PHP_METHOD(Stub_Unsettest, addValueToProperty) ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(key) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &key, &value); - - zephir_update_property_array(this_ptr, SL("property"), key, value); } @@ -89,17 +72,10 @@ PHP_METHOD(Stub_Unsettest, testUnsetValueFromProperty) ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(key) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(1, 0, &key); - - zephir_unset_property_array(this_ptr, ZEND_STRL("property"), key); zephir_read_property(&_0, this_ptr, ZEND_STRL("property"), PH_NOISY_CC | PH_READONLY); zephir_array_unset(&_0, key, PH_SEPARATE); @@ -109,22 +85,15 @@ PHP_METHOD(Stub_Unsettest, testUnsetFromArray) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *arrayParameter, arrayParameter_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arrayParameter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(arrayParameter) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &arrayParameter); ZEPHIR_SEPARATE_PARAM(arrayParameter); - - zephir_array_unset_long(arrayParameter, 0, PH_SEPARATE); RETVAL_ZVAL(arrayParameter, 1, 0); RETURN_MM(); @@ -134,24 +103,17 @@ PHP_METHOD(Stub_Unsettest, testUnsetFromArrayByIndexVar) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *arrayParameter, arrayParameter_sub, *index, index_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arrayParameter_sub); ZVAL_UNDEF(&index_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(arrayParameter) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &arrayParameter, &index); ZEPHIR_SEPARATE_PARAM(arrayParameter); - - zephir_array_unset(arrayParameter, index, PH_SEPARATE); RETVAL_ZVAL(arrayParameter, 1, 0); RETURN_MM(); @@ -160,9 +122,6 @@ PHP_METHOD(Stub_Unsettest, testUnsetFromArrayByIndexVar) PHP_METHOD(Stub_Unsettest, testUnsetProperty) { zval *this_ptr = getThis(); - - - zephir_unset_property(this_ptr, "property"); RETURN_MEMBER(getThis(), "property"); } @@ -171,25 +130,23 @@ PHP_METHOD(Stub_Unsettest, testStdClassUnset) { zval simpleObject, _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&simpleObject); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&simpleObject); object_init(&simpleObject); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 12345); zephir_update_property_zval(&simpleObject, ZEND_STRL("property1"), &_0); ZEPHIR_INIT_VAR(&_1); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "test"); zephir_update_property_zval(&simpleObject, ZEND_STRL("property2"), &_1); - ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_UNDEF(&_0); ZVAL_LONG(&_0, 12345); zephir_update_property_zval(&simpleObject, ZEND_STRL("property3"), &_0); zephir_unset_property(&simpleObject, "property2"); @@ -202,25 +159,18 @@ PHP_METHOD(Stub_Unsettest, testUnsetTypedArray) zval key; zval *arr_param = NULL, *key_param = NULL; zval arr; - zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&key); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(arr) Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 2, 0, &arr_param, &key_param); zephir_get_arrval(&arr, arr_param); zephir_get_strval(&key, key_param); - - zephir_array_unset(&arr, &key, PH_SEPARATE); RETURN_CTOR(&arr); } diff --git a/ext/stub/unsettest.zep.h b/ext/stub/unsettest.zep.h index 068f5147b5..aa589a35f4 100644 --- a/ext/stub/unsettest.zep.h +++ b/ext/stub/unsettest.zep.h @@ -50,26 +50,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_unsettest_testunsettypedarray, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_unsettest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Unsettest, getProperty, arginfo_stub_unsettest_getproperty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Unsettest, getProperty, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Unsettest, getProperty, arginfo_stub_unsettest_getproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, has, arginfo_stub_unsettest_has, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, addValueToProperty, arginfo_stub_unsettest_addvaluetoproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, testUnsetValueFromProperty, arginfo_stub_unsettest_testunsetvaluefromproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, testUnsetFromArray, arginfo_stub_unsettest_testunsetfromarray, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, testUnsetFromArrayByIndexVar, arginfo_stub_unsettest_testunsetfromarraybyindexvar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Unsettest, testUnsetProperty, arginfo_stub_unsettest_testunsetproperty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Unsettest, testUnsetProperty, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Unsettest, testStdClassUnset, arginfo_stub_unsettest_teststdclassunset, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Unsettest, testStdClassUnset, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Unsettest, testUnsetProperty, arginfo_stub_unsettest_testunsetproperty, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Unsettest, testStdClassUnset, arginfo_stub_unsettest_teststdclassunset, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, testUnsetTypedArray, arginfo_stub_unsettest_testunsettypedarray, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/usetest.zep.c b/ext/stub/usetest.zep.c index 880dd6aedc..1201799f4e 100644 --- a/ext/stub/usetest.zep.c +++ b/ext/stub/usetest.zep.c @@ -27,9 +27,6 @@ ZEPHIR_INIT_CLASS(Stub_UseTest) PHP_METHOD(Stub_UseTest, createInstance) { - zval *this_ptr = getThis(); - - object_init(return_value); return; @@ -37,9 +34,6 @@ PHP_METHOD(Stub_UseTest, createInstance) PHP_METHOD(Stub_UseTest, count) { - zval *this_ptr = getThis(); - - RETURN_LONG(0); } @@ -49,11 +43,8 @@ PHP_METHOD(Stub_UseTest, testUseClass1) zend_class_entry *_0 = NULL; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); if (!_0) { _0 = zephir_fetch_class_str_ex(SL("Oo\\OoConstruct"), ZEND_FETCH_CLASS_AUTO); @@ -72,11 +63,8 @@ PHP_METHOD(Stub_UseTest, testUseClass2) zend_class_entry *_0 = NULL; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); if (!_0) { _0 = zephir_fetch_class_str_ex(SL("Strings"), ZEND_FETCH_CLASS_AUTO); @@ -95,11 +83,8 @@ PHP_METHOD(Stub_UseTest, testUseNamespaceAlias) zend_class_entry *_0 = NULL; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); if (!_0) { _0 = zephir_fetch_class_str_ex(SL("Oo\\OoConstruct"), ZEND_FETCH_CLASS_AUTO); diff --git a/ext/stub/usetest.zep.h b/ext/stub/usetest.zep.h index 6c32b08e57..4967791a22 100644 --- a/ext/stub/usetest.zep.h +++ b/ext/stub/usetest.zep.h @@ -25,26 +25,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_usetest_testusenamespacealias, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_usetest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_UseTest, createInstance, arginfo_stub_usetest_createinstance, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, createInstance, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_UseTest, createInstance, arginfo_stub_usetest_createinstance, ZEND_ACC_PUBLIC) PHP_ME(Stub_UseTest, count, arginfo_stub_usetest_count, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_UseTest, testUseClass1, arginfo_stub_usetest_testuseclass1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, testUseClass1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_UseTest, testUseClass2, arginfo_stub_usetest_testuseclass2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, testUseClass2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_UseTest, testUseNamespaceAlias, arginfo_stub_usetest_testusenamespacealias, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, testUseNamespaceAlias, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_UseTest, testUseClass1, arginfo_stub_usetest_testuseclass1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_UseTest, testUseClass2, arginfo_stub_usetest_testuseclass2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_UseTest, testUseNamespaceAlias, arginfo_stub_usetest_testusenamespacealias, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/vars.zep.c b/ext/stub/vars.zep.c index d85b039d34..cb9858fdd5 100644 --- a/ext/stub/vars.zep.c +++ b/ext/stub/vars.zep.c @@ -38,7 +38,6 @@ PHP_METHOD(Stub_Vars, testParam) zend_long ZEPHIR_LAST_CALL_STATUS; zval *config_param = NULL, k, v, _0, *_1, _2, _5$$3, _7$$4; zval config; - zval *this_ptr = getThis(); ZVAL_UNDEF(&config); ZVAL_UNDEF(&k); @@ -47,19 +46,13 @@ PHP_METHOD(Stub_Vars, testParam) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_5$$3); ZVAL_UNDEF(&_7$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(config) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &config_param); ZEPHIR_OBS_COPY_OR_DUP(&config, config_param); - - zephir_array_fetch_string(&_0, &config, SL("dir"), PH_NOISY | PH_READONLY, "stub/vars.zep", 8); zephir_is_iterable(&_0, 0, "stub/vars.zep", 11); if (Z_TYPE_P(&_0) == IS_ARRAY) { @@ -73,7 +66,7 @@ PHP_METHOD(Stub_Vars, testParam) } ZEPHIR_INIT_NVAR(&v); ZVAL_COPY(&v, _1); - ZEPHIR_CALL_FUNCTION(&_5$$3, "realpath", &_6, 67, &v); + ZEPHIR_CALL_FUNCTION(&_5$$3, "realpath", &_6, 68, &v); zephir_check_call_status(); zephir_array_update_multi(&config, &_5$$3, SL("sz"), 3, SL("dir"), &k); } ZEND_HASH_FOREACH_END(); @@ -90,7 +83,7 @@ PHP_METHOD(Stub_Vars, testParam) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&v, &_0, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_7$$4, "realpath", &_6, 67, &v); + ZEPHIR_CALL_FUNCTION(&_7$$4, "realpath", &_6, 68, &v); zephir_check_call_status(); zephir_array_update_multi(&config, &_7$$4, SL("sz"), 3, SL("dir"), &k); ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); @@ -106,15 +99,13 @@ PHP_METHOD(Stub_Vars, testVarDump) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$false, a, ar, _0; - zval *this_ptr = getThis(); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); ZVAL_UNDEF(&ar); ZVAL_UNDEF(&_0); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "hello"); @@ -136,22 +127,15 @@ PHP_METHOD(Stub_Vars, testVarDump2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *ret, ret_sub, _0; - zval *this_ptr = getThis(); ZVAL_UNDEF(&ret_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(ret) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &ret); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_BOOL(&_0, ZEPHIR_IS_LONG(ret, 1)); @@ -163,7 +147,6 @@ PHP_METHOD(Stub_Vars, testVarExport) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval __$false, a, ar, ret, _0, _1, _2; - zval *this_ptr = getThis(); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&a); @@ -172,9 +155,8 @@ PHP_METHOD(Stub_Vars, testVarExport) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); ZEPHIR_INIT_VAR(&a); ZVAL_STRING(&a, "hello"); @@ -205,7 +187,6 @@ PHP_METHOD(Stub_Vars, test88Issue) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *param1_param = NULL, *param2_param = NULL, _0, _1, _2, _3; zval param1, param2; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1); ZVAL_UNDEF(¶m2); @@ -213,17 +194,14 @@ PHP_METHOD(Stub_Vars, test88Issue) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(param1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(param2) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, ¶m1_param, ¶m2_param); if (UNEXPECTED(Z_TYPE_P(param1_param) != IS_STRING && Z_TYPE_P(param1_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'param1' must be of the type string")); @@ -239,8 +217,6 @@ PHP_METHOD(Stub_Vars, test88Issue) } else { zephir_get_strval(¶m2, param2_param); } - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CPY_WRT(&_0, ¶m1); zephir_var_dump(&_0); @@ -261,22 +237,17 @@ PHP_METHOD(Stub_Vars, test88IssueParam2InitString) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *param1_param = NULL, *param2_param = NULL, _0; zval param1, param2; - zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1); ZVAL_UNDEF(¶m2); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(param1) Z_PARAM_OPTIONAL Z_PARAM_STR(param2) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 1, ¶m1_param, ¶m2_param); if (UNEXPECTED(Z_TYPE_P(param1_param) != IS_STRING && Z_TYPE_P(param1_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'param1' must be of the type string")); @@ -293,8 +264,6 @@ PHP_METHOD(Stub_Vars, test88IssueParam2InitString) } else { zephir_get_strval(¶m2, param2_param); } - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CPY_WRT(&_0, ¶m2); zephir_var_export(&_0); @@ -304,22 +273,14 @@ PHP_METHOD(Stub_Vars, test88IssueParam2InitString) PHP_METHOD(Stub_Vars, testVarDump2param) { zval *p1, p1_sub, *p2, p2_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&p1_sub); ZVAL_UNDEF(&p2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(p1) Z_PARAM_ZVAL(p2) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(2, 0, &p1, &p2); - - zephir_var_dump(p1); zephir_var_dump(p2); } @@ -327,24 +288,16 @@ PHP_METHOD(Stub_Vars, testVarDump2param) PHP_METHOD(Stub_Vars, testVarDump3param) { zval *p1, p1_sub, *p2, p2_sub, *p3, p3_sub; - zval *this_ptr = getThis(); ZVAL_UNDEF(&p1_sub); ZVAL_UNDEF(&p2_sub); ZVAL_UNDEF(&p3_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(p1) Z_PARAM_ZVAL(p2) Z_PARAM_ZVAL(p3) ZEND_PARSE_PARAMETERS_END(); -#endif - - zephir_fetch_params_without_memory_grow(3, 0, &p1, &p2, &p3); - - zephir_var_dump(p1); zephir_var_dump(p2); zephir_var_dump(p3); @@ -354,23 +307,16 @@ PHP_METHOD(Stub_Vars, testCountOptimizerVarDumpAndExport) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *testVar, testVar_sub, _0, _1; - zval *this_ptr = getThis(); ZVAL_UNDEF(&testVar_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(testVar) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 1, 0, &testVar); - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, zephir_fast_count_int(testVar)); @@ -387,21 +333,16 @@ PHP_METHOD(Stub_Vars, testArrayTypeVarDumpAndExport) zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *testVar_param = NULL, _0, _1; zval testVar; - zval *this_ptr = getThis(); ZVAL_UNDEF(&testVar); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(testVar) ZEND_PARSE_PARAMETERS_END(); -#endif - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); zephir_fetch_params(1, 0, 1, &testVar_param); if (!testVar_param) { ZEPHIR_INIT_VAR(&testVar); @@ -409,8 +350,6 @@ PHP_METHOD(Stub_Vars, testArrayTypeVarDumpAndExport) } else { zephir_get_arrval(&testVar, testVar_param); } - - ZEPHIR_INIT_VAR(&_0); ZEPHIR_CPY_WRT(&_0, &testVar); zephir_var_dump(&_0); @@ -428,13 +367,11 @@ PHP_METHOD(Stub_Vars, testIntVarDump) zval _0, _1; zend_long a = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 1; ZEPHIR_INIT_VAR(&_0); @@ -453,13 +390,11 @@ PHP_METHOD(Stub_Vars, testDoubleVarDump) zval _0, _1; double a = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = (double) (1); ZEPHIR_INIT_VAR(&_0); @@ -478,13 +413,11 @@ PHP_METHOD(Stub_Vars, testBoolVarDump) zval _0, _1; zend_bool a = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - - - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); a = 1; ZEPHIR_INIT_VAR(&_0); @@ -502,13 +435,8 @@ PHP_METHOD(Stub_Vars, testGetDefinedVars) { double pi; zend_long a; - zval *this_ptr = getThis(); - - - - a = 1; - pi = 3.14; + pi = (3.14); zephir_get_defined_vars(return_value); return; } diff --git a/ext/stub/vars.zep.h b/ext/stub/vars.zep.h index f8473e514e..48c3dc669f 100644 --- a/ext/stub/vars.zep.h +++ b/ext/stub/vars.zep.h @@ -58,11 +58,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testcountoptimizervardumpandexport, 0, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testarraytypevardumpandexport, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, testVar, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, testVar, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, testVar, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testintvardump, 0, 0, 0) @@ -79,42 +75,18 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_vars_method_entry) { PHP_ME(Stub_Vars, testParam, arginfo_stub_vars_testparam, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testVarDump, arginfo_stub_vars_testvardump, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testVarDump, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Vars, testVarDump, arginfo_stub_vars_testvardump, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testVarDump2, arginfo_stub_vars_testvardump2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testVarExport, arginfo_stub_vars_testvarexport, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testVarExport, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Vars, testVarExport, arginfo_stub_vars_testvarexport, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, test88Issue, arginfo_stub_vars_test88issue, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, test88IssueParam2InitString, arginfo_stub_vars_test88issueparam2initstring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testVarDump2param, arginfo_stub_vars_testvardump2param, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testVarDump3param, arginfo_stub_vars_testvardump3param, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testCountOptimizerVarDumpAndExport, arginfo_stub_vars_testcountoptimizervardumpandexport, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testArrayTypeVarDumpAndExport, arginfo_stub_vars_testarraytypevardumpandexport, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testIntVarDump, arginfo_stub_vars_testintvardump, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testIntVarDump, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testDoubleVarDump, arginfo_stub_vars_testdoublevardump, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testDoubleVarDump, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testBoolVarDump, arginfo_stub_vars_testboolvardump, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testBoolVarDump, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testGetDefinedVars, arginfo_stub_vars_testgetdefinedvars, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testGetDefinedVars, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Vars, testIntVarDump, arginfo_stub_vars_testintvardump, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Vars, testDoubleVarDump, arginfo_stub_vars_testdoublevardump, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Vars, testBoolVarDump, arginfo_stub_vars_testboolvardump, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Vars, testGetDefinedVars, arginfo_stub_vars_testgetdefinedvars, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/kernels/ZendEngine3/README.md b/kernel/README.md old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/README.md rename to kernel/README.md diff --git a/kernels/ZendEngine3/array.c b/kernel/array.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/array.c rename to kernel/array.c diff --git a/kernels/ZendEngine3/array.h b/kernel/array.h old mode 100755 new mode 100644 similarity index 97% rename from kernels/ZendEngine3/array.h rename to kernel/array.h index 11d19b6f77..1c98ca2cc0 --- a/kernels/ZendEngine3/array.h +++ b/kernel/array.h @@ -9,8 +9,6 @@ * following url: https://docs.zephir-lang.com/en/latest/license */ -#ifndef ZEPHIR_KERNEL_ARRAY_H -#define ZEPHIR_KERNEL_ARRAY_H #define ZEPHIR_MAX_ARRAY_LEVELS 16 #include @@ -73,5 +71,3 @@ int zephir_fast_in_array(zval *needle, zval *haystack); Z_TRY_ADDREF_P(value); \ zend_hash_next_index_insert(Z_ARRVAL_P(arr), value); \ } while (0) - -#endif /* ZEPHIR_KERNEL_ARRAY_H */ diff --git a/kernels/ZendEngine3/backtrace.c b/kernel/backtrace.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/backtrace.c rename to kernel/backtrace.c diff --git a/kernels/ZendEngine3/backtrace.h b/kernel/backtrace.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/backtrace.h rename to kernel/backtrace.h diff --git a/kernels/ZendEngine3/debug.c b/kernel/debug.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/debug.c rename to kernel/debug.c diff --git a/kernels/ZendEngine3/debug.h b/kernel/debug.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/debug.h rename to kernel/debug.h diff --git a/kernels/ZendEngine3/exception.c b/kernel/exception.c old mode 100755 new mode 100644 similarity index 89% rename from kernels/ZendEngine3/exception.c rename to kernel/exception.c index 6d0a50ba3c..404162af8d --- a/kernels/ZendEngine3/exception.c +++ b/kernel/exception.c @@ -38,7 +38,8 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line) ZVAL_UNDEF(&curline); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); if (Z_TYPE_P(object) != IS_OBJECT) { ZVAL_COPY_VALUE(&object_copy, object); @@ -54,14 +55,8 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line) zephir_check_call_status(); if (ZEPHIR_IS_LONG(&curline, 0)) { default_exception_ce = zend_exception_get_default(); - -#if PHP_VERSION_ID >= 80000 zend_update_property_string(default_exception_ce, Z_OBJ_P(object), SL("file"), file); zend_update_property_long(default_exception_ce, Z_OBJ_P(object), SL("line"), line); -#else - zend_update_property_string(default_exception_ce, object, SL("file"), file); - zend_update_property_long(default_exception_ce, object, SL("line"), line); -#endif } } @@ -88,13 +83,8 @@ void zephir_throw_exception_string_debug(zend_class_entry *ce, const char *messa if (line > 0) { default_exception_ce = zend_exception_get_default(); -#if PHP_VERSION_ID >= 80000 zend_update_property_string(default_exception_ce, Z_OBJ(object), "file", sizeof("file")-1, file); zend_update_property_long(default_exception_ce, Z_OBJ(object), "line", sizeof("line")-1, line); -#else - zend_update_property_string(default_exception_ce, &object, "file", sizeof("file")-1, file); - zend_update_property_long(default_exception_ce, &object, "line", sizeof("line")-1, line); -#endif } if (ZEPHIR_LAST_CALL_STATUS != FAILURE) { diff --git a/kernels/ZendEngine3/exception.h b/kernel/exception.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/exception.h rename to kernel/exception.h diff --git a/kernels/ZendEngine3/exit.c b/kernel/exit.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/exit.c rename to kernel/exit.c diff --git a/kernels/ZendEngine3/exit.h b/kernel/exit.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/exit.h rename to kernel/exit.h diff --git a/kernels/ZendEngine3/fcall.c b/kernel/fcall.c old mode 100755 new mode 100644 similarity index 91% rename from kernels/ZendEngine3/fcall.c rename to kernel/fcall.c index d017ec4db3..40b1f98f60 --- a/kernels/ZendEngine3/fcall.c +++ b/kernel/fcall.c @@ -211,21 +211,12 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze } fcic->called_scope = called_scope; - -#if PHP_VERSION_ID >= 80000 calling_scope = zend_get_called_scope(EG(current_execute_data)); -#else - calling_scope = zend_get_executed_scope(); -#endif - fcic->object = this_ptr ? Z_OBJ_P(this_ptr) : NULL; switch (type) { case zephir_fcall_parent: - -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->parent->function_table, Z_STR_P(func)); - fcic->calling_scope = ce->parent; } else if (EXPECTED(calling_scope && calling_scope->parent)) { if (Z_TYPE_P(func) == IS_STRING) { @@ -235,7 +226,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze } else { return; } -#endif + if (UNEXPECTED(!calling_scope || !calling_scope->parent)) { return; } @@ -244,7 +235,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze break; case zephir_fcall_static: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); fcic->calling_scope = ce; @@ -252,17 +242,10 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func)); fcic->calling_scope = called_scope; } -#else - fcic->calling_scope = called_scope; - if (UNEXPECTED(!calling_scope)) { - return; - } -#endif break; case zephir_fcall_self: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); fcic->calling_scope = ce; @@ -273,13 +256,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze //fcic->called_scope = zend_get_called_scope(EG(current_execute_data)); fcic->calling_scope = calling_scope; } -#else - fcic->calling_scope = calling_scope; -#endif break; case zephir_fcall_ce: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); @@ -288,7 +267,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func)); fcic->calling_scope = calling_scope; } -#endif // TODO: Check for PHP 7.4 and PHP 8.0, as it rewrite from above fcic->calling_scope = ce; fcic->called_scope = ce; @@ -297,11 +275,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze case zephir_fcall_function: case zephir_fcall_method: if (Z_TYPE_P(func) == IS_OBJECT) { -#if PHP_VERSION_ID >= 80000 if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(Z_OBJ_P(func), &fcic->calling_scope, &fcic->function_handler, &fcic->object, 0) == SUCCESS) { -#else - if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(func, &fcic->calling_scope, &fcic->function_handler, &fcic->object) == SUCCESS) { -#endif fcic->called_scope = fcic->calling_scope; break; } @@ -309,11 +283,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze return; } -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); } -#endif fcic->calling_scope = this_ptr ? Z_OBJCE_P(this_ptr) : NULL; fcic->called_scope = fcic->calling_scope; break; @@ -383,12 +355,7 @@ int zephir_call_user_function( ZVAL_COPY_VALUE(&fci.function_name, function_name); fci.retval = retval_ptr ? retval_ptr : &local_retval_ptr; fci.param_count = param_count; - -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else fci.named_params = NULL; -#endif if (cache_entry && *cache_entry) { /* We have a cache record, initialize scope */ @@ -402,22 +369,22 @@ int zephir_call_user_function( /* The caller is interested in caching OR we have the call cache enabled */ resolve_callable(&callable, type, (object_pp && type != zephir_fcall_ce ? Z_OBJCE_P(object_pp) : obj_ce), object_pp, function_name); -#if PHP_VERSION_ID >= 80000 - char *is_callable_error = NULL; - zend_execute_data *frame = EG(current_execute_data); + char *is_callable_error = NULL; + zend_execute_data *frame = EG(current_execute_data); +#if PHP_VERSION_ID >= 80200 + if (obj_ce || !zend_is_callable_at_frame(&callable, fci.object, frame, IS_CALLABLE_SUPPRESS_DEPRECATIONS, &fcic, &is_callable_error)) { +#else if (obj_ce || !zend_is_callable_at_frame(&callable, fci.object, frame, 0, &fcic, &is_callable_error)) { - if (is_callable_error) { - zend_error(E_WARNING, "%s", is_callable_error); - efree(is_callable_error); +#endif + if (is_callable_error) { + zend_error(E_WARNING, "%s", is_callable_error); + efree(is_callable_error); - return FAILURE; - } + return FAILURE; + } populate_fcic(&fcic, type, obj_ce, object_pp, function_name, called_scope); } -#else - zend_is_callable_ex(&callable, fci.object, IS_CALLABLE_CHECK_SILENT, NULL, &fcic, NULL); -#endif } #ifdef _MSC_VER @@ -432,12 +399,9 @@ int zephir_call_user_function( } fci.params = p; - -#if PHP_VERSION_ID >= 80000 if (!fcic.function_handler) { ZVAL_COPY_VALUE(&fci.function_name, &callable); } -#endif status = zend_call_function(&fci, &fcic); @@ -630,31 +594,12 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa return FAILURE; } -#if PHP_VERSION_ID < 80000 - zend_fcall_info_init(handler, 0, &fci, &fci_cache, NULL, &is_callable_error); - - if (is_callable_error) { - zend_error(E_WARNING, "%s", is_callable_error); - efree(is_callable_error); - } else { - status = SUCCESS; - } - - if (status == SUCCESS) { - zend_fcall_info_args(&fci, params); - - fci.retval = return_value; - zend_call_function(&fci, &fci_cache); - - zend_fcall_info_args_clear(&fci, 1); - } - - if (EG(exception)) { - status = SUCCESS; - } -#else zend_execute_data *frame = EG(current_execute_data); +#if PHP_VERSION_ID >= 80200 + if (!zend_is_callable_at_frame(handler, NULL, frame, IS_CALLABLE_SUPPRESS_DEPRECATIONS, &fci_cache, &is_callable_error)) { +#else if (!zend_is_callable_at_frame(handler, NULL, frame, 0, &fci_cache, &is_callable_error)) { +#endif if (is_callable_error) { zend_error(E_WARNING, "%s", is_callable_error); efree(is_callable_error); @@ -674,7 +619,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa zend_fcall_info_args(&fci, params); status = zend_call_function(&fci, &fci_cache); zend_fcall_info_args_clear(&fci, 1); -#endif return status; } @@ -696,11 +640,7 @@ void zephir_eval_php(zval *str, zval *retval_ptr, char *context) #if PHP_VERSION_ID >= 80200 new_op_array = zend_compile_string(Z_STR_P(str), context, ZEND_COMPILE_POSITION_AFTER_OPEN_TAG); #else -#if PHP_VERSION_ID >= 80000 new_op_array = zend_compile_string(Z_STR_P(str), context); -#else - new_op_array = zend_compile_string(str, context); -#endif #endif CG(compiler_options) = original_compiler_options; diff --git a/kernels/ZendEngine3/fcall.h b/kernel/fcall.h old mode 100755 new mode 100644 similarity index 90% rename from kernels/ZendEngine3/fcall.h rename to kernel/fcall.h index 2581360756..4754bf4626 --- a/kernels/ZendEngine3/fcall.h +++ b/kernel/fcall.h @@ -167,19 +167,11 @@ typedef enum _zephir_call_type { ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif #define ZEPHIR_RETURN_CALL_PARENT(class_entry, this_ptr, method, cache, cache_slot, ...) \ do { \ @@ -187,51 +179,25 @@ typedef enum _zephir_call_type { ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_parent, this_ptr, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ - ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ - ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif #define ZEPHIR_CALL_CE_STATIC(return_value_ptr, class_entry, method, cache, cache_slot, ...) \ do { \ diff --git a/kernels/ZendEngine3/file.c b/kernel/file.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/file.c rename to kernel/file.c diff --git a/kernels/ZendEngine3/file.h b/kernel/file.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/file.h rename to kernel/file.h diff --git a/kernels/ZendEngine3/filter.c b/kernel/filter.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/filter.c rename to kernel/filter.c diff --git a/kernels/ZendEngine3/filter.h b/kernel/filter.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/filter.h rename to kernel/filter.h diff --git a/kernels/ZendEngine3/globals.h b/kernel/globals.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/globals.h rename to kernel/globals.h diff --git a/kernels/ZendEngine3/iterator.c b/kernel/iterator.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/iterator.c rename to kernel/iterator.c diff --git a/kernels/ZendEngine3/iterator.h b/kernel/iterator.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/iterator.h rename to kernel/iterator.h diff --git a/kernels/ZendEngine3/main.c b/kernel/main.c old mode 100755 new mode 100644 similarity index 91% rename from kernels/ZendEngine3/main.c rename to kernel/main.c index 1bbd149639..8aeedda44e --- a/kernels/ZendEngine3/main.c +++ b/kernel/main.c @@ -137,26 +137,17 @@ void zephir_fast_count(zval *result, zval *value) } if (Z_TYPE_P(value) == IS_OBJECT) { - zval retval; if (Z_OBJ_HT_P(value)->count_elements) { ZVAL_LONG(result, 1); -#if PHP_VERSION_ID >= 80000 if (SUCCESS == Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &Z_LVAL_P(result))) { -#else - if (SUCCESS == Z_OBJ_HT(*value)->count_elements(value, &Z_LVAL_P(result))) { -#endif return; } } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); ZVAL_LONG(result, Z_LVAL(retval)); @@ -189,24 +180,15 @@ int zephir_fast_count_ev(zval *value) } if (Z_TYPE_P(value) == IS_OBJECT) { - zval retval; if (Z_OBJ_HT_P(value)->count_elements) { -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &count); -#else - Z_OBJ_HT(*value)->count_elements(value, &count); -#endif return (int) count > 0; } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); count = Z_LVAL(retval); @@ -241,20 +223,12 @@ int zephir_fast_count_int(zval *value) zval retval; if (Z_OBJ_HT_P(value)->count_elements) { -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &count); -#else - Z_OBJ_HT(*value)->count_elements(value, &count); -#endif return (int) count; } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); count = Z_LVAL(retval); @@ -282,7 +256,7 @@ int zephir_fast_count_int(zval *value) */ int zephir_function_exists(const zval *function_name) { - if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)) != NULL) { + if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name))) { return SUCCESS; } @@ -406,7 +380,6 @@ zend_class_entry* zephir_get_internal_ce(const char *class_name, unsigned int cl /* Declare constants */ int zephir_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value) { -#if PHP_VERSION_ID >= 80000 zend_string *key; if (ce->type == ZEND_INTERNAL_CLASS) { @@ -422,24 +395,6 @@ int zephir_declare_class_constant(zend_class_entry *ce, const char *name, size_t } return SUCCESS; -#else - int ret; - zend_string *key; - - if (ce->type == ZEND_INTERNAL_CLASS) { - key = zend_string_init_interned(name, name_length, 1); - } else { - key = zend_string_init(name, name_length, 0); - } - - ret = zend_declare_class_constant_ex(ce, key, value, ZEND_ACC_PUBLIC, NULL); - - if (ce->type != ZEND_INTERNAL_CLASS) { - zend_string_release(key); - } - - return ret; -#endif } int zephir_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length) diff --git a/kernels/ZendEngine3/main.h b/kernel/main.h old mode 100755 new mode 100644 similarity index 98% rename from kernels/ZendEngine3/main.h rename to kernel/main.h index 72278a569f..99194e3c92 --- a/kernels/ZendEngine3/main.h +++ b/kernel/main.h @@ -36,11 +36,6 @@ extern zend_string* i_self; #define PH_COPY 1024 #define PH_CTOR 4096 -/* Deprecated */ -#ifndef zend_uint - #define zend_uint uint32_t -#endif - #ifndef ZEND_ACC_FINAL_CLASS #define ZEND_ACC_FINAL_CLASS ZEND_ACC_FINAL #endif @@ -198,7 +193,6 @@ extern zend_string* i_self; #define RETURN_MM_ON_FAILURE(what) \ do { \ if (what == FAILURE) { \ - ZEPHIR_MM_RESTORE(); \ return; \ } \ } while (0) @@ -289,7 +283,7 @@ int zephir_fetch_parameters(int num_args, int required_args, int optional_args, zval _null; \ ZVAL_NULL(&_null); \ ZVAL_COPY(return_value, &_null); \ - zephir_ptr_dtor(&_null); \ + zval_ptr_dtor(&_null); \ } else { \ ZVAL_COPY(return_value, _constant_ptr); \ } \ diff --git a/kernels/ZendEngine3/math.c b/kernel/math.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/math.c rename to kernel/math.c diff --git a/kernels/ZendEngine3/math.h b/kernel/math.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/math.h rename to kernel/math.h diff --git a/kernels/ZendEngine3/memory.c b/kernel/memory.c old mode 100755 new mode 100644 similarity index 50% rename from kernels/ZendEngine3/memory.c rename to kernel/memory.c index ac1f012fd0..68c76a15a1 --- a/kernels/ZendEngine3/memory.c +++ b/kernel/memory.c @@ -38,147 +38,147 @@ static zend_always_inline zend_execute_data* find_symbol_table(zend_execute_data* ex) { - while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->common.type))) { - ex = ex->prev_execute_data; - } + while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->common.type))) { + ex = ex->prev_execute_data; + } - return ex; + return ex; } /** - * Adds a memory frame in the current executed method - */ +* Adds a memory frame in the current executed method +*/ void ZEPHIR_FASTCALL zephir_memory_grow_stack(zephir_method_globals *g, const char *func) { - if (g->active_memory == NULL) { - zephir_memory_entry *active_memory; +if (g->active_memory == NULL) { + zephir_memory_entry *active_memory; - active_memory = (zephir_memory_entry *) pecalloc(1, sizeof(zephir_memory_entry), 0); + active_memory = (zephir_memory_entry *) pecalloc(1, sizeof(zephir_memory_entry), 0); - active_memory->addresses = pecalloc(24, sizeof(zval*), 0); - active_memory->capacity = 24; + active_memory->addresses = pecalloc(24, sizeof(zval*), 0); + active_memory->capacity = 24; - g->active_memory = active_memory; - } + g->active_memory = active_memory; +} - assert(g->active_memory != NULL); - assert(g->active_memory->pointer == 0); +assert(g->active_memory != NULL); +assert(g->active_memory->pointer == 0); #ifndef ZEPHIR_RELEASE - g->active_memory->func = func; +g->active_memory->func = func; #endif } void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func) { - size_t i; - zephir_memory_entry *active_memory; - zephir_symbol_table *active_symbol_table; - zval *ptr; +size_t i; +zephir_memory_entry *active_memory; +zephir_symbol_table *active_symbol_table; +zval *ptr; #ifndef ZEPHIR_RELEASE - int show_backtrace = 0; +int show_backtrace = 0; #endif #ifndef ZEPHIR_RELEASE - if (UNEXPECTED(g->active_memory == NULL)) { - fprintf(stderr, "WARNING: calling zephir_memory_restore_stack() without an active memory frame!\n"); - fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); - fprintf(stderr, "Calling function: %s\n", func); - zephir_print_backtrace(); - return; - } +if (UNEXPECTED(g->active_memory == NULL)) { + fprintf(stderr, "WARNING: calling zephir_memory_restore_stack() without an active memory frame!\n"); + fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); + fprintf(stderr, "Calling function: %s\n", func); + zephir_print_backtrace(); + return; +} - if (UNEXPECTED(g->active_memory->func != func)) { - fprintf(stderr, "Trying to free someone else's memory frame!\n"); - fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); - fprintf(stderr, "Calling function: %s\n", func); - zephir_print_backtrace(); - return; - } +if (UNEXPECTED(g->active_memory->func != func)) { + fprintf(stderr, "Trying to free someone else's memory frame!\n"); + fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); + fprintf(stderr, "Calling function: %s\n", func); + zephir_print_backtrace(); + return; +} #endif - active_memory = g->active_memory; - assert(active_memory != NULL); +active_memory = g->active_memory; +assert(active_memory != NULL); - if (EXPECTED(!CG(unclean_shutdown))) { - /* Clean active symbol table */ - if (g->active_symbol_table) { - active_symbol_table = g->active_symbol_table; - while (active_symbol_table && active_symbol_table->scope == active_memory) { - zend_execute_data *ex = find_symbol_table(EG(current_execute_data)); +if (EXPECTED(!CG(unclean_shutdown))) { + /* Clean active symbol table */ + if (g->active_symbol_table) { + active_symbol_table = g->active_symbol_table; + while (active_symbol_table && active_symbol_table->scope == active_memory) { + zend_execute_data *ex = find_symbol_table(EG(current_execute_data)); #ifndef ZEPHIR_RELEASE - if (UNEXPECTED(!ex)) { - fprintf(stderr, "ERROR: unable to find a symbol table"); - zephir_print_backtrace(); - return; - } -#endif - zend_hash_destroy(ex->symbol_table); - efree(ex->symbol_table); - ex->symbol_table = active_symbol_table->symbol_table; - zend_attach_symbol_table(ex); - zend_rebuild_symbol_table(); - - g->active_symbol_table = active_symbol_table->prev; - efree(active_symbol_table); - active_symbol_table = g->active_symbol_table; + if (UNEXPECTED(!ex)) { + fprintf(stderr, "ERROR: unable to find a symbol table"); + zephir_print_backtrace(); + return; } +#endif + zend_hash_destroy(ex->symbol_table); + efree(ex->symbol_table); + ex->symbol_table = active_symbol_table->symbol_table; + zend_attach_symbol_table(ex); + zend_rebuild_symbol_table(); + + g->active_symbol_table = active_symbol_table->prev; + efree(active_symbol_table); + active_symbol_table = g->active_symbol_table; } + } #ifndef ZEPHIR_RELEASE - for (i = 0; i < active_memory->pointer; ++i) { - if (active_memory->addresses[i] != NULL) { - zval *var = active_memory->addresses[i]; - if (Z_TYPE_P(var) > IS_CALLABLE) { - fprintf(stderr, "%s: observed variable #%d (%p) has invalid type %u [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); - show_backtrace = 1; - } - - if (!Z_REFCOUNTED_P(var)) { - continue; - } - - if (Z_REFCOUNT_P(var) == 0) { - fprintf(stderr, "%s: observed variable #%d (%p) has 0 references, type=%d [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); - show_backtrace = 1; - } - else if (Z_REFCOUNT_P(var) >= 1000000) { - fprintf(stderr, "%s: observed variable #%d (%p) has too many references (%u), type=%d [%s]\n", __func__, (int)i, var, Z_REFCOUNT_P(var), Z_TYPE_P(var), active_memory->func); - show_backtrace = 1; - } + for (i = 0; i < active_memory->pointer; ++i) { + if (active_memory->addresses[i] != NULL) { + zval *var = active_memory->addresses[i]; + if (Z_TYPE_P(var) > IS_CALLABLE) { + fprintf(stderr, "%s: observed variable #%d (%p) has invalid type %u [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); + show_backtrace = 1; + } + + if (!Z_REFCOUNTED_P(var)) { + continue; + } + + if (Z_REFCOUNT_P(var) == 0) { + fprintf(stderr, "%s: observed variable #%d (%p) has 0 references, type=%d [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); + show_backtrace = 1; + } + else if (Z_REFCOUNT_P(var) >= 1000000) { + fprintf(stderr, "%s: observed variable #%d (%p) has too many references (%u), type=%d [%s]\n", __func__, (int)i, var, Z_REFCOUNT_P(var), Z_TYPE_P(var), active_memory->func); + show_backtrace = 1; } } + } #endif - /* Traverse all zvals allocated, reduce the reference counting or free them */ - for (i = 0; i < active_memory->pointer; ++i) { - ptr = active_memory->addresses[i]; - if (EXPECTED(ptr != NULL)) { - if (!Z_REFCOUNTED_P(ptr)) continue; - if (Z_REFCOUNT_P(ptr) == 1) { - zval_ptr_dtor(ptr); - } else { - Z_DELREF_P(ptr); - } + /* Traverse all zvals allocated, reduce the reference counting or free them */ + for (i = 0; i < active_memory->pointer; ++i) { + ptr = active_memory->addresses[i]; + if (EXPECTED(ptr != NULL)) { + if (!Z_REFCOUNTED_P(ptr)) continue; + if (Z_REFCOUNT_P(ptr) == 1) { + zval_ptr_dtor(ptr); + } else { + Z_DELREF_P(ptr); } } } +} #ifndef ZEPHIR_RELEASE - active_memory->func = NULL; +active_memory->func = NULL; #endif - if (active_memory->addresses != NULL) { - pefree(active_memory->addresses, 0); - } +if (active_memory->addresses != NULL) { + pefree(active_memory->addresses, 0); +} - pefree(g->active_memory, 0); - g->active_memory = NULL; +pefree(g->active_memory, 0); +g->active_memory = NULL; #ifndef ZEPHIR_RELEASE - if (show_backtrace == 1) { - zephir_print_backtrace(); - } +if (show_backtrace == 1) { + zephir_print_backtrace(); +} #endif } @@ -274,60 +274,6 @@ int zephir_set_symbol(zval *key_name, zval *value) return SUCCESS; } -/** - * Exports a string symbol to the active symbol table - */ -int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value) -{ - zend_array *symbol_table = zend_rebuild_symbol_table(); - - if (!symbol_table) { - php_error_docref(NULL, E_WARNING, "Cannot find a valid symbol_table"); - return FAILURE; - } - - Z_TRY_ADDREF_P(value); - zend_hash_str_update(symbol_table, key_name, key_length, value); - - return SUCCESS; -} - -/** - * Cleans the function/method cache up - */ -int zephir_cleanup_fcache(void *pDest, int num_args, va_list args, zend_hash_key *hash_key) -{ - zephir_fcall_cache_entry **entry = (zephir_fcall_cache_entry**) pDest; - zend_class_entry *scope; - size_t len = ZSTR_LEN(hash_key->key); - - assert(hash_key->key != NULL); - assert(len > 2 * sizeof(zend_class_entry**)); - - memcpy(&scope, &ZSTR_VAL(hash_key->key)[(len -1) - 2 * sizeof(zend_class_entry**)], sizeof(zend_class_entry*)); - -/* -#ifndef ZEPHIR_RELEASE - { - zend_class_entry *cls; - memcpy(&cls, &hash_key->arKey[len - sizeof(zend_class_entry**)], sizeof(zend_class_entry*)); - - fprintf(stderr, "func: %s, cls: %s, scope: %s [%u]\n", (*entry)->f->common.function_name, (cls ? cls->name : "N/A"), (scope ? scope->name : "N/A"), (uint)(*entry)->times); - } -#endif -*/ - - if ((*entry)->type != ZEND_INTERNAL_FUNCTION || (scope && scope->type != ZEND_INTERNAL_CLASS)) { - return ZEND_HASH_APPLY_REMOVE; - } - - if (scope && scope->type == ZEND_INTERNAL_CLASS && scope->info.internal.module->type != MODULE_PERSISTENT) { - return ZEND_HASH_APPLY_REMOVE; - } - - return ZEND_HASH_APPLY_KEEP; -} - void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g) { zephir_memory_entry *frame = g->active_memory; diff --git a/kernels/ZendEngine3/memory.h b/kernel/memory.h old mode 100755 new mode 100644 similarity index 77% rename from kernels/ZendEngine3/memory.h rename to kernel/memory.h index 269ed60920..7da4ec47e2 --- a/kernels/ZendEngine3/memory.h +++ b/kernel/memory.h @@ -17,12 +17,6 @@ #include "php_ext.h" #include "kernel/globals.h" -#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64) - #define ZEPHIR_ENABLE_64BITS 1 -#endif - -#define ZEPHIR_NUM_PREALLOCATED_FRAMES 25 - /** Memory frame */ typedef struct _zephir_memory_entry { size_t pointer; @@ -53,21 +47,14 @@ typedef struct _zephir_method_globals { void ZEPHIR_FASTCALL zephir_memory_grow_stack(zephir_method_globals *g, const char *func); void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func); -#define ZEPHIR_MM_GROW() \ - ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); \ - zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - #define ZEPHIR_MM_RESTORE() \ zephir_memory_restore_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); \ pefree(ZEPHIR_METHOD_GLOBALS_PTR, 0); \ ZEPHIR_METHOD_GLOBALS_PTR = NULL; void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); -int zephir_cleanup_fcache(void *pDest, int num_args, va_list args, zend_hash_key *hash_key); void zephir_deinitialize_memory(); -#define zephir_ptr_dtor(x) zval_ptr_dtor(x) - void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g); #define zephir_memory_observe(var) zephir_do_memory_observe(var, ZEPHIR_METHOD_GLOBALS_PTR); @@ -78,14 +65,11 @@ void zephir_create_symbol_table(zephir_method_globals *g); #define ZEPHIR_CREATE_SYMBOL_TABLE() zephir_create_symbol_table(ZEPHIR_METHOD_GLOBALS_PTR); int zephir_set_symbol(zval *key_name, zval *value); -int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); #define ZEPHIR_INIT_VAR(z) \ zephir_memory_observe(z); \ ZVAL_NULL(z); -#define ZEPHIR_INIT_ZVAL_NREF(z) ZVAL_UNDEF(&z); - #define ZEPHIR_INIT_NVAR(z) \ do { \ if (Z_TYPE_P(z) == IS_UNDEF) { \ @@ -100,14 +84,11 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); ZVAL_NULL(z); \ } while (0) -/* only removes the value body of the zval */ -#define ZEPHIR_INIT_LNVAR(z) ZEPHIR_INIT_NVAR(&z) - #define ZEPHIR_CPY_WRT(d, v) \ Z_TRY_ADDREF_P(v); \ if (Z_TYPE_P(d) > IS_UNDEF) { \ if (Z_REFCOUNTED_P(d) && Z_REFCOUNT_P(d) > 0) { \ - zephir_ptr_dtor(d); \ + zval_ptr_dtor(d); \ } \ } else { \ zephir_memory_observe(d); \ @@ -117,24 +98,16 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); #define ZEPHIR_CPY_WRT_CTOR(d, v) \ if (d) { \ if (Z_REFCOUNTED_P(d) && Z_REFCOUNT_P(d) > 0) { \ - zephir_ptr_dtor(d); \ + zval_ptr_dtor(d); \ } \ - } else { \ - /*TODO: as above */ \ } \ ZVAL_DUP(d, v); -#define ZEPHIR_OBS_VAR(z) \ - zephir_memory_observe(z) - -#define ZEPHIR_OBS_VAR_ONCE(z) \ +#define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ if (Z_TYPE_P(z) == IS_UNDEF) { \ zephir_memory_observe(z); \ - } - -#define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ - ZEPHIR_OBS_VAR_ONCE(z); \ - ZVAL_COPY(z, v); + } \ + ZVAL_COPY(z, v); #define ZEPHIR_HASH_COPY(z, v) \ if (Z_TYPE_P(z) == IS_ARRAY && Z_TYPE_P(v) == IS_ARRAY) { \ @@ -146,7 +119,7 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); if (Z_REFCOUNTED_P(z) && Z_REFCOUNT_P(z) > 1) { \ Z_DELREF_P(z); \ } else {\ - zephir_ptr_dtor(z); \ + zval_ptr_dtor(z); \ ZVAL_NULL(z); \ } \ } else { \ @@ -161,7 +134,7 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); zval *tmp_ = (ppzv); \ if (tmp_ != NULL) { \ if (Z_TYPE_P(tmp_) != IS_UNDEF) { \ - zephir_ptr_dtor(tmp_); \ + zval_ptr_dtor(tmp_); \ } else { \ zephir_memory_observe(tmp_); \ } \ @@ -169,13 +142,10 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); } \ } while (0) -#define ZEPHIR_SEPARATE(z) SEPARATE_ZVAL(z) - #define ZEPHIR_SEPARATE_PARAM(z) \ do { \ zval *orig_ptr = z; \ - ZEPHIR_SEPARATE(orig_ptr); \ - /*zephir_memory_observe(orig_ptr);*/ \ + SEPARATE_ZVAL(orig_ptr); \ } while (0) #endif diff --git a/kernels/ZendEngine3/object.c b/kernel/object.c old mode 100755 new mode 100644 similarity index 96% rename from kernels/ZendEngine3/object.c rename to kernel/object.c index 3fb2e006c6..12f703ef27 --- a/kernels/ZendEngine3/object.c +++ b/kernel/object.c @@ -338,11 +338,7 @@ int zephir_clone(zval *destination, zval *obj) status = FAILURE; } else { if (!EG(exception)) { -#if PHP_VERSION_ID >= 80000 ZVAL_OBJ(destination, clone_call(Z_OBJ_P(obj))); -#else - ZVAL_OBJ(destination, clone_call(obj)); -#endif if (EG(exception)) { zval_ptr_dtor(destination); } @@ -363,19 +359,11 @@ int zephir_isset_property(zval *object, const char *property_name, unsigned int return 1; } -#if PHP_VERSION_ID >= 80000 return zend_hash_str_exists( Z_OBJ_HT_P(object)->get_properties(Z_OBJ_P(object)), property_name, property_length ); -#else - return zend_hash_str_exists( - Z_OBJ_HT_P(object)->get_properties(object), - property_name, - property_length - ); -#endif } return 0; @@ -391,19 +379,11 @@ int zephir_isset_property_zval(zval *object, const zval *property) if (EXPECTED(zend_hash_str_exists(&Z_OBJCE_P(object)->properties_info, Z_STRVAL_P(property), Z_STRLEN_P(property)))) { return 1; } else { -#if PHP_VERSION_ID >= 80000 return zend_hash_str_exists( Z_OBJ_HT_P(object)->get_properties(Z_OBJ_P(object)), Z_STRVAL_P(property), Z_STRLEN_P(property) ); -#else - return zend_hash_str_exists( - Z_OBJ_HT_P(object)->get_properties(object), - Z_STRVAL_P(property), - Z_STRLEN_P(property) - ); -#endif } } } @@ -523,15 +503,9 @@ int zephir_read_property( } ZVAL_STRINGL(&property, property_name, property_length); -#if PHP_VERSION_ID >= 80000 res = Z_OBJ_HT_P(object)->read_property(Z_OBJ_P(object), Z_STR(property), flags ? BP_VAR_IS : BP_VAR_R, NULL, &tmp); -#else - res = Z_OBJ_HT_P(object)->read_property(object, &property, - flags ? BP_VAR_IS : BP_VAR_R, - NULL, &tmp); -#endif if ((flags & PH_READONLY) == PH_READONLY) { ZVAL_COPY_VALUE(result, res); @@ -674,11 +648,7 @@ int zephir_update_property_zval( /* write_property will add 1 to refcount, so no Z_TRY_ADDREF_P(value) is necessary */ -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT_P(object)->write_property(Z_OBJ_P(object), Z_STR(property), &sep_value, 0); -#else - Z_OBJ_HT_P(object)->write_property(object, &property, &sep_value, 0); -#endif zval_ptr_dtor(&property); @@ -770,7 +740,7 @@ int zephir_update_property_array(zval *object, const char *property, uint32_t pr if (separated) { zephir_update_property_zval(object, property, property_length, &tmp); - zephir_ptr_dtor(&tmp); + zval_ptr_dtor(&tmp); } return SUCCESS; @@ -858,7 +828,7 @@ int zephir_update_property_array_append(zval *object, char *property, unsigned i if (separated) { zephir_update_property_zval(object, property, property_length, &tmp); - zephir_ptr_dtor(&tmp); + zval_ptr_dtor(&tmp); } return SUCCESS; @@ -920,7 +890,7 @@ int zephir_update_property_array_multi(zval *object, const char *property, uint3 if (separated) { zephir_update_property_zval(object, property, property_length, &tmp_arr); - zephir_ptr_dtor(&tmp_arr); + zval_ptr_dtor(&tmp_arr); } } @@ -943,11 +913,7 @@ int zephir_unset_property(zval* object, const char* name) /* Use caller's scope */ zephir_set_scope(Z_OBJCE_P(object)); -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT_P(object)->unset_property(Z_OBJ_P(object), Z_STR(member), 0); -#else - Z_OBJ_HT_P(object)->unset_property(object, &member, 0); -#endif /* Restore original scope */ zephir_set_scope(scope); @@ -1296,11 +1262,7 @@ int zephir_create_instance(zval *return_value, const zval *class_name) fci.retval = 0; fci.param_count = 0; fci.params = 0; -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else - fci.named_params = NULL; -#endif + fci.named_params = NULL; ZVAL_NULL(&fci.function_name); @@ -1358,11 +1320,8 @@ int zephir_create_instance_params(zval *return_value, const zval *class_name, zv fci.retval = 0; fci.param_count = 0; fci.params = 0; -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else - fci.named_params = NULL; -#endif + fci.named_params = NULL; + ZVAL_NULL(&fci.function_name); fcc.object = obj; diff --git a/kernels/ZendEngine3/object.h b/kernel/object.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/object.h rename to kernel/object.h diff --git a/kernels/ZendEngine3/operators.c b/kernel/operators.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/operators.c rename to kernel/operators.c diff --git a/kernels/ZendEngine3/operators.h b/kernel/operators.h old mode 100755 new mode 100644 similarity index 98% rename from kernels/ZendEngine3/operators.h rename to kernel/operators.h index 059f0a0fe2..44351f897a --- a/kernels/ZendEngine3/operators.h +++ b/kernel/operators.h @@ -146,7 +146,11 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define zephir_get_boolval(z) (Z_TYPE_P(z) == IS_TRUE ? 1 : (Z_TYPE_P(z) == IS_FALSE ? 0 : zephir_get_boolval_ex(z))) #define zephir_get_charval(z) (Z_TYPE_P(z) == IS_LONG ? Z_LVAL_P(z) : zephir_get_charval_ex(z)) +#if PHP_VERSION_ID >= 80300 +#define zephir_add_function(result, left, right) add_function(result, left, right) +#else #define zephir_add_function(result, left, right) fast_add_function(result, left, right) +#endif #define zephir_sub_function(result, left, right) sub_function(result, left, right) #define zephir_pow_function(result, op1, op2) pow_function(result, op1, op2) #define zephir_increment(var) increment_function(var) @@ -155,7 +159,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_ADD_ASSIGN(z, v) \ { \ zval tmp; \ - ZEPHIR_SEPARATE(z); \ + SEPARATE_ZVAL(z); \ add_function(&tmp, z, v); \ if (Z_TYPE(tmp) == IS_LONG) { \ Z_LVAL_P(z) = Z_LVAL(tmp); \ @@ -169,7 +173,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_SUB_ASSIGN(z, v) \ { \ zval tmp; \ - ZEPHIR_SEPARATE(z); \ + SEPARATE_ZVAL(z); \ sub_function(&tmp, z, v); \ if (Z_TYPE(tmp) == IS_LONG) { \ Z_LVAL_P(z) = Z_LVAL(tmp); \ @@ -183,7 +187,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_MUL_ASSIGN(z, v) \ { \ zval tmp; \ - ZEPHIR_SEPARATE(z); \ + SEPARATE_ZVAL(z); \ mul_function(&tmp, z, v); \ if (Z_TYPE(tmp) == IS_LONG) { \ Z_LVAL_P(z) = Z_LVAL(tmp); \ diff --git a/kernels/ZendEngine3/require.c b/kernel/require.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/require.c rename to kernel/require.c diff --git a/kernels/ZendEngine3/require.h b/kernel/require.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/require.h rename to kernel/require.h diff --git a/kernels/ZendEngine3/string.c b/kernel/string.c old mode 100755 new mode 100644 similarity index 99% rename from kernels/ZendEngine3/string.c rename to kernel/string.c index dd5ba9d432..96a49a4254 --- a/kernels/ZendEngine3/string.c +++ b/kernel/string.c @@ -461,11 +461,8 @@ void zephir_fast_join(zval *result, zval *glue, zval *pieces) zend_error(E_WARNING, "Invalid arguments supplied for join()"); return; } -#if PHP_VERSION_ID < 80000 - php_implode(Z_STR_P(glue), pieces, result); -#else + php_implode(Z_STR_P(glue), Z_ARRVAL_P(pieces), result); -#endif } /** diff --git a/kernels/ZendEngine3/string.h b/kernel/string.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/string.h rename to kernel/string.h diff --git a/kernels/ZendEngine3/time.c b/kernel/time.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/time.c rename to kernel/time.c diff --git a/kernels/ZendEngine3/time.h b/kernel/time.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/time.h rename to kernel/time.h diff --git a/kernels/ZendEngine3/variables.c b/kernel/variables.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/variables.c rename to kernel/variables.c diff --git a/kernels/ZendEngine3/variables.h b/kernel/variables.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/variables.h rename to kernel/variables.h diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c237e93b78..6bbcfd8ed9 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -17,8 +17,8 @@ - - + + @@ -26,9 +26,10 @@ - + + - Library + src diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 22bdcbfddf..54dd01cab6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,7 +7,7 @@ > - Library + src diff --git a/prototypes/apache.php b/prototypes/apache.php index 0ebdc52fd8..09535638bf 100644 --- a/prototypes/apache.php +++ b/prototypes/apache.php @@ -1,6 +1,6 @@ @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - if (!function_exists('apache_child_terminate')) { /** * Terminate apache process after this request. diff --git a/prototypes/apc.php b/prototypes/apc.php index d488269dcc..5a00a5dd42 100644 --- a/prototypes/apc.php +++ b/prototypes/apc.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - if (!class_exists('APCIterator', false)) { // See: https://github.com/php/pecl-caching-apc/blob/master/apc_bin.h defined('APC_BIN_VERIFY_CRC32') || define('APC_BIN_VERIFY_CRC32', 1 << 1); @@ -120,8 +119,8 @@ function apc_sma_info($limited = false) /** * @see https://www.php.net/manual/en/function.apc-store.php * - * @param $key - * @param $var + * @param $key + * @param $var * @param int $ttl */ function apc_store($key, $var, $ttl = 0) @@ -131,7 +130,7 @@ function apc_store($key, $var, $ttl = 0) /** * @see https://www.php.net/manual/en/function.apc-fetch.php * - * @param $key + * @param $key * @param null $success * * @return mixed @@ -152,7 +151,7 @@ function apc_delete($key) /** * @see https://www.php.net/manual/en/function.apc-define-constants.php * - * @param $key + * @param $key * @param array $constants * @param bool $case_sensitive */ @@ -163,8 +162,8 @@ function apc_define_constants($key, array $constants, $case_sensitive = true) /** * @see https://www.php.net/manual/en/function.apc-add.php * - * @param $key - * @param $var + * @param $key + * @param $var * @param int $ttl */ function apc_add($key, $var, $ttl = 0) @@ -174,7 +173,7 @@ function apc_add($key, $var, $ttl = 0) /** * @see https://www.php.net/manual/en/function.apc-compile-file.php * - * @param $filename + * @param $filename * @param bool $atomic */ function apc_compile_file($filename, $atomic = true) @@ -184,7 +183,7 @@ function apc_compile_file($filename, $atomic = true) /** * @see https://www.php.net/manual/en/function.apc-load-constants.php * - * @param $key + * @param $key * @param bool $case_sensitive */ function apc_load_constants($key, $case_sensitive = true) @@ -212,7 +211,7 @@ function apc_delete_file($keys) /** * @see https://www.php.net/manual/en/function.apc-inc.php * - * @param $key + * @param $key * @param int $step * @param null $success */ @@ -223,7 +222,7 @@ function apc_inc($key, $step = 1, &$success = null) /** * @see https://www.php.net/manual/en/function.apc-dec.php * - * @param $key + * @param $key * @param int $step * @param null $success */ @@ -255,9 +254,9 @@ function apc_bin_dump($files = null, $user_vars = null) /** * @see https://php.net/manual/en/function.apc-bin-dumpfile.php * - * @param $files - * @param $user_vars - * @param $filename + * @param $files + * @param $user_vars + * @param $filename * @param int $flags * @param null $context */ @@ -268,7 +267,7 @@ function apc_bin_dumpfile($files, $user_vars, $filename, $flags = 0, $context = /** * @see https://php.net/manual/en/function.apc-bin-load.php * - * @param $data + * @param $data * @param int $flags */ function apc_bin_load($data, $flags = 0) @@ -278,7 +277,7 @@ function apc_bin_load($data, $flags = 0) /** * @see https://php.net/manual/en/function.apc-bin-loadfile.php * - * @param $filename + * @param $filename * @param null $context * @param int $flags */ diff --git a/prototypes/fpm.php b/prototypes/fpm.php index 14da00a719..9758804d9b 100644 --- a/prototypes/fpm.php +++ b/prototypes/fpm.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - if (function_exists('fastcgi_finish_request')) { return false; } diff --git a/prototypes/gd.php b/prototypes/gd.php index 058bfbdf39..7db13aec6e 100644 --- a/prototypes/gd.php +++ b/prototypes/gd.php @@ -1,6 +1,6 @@ @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - if (!function_exists('gd_info')) { /** * Retrieve information about the currently installed GD library. @@ -60,7 +59,7 @@ function getimagesizefromstring($imagedata, array &$imageinfo) * * @see https://www.php.net/manual/en/function.image-type-to-extension.php * - * @param $imagetype + * @param $imagetype * @param bool $include_dot * * @return string diff --git a/prototypes/iconv.php b/prototypes/iconv.php index bf120f1638..154a95a551 100644 --- a/prototypes/iconv.php +++ b/prototypes/iconv.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - function iconv($in_charset, $out_charset, $str) { } diff --git a/prototypes/igbinary.php b/prototypes/igbinary.php index 25191d9b3d..cf5c3819ab 100644 --- a/prototypes/igbinary.php +++ b/prototypes/igbinary.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - function igbinary_serialize($data) { } diff --git a/prototypes/imagick.php b/prototypes/imagick.php index 2f2507aa33..d33d0b77cf 100644 --- a/prototypes/imagick.php +++ b/prototypes/imagick.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - class Imagick { public function setImageAlphaChannel($channel) diff --git a/prototypes/mcrypt.php b/prototypes/mcrypt.php index 4b1a67fc4f..314060df72 100644 --- a/prototypes/mcrypt.php +++ b/prototypes/mcrypt.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - function mcrypt_list_algorithms() { } diff --git a/prototypes/memcache.php b/prototypes/memcache.php index ad0dae9ea9..d0c31ef462 100644 --- a/prototypes/memcache.php +++ b/prototypes/memcache.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - define('MEMCACHE_HAVE_SESSION', 1); define('MEMCACHE_COMPRESSED', 2); diff --git a/prototypes/memcached.php b/prototypes/memcached.php index a46c5dbe9f..92d7f6c0dd 100644 --- a/prototypes/memcached.php +++ b/prototypes/memcached.php @@ -1,111 +1,110 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - class Memcached { - const OPT_COMPRESSION = -1001; - const OPT_COMPRESSION_TYPE = -1004; - const OPT_PREFIX_KEY = -1002; - const OPT_SERIALIZER = -1003; - const OPT_HASH = 2; - const OPT_DISTRIBUTION = 9; - const OPT_LIBKETAMA_COMPATIBLE = 16; - const OPT_LIBKETAMA_HASH = 17; - const OPT_TCP_KEEPALIVE = 32; - const OPT_BUFFER_WRITES = 10; - const OPT_BINARY_PROTOCOL = 18; - const OPT_NO_BLOCK = 0; - const OPT_TCP_NODELAY = 1; - const OPT_SOCKET_SEND_SIZE = 4; - const OPT_SOCKET_RECV_SIZE = 5; - const OPT_CONNECT_TIMEOUT = 14; - const OPT_RETRY_TIMEOUT = 15; - const OPT_SEND_TIMEOUT = 19; - const OPT_RECV_TIMEOUT = 20; - const OPT_POLL_TIMEOUT = 8; - const OPT_CACHE_LOOKUPS = 6; - - const HAVE_IGBINARY = 0; - const HAVE_JSON = 0; - const HAVE_SESSION = 1; - const HAVE_SASL = 0; - - const HASH_DEFAULT = 0; - const HASH_MD5 = 1; - const HASH_CRC = 2; - const HASH_FNV1_64 = 3; - const HASH_FNV1A_64 = 4; - const HASH_FNV1_32 = 5; - const HASH_FNV1A_32 = 6; - const HASH_HSIEH = 7; - const HASH_MURMUR = 8; - - const DISTRIBUTION_MODULA = 0; - const DISTRIBUTION_CONSISTENT = 1; - const DISTRIBUTION_VIRTUAL_BUCKET = 6; - const OPT_SERVER_FAILURE_LIMIT = 21; - const OPT_AUTO_EJECT_HOSTS = 28; - const OPT_HASH_WITH_PREFIX_KEY = 25; - const OPT_NOREPLY = 26; - const OPT_SORT_HOSTS = 12; - const OPT_VERIFY_KEY = 13; - const OPT_USE_UDP = 27; - const OPT_NUMBER_OF_REPLICAS = 29; - const OPT_RANDOMIZE_REPLICA_READ = 30; - const OPT_REMOVE_FAILED_SERVERS = 35; - - const RES_SUCCESS = 0; - const RES_FAILURE = 1; - const RES_HOST_LOOKUP_FAILURE = 2; - const RES_UNKNOWN_READ_FAILURE = 7; - const RES_PROTOCOL_ERROR = 8; - - const RES_CLIENT_ERROR = 9; - const RES_SERVER_ERROR = 10; - const RES_WRITE_FAILURE = 5; - - const RES_DATA_EXISTS = 12; - const RES_NOTSTORED = 14; - const RES_NOTFOUND = 16; - const RES_PARTIAL_READ = 18; - const RES_SOME_ERRORS = 19; - const RES_NO_SERVERS = 20; - const RES_END = 21; - const RES_ERRNO = 26; - const RES_BUFFERED = 32; - const RES_TIMEOUT = 31; - const RES_BAD_KEY_PROVIDED = 33; - const RES_STORED = 15; - const RES_DELETED = 22; - const RES_STAT = 24; - const RES_ITEM = 25; - const RES_NOT_SUPPORTED = 28; - const RES_FETCH_NOTFINISHED = 30; - const RES_SERVER_MARKED_DEAD = 35; - const RES_UNKNOWN_STAT_KEY = 36; - const RES_INVALID_HOST_PROTOCOL = 34; - const RES_MEMORY_ALLOCATION_FAILURE = 17; - const RES_CONNECTION_SOCKET_CREATE_FAILURE = 11; - const RES_PAYLOAD_FAILURE = -1001; - - const SERIALIZER_PHP = 1; - const SERIALIZER_IGBINARY = 2; - const SERIALIZER_JSON = 3; - const SERIALIZER_JSON_ARRAY = 4; - - const COMPRESSION_FASTLZ = 2; - const COMPRESSION_ZLIB = 1; - - const GET_PRESERVE_ORDER = 1; - const GET_ERROR_RETURN_VALUE = false; + public const OPT_COMPRESSION = -1001; + public const OPT_COMPRESSION_TYPE = -1004; + public const OPT_PREFIX_KEY = -1002; + public const OPT_SERIALIZER = -1003; + public const OPT_HASH = 2; + public const OPT_DISTRIBUTION = 9; + public const OPT_LIBKETAMA_COMPATIBLE = 16; + public const OPT_LIBKETAMA_HASH = 17; + public const OPT_TCP_KEEPALIVE = 32; + public const OPT_BUFFER_WRITES = 10; + public const OPT_BINARY_PROTOCOL = 18; + public const OPT_NO_BLOCK = 0; + public const OPT_TCP_NODELAY = 1; + public const OPT_SOCKET_SEND_SIZE = 4; + public const OPT_SOCKET_RECV_SIZE = 5; + public const OPT_CONNECT_TIMEOUT = 14; + public const OPT_RETRY_TIMEOUT = 15; + public const OPT_SEND_TIMEOUT = 19; + public const OPT_RECV_TIMEOUT = 20; + public const OPT_POLL_TIMEOUT = 8; + public const OPT_CACHE_LOOKUPS = 6; + + public const HAVE_IGBINARY = 0; + public const HAVE_JSON = 0; + public const HAVE_SESSION = 1; + public const HAVE_SASL = 0; + + public const HASH_DEFAULT = 0; + public const HASH_MD5 = 1; + public const HASH_CRC = 2; + public const HASH_FNV1_64 = 3; + public const HASH_FNV1A_64 = 4; + public const HASH_FNV1_32 = 5; + public const HASH_FNV1A_32 = 6; + public const HASH_HSIEH = 7; + public const HASH_MURMUR = 8; + + public const DISTRIBUTION_MODULA = 0; + public const DISTRIBUTION_CONSISTENT = 1; + public const DISTRIBUTION_VIRTUAL_BUCKET = 6; + public const OPT_SERVER_FAILURE_LIMIT = 21; + public const OPT_AUTO_EJECT_HOSTS = 28; + public const OPT_HASH_WITH_PREFIX_KEY = 25; + public const OPT_NOREPLY = 26; + public const OPT_SORT_HOSTS = 12; + public const OPT_VERIFY_KEY = 13; + public const OPT_USE_UDP = 27; + public const OPT_NUMBER_OF_REPLICAS = 29; + public const OPT_RANDOMIZE_REPLICA_READ = 30; + public const OPT_REMOVE_FAILED_SERVERS = 35; + + public const RES_SUCCESS = 0; + public const RES_FAILURE = 1; + public const RES_HOST_LOOKUP_FAILURE = 2; + public const RES_UNKNOWN_READ_FAILURE = 7; + public const RES_PROTOCOL_ERROR = 8; + + public const RES_CLIENT_ERROR = 9; + public const RES_SERVER_ERROR = 10; + public const RES_WRITE_FAILURE = 5; + + public const RES_DATA_EXISTS = 12; + public const RES_NOTSTORED = 14; + public const RES_NOTFOUND = 16; + public const RES_PARTIAL_READ = 18; + public const RES_SOME_ERRORS = 19; + public const RES_NO_SERVERS = 20; + public const RES_END = 21; + public const RES_ERRNO = 26; + public const RES_BUFFERED = 32; + public const RES_TIMEOUT = 31; + public const RES_BAD_KEY_PROVIDED = 33; + public const RES_STORED = 15; + public const RES_DELETED = 22; + public const RES_STAT = 24; + public const RES_ITEM = 25; + public const RES_NOT_SUPPORTED = 28; + public const RES_FETCH_NOTFINISHED = 30; + public const RES_SERVER_MARKED_DEAD = 35; + public const RES_UNKNOWN_STAT_KEY = 36; + public const RES_INVALID_HOST_PROTOCOL = 34; + public const RES_MEMORY_ALLOCATION_FAILURE = 17; + public const RES_CONNECTION_SOCKET_CREATE_FAILURE = 11; + public const RES_PAYLOAD_FAILURE = -1001; + + public const SERIALIZER_PHP = 1; + public const SERIALIZER_IGBINARY = 2; + public const SERIALIZER_JSON = 3; + public const SERIALIZER_JSON_ARRAY = 4; + + public const COMPRESSION_FASTLZ = 2; + public const COMPRESSION_ZLIB = 1; + + public const GET_PRESERVE_ORDER = 1; + public const GET_ERROR_RETURN_VALUE = false; /** * @see https://php.net/manual/en/memcached.construct.php diff --git a/prototypes/mongo.php b/prototypes/mongo.php index 1420f26fb6..ab2218483a 100644 --- a/prototypes/mongo.php +++ b/prototypes/mongo.php @@ -1,6 +1,6 @@ @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - if (!class_exists('MongoRegex', false)) { class MongoRegex { @@ -30,9 +29,9 @@ class MongoId if (!class_exists('MongoDB', false)) { class MongoDB { - const PROFILING_OFF = 0; - const PROFILING_SLOW = 1; - const PROFILING_ON = 2; + public const PROFILING_OFF = 0; + public const PROFILING_SLOW = 1; + public const PROFILING_ON = 2; /** * Creates a new database. @@ -51,14 +50,14 @@ public function __construct(MongoClient $conn, $name) if (!class_exists('MongoClient', false)) { class MongoClient { - const VERSION = ''; - const DEFAULT_HOST = 'localhost'; - const DEFAULT_PORT = 27017; - const RP_PRIMARY = 'primary'; - const RP_PRIMARY_PREFERRED = 'primaryPreferred'; - const RP_SECONDARY = 'secondary'; - const RP_SECONDARY_PREFERRED = 'secondaryPreferred'; - const RP_NEAREST = 'nearest'; + public const VERSION = ''; + public const DEFAULT_HOST = 'localhost'; + public const DEFAULT_PORT = 27017; + public const RP_PRIMARY = 'primary'; + public const RP_PRIMARY_PREFERRED = 'primaryPreferred'; + public const RP_SECONDARY = 'secondary'; + public const RP_SECONDARY_PREFERRED = 'secondaryPreferred'; + public const RP_NEAREST = 'nearest'; /** * Gets a database. diff --git a/prototypes/mongodb.php b/prototypes/mongodb.php index d7d428be4f..e51725d179 100644 --- a/prototypes/mongodb.php +++ b/prototypes/mongodb.php @@ -2,7 +2,7 @@ // @codingStandardsIgnoreStart -/* +/** * This file is part of the Zephir. * * (c) Phalcon Team diff --git a/prototypes/msgpack.php b/prototypes/msgpack.php index e6dcdd9326..f240502040 100644 --- a/prototypes/msgpack.php +++ b/prototypes/msgpack.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - define('MSGPACK_CLASS_OPT_PHPONLY', -1001); /** diff --git a/prototypes/phalcon.php b/prototypes/phalcon.php index edbd4daa0d..07f63a4422 100644 --- a/prototypes/phalcon.php +++ b/prototypes/phalcon.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ namespace Phalcon { @@ -35,12 +35,12 @@ class Application namespace Phalcon\Mvc\Model { class Query { - const TYPE_SELECT = 309; + public const TYPE_SELECT = 309; - const TYPE_INSERT = 306; + public const TYPE_INSERT = 306; - const TYPE_UPDATE = 300; + public const TYPE_UPDATE = 300; - const TYPE_DELETE = 303; + public const TYPE_DELETE = 303; } } diff --git a/prototypes/redis.php b/prototypes/redis.php index a9b1bf6fc4..8e00e86b2c 100644 --- a/prototypes/redis.php +++ b/prototypes/redis.php @@ -1,6 +1,6 @@ @@ -8,46 +8,45 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - class redis { /** * Options. */ - const OPT_SERIALIZER = 1; - const OPT_PREFIX = 2; - const OPT_READ_TIMEOUT = 3; - const OPT_SCAN = 4; + public const OPT_SERIALIZER = 1; + public const OPT_PREFIX = 2; + public const OPT_READ_TIMEOUT = 3; + public const OPT_SCAN = 4; /** * Serializers. */ - const SERIALIZER_NONE = 0; - const SERIALIZER_PHP = 1; - const SERIALIZER_IGBINARY = 2; + public const SERIALIZER_NONE = 0; + public const SERIALIZER_PHP = 1; + public const SERIALIZER_IGBINARY = 2; /** * Multi. */ - const ATOMIC = 0; - const MULTI = 1; - const PIPELINE = 2; + public const ATOMIC = 0; + public const MULTI = 1; + public const PIPELINE = 2; /** * Type. */ - const REDIS_NOT_FOUND = 0; - const REDIS_STRING = 1; - const REDIS_SET = 2; - const REDIS_LIST = 3; - const REDIS_ZSET = 4; - const REDIS_HASH = 5; + public const REDIS_NOT_FOUND = 0; + public const REDIS_STRING = 1; + public const REDIS_SET = 2; + public const REDIS_LIST = 3; + public const REDIS_ZSET = 4; + public const REDIS_HASH = 5; /** * Scan. */ - const SCAN_NORETRY = 0; - const SCAN_RETRY = 1; + public const SCAN_NORETRY = 0; + public const SCAN_RETRY = 1; public function connect($host, $port = 6379, $timeout = 0.0) { diff --git a/prototypes/xcache.php b/prototypes/xcache.php index db4dae4c37..670b530e0b 100644 --- a/prototypes/xcache.php +++ b/prototypes/xcache.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - function xcache_get($name) { } diff --git a/prototypes/yaml.php b/prototypes/yaml.php index b9fd1d95b9..344098f099 100644 --- a/prototypes/yaml.php +++ b/prototypes/yaml.php @@ -1,14 +1,13 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ - function yaml_parse_file($filename, $pos = 0, &$ndocs = 0, $callbacks = null) { } diff --git a/qodana.sarif.json b/qodana.sarif.json new file mode 100644 index 0000000000..2fca670411 --- /dev/null +++ b/qodana.sarif.json @@ -0,0 +1,111943 @@ +{ + "$schema": "https://raw.githubusercontent.com/schemastore/schemastore/master/src/schemas/json/sarif-2.1.0-rtm.5.json", + "version": "2.1.0", + "runs": [ + { + "tool": { + "driver": { + "name": "QDPHP", + "fullName": "Qodana for PHP", + "version": "232.9881.131", + "rules": [], + "taxa": [ + { + "id": "PHP", + "name": "PHP" + }, + { + "id": "PHP/Code smell", + "name": "Code smell", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/PHPDoc", + "name": "PHPDoc", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Code style", + "name": "Code style", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Naming conventions", + "name": "Naming conventions", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Shell script", + "name": "Shell script" + }, + { + "id": "PHP/General", + "name": "General", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript", + "name": "JavaScript and TypeScript" + }, + { + "id": "JavaScript and TypeScript/Unit testing", + "name": "Unit testing", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Probable bugs", + "name": "Probable bugs", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MySQL", + "name": "MySQL" + }, + { + "id": "PHP/PHPDoc/Code style", + "name": "Code style", + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Control flow", + "name": "Control flow", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Sass/SCSS", + "name": "Sass/SCSS" + }, + { + "id": "HTML", + "name": "HTML" + }, + { + "id": "JavaScript and TypeScript/Unused symbols", + "name": "Unused symbols", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Cucumber", + "name": "Cucumber" + }, + { + "id": "JavaScript and TypeScript/Flow type checker", + "name": "Flow type checker", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Data flow", + "name": "Data flow", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfig", + "name": "EditorConfig" + }, + { + "id": "PHP/PHPUnit", + "name": "PHPUnit", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PostCSS", + "name": "PostCSS" + }, + { + "id": "JavaScript and TypeScript/Bitwise operation issues", + "name": "Bitwise operation issues", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Type compatibility", + "name": "Type compatibility", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/General", + "name": "General", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/ES2015 migration aids", + "name": "ES2015 migration aids", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Undefined symbols", + "name": "Undefined symbols", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "General", + "name": "General" + }, + { + "id": "HTML/Accessibility", + "name": "Accessibility", + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/React", + "name": "React", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Validity issues", + "name": "Validity issues", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "name": "Potentially confusing code constructs", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CSS", + "name": "CSS" + }, + { + "id": "CSS/Invalid elements", + "name": "Invalid elements", + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SQL", + "name": "SQL" + }, + { + "id": "JavaScript and TypeScript/Try statement issues", + "name": "Try statement issues", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "YAML", + "name": "YAML" + }, + { + "id": "PHP/Unused symbols", + "name": "Unused symbols", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Composer", + "name": "Composer", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Control flow issues", + "name": "Control flow issues", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XML", + "name": "XML" + }, + { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "name": "Potentially undesirable code constructs", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CSS/Code style issues", + "name": "Code style issues", + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Less", + "name": "Less" + }, + { + "id": "JavaScript and TypeScript/Probable bugs", + "name": "Probable bugs", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Attributes", + "name": "Attributes", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExp", + "name": "RegExp" + }, + { + "id": "JavaScript and TypeScript/Code style issues", + "name": "Code style issues", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Assignment issues", + "name": "Assignment issues", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Joomla!", + "name": "Joomla!" + }, + { + "id": "PHP/Refactoring opportunities", + "name": "Refactoring opportunities", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/TypeScript", + "name": "TypeScript", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CSS/Probable bugs", + "name": "Probable bugs", + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Switch statement issues", + "name": "Switch statement issues", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/DOM issues", + "name": "DOM issues", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Async code and promises", + "name": "Async code and promises", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Code Coverage", + "name": "Code Coverage" + }, + { + "id": "Proofreading", + "name": "Proofreading" + }, + { + "id": "PHP/Behat", + "name": "Behat", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Imports and dependencies", + "name": "Imports and dependencies", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Ini files", + "name": "Ini files" + }, + { + "id": "PHP/Code style/PSR-12", + "name": "PSR-12", + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Psalm", + "name": "Psalm", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Naming conventions", + "name": "Naming conventions", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Taint analysis", + "name": "Taint analysis", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Code quality tools", + "name": "Code quality tools", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Blade files", + "name": "Blade files" + }, + { + "id": "PHP/PHP strict standards", + "name": "PHP strict standards", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Regular expressions", + "name": "Regular expressions", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaScript and TypeScript/Function metrics", + "name": "Function metrics", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PHP/Quality tools", + "name": "Quality tools", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSON and JSON5", + "name": "JSON and JSON5" + }, + { + "id": "PHP/Error handling", + "name": "Error handling", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Oracle", + "name": "Oracle" + }, + { + "id": "Internationalization", + "name": "Internationalization" + }, + { + "id": "MongoJS", + "name": "MongoJS" + }, + { + "id": "Vue", + "name": "Vue" + }, + { + "id": "Version control", + "name": "Version control" + }, + { + "id": "Structural search", + "name": "Structural search" + }, + { + "id": "Dependency analysis", + "name": "Dependency analysis" + }, + { + "id": "JavaScript and TypeScript/Node.js", + "name": "Node.js", + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript", + "index": 7, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RELAX NG", + "name": "RELAX NG" + }, + { + "id": "PHP/Replaceable assignments", + "name": "Replaceable assignments", + "relationships": [ + { + "target": { + "id": "PHP", + "index": 0, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CSS/Code quality tools", + "name": "Code quality tools", + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PostgreSQL", + "name": "PostgreSQL" + }, + { + "id": "SQL server", + "name": "SQL server" + }, + { + "id": "Qodana", + "name": "Qodana" + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + "extensions": [ + { + "name": "com.jetbrains.php", + "version": "232.9881", + "rules": [ + { + "id": "PhpLoopCanBeReplacedWithStrRepeatInspection", + "shortDescription": { + "text": "Loop can be replaced with 'str_repeat'" + }, + "fullDescription": { + "text": "Reports the 'for' loops that can be safely replaced with 'str_repeat()' calls.", + "markdown": "Reports the `for` loops that can be safely replaced with `str_repeat()` calls." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpLoopCanBeReplacedWithStrRepeatInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDocDuplicateTypeInspection", + "shortDescription": { + "text": "Type already exists in PHPDoc tag" + }, + "fullDescription": { + "text": "Reports duplicate types in PHPDoc comments.", + "markdown": "Reports duplicate types in PHPDoc comments." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDocDuplicateTypeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryCurlyVarSyntaxInspection", + "shortDescription": { + "text": "Unnecessary curly braces syntax for variable" + }, + "fullDescription": { + "text": "Reports unnecessary '{' and '}' used for interpolating variables in string literals. See Variable parsing (php.net) for details.", + "markdown": "Reports unnecessary `{` and `}` used for interpolating variables in string literals.\n\n\nSee [Variable parsing (php.net)](https://www.php.net/manual/en/language.types.string.php#language.types.string.parsing) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFunctionNamingConventionInspection", + "shortDescription": { + "text": "Function name is not following coding convention" + }, + "fullDescription": { + "text": "Reports the functions' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for functions. Use the inspection options to specify minimum/maximum length and the regular expression expected for functions' names. To ignore the names' length, specify 0. To learn more about regular expressions, refer to the Quick Start guide (regular-expressions.info).", + "markdown": "Reports the functions' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for functions.\n\n\nUse the inspection options to specify minimum/maximum length and the regular expression expected for functions' names.\nTo ignore the names' length, specify **0**.\n\n\nTo learn more about regular expressions, refer to the [Quick Start guide (regular-expressions.info)](https://www.regular-expressions.info/quickstart.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpFunctionNamingConventionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Naming conventions", + "index": 4, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayFillCanBeConvertedToLoopInspection", + "shortDescription": { + "text": "'array_fill' can be converted to loop" + }, + "fullDescription": { + "text": "Reports the 'array_fill()' calls that can be replaced with 'foreach' loops.", + "markdown": "Reports the `array_fill()` calls that can be replaced with `foreach` loops." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayFillCanBeConvertedToLoopInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIssetCanBeReplacedWithCoalesceInspection", + "shortDescription": { + "text": "'isset' can be replaced with coalesce" + }, + "fullDescription": { + "text": "Reports the conditions using 'isset' that can be safely replaced with expressions using the '??' null coalesce operator. See Null coalesce operator (php.net) for details.", + "markdown": "Reports the conditions using `isset` that can be safely replaced with expressions using the `??` null coalesce operator.\n\n\nSee [Null coalesce operator (php.net)](https://wiki.php.net/rfc/isset_ternary) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpIssetCanBeReplacedWithCoalesceInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNestedTernaryExpressionUsageInspection", + "shortDescription": { + "text": "Nested ternary operator usage" + }, + "fullDescription": { + "text": "Reports nested ternary expressions, which are deprecated starting from PHP 7.4.", + "markdown": "Reports nested ternary expressions, which are deprecated starting from PHP 7.4." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpNestedTernaryExpressionUsageInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpVoidFunctionResultUsedInspection", + "shortDescription": { + "text": "Invalid function result used" + }, + "fullDescription": { + "text": "Reports the usages of a 'void' or 'never' function's return value. Since 'void' functions do not have a return value and 'never' functions terminate execution or throw an exception, such usages are most likely a programming mistake.", + "markdown": "Reports the usages of a `void` or `never` function's return value.\n\n\nSince `void` functions do not have a return value and `never` functions terminate execution or throw an exception, such usages are most likely a programming mistake." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpVoidFunctionResultUsedInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpConstantNamingConventionInspection", + "shortDescription": { + "text": "Constant name is not following coding convention" + }, + "fullDescription": { + "text": "Reports the constants' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for constants. Use the inspection options to specify minimum/maximum length and the regular expression expected for constants' names. To ignore the names' length, specify 0. To learn more about regular expressions, refer to the Quick Start guide (regular-expressions.info).", + "markdown": "Reports the constants' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for constants.\n\n\nUse the inspection options to specify minimum/maximum length and the regular expression expected for constants' names.\nTo ignore the names' length, specify **0**.\n\n\nTo learn more about regular expressions, refer to the [Quick Start guide (regular-expressions.info)](https://www.regular-expressions.info/quickstart.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpConstantNamingConventionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Naming conventions", + "index": 4, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpTernaryExpressionCanBeReducedToShortVersionInspection", + "shortDescription": { + "text": "Ternary expression can be replaced with short version" + }, + "fullDescription": { + "text": "Reports the '?:' ternary expressions in which the condition and the 'true' statement are matching.", + "markdown": "Reports the `?:` ternary expressions in which the condition and the `true` statement are matching." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpTernaryExpressionCanBeReducedToShortVersionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpCatchWithInstanceOfCanBeReplacedWithSpecificCatchesInspection", + "shortDescription": { + "text": "'instanceof' checks in 'catch' block can be replaced with specific catches" + }, + "fullDescription": { + "text": "Reports the 'instanceof' checks in single 'catch' blocks that could be replaced with multiple 'catch' blocks specific for each exception instance.", + "markdown": "Reports the `instanceof` checks in single `catch` blocks that could be replaced with multiple `catch` blocks specific for each exception instance." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpCatchWithInstanceOfCanBeReplacedWithSpecificCatchesInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDuplicateMatchArmBodyInspection", + "shortDescription": { + "text": "Duplicate arm in 'match' expression" + }, + "fullDescription": { + "text": "Reports duplicate bodies in 'match' arms. See Match expression (php.net) for details.", + "markdown": "Reports duplicate bodies in `match` arms.\n\n\nSee [Match expression (php.net)](https://wiki.php.net/rfc/match_expression_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDuplicateMatchArmBodyInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMissingDocCommentInspection", + "shortDescription": { + "text": "Missing PHPDoc comment" + }, + "fullDescription": { + "text": "Reports non-fully typed elements without a PHPDoc comment or with a PHPDoc comment only containing the '@noinspection' tag. You can use the Enforce PHPDoc Comment inspection to report fully typed elements.", + "markdown": "Reports non-fully typed elements without a PHPDoc comment or with a PHPDoc comment only containing the `@noinspection` tag.\n\nYou can use the *Enforce PHPDoc Comment* inspection to report fully typed elements." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMissingDocCommentInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc/Code style", + "index": 11, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection", + "shortDescription": { + "text": "Write access to referenced array value without 'unset'" + }, + "fullDescription": { + "text": "Reports the write access expressions on variables that are still referencing the array value previously used in a 'foreach' statement. It is recommended to destroy such references by using 'unset'. See foreach (php.net) and unset (php.net) for details.", + "markdown": "Reports the write access expressions on variables that are still referencing the array value previously used in a `foreach` statement.\n\n\nIt is recommended to destroy such references by using `unset`.\n\n\nSee [foreach (php.net)](https://www.php.net/manual/en/control-structures.foreach.php) and [unset (php.net)](https://www.php.net/manual/en/function.unset.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSameParameterValueInspection", + "shortDescription": { + "text": "Parameter's value is always the same" + }, + "fullDescription": { + "text": "Reports the parameters in private methods that have the same value across all method calls.", + "markdown": "Reports the parameters in private methods that have the same value across all method calls." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpSameParameterValueInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitCoversFunctionWithoutScopeResolutionOperatorInspection", + "shortDescription": { + "text": "Covered function reference is provided without ‘::’" + }, + "fullDescription": { + "text": "Reports the references to functions/methods in the '@covers' PHPDoc tags that are not prepended with the scope resolution operator ('::').", + "markdown": "Reports the references to functions/methods in the `@covers` PHPDoc tags that are not prepended with the scope resolution operator (`::`)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitCoversFunctionWithoutScopeResolutionOperatorInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayAccessOnIllegalTypeInspection", + "shortDescription": { + "text": "Array offset access on illegal type" + }, + "fullDescription": { + "text": "Reports the array offset access expressions that are used on illegal types.", + "markdown": "Reports the array offset access expressions that are used on illegal types." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayAccessOnIllegalTypeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUndefinedGotoLabelInspection", + "shortDescription": { + "text": "Undefined goto label" + }, + "fullDescription": { + "text": "Reports the 'goto' labels that are not found in the current scope. The target 'goto' label must reside in the same file and context: you cannot jump into or out of a function or method, and cannot jump into a loop or switch structure. See goto (php.net) for details.", + "markdown": "Reports the `goto` labels that are not found in the current scope.\n\n\nThe target `goto` label must reside in the same file and context: you cannot jump into or out of a function or method, and cannot jump into a loop or switch structure.\n\n\nSee [goto (php.net)](https://www.php.net/manual/en/control-structures.goto.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUndefinedGotoLabelInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDeprecatedPartiallySupportedCallableInspection", + "shortDescription": { + "text": "Deprecated partially supported callables" + }, + "fullDescription": { + "text": "Reports deprecated usage of callables that are supported by 'call_user_func($callable)', but not by '$callable()'. Starting from PHP 8.2, the following callables are deprecated: '\"self::method\"'\n'\"parent::method\"'\n'\"static::method\"'\n'[\"self\", \"method\"]'\n'[\"parent\", \"method\"]'\n'[\"static\", \"method\"]'\n'[\"Foo\", \"Bar::method\"]'\n'[new Foo, \"Bar::method\"]' See Deprecate partially supported callables (php.net) for details.", + "markdown": "Reports deprecated usage of callables that are supported by `call_user_func($callable)`, but not by `$callable()`.\n\nStarting from PHP 8.2, the following callables are deprecated:\n\n \"self::method\"\n \"parent::method\"\n \"static::method\"\n [\"self\", \"method\"]\n [\"parent\", \"method\"]\n [\"static\", \"method\"]\n [\"Foo\", \"Bar::method\"]\n [new Foo, \"Bar::method\"]\n\n\nSee [Deprecate partially supported callables (php.net)](https://wiki.php.net/rfc/deprecate_partially_supported_callables) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDeprecatedPartiallySupportedCallableInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpLoopCanBeConvertedToArrayFillInspection", + "shortDescription": { + "text": "Loop can be converted to 'array_fill()' call" + }, + "fullDescription": { + "text": "Reports the 'for' loops that can be replaced with 'array_fill()' calls.", + "markdown": "Reports the `for` loops that can be replaced with `array_fill()` calls." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpLoopCanBeConvertedToArrayFillInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayToStringConversionInspection", + "shortDescription": { + "text": "Array to string conversion" + }, + "fullDescription": { + "text": "Reports array to string conversions, that is, the arrays that are provided in the contexts where a string is expected. Prior to PHP 8.0, this would lead to a 'E_NOTICE' level error. In PHP 8.0, an 'E-WARNING' is emitted.", + "markdown": "Reports array to string conversions, that is, the arrays that are provided in the contexts where a string is expected.\n\n\nPrior to PHP 8.0, this would lead to a `E_NOTICE` level error. In PHP 8.0, an `E-WARNING` is emitted." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpArrayToStringConversionInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpConstantReassignmentInspection", + "shortDescription": { + "text": "Constant reassignment" + }, + "fullDescription": { + "text": "Reports reassignments of constants. Since constants cannot be changed, such assignments will have no effect and will emit an 'E_NOTICE' (in PHP 7.4 and earlier) or 'E_WARNING' (in PHP 8.0 and later).", + "markdown": "Reports reassignments of constants.\n\n\nSince constants cannot be changed, such assignments will have no effect and will emit an `E_NOTICE` (in PHP 7.4 and earlier) or `E_WARNING` (in PHP 8.0 and later)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpConstantReassignmentInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUndefinedFieldInspection", + "shortDescription": { + "text": "Undefined property" + }, + "fullDescription": { + "text": "Reports the references to class properties that are not declared. The inspection skips the objects of the 'stdClass' or derived types.", + "markdown": "Reports the references to class properties that are not declared.\n\n\nThe inspection skips the objects of the `stdClass` or derived types." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUndefinedFieldInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUndefinedClassConstantInspection", + "shortDescription": { + "text": "Undefined class constant" + }, + "fullDescription": { + "text": "Reports the references to class constants that are not declared.", + "markdown": "Reports the references to class constants that are not declared." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpUndefinedClassConstantInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPregMatchWithoutEffectiveRegexpInspection", + "shortDescription": { + "text": "'preg_match' can be replaced with 'str_contains'" + }, + "fullDescription": { + "text": "Reports the 'preg_match()' calls with 'pattern' arguments that don't use any regexp facilities. Such calls can be replaced with 'str_starts_with()', 'str_ends_with()' or 'str_contains()' calls.", + "markdown": "Reports the `preg_match()` calls with `pattern` arguments that don't use any regexp facilities. Such calls can be replaced with `str_starts_with()`, `str_ends_with()` or `str_contains()` calls." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPregMatchWithoutEffectiveRegexpInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpToStringReturnInspection", + "shortDescription": { + "text": "Method '__toString' return type" + }, + "fullDescription": { + "text": "Reports the '__toString' methods that do not return 'string'. Prior to PHP 7.4, this would lead to a fatal 'E_RECOVERABLE_ERROR' level error. In PHP 7.4, a fatal non-recoverable 'ERROR' is thrown. In PHP 8.0, the return value follows the standard PHP type semantics and will be coerced into a string if possible and if strict typing is disabled. See __toString (php.net) for details.", + "markdown": "Reports the `__toString` methods that do not return `string`.\n\nPrior to PHP 7.4, this would lead to a fatal `E_RECOVERABLE_ERROR` level error. In PHP 7.4, a fatal non-recoverable `ERROR` is thrown. In PHP 8.0, the return value follows the standard PHP type semantics and will be coerced into a string if possible and if strict typing is disabled.\n\n\nSee [__toString (php.net)](https://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpToStringReturnInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIfCanBeReplacedWithMatchExpressionInspection", + "shortDescription": { + "text": "'if' can be replaced with 'match' expression" + }, + "fullDescription": { + "text": "Reports the 'if' statements inside 'if-elseif-else' constructs that use strict comparisons ('===') and could be replaced with 'match' expressions.", + "markdown": "Reports the `if` statements inside `if-elseif-else` constructs that use strict comparisons (`===`) and could be replaced with `match` expressions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpIfCanBeReplacedWithMatchExpressionInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUselessTrailingCommaInspection", + "shortDescription": { + "text": "Useless trailing comma" + }, + "fullDescription": { + "text": "Reports the trailing commas in parameters lists and closures' 'use' lists that do not bring any benefit. In a single-line list, a trailing comma is redundant and can be removed. In a multiline list, if no line break is provided after a trailing comma, it becomes impossible to easily add, remove, or move lines.", + "markdown": "Reports the trailing commas in parameters lists and closures' `use` lists that do not bring any benefit.\n\n* In a single-line list, a trailing comma is redundant and can be removed.\n* In a multiline list, if no line break is provided after a trailing comma, it becomes impossible to easily add, remove, or move lines." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUselessTrailingCommaInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpParamsInspection", + "shortDescription": { + "text": "Parameter type" + }, + "fullDescription": { + "text": "Reports the parameters passed to a function call, whose types do not match the ones specified in the function definition via type declaration or the PHPDoc '@param' tag. See Type declarations (php.net) and @param (phpdoc.org) for details.", + "markdown": "Reports the parameters passed to a function call, whose types do not match the ones specified in the function definition via type declaration or the PHPDoc `@param` tag.\n\nSee [Type declarations (php.net)](http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration) and\n[@param (phpdoc.org)](https://docs.phpdoc.org/guide/references/phpdoc/tags/param.html#param) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpParamsInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpClassCanBeReadonlyInspection", + "shortDescription": { + "text": "Class can be 'readonly'" + }, + "fullDescription": { + "text": "Reports classes which contain only 'readonly' properties.", + "markdown": "Reports classes which contain only `readonly` properties." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpClassCanBeReadonlyInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpCastIsUnnecessaryInspection", + "shortDescription": { + "text": "Type cast is unnecessary" + }, + "fullDescription": { + "text": "Reports the type cast operators used on the values that are already of the corresponding type. Such operators are redundant and can be safely removed. See Type juggling (php.net) for details.", + "markdown": "Reports the type cast operators used on the values that are already of the corresponding type. Such operators are redundant and can be safely removed.\n\n\nSee [Type juggling (php.net)](https://www.php.net/manual/en/language.types.type-juggling.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpCastIsUnnecessaryInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDocMissingThrowsInspection", + "shortDescription": { + "text": "Missing @throws tag(s)" + }, + "fullDescription": { + "text": "Reports missing PHPDoc '@throws' tags for exceptions thrown by functions or methods. The exception classes added to the Unchecked Exceptions list under Settings | PHP | Analysis are excluded from the inspection scope.", + "markdown": "Reports missing PHPDoc `@throws` tags for exceptions thrown by functions or methods.\n\nThe exception classes added to the **Unchecked Exceptions** list under\n[Settings \\| PHP \\| Analysis](settings://reference.webide.settings.project.settings.php?Unchecked%20Exceptions)\nare excluded from the inspection scope." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDocMissingThrowsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc/Code style", + "index": 11, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnusedAliasInspection", + "shortDescription": { + "text": "Unused import" + }, + "fullDescription": { + "text": "Reports the imports that are never used.", + "markdown": "Reports the imports that are never used." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnusedAliasInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Unused symbols", + "index": 37, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ComposerJsonFileReferencesInspection", + "shortDescription": { + "text": "Unresolved file references" + }, + "fullDescription": { + "text": "Reports unresolved file references in composer.json.", + "markdown": "Reports unresolved file references in composer.json." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "ComposerJsonFileReferencesInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Composer", + "index": 38, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIssetCanCheckNestedAccessDirectlyInspection", + "shortDescription": { + "text": "'isset' can check nested array access and sub properties directly" + }, + "fullDescription": { + "text": "Reports constructions like 'isset($a['a']) && isset($a['a']['b']) && isset($b) && isset($b->b)' that can be replaced with 'isset($a['a']['b']) && isset($b->b)'.", + "markdown": "Reports constructions like `isset($a['a']) && isset($a['a']['b']) && isset($b) && isset($b->b)` that can be replaced with `isset($a['a']['b']) && isset($b->b)`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpIssetCanCheckNestedAccessDirectlyInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantDefaultBreakContinueArgumentInspection", + "shortDescription": { + "text": "Redundant 'continue/break' argument" + }, + "fullDescription": { + "text": "Reports the redundant '1' argument of 'continue' and 'break' statements. Since this argument is optional and its default value is '1', such usages can be omitted. See continue (php.net) and break (php.net) for details.", + "markdown": "Reports the redundant `1` argument of `continue` and `break` statements. Since this argument is optional and its default value is `1`, such usages can be omitted.\n\n\nSee [continue (php.net)](https://www.php.net/manual/en/control-structures.continue.php) and [break (php.net)](https://www.php.net/manual/en/control-structures.break.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantDefaultBreakContinueArgumentInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayUsedOnlyForWriteInspection", + "shortDescription": { + "text": "Array used only with write access" + }, + "fullDescription": { + "text": "Reports local arrays that are only updated, but never queried.", + "markdown": "Reports local arrays that are only updated, but never queried." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayUsedOnlyForWriteInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIllegalPsrClassPathInspection", + "shortDescription": { + "text": "Class path doesn't match project structure" + }, + "fullDescription": { + "text": "Reports the classes with the filepath not following the PSR-0/PSR-4 project structure. You can configure the project vendor roots under Settings/Preferences | Directories. See PSR-0/PSR-4 standards (php-fig.org) for details.", + "markdown": "Reports the classes with the filepath not following the PSR-0/PSR-4 project structure.\n\n\nYou can configure the project vendor roots under **Settings/Preferences \\| Directories**.\n\n\nSee [PSR-0/PSR-4 standards (php-fig.org)](https://www.php-fig.org/psr/psr-4/) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpIllegalPsrClassPathInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantMethodOverrideInspection", + "shortDescription": { + "text": "Redundant method override" + }, + "fullDescription": { + "text": "Reports the overriding methods that only consist of a single call to the parent method.", + "markdown": "Reports the overriding methods that only consist of a single call to the parent method." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantMethodOverrideInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDefineCanBeReplacedWithConstInspection", + "shortDescription": { + "text": "Define constant name can be replaced with 'const' syntax" + }, + "fullDescription": { + "text": "Reports the 'define()' calls that can be replaced with 'const' syntax.", + "markdown": "Reports the `define()` calls that can be replaced with `const` syntax." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDefineCanBeReplacedWithConstInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayAppendUsingCountInspection", + "shortDescription": { + "text": "Using 'count()' as index for appending value to array" + }, + "fullDescription": { + "text": "Reports the 'count($array)' calls that are used as an array index for appending an element to the array: '$array[count($array)] = 42'. In such cases, it is recommended to use square bracket syntax ('$array[] = 42') instead, which adds no overhead of calling a function.", + "markdown": "Reports the `count($array)` calls that are used as an array index for appending an element to the array: `$array[count($array)] = 42`. In such cases, it is recommended to use square bracket syntax (`$array[] = 42`) instead, which adds no overhead of calling a function." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayAppendUsingCountInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSwitchCanBeReplacedWithMatchExpressionInspection", + "shortDescription": { + "text": "'switch' can be replaced with 'match' expression" + }, + "fullDescription": { + "text": "Reports 'switch' statements that could be replaced with 'match' expression", + "markdown": "Reports 'switch' statements that could be replaced with 'match' expression" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpSwitchCanBeReplacedWithMatchExpressionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPowCallCanBeReplacedWithOperatorInspection", + "shortDescription": { + "text": "'pow()' call can be replaced with '**' operator" + }, + "fullDescription": { + "text": "Reports the 'pow()' calls that can be replaced with the '**' operator, which adds no overhead of calling a function. See Power operator (php.net) for details.", + "markdown": "Reports the `pow()` calls that can be replaced with the `**` operator, which adds no overhead of calling a function.\n\n\nSee [Power operator (php.net)](https://wiki.php.net/rfc/pow-operator) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpPowCallCanBeReplacedWithOperatorInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFormatFunctionParametersMismatchInspection", + "shortDescription": { + "text": "Format function parameters mismatch" + }, + "fullDescription": { + "text": "Reports the arguments of a format function (such as 'printf' or 'sprintf') that are not mapped to any parameters or specification conversions. See printf (php.net) and sprintf (php.net) for details.", + "markdown": "Reports the arguments of a format function (such as `printf` or `sprintf`) that are not mapped to any parameters or specification conversions.\n\n\nSee [printf (php.net)](https://www.php.net/manual/en/function.printf.php) and [sprintf (php.net)](https://www.php.net/manual/en/function.sprintf.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpFormatFunctionParametersMismatchInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpForeachVariableOverwritesAlreadyDefinedVariableInspection", + "shortDescription": { + "text": "'foreach' variable overwrites already defined variable" + }, + "fullDescription": { + "text": "Reports the keys and values in 'foreach' loops that are assigned a non-primitive value before the 'foreach' loop and are accessed after it. Such usages may unwillingly overwrite an already defined value and cause latent bugs.", + "markdown": "Reports the keys and values in `foreach` loops that are assigned a non-primitive value before the `foreach` loop and are accessed after it. Such usages may unwillingly overwrite an already defined value and cause latent bugs." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpForeachVariableOverwritesAlreadyDefinedVariableInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpLoopCanBeReplacedWithStdFunctionCallsInspection", + "shortDescription": { + "text": "Loop can be replaced with 'in_array()' or 'array_key_exists()' call" + }, + "fullDescription": { + "text": "Reports the 'foreach' loops that can be safely replaced with 'in_array()' or 'array_key_exists()' calls. See in_array (php.net) and array_key_exists (php.net) for details.", + "markdown": "Reports the `foreach` loops that can be safely replaced with `in_array()` or `array_key_exists()` calls.\n\n\nSee [in_array (php.net)](https://www.php.net/manual/en/function.in-array) and [array_key_exists (php.net)](https://www.php.net/manual/en/function.array-key-exists) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpLoopCanBeReplacedWithStdFunctionCallsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayKeyDoesNotMatchArrayShapeInspection", + "shortDescription": { + "text": "Array key does not match array shape " + }, + "fullDescription": { + "text": "Reports the array keys that do not match the keys specified via the '#[ArrayShape]' attribute.", + "markdown": "Reports the array keys that do not match the keys specified via the `#[ArrayShape]` attribute." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayKeyDoesNotMatchArrayShapeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpComposerExtensionStubsInspection", + "shortDescription": { + "text": "Extension is missing in composer.json" + }, + "fullDescription": { + "text": "Reports the usages of classes, functions, and constants from the PHP extensions not specified in composer.json. If an extension is listed in the 'require-dev' section of composer.json, the inspection reports the corresponding symbols' usages located outside of the folders marked as test roots.", + "markdown": "Reports the usages of classes, functions, and constants from the PHP extensions not specified in *composer.json* . If an extension is listed in the `require-dev` section of *composer.json*, the inspection reports the corresponding symbols' usages located outside of the folders marked as test roots." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpComposerExtensionStubsInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Composer", + "index": 38, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnusedParameterInspection", + "shortDescription": { + "text": "Unused parameter" + }, + "fullDescription": { + "text": "Reports the parameters that are considered unused in the following cases: The parameter is passed by value, and the value is not used anywhere or is overwritten immediately. The parameter is passed by reference, and the reference is not used anywhere or is overwritten immediately.", + "markdown": "Reports the parameters that are considered unused in the following cases:\n\n* The parameter is passed by value, and the value is not used anywhere or is overwritten immediately.\n* The parameter is passed by reference, and the reference is not used anywhere or is overwritten immediately." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnusedParameterInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Unused symbols", + "index": 37, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDisabledExtensionStubsInspection", + "shortDescription": { + "text": "Disabled extension stubs" + }, + "fullDescription": { + "text": "Reports the usages of classes, functions, and constants, for which the stubs for the corresponding PHP interpreter extensions are disabled. You can configure the set of stubs under Settings | PHP | PHP Runtime. See PhpStorm stubs (blog.jetbrains.com/phpstorm) for details.", + "markdown": "Reports the usages of classes, functions, and constants, for which the stubs for the corresponding PHP interpreter extensions are disabled.\n\n\nYou can configure the set of stubs under\n[Settings \\| PHP \\| PHP Runtime](settings://reference.webide.settings.project.settings.php?PHP%20Runtime).\n\n\nSee [PhpStorm stubs (blog.jetbrains.com/phpstorm)](https://blog.jetbrains.com/phpstorm/2018/03/how-to-provide-stubs-for-phpstorm/) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpDisabledExtensionStubsInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpTernaryExpressionCanBeReplacedWithConditionInspection", + "shortDescription": { + "text": "Ternary expression can be replaced with condition" + }, + "fullDescription": { + "text": "Reports the ternary expressions specified as 'condition ? true : false' that can be safely replaced with just 'condition'.", + "markdown": "Reports the ternary expressions specified as `condition ? true : false` that can be safely replaced with just `condition`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpTernaryExpressionCanBeReplacedWithConditionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPregMatchReplaceWithComparisonInspection", + "shortDescription": { + "text": "'preg_match()' can be replaced with comparison" + }, + "fullDescription": { + "text": "Reports the 'preg_match()' calls that are provided with a string argument starting with '^' (Start of String anchor) and ending with '$' (End of String anchor). Such calls can be replaced with a comparison operation.", + "markdown": "Reports the `preg_match()` calls that are provided with a string argument starting with `^` (Start of String anchor) and ending with `$` (End of String anchor). Such calls can be replaced with a comparison operation." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPregMatchReplaceWithComparisonInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMethodMayBeInaccessibleInLateStaticBindingInspection", + "shortDescription": { + "text": "Private method may be inaccessible during late static binding call" + }, + "fullDescription": { + "text": "Reports the late static binding method calls (that is, performed via 'static::') that may be resolved to inaccessible private methods from child classes. See Late Static Bindings (php.net) for details.", + "markdown": "Reports the late static binding method calls (that is, performed via `static::`) that may be resolved to inaccessible private methods from child classes.\n\n\nSee [Late Static Bindings (php.net)](https://www.php.net/manual/en/language.oop5.late-static-bindings.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpMethodMayBeInaccessibleInLateStaticBindingInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpClassConstantCanBeFinalInspection", + "shortDescription": { + "text": "Class constant can be 'final'" + }, + "fullDescription": { + "text": "Reports the non-'final' class constants that are not redefined in child classes. In PHP 8.1 and later, such constants can be made 'final'. See Final class constants (php.net) for details.", + "markdown": "Reports the non-`final` class constants that are not redefined in child classes. In PHP 8.1 and later, such constants can be made `final`.\n\n\nSee [Final class constants (php.net)](https://wiki.php.net/rfc/final_class_const) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpClassConstantCanBeFinalInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpClosureCanBeConvertedToFirstClassCallableInspection", + "shortDescription": { + "text": "'Closure::fromCallable()' can be converted to the first-class callable syntax" + }, + "fullDescription": { + "text": "Reports the 'callable' creation expressions that use 'Closure::fromCallable' but can be replaced with first-class callable syntax 'f(...)' available since PHP 8.1. See First-class callable syntax (php.net) for details.", + "markdown": "Reports the `callable` creation expressions that use `Closure::fromCallable` but can be replaced with first-class callable syntax `f(...)` available since PHP 8.1.\n\n\nSee [First-class callable syntax (php.net)](https://wiki.php.net/rfc/first_class_callable_syntax) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpClosureCanBeConvertedToFirstClassCallableInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantArrayCallInForeachIteratedValueInspection", + "shortDescription": { + "text": "Redundant 'array_values' call on a value iterated in 'foreach'" + }, + "fullDescription": { + "text": "Reports the 'array_values()' calls inside 'foreach' loops in which the iterated value is used without a key. Such calls are redundant and can be safely removed.", + "markdown": "Reports the `array_values()` calls inside `foreach` loops in which the iterated value is used without a key. Such calls are redundant and can be safely removed." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantArrayCallInForeachIteratedValueInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpExpressionAlwaysNullInspection", + "shortDescription": { + "text": "Expression is always 'null'" + }, + "fullDescription": { + "text": "Reports the variables in 'return' statements that are always 'null'.", + "markdown": "Reports the variables in `return` statements that are always `null`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpExpressionAlwaysNullInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitAssertCountInspection", + "shortDescription": { + "text": "Usage 'assertCount/assertSameSize' methods instead of assertEquals" + }, + "fullDescription": { + "text": "Reports alternative usage of the 'assertEquals' and 'assertNotEquals' methods with 'count' function as a parameter See Usage of the assertCount for details. See Usage of the assertSameSize for details.", + "markdown": "Reports alternative usage of the `assertEquals` and `assertNotEquals` methods with `count` function as a parameter\n\n\nSee [Usage of the assertCount](https://phpunit.readthedocs.io/en/stable/assertions.html#assertcount) for details.\n\n\nSee [Usage of the assertSameSize](https://hotexamples.com/examples/-/PHPUnit_Framework_Assert/assertSameSize/php-phpunit_framework_assert-assertsamesize-method-examples.html) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitAssertCountInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDefineConstantNameStartsWithLeadingSlashInspection", + "shortDescription": { + "text": "Constant name defined with a leading slash" + }, + "fullDescription": { + "text": "Reports the 'define' constructs in which the constant's FQN starts with a leading slash. Such constants will not be correctly registered by PHP.", + "markdown": "Reports the `define` constructs in which the constant's FQN starts with a leading slash. Such constants will not be correctly registered by PHP." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDefineConstantNameStartsWithLeadingSlashInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryParenthesesInspection", + "shortDescription": { + "text": "Unnecessary parentheses" + }, + "fullDescription": { + "text": "Reports the expressions containing redundant parenthesis, which can be safely removed.", + "markdown": "Reports the expressions containing redundant parenthesis, which can be safely removed." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryParenthesesInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIfCanBeMergedWithSequentialConditionInspection", + "shortDescription": { + "text": "'if' can be merged with subsequent condition" + }, + "fullDescription": { + "text": "Reports the 'if' statements that are followed by 'elseif' or other 'if' statements having the same bodies. Such statements can be merged together.", + "markdown": "Reports the `if` statements that are followed by `elseif` or other `if` statements having the same bodies. Such statements can be merged together." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpIfCanBeMergedWithSequentialConditionInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayModificationWillNotHaveEffectInspection", + "shortDescription": { + "text": "Modification of the array returned from function by value won't have any effect" + }, + "fullDescription": { + "text": "Reports call to a function that returns array by value, which makes the assignment operation non-working. Return by reference shall be used instead. For example: 'values;\n }\n}\n$config = new A();\n$config->getValues()['a'] = 'a';'", + "markdown": "Reports call to a function that returns array by value, which makes the assignment operation non-working. Return by reference shall be used instead.\n\n**For example:**\n\n\n values;\n }\n }\n $config = new A();\n $config->getValues()['a'] = 'a';\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayModificationWillNotHaveEffectInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpConstructorStyleInspection", + "shortDescription": { + "text": "Old style constructor" + }, + "fullDescription": { + "text": "Reports old-style constructor declarations ('ClassName()') and suggests replacing them with new-style constructors ('__construct()'). Prior to PHP 8.0, old-style constructor syntax used in the classes in the global namespace is treated as deprecated and will result in an 'E_DEPRECATED' error. If both a '__construct()' and a 'ClassName()' method are defined, '__construct()' will be called. In namespaced classes, or any classes as of PHP 8.0, a 'ClassName()' method never has any special meaning and will never be called as a constructor. As a result, the inspection does not report such cases if the PHP language level is set to 8.0 or later. See Constructors and destructors (php.net) for details.", + "markdown": "Reports old-style constructor declarations (`ClassName()`) and suggests replacing them with new-style constructors (`__construct()`).\n\n\nPrior to PHP 8.0, old-style constructor syntax used in the classes in the global namespace is treated as deprecated and will result in an `E_DEPRECATED` error. If both a `__construct()` and a `ClassName()` method are defined, `__construct()` will be called.\n\nIn namespaced classes, or any classes as of PHP 8.0, a `ClassName()` method never has any special meaning and will never be called as a constructor. As a result, the inspection does not report such cases if the PHP language level is set to 8.0 or later.\n\n\nSee [Constructors and destructors (php.net)](https://www.php.net/manual/en/language.oop5.decon.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpConstructorStyleInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNonStrictObjectEqualityInspection", + "shortDescription": { + "text": "Non-strict object equality" + }, + "fullDescription": { + "text": "Reports the usages of the comparison operator ('==') for comparing object variables. Object variables are compared as follows: When using the comparison operator ('=='), two object instances are considered equal if they have the same attributes and values (values are compared with '=='), and are instances of the same class. When using the identity operator ('==='), object variables are considered identical if and only if they refer to the same instance of the same class. See Comparing Objects (php.net) for details.", + "markdown": "Reports the usages of the comparison operator (`==`) for comparing object variables.\n\n\nObject variables are compared as follows:\n\n* When using the comparison operator (`==`), two object instances are considered equal if they have the same attributes and values (values are compared with `==`), and are instances of the same class.\n* When using the identity operator (`===`), object variables are considered identical if and only if they refer to the same instance of the same class.\n\n\nSee [Comparing Objects (php.net)](http://www.php.net/manual/en/language.oop5.object-comparison.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpNonStrictObjectEqualityInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUndefinedVariableInspection", + "shortDescription": { + "text": "Undefined variable" + }, + "fullDescription": { + "text": "Produces two types of warnings: Undefined variable: the variable's definition is not found in the project files, configured include paths, or among the PHP predefined variables. Variable might have not been defined: there are one or more paths to reach the line with the variable usage without defining it. Use the options below to customize the inspection: Report that variable is probably undefined: clear the checkbox to disable the Variable might have not been defined warnings. Enable inspection in global space: by default, the inspection is enabled for global space. Clear the checkbox to only report undefined variables from functions' local scope. Search for variable's definition outside the current file: if selected, the IDE reports a global variable as undefined only in case there are no 'include' or 'require' statements in the current file and the variable's definition cannot be found in the project. Note that the IDE does not examine the actual content of included files but only checks the presence of 'include' or 'require' statements. Otherwise, if not selected, the IDE searches for the variable's definition only in the current file and ignores the 'include' or 'require' statements if any.", + "markdown": "Produces two types of warnings:\n\n* *Undefined variable*: the variable's definition is not found in the project files, configured include paths, or among the PHP predefined variables.\n* *Variable might have not been defined*: there are one or more paths to reach the line with the variable usage without defining it.\n\n\nUse the options below to customize the inspection:\n\n* **Report that variable is probably undefined** : clear the checkbox to disable the *Variable might have not been defined* warnings.\n* **Enable inspection in global space**: by default, the inspection is enabled for global space. Clear the checkbox to only report undefined variables from functions' local scope.\n*\n **Search for variable's definition outside the current file** : if selected, the IDE reports a global variable as undefined only in case there are no `include` or `require` statements in the current file and the variable's definition cannot be found in the project. Note that the IDE does not examine the actual content of included files but only checks the presence of `include` or `require` statements.\n\n\n Otherwise, if not selected, the IDE searches for the variable's definition only in the current file and ignores the `include` or `require` statements if any." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpUndefinedVariableInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUsageOfSilenceOperatorInspection", + "shortDescription": { + "text": "Usage of a silence operator" + }, + "fullDescription": { + "text": "Reports the usages of the silence operator ('@'), which is highly discouraged. See Error Control Operators (php.net) for details.", + "markdown": "Reports the usages of the silence operator (`@`), which is highly discouraged.\n\nSee [Error Control Operators (php.net)](https://www.php.net/manual/en/language.operators.errorcontrol.php) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpUsageOfSilenceOperatorInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpShortOpenTagInspection", + "shortDescription": { + "text": "Short open tag usage" + }, + "fullDescription": { + "text": "Reports short PHP opening tag '' PHPDoc syntax.", + "markdown": "Reports the assignments and return statements whose arguments do not match the expected ranges specified via `int` PHPDoc syntax." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpIntRangesMismatchInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpReturnDocTypeMismatchInspection", + "shortDescription": { + "text": "Return type in PHPDoc comment does not match the actual return type" + }, + "fullDescription": { + "text": "Reports the return types in PHPDoc comments that do not match the actual return type of a function.", + "markdown": "Reports the return types in PHPDoc comments that do not match the actual return type of a function." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpReturnDocTypeMismatchInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpElementIsNotAvailableInCurrentPhpVersionInspection", + "shortDescription": { + "text": "Element is not available in configured PHP version" + }, + "fullDescription": { + "text": "Reports the usages of entities which were introduced in PHP version later than configured one.", + "markdown": "Reports the usages of entities which were introduced in PHP version later than configured one." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpElementIsNotAvailableInCurrentPhpVersionInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFieldCanBePromotedInspection", + "shortDescription": { + "text": "Property can be promoted" + }, + "fullDescription": { + "text": "Reports the properties that can be replaced with promoted versions. See Constructor Property Promotion (php.net) for details.", + "markdown": "Reports the properties that can be replaced with promoted versions.\n\n\nSee [Constructor Property Promotion (php.net)](https://wiki.php.net/rfc/constructor_promotion) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpFieldCanBePromotedInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPrivateFieldCanBeLocalVariableInspection", + "shortDescription": { + "text": "Private property can be local" + }, + "fullDescription": { + "text": "Reports the private properties that are used only in a single method. Such properties can be replaced with local variables.", + "markdown": "Reports the private properties that are used only in a single method. Such properties can be replaced with local variables." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPrivateFieldCanBeLocalVariableInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpTypedPropertyMightBeUninitializedInspection", + "shortDescription": { + "text": "Typed property might be uninitialized" + }, + "fullDescription": { + "text": "Reports the attempts to read from an uninitialized typed property. Such attempts will result in 'TypeError'. Typed properties should be initialized in any of the following ways: by a default value in the constructor by the '__get()' magic getter in-place, at the moment of usage See Uninitialized and Unset Properties (php.net) for details.", + "markdown": "Reports the attempts to read from an uninitialized typed property. Such attempts will result in `TypeError`.\n\n\nTyped properties should be initialized in any of the following ways:\n\n* by a default value\n* in the constructor\n* by the `__get()` magic getter\n* in-place, at the moment of usage\n\n\nSee [Uninitialized and Unset Properties (php.net)](https://wiki.php.net/rfc/typed_properties_v2#uninitialized_and_unset_properties) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpTypedPropertyMightBeUninitializedInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMissingParamTypeInspection", + "shortDescription": { + "text": "Missing parameter's type declaration" + }, + "fullDescription": { + "text": "Reports the parameters that have no type declaration specified.", + "markdown": "Reports the parameters that have no type declaration specified." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpMissingParamTypeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryFullyQualifiedNameInspection", + "shortDescription": { + "text": "Unnecessary fully qualified name" + }, + "fullDescription": { + "text": "Reports the usages of fully qualified class names, which can be shortened without adding the 'use' statement.", + "markdown": "Reports the usages of fully qualified class names, which can be shortened without adding the `use` statement." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryFullyQualifiedNameInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMissingParentCallCommonInspection", + "shortDescription": { + "text": "Missing parent call for method" + }, + "fullDescription": { + "text": "Reports the methods that do not call their parent method.", + "markdown": "Reports the methods that do not call their parent method." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMissingParentCallCommonInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMixedReturnTypeCanBeReducedInspection", + "shortDescription": { + "text": "'mixed' return type can be narrowed" + }, + "fullDescription": { + "text": "Reports 'mixed' return types that can be narrowed down to more concrete types.", + "markdown": "Reports 'mixed' return types that can be narrowed down to more concrete types." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpMixedReturnTypeCanBeReducedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpTraditionalSyntaxArrayLiteralInspection", + "shortDescription": { + "text": "Traditional syntax array literal detected" + }, + "fullDescription": { + "text": "Reports traditional array syntax ('array()') usages in array literals and suggests replacing them with short array syntax ('[]').", + "markdown": "Reports traditional array syntax (`array()`) usages in array literals and suggests replacing them with short array syntax (`[]`)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpTraditionalSyntaxArrayLiteralInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpConditionCheckedByNextConditionInspection", + "shortDescription": { + "text": "Condition inside logical expression checked by subsequent condition" + }, + "fullDescription": { + "text": "Reports the conditions inside logical binary expressions that are covered by subsequent conditions and are therefore redundant.", + "markdown": "Reports the conditions inside logical binary expressions that are covered by subsequent conditions and are therefore redundant." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpConditionCheckedByNextConditionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpInconsistentReturnPointsInspection", + "shortDescription": { + "text": "Inconsistent return points" + }, + "fullDescription": { + "text": "Reports inconsistencies in function/method exit points. The following types of inconsistencies are reported: The function/method contains the 'return' statements both with and without arguments. The function/method may return a value or otherwise end its execution without returning anything. Technically these are not errors, but practically they usually indicate a programming mistake.", + "markdown": "Reports inconsistencies in function/method exit points.\n\n\nThe following types of inconsistencies are reported:\n\n* The function/method contains the `return` statements both with and without arguments.\n* The function/method may return a value or otherwise end its execution without returning anything.\n\n\nTechnically these are not errors, but practically they usually indicate a programming mistake." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpInconsistentReturnPointsInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNoReturnAttributeCanBeAddedInspection", + "shortDescription": { + "text": "NoReturn attribute can be added" + }, + "fullDescription": { + "text": "Reports function without '#[NoReturn]' that are always halting their execution by calling other exitPoint functions attribute.", + "markdown": "Reports function without `#[NoReturn]` that are always halting their execution by calling other exitPoint functions attribute." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpNoReturnAttributeCanBeAddedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpConditionCanBeReplacedWithMinMaxCallInspection", + "shortDescription": { + "text": "Condition can be replaced with 'min()'/'max()' call" + }, + "fullDescription": { + "text": "Reports the conditions that perform manual min/max calculation instead of calling 'min'/'max' functions.", + "markdown": "Reports the conditions that perform manual min/max calculation instead of calling `min`/`max` functions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpConditionCanBeReplacedWithMinMaxCallInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpInapplicableAttributeTargetDeclarationInspection", + "shortDescription": { + "text": "Non-applicable attribute target declaration" + }, + "fullDescription": { + "text": "Reports the attributes that do not have the appropriate 'Attribute::TARGET_*' flag in their arguments declaration. See Attributes (php.net) for details.", + "markdown": "Reports the attributes that do not have the appropriate `Attribute::TARGET_*` flag in their arguments declaration.\n\n\nSee [Attributes (php.net)](https://wiki.php.net/rfc/attributes_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpInapplicableAttributeTargetDeclarationInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMissingParentCallMagicInspection", + "shortDescription": { + "text": "Missing parent call for magic methods" + }, + "fullDescription": { + "text": "Reports the magic methods that do not call their parent magic method.", + "markdown": "Reports the magic methods that do not call their parent magic method." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMissingParentCallMagicInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpGotoIntoLoopInspection", + "shortDescription": { + "text": "Goto into loop statement" + }, + "fullDescription": { + "text": "Reports the 'goto' labels that are located inside loops or 'switch' statements. See goto (php.net) for details.", + "markdown": "Reports the `goto` labels that are located inside loops or `switch` statements.\n\n\nSee [goto (php.net)](https://www.php.net/manual/en/control-structures.goto.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpGotoIntoLoopInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMatchExpressionCanBeReplacedWithTernaryInspection", + "shortDescription": { + "text": "'match' expression can be replace with ternary expression" + }, + "fullDescription": { + "text": "Reports the 'match' expressions containing a default arm and a single non-default arm. Such 'match' expressions can be replaced with ternary expressions. See Match expression (php.net) for details.", + "markdown": "Reports the `match` expressions containing a default arm and a single non-default arm. Such `match` expressions can be replaced with ternary expressions.\n\n\nSee [Match expression (php.net)](https://wiki.php.net/rfc/match_expression_v2) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMatchExpressionCanBeReplacedWithTernaryInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDeprecatedStdLibCallInspection", + "shortDescription": { + "text": "Deprecated Standard Library call" + }, + "fullDescription": { + "text": "Reports the calls to Standard PHP Library functions that are deprecated starting from PHP 8.1. The following calls are reported: 'key()', 'current()', 'next()', 'prev()', and 'reset()' calls with objects as arguments. 'mb_check_encoding()' calls without arguments. 'get_class()', 'get_parent_class()' and 'get_called_class()' calls without arguments. 'IntlCalendar::roll()' calls with a Boolean passed as the '$value' argument. 'ctype_*()' calls with non-string arguments. See PHP RFC: Deprecations for PHP 8.1 for details.", + "markdown": "Reports the calls to Standard PHP Library functions that are deprecated starting from PHP 8.1.\n\n\nThe following calls are reported:\n\n* `key()`, `current()`, `next()`, `prev()`, and `reset()` calls with objects as arguments.\n* `mb_check_encoding()` calls without arguments.\n* `get_class()`, `get_parent_class()` and `get_called_class()` calls without arguments.\n* `IntlCalendar::roll()` calls with a Boolean passed as the `$value` argument.\n* `ctype_*()` calls with non-string arguments.\n\n\nSee [PHP RFC: Deprecations for PHP 8.1](https://wiki.php.net/rfc/deprecations_php_8_1) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDeprecatedStdLibCallInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMissingBreakStatementInspection", + "shortDescription": { + "text": "Missing 'break' statement" + }, + "fullDescription": { + "text": "Reports the 'case' clauses in 'switch' statements that do not end with a 'break' or a 'return' statement. If a 'case' clause does not end with 'break' or 'return', its execution can unintentionally fall through the next case.", + "markdown": "Reports the `case` clauses in `switch` statements that do not end with a `break` or a `return` statement.\n\n\nIf a `case` clause does not end with `break` or `return`, its execution can unintentionally fall through the next case." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpMissingBreakStatementInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMethodMayBeStaticInspection", + "shortDescription": { + "text": "Method can be made 'static'" + }, + "fullDescription": { + "text": "Reports the methods that don't use any instance references and thus may be converted to static methods.", + "markdown": "Reports the methods that don't use any instance references and thus may be converted to static methods." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMethodMayBeStaticInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpForeachArrayIsUsedAsValueInspection", + "shortDescription": { + "text": "Foreach array is used as value" + }, + "fullDescription": { + "text": "Reports the variables that are used in a 'foreach' loop as both an array expression and an array's key or value (for example, 'foreach ($items as $items) {}'). Commonly, this is the result of a typing error.", + "markdown": "Reports the variables that are used in a `foreach` loop as both an array expression and an array's key or value (for example, `foreach ($items as $items) {}`).\n\n\nCommonly, this is the result of a typing error." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpForeachArrayIsUsedAsValueInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpToStringMayProduceExceptionInspection", + "shortDescription": { + "text": "'__toString' may throw an exception" + }, + "fullDescription": { + "text": "Reports the usages of '__toString' that may throw an exception, which is not allowed for PHP language level lower than 7.4.", + "markdown": "Reports the usages of `__toString` that may throw an exception, which is not allowed for PHP language level lower than 7.4." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpToStringMayProduceExceptionInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDeprecatedDollarBraceStringInterpolationInspection", + "shortDescription": { + "text": "Deprecated '${' string interpolation" + }, + "fullDescription": { + "text": "Reports '${var}' and '${expr}' interpolations in strings. Such interpolations are deprecated starting from PHP 8.2. See Deprecate ${} string interpolation (php.net) for details.", + "markdown": "Reports `${var}` and `${expr}` interpolations in strings. Such interpolations are deprecated starting from PHP 8.2.\n\n\nSee [Deprecate ${} string interpolation (php.net)](https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDeprecatedDollarBraceStringInterpolationInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSeparateElseIfInspection", + "shortDescription": { + "text": "Else if" + }, + "fullDescription": { + "text": "Reports the usages of the 'else if' constructs specified in two words. According to PSR-12, the keyword 'elseif' SHOULD be used instead of 'else if' so that all control keywords look like single words. See PSR-12: Extended Coding Style (php-fig.org) for details.", + "markdown": "Reports the usages of the `else if` constructs specified in two words.\n\nAccording to PSR-12, the keyword `elseif` SHOULD be used instead of `else if` so that all control keywords look like single words.\n\n\nSee [PSR-12: Extended Coding Style (php-fig.org)](https://www.php-fig.org/psr/psr-12/#51-if-elseif-else) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpSeparateElseIfInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style/PSR-12", + "index": 61, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUndefinedFunctionInspection", + "shortDescription": { + "text": "Undefined function" + }, + "fullDescription": { + "text": "Reports the references to functions that are not defined in the project files, configured include paths, or among the PHP predefined functions.", + "markdown": "Reports the references to functions that are not defined in the project files, configured include paths, or among the PHP predefined functions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUndefinedFunctionInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDuplicateArrayKeysInspection", + "shortDescription": { + "text": "Duplicate array keys" + }, + "fullDescription": { + "text": "Reports duplicate keys in array declarations. If multiple elements in the array declaration use the same key, only the last one will be used, and all others will be overwritten.", + "markdown": "Reports duplicate keys in array declarations.\n\nIf multiple elements in the array declaration use the same key, only the last one will be used, and all others will be overwritten." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDuplicateArrayKeysInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitDeprecatedExpectExceptionInspection", + "shortDescription": { + "text": "Deprecated expectException usage" + }, + "fullDescription": { + "text": "Reports deprecated usages of 'expectException()'. Support for using the 'expectException()' method with '\\PHPUnit\\Framework\\Error\\Deprecated', '\\PHPUnit\\Framework\\Error\\Error', '\\PHPUnit\\Framework\\Error\\Notice', and '\\PHPUnit\\Framework\\Error\\Warning' is deprecated and will be removed in PHPUnit 10. Instead, the 'expectDeprecation()', 'expectError()', 'expectNotice()', and 'expectWarning()' methods should be used. See Testing PHP Errors, Warnings, and Notices (phpunit.readthedocs.io) for details.", + "markdown": "Reports deprecated usages of `expectException()`.\n\n\nSupport for using the `expectException()` method with\n`\\PHPUnit\\Framework\\Error\\Deprecated`,\n`\\PHPUnit\\Framework\\Error\\Error`,\n`\\PHPUnit\\Framework\\Error\\Notice`, and\n`\\PHPUnit\\Framework\\Error\\Warning` is deprecated and will be removed in PHPUnit 10.\n\n\nInstead, the `expectDeprecation()`, `expectError()`, `expectNotice()`, and\n`expectWarning()` methods should be used.\n\n\nSee [Testing PHP Errors, Warnings, and Notices (phpunit.readthedocs.io)](https://phpunit.readthedocs.io/en/stable/writing-tests-for-phpunit.html#testing-php-errors-warnings-and-notices) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitDeprecatedExpectExceptionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitTestFailedLineInspection", + "shortDescription": { + "text": "Failed line in test" + }, + "fullDescription": { + "text": "Reports failed method calls or assertions in tests. It helps detect the failed line in code faster and start debugging it immediately. Example: 'function test() {\n $this->assertEquals(1,2); //highlighted\n }'", + "markdown": "Reports failed method calls or assertions in tests. It helps detect the failed line in code faster and start debugging it immediately.\n\n**Example:**\n\n\n function test() {\n $this->assertEquals(1,2); //highlighted\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUnitTestFailedLineInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMatchCanBeReplacedWithSwitchStatementInspection", + "shortDescription": { + "text": "'match' can be replaced with 'switch' statement" + }, + "fullDescription": { + "text": "Reports the 'match' expressions that can be replaced with 'switch' statements. Note that 'match' expressions use strict type comparison, while 'switch' statements rely on loose comparison. As a result, the expression semantics may change after replacement. See match (php.net) and switch (php.net) for details.", + "markdown": "Reports the `match` expressions that can be replaced with `switch` statements.\n\n\nNote that `match` expressions use strict type comparison, while `switch` statements rely on loose comparison. As a\nresult, the expression semantics may change after replacement.\n\n\nSee [match (php.net)](https://www.php.net/manual/en/control-structures.match.php) and [switch (php.net)](https://www.php.net/manual/en/control-structures.switch.php) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMatchCanBeReplacedWithSwitchStatementInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSecondWriteToReadonlyPropertyInspection", + "shortDescription": { + "text": "Second write to 'readonly' property" + }, + "fullDescription": { + "text": "Reports reassignments of 'readonly' properties. Such properties cannot be modified after initialization. See Readonly properties (php.net) for details.", + "markdown": "Reports reassignments of `readonly` properties. Such properties cannot be modified after initialization.\n\n\nSee [Readonly properties (php.net)](https://wiki.php.net/rfc/readonly_properties_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpSecondWriteToReadonlyPropertyInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpEnforceDocCommentInspection", + "shortDescription": { + "text": "Enforce PHPDoc comment" + }, + "fullDescription": { + "text": "Reports the elements without a PHPDoc comment or with a PHPDoc comment only containing the '@noinspection' tag. You can use Missing PHPDoc Comment inspection to report only non-fully typed elements.", + "markdown": "Reports the elements without a PHPDoc comment or with a PHPDoc comment only containing the `@noinspection` tag.\n\nYou can use *Missing PHPDoc Comment* inspection to report only non-fully typed elements." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpEnforceDocCommentInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc/Code style", + "index": 11, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDocFinalChecksInspection", + "shortDescription": { + "text": "Overriding method/extending class marked as '@final'" + }, + "fullDescription": { + "text": "Reports override of method or extending of class with '@final' in the PHPDoc.", + "markdown": "Reports override of method or extending of class with `@final` in the PHPDoc." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDocFinalChecksInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPureAttributeCanBeAddedInspection", + "shortDescription": { + "text": "'#[Pure]' attribute can be added" + }, + "fullDescription": { + "text": "Reports the functions that are non-trivially pure. Such functions have other functions calls in their body, but all such calls do not produce any side effects.", + "markdown": "Reports the functions that are non-trivially pure. Such functions have other functions calls in their body, but all such calls do not produce any side effects." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpPureAttributeCanBeAddedInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpVarTagWithoutVariableNameInspection", + "shortDescription": { + "text": "Type tag without variable name" + }, + "fullDescription": { + "text": "Reports the PHPDoc type tags ('@var','@type','@param') that are provided without a specified variable/parameter name. Such tags do not provide any type information for expressions and should be either deleted or expanded to include a concrete variable name for which the type is provided.", + "markdown": "Reports the PHPDoc type tags (`@var`,`@type`,`@param`) that are provided without a specified variable/parameter name. Such tags do not provide any type information for expressions and should be either deleted or expanded to include a concrete variable name for which the type is provided." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpVarTagWithoutVariableNameInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpImmutablePropertyIsWrittenInspection", + "shortDescription": { + "text": "Immutable property written in invalid scope" + }, + "fullDescription": { + "text": "Highlights write access references to properties, for which the write access scope declared via '#[Immutable]' is stricter than the reference scope.", + "markdown": "Highlights write access references to properties, for which the write access scope declared via `#[Immutable]` is stricter than the reference scope." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpImmutablePropertyIsWrittenInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDeprecatedAssertDeclarationInspection", + "shortDescription": { + "text": "Deprecated 'assert()' function declaration" + }, + "fullDescription": { + "text": "Reports the 'assert()' function declarations. Declaring the 'assert()' function is global namespace is forbidden. Starting from PHP 7.3, declaring the 'assert()' function in non-global namespace is deprecated. See assert (php.net) for details.", + "markdown": "Reports the `assert()` function declarations.\n\n* Declaring the `assert()` function is global namespace is forbidden.\n* Starting from PHP 7.3, declaring the `assert()` function in non-global namespace is deprecated.\n\n\nSee [assert (php.net)](https://www.php.net/manual/en/function.assert.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpDeprecatedAssertDeclarationInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDocSignatureIsNotCompleteInspection", + "shortDescription": { + "text": "PHPDoc comment signature is not complete" + }, + "fullDescription": { + "text": "Reports the PHPDoc comments that contain at least one '@param' or '@return' tag but are missing some of the '@param' or '@return' tags for parameters or return types specified in the function/method declaration.", + "markdown": "Reports the PHPDoc comments that contain at least one `@param` or `@return` tag but are missing some of the `@param` or `@return` tags for parameters or return types specified in the function/method declaration." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDocSignatureIsNotCompleteInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc/Code style", + "index": 11, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpAutovivificationOnFalseValuesInspection", + "shortDescription": { + "text": "Automatic conversion of 'false' to array is deprecated" + }, + "fullDescription": { + "text": "Reports automatic conversions of 'false' values to arrays. Such expressions are deprecated starting from PHP 8.1. See Deprecate autovivification on false for details.", + "markdown": "Reports automatic conversions of `false` values to arrays. Such expressions are deprecated starting from PHP 8.1.\n\n\nSee [Deprecate autovivification on false](https://wiki.php.net/rfc/autovivification_false) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpAutovivificationOnFalseValuesInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSignatureMismatchDuringInheritanceInspection", + "shortDescription": { + "text": "Declaration of overridden method should be compatible with parent class" + }, + "fullDescription": { + "text": "Reports the overridden methods declarations that are not compatible with the parent class. The inspection is enabled only for the PHP language level lower than 8.0.", + "markdown": "Reports the overridden methods declarations that are not compatible with the parent class. The inspection is enabled only for the PHP language level lower than 8.0." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpSignatureMismatchDuringInheritanceInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHP strict standards", + "index": 67, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpTraitUsageOutsideUseInspection", + "shortDescription": { + "text": "Trait usage is not allowed" + }, + "fullDescription": { + "text": "Reports the class references that are resolved to traits but are specified outside 'use' statements. Such usages are most probably the result of a programming mistake, since traits cannot be instantiated and any 'instanceof'-like behaviour is not supported for traits by design. See Traits (php.net) for details.", + "markdown": "Reports the class references that are resolved to traits but are specified outside `use` statements. Such usages are most probably the result of a programming mistake, since traits cannot be instantiated and any `instanceof`-like behaviour is not supported for traits by design.\n\n\nSee [Traits (php.net)](https://www.php.net/manual/en/language.oop5.traits.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpTraitUsageOutsideUseInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpStrictTypeCheckingInspection", + "shortDescription": { + "text": "Strict type checking rules violation" + }, + "fullDescription": { + "text": "Reports violations of the strict type checking rules. In strict mode, only the variables exactly matching the declaration types are accepted. Strict type-checking mode can be enabled: Per file, if the 'declare(strict_types=1)' directive is specified. The directive must be the first statement in a file, block mode is explicitly disallowed. For all files, if the Enable for all files inspection option is enabled. See Strict typing (php.net) for details.", + "markdown": "Reports violations of the strict type checking rules.\n\n\nIn strict mode, only the variables exactly matching the declaration types are accepted. Strict type-checking mode can be enabled:\n\n* Per file, if the `declare(strict_types=1)` directive is specified. The directive must be the first statement in a file, block mode is explicitly disallowed.\n* For all files, if the **Enable for all files** inspection option is enabled.\n\n\nSee [Strict typing (php.net)](https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpStrictTypeCheckingInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIfWithCommonPartsInspection", + "shortDescription": { + "text": "'if' with common parts" + }, + "fullDescription": { + "text": "Reports the 'if' statements with duplicated common parts.", + "markdown": "Reports the `if` statements with duplicated common parts." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpIfWithCommonPartsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpStaticAsDynamicMethodCallInspection", + "shortDescription": { + "text": "Static method called as dynamic" + }, + "fullDescription": { + "text": "Reports dynamic calls to static class methods. If the target has the magic method '__call', a separate inspection severity and highlighting level can be set.", + "markdown": "Reports dynamic calls to static class methods.\n\nIf the target has the magic method `__call`, a separate inspection severity and highlighting level can be set." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpStaticAsDynamicMethodCallInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDeprecatedImplodeUsageInspection", + "shortDescription": { + "text": "Deprecated 'implode/join' usage" + }, + "fullDescription": { + "text": "Reports deprecated usage of the 'implode' and 'join' functions. Starting from PHP 7.4, using 'implode' and 'join' with an array as the first argument and a string as the second argument is deprecated. See Deprecations for PHP 7.4 (php.net) for details.", + "markdown": "Reports deprecated usage of the `implode` and `join` functions.\n\nStarting from PHP 7.4, using `implode` and `join` with an array as the first argument and a string as the second argument is deprecated.\n\n\nSee [Deprecations for PHP 7.4 (php.net)](https://wiki.php.net/rfc/deprecations_php_7_4#implode_parameter_order_mix) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDeprecatedImplodeUsageInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDangerousArrayInitializationInspection", + "shortDescription": { + "text": "Dangerous array initialization" + }, + "fullDescription": { + "text": "Reports dangerous array initializations (such as '$arr[] = value'). This practice is discouraged because if '$arr' already contains some value (for example, a string from a request variable), then this value will stay in place and '[]' may actually stand for string access operator. It is always preferable to initialize a variable by direct assignment. See Creating/modifying with square bracket syntax (php.net) for details.", + "markdown": "Reports dangerous array initializations (such as `$arr[] = value`).\n\n\nThis practice is discouraged because if `$arr` already contains some value (for example, a string from a request variable), then this value will stay in place and `[]` may actually stand for string access operator. It is always preferable to initialize a variable by direct assignment.\n\nSee [Creating/modifying with square bracket syntax (php.net)](https://www.php.net/manual/en/language.types.array.php#language.types.array.syntax.modifying) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpDangerousArrayInitializationInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpOverridingMethodVisibilityInspection", + "shortDescription": { + "text": "Method visibility should not be overridden" + }, + "fullDescription": { + "text": "Checks that the methods don't override visibility. Overriding a 'protected' method with a 'public' method in a child class makes this method accessible from everywhere. This violates the encapsulation principle and is considered bad practice. See Method Visibility (php.net) for details.", + "markdown": "Checks that the methods don't override visibility.\n\n\nOverriding a `protected` method with a `public` method in a child class makes this method accessible from everywhere.\nThis violates the encapsulation principle and is considered bad practice.\n\n\nSee [Method Visibility (php.net)](https://www.php.net/manual/en/language.oop5.visibility.php#language.oop5.visiblity-methods) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpOverridingMethodVisibilityInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMockeryInvalidMockingMethodInspection", + "shortDescription": { + "text": "Invalid Mockery mocking target" + }, + "fullDescription": { + "text": "Reports the methods and classes that are incorrectly mocked in Mockery tests. The following entities are reported: 'private' methods 'protected' methods without appropriate '\\Mockery\\Mock::shouldAllowMockingProtectedMethods' call", + "markdown": "Reports the methods and classes that are incorrectly mocked in Mockery tests.\n\n\nThe following entities are reported:\n\n* `private` methods\n* `protected` methods without appropriate `\\Mockery\\Mock::shouldAllowMockingProtectedMethods` call" + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpMockeryInvalidMockingMethodInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpForeachOverSingleElementArrayLiteralInspection", + "shortDescription": { + "text": "Foreach over array literal with single element" + }, + "fullDescription": { + "text": "Reports the 'foreach' statements that iterate over an array literal containing a single element.", + "markdown": "Reports the `foreach` statements that iterate over an array literal containing a single element." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpForeachOverSingleElementArrayLiteralInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpClassNamingConventionInspection", + "shortDescription": { + "text": "Class name is not following coding convention" + }, + "fullDescription": { + "text": "Reports the classes' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for classes. Use the inspection options to specify minimum/maximum length and the regular expression expected for classes' names. To ignore the names' length, specify 0. To learn more about regular expressions, refer to the Quick Start guide (regular-expressions.info).", + "markdown": "Reports the classes' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for classes.\n\n\nUse the inspection options to specify minimum/maximum length and the regular expression expected for classes' names.\nTo ignore the names' length, specify **0**.\n\n\nTo learn more about regular expressions, refer to the [Quick Start guide (regular-expressions.info)](https://www.regular-expressions.info/quickstart.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpClassNamingConventionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Naming conventions", + "index": 4, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpCoveredCharacterInClassInspection", + "shortDescription": { + "text": "Element in class is already covered" + }, + "fullDescription": { + "text": "Reports the elements in regular expression character classes that are already covered by another element in the same class. Such elements are redundant and can be safely removed.", + "markdown": "Reports the elements in regular expression character classes that are already covered by another element in the same class. Such elements are redundant and can be safely removed." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpCoveredCharacterInClassInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Regular expressions", + "index": 68, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpVariableIsUsedOnlyInClosureInspection", + "shortDescription": { + "text": "Variable is only used inside closure" + }, + "fullDescription": { + "text": "Reports variables in closures' 'use' list that are only used inside closure.", + "markdown": "Reports variables in closures' `use` list that are only used inside closure." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpVariableIsUsedOnlyInClosureInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpLongTypeFormInspection", + "shortDescription": { + "text": "Short form of type keywords" + }, + "fullDescription": { + "text": "Reports usages of long form type keywords. According to PSR-12, short form of type keywords MUST be used, that is 'bool' instead of 'boolean', 'int' instead of 'integer', and so on. See Keywords and Types (php-fig.org) for details.", + "markdown": "Reports usages of long form type keywords.\n\n\nAccording to PSR-12, short form of type keywords MUST be used, that is `bool` instead of `boolean`, `int` instead of `integer`, and so on.\n\n\nSee [Keywords and Types (php-fig.org)](https://www.php-fig.org/psr/psr-12/#25-keywords-and-types) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpLongTypeFormInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style/PSR-12", + "index": 61, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnreachableStatementInspection", + "shortDescription": { + "text": "Unreachable statement" + }, + "fullDescription": { + "text": "Reports the statements that cannot be reached.", + "markdown": "Reports the statements that cannot be reached." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUnreachableStatementInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpClosureCanBeConvertedToShortArrowFunctionInspection", + "shortDescription": { + "text": "Closure can be converted to arrow function" + }, + "fullDescription": { + "text": "Reports the anonymous functions that can be transformed to short arrow functions. Support for short arrow functions is available since PHP 7.4. See PHP RFC: Arrow Functions 2.0 (php.net) for details.", + "markdown": "Reports the anonymous functions that can be transformed to short arrow functions. Support for short arrow functions is available since PHP 7.4.\n\n\nSee [PHP RFC: Arrow Functions 2.0 (php.net)](https://wiki.php.net/rfc/arrow_functions_v2) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpClosureCanBeConvertedToShortArrowFunctionInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpCSFixerValidationInspection", + "shortDescription": { + "text": "PHP CS Fixer validation" + }, + "fullDescription": { + "text": "Reports coding style problems detected by PHP CS Fixer. The inspection requires PHP CS Fixer to be properly installed and set up in the IDE under Settings | PHP | Quality Tools | PHP CS Fixer. To learn more about installing PHP CS Fixer, see PHP-CS-Fixer installation (GitHub).", + "markdown": "Reports coding style problems detected by PHP CS Fixer.\n\n\nThe inspection requires PHP CS Fixer to be properly installed and set up in the IDE under\n[Settings \\| PHP \\| Quality Tools \\| PHP CS Fixer](settings://settings.php.quality.tools?CS%20Fixer).\n\n\nTo learn more about installing PHP CS Fixer, see [PHP-CS-Fixer installation (GitHub)](https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpCSFixerValidationInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Quality tools", + "index": 70, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitDeprecatedCallsIn10VersionInspection", + "shortDescription": { + "text": "Method is deprecated in PHPUnit 10" + }, + "fullDescription": { + "text": "Reports the calls to the PHPUnit assertion methods that are removed in PHPUnit 10.", + "markdown": "Reports the calls to the PHPUnit assertion methods that are removed in PHPUnit 10." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUnitDeprecatedCallsIn10VersionInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnhandledExceptionInspection", + "shortDescription": { + "text": "Unhandled exception" + }, + "fullDescription": { + "text": "Reports the exceptions that are neither enclosed in a 'try-catch' block nor documented via the '@throws' tag.", + "markdown": "Reports the exceptions that are neither enclosed in a `try-catch` block nor documented via the `@throws` tag." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnhandledExceptionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Error handling", + "index": 72, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIncludeInspection", + "shortDescription": { + "text": "Unresolved include" + }, + "fullDescription": { + "text": "Reports non-resolved 'include', 'include_once', 'require', and 'require_once' expressions.", + "markdown": "Reports non-resolved `include`, `include_once`, `require`, and `require_once` expressions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpIncludeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitUndefinedDataProviderInspection", + "shortDescription": { + "text": "Undefined PHPUnit data provider" + }, + "fullDescription": { + "text": "Reports the references to functions/methods in the '@dataProvider' PHPDoc tag that are not resolved. Note that when resolving 'dataProvider', PHPUnit doesn't take 'use' statements into account.", + "markdown": "Reports the references to functions/methods in the `@dataProvider` PHPDoc tag that are not resolved.\n\nNote that when resolving `dataProvider`, PHPUnit doesn't take `use` statements into account." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUnitUndefinedDataProviderInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFieldAssignmentTypeMismatchInspection", + "shortDescription": { + "text": "Type mismatch in property assignment" + }, + "fullDescription": { + "text": "Reports type violations in properties assignments.", + "markdown": "Reports type violations in properties assignments." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpFieldAssignmentTypeMismatchInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMissingParentConstructorInspection", + "shortDescription": { + "text": "Missing parent call for constructor" + }, + "fullDescription": { + "text": "Reports the constructors that do not call their parent constructor.", + "markdown": "Reports the constructors that do not call their parent constructor." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpMissingParentConstructorInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitAssertEqualsCanBeReplacedWithAssertTrueOrFalseInspection", + "shortDescription": { + "text": "Assertion can be replaced with 'assertTrue/assertFalse'" + }, + "fullDescription": { + "text": "Reports the 'assertEquals()' calls with the 'true'/'false' arguments in PHPUnit tests. Such usages can be replaced with 'assertTrue()'/'assertFalse()' calls.", + "markdown": "Reports the `assertEquals()` calls with the `true`/`false` arguments in PHPUnit tests. Such usages can be replaced with `assertTrue()`/`assertFalse()` calls." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitAssertEqualsCanBeReplacedWithAssertTrueOrFalseInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDynamicAsStaticMethodCallInspection", + "shortDescription": { + "text": "Dynamic method called as static" + }, + "fullDescription": { + "text": "Reports static calls to dynamic class methods. For classes having the magic method '__callStatic', a separate inspection severity and highlighting level can be set.", + "markdown": "Reports static calls to dynamic class methods.\n\nFor classes having the magic method `__callStatic`, a separate inspection severity and highlighting level can be set." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDynamicAsStaticMethodCallInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpReadonlyPropertyWrittenOutsideDeclarationScopeInspection", + "shortDescription": { + "text": "Write access to 'readonly' property outside of declaration scope" + }, + "fullDescription": { + "text": "Reports the write accesses to 'readonly' properties that are made outside the declaration scope. A declaration scope effectively means non-static methods of the class in which a property is declared. See Readonly properties (php.net) for details.", + "markdown": "Reports the write accesses to `readonly` properties that are made outside the declaration scope. A declaration scope effectively means non-static methods of the class in which a property is declared.\n\n\nSee [Readonly properties (php.net)](https://wiki.php.net/rfc/readonly_properties_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpReadonlyPropertyWrittenOutsideDeclarationScopeInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFormatCallWithSingleArgumentInspection", + "shortDescription": { + "text": "Format function call with single argument" + }, + "fullDescription": { + "text": "Reports the 'sprintf()' and 'vsprintf()' calls with a single argument. Such calls produce no effect and can be safely unwrapped, that is, replaced with the argument itself.", + "markdown": "Reports the `sprintf()` and `vsprintf()` calls with a single argument. Such calls produce no effect and can be safely unwrapped, that is, replaced with the argument itself." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpFormatCallWithSingleArgumentInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIllegalArrayKeyTypeInspection", + "shortDescription": { + "text": "Illegal array key type" + }, + "fullDescription": { + "text": "Reports the array keys that are of illegal type, such as objects or arrays. See Arrays (php.net) for details.", + "markdown": "Reports the array keys that are of illegal type, such as objects or arrays.\n\n\nSee [Arrays (php.net)](http://www.php.net/manual/en/language.types.array.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpIllegalArrayKeyTypeInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayIsAlwaysEmptyInspection", + "shortDescription": { + "text": "Array is always empty at the point of access" + }, + "fullDescription": { + "text": "Reports the iterated/accessed arrays that are known to be empty at the point of access.", + "markdown": "Reports the iterated/accessed arrays that are known to be empty at the point of access." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayIsAlwaysEmptyInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpLoopNeverIteratesInspection", + "shortDescription": { + "text": "Loop does not iterate" + }, + "fullDescription": { + "text": "Reports the loop statements whose bodies will execute at most once. The inspection does not report 'foreach' loops with a key or value used inside the loop body. Commonly, such loops are intended to perform an action only on their first iteration (for example, get the first element of an array).", + "markdown": "Reports the loop statements whose bodies will execute at most once.\n\n\nThe inspection does not report `foreach` loops with a key or value used inside the loop body. Commonly, such loops are intended to perform an action only on their first iteration (for example, get the first element of an array)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpLoopNeverIteratesInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRegExpUnsupportedModifierInspection", + "shortDescription": { + "text": "Unsupported modifier" + }, + "fullDescription": { + "text": "Reports the usages of the 'e' modifier in regular expression patterns. In PHP 7.0 and later, such usages are deprecated and will emit an 'E_WARNING'.", + "markdown": "Reports the usages of the `e` modifier in regular expression patterns. In PHP 7.0 and later, such usages are deprecated and will emit an `E_WARNING`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpRegExpUnsupportedModifierInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Regular expressions", + "index": 68, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpVariableNamingConventionInspection", + "shortDescription": { + "text": "Variable name is not following coding convention" + }, + "fullDescription": { + "text": "Reports the variables' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for variables. Use the inspection options to specify minimum/maximum length and the regular expression expected for variables' names. To ignore the names' length, specify 0. To learn more about regular expressions, refer to the Quick Start guide (regular-expressions.info).", + "markdown": "Reports the variables' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for variables.\n\n\nUse the inspection options to specify minimum/maximum length and the regular expression expected for variables' names.\nTo ignore the names' length, specify **0**.\n\n\nTo learn more about regular expressions, refer to the [Quick Start guide (regular-expressions.info)](https://www.regular-expressions.info/quickstart.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpVariableNamingConventionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Naming conventions", + "index": 4, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPassByRefInspection", + "shortDescription": { + "text": "Pass parameter by reference" + }, + "fullDescription": { + "text": "Reports the arguments in a function/method call that cannot be passed by reference. Only variables and references returned from functions can be passed by reference. See Passing by Reference (php.net) for details.", + "markdown": "Reports the arguments in a function/method call that cannot be passed by reference.\n\n\nOnly variables and references returned from functions can be passed by reference. See [Passing by Reference (php.net)](https://www.php.net/manual/en/language.references.pass.php#language.references.pass) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpPassByRefInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpWrongStringConcatenationInspection", + "shortDescription": { + "text": "Wrong string concatenation" + }, + "fullDescription": { + "text": "Reports the attempts to concatenate strings by using the '+' operator instead of the dot ('.') concatenation operator. Such attempts are most likely a programming mistake.", + "markdown": "Reports the attempts to concatenate strings by using the `+` operator instead of the dot (`.`) concatenation operator. Such attempts are most likely a programming mistake." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpWrongStringConcatenationInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNonCanonicalElementsOrderInspection", + "shortDescription": { + "text": "Non-canonical order of elements" + }, + "fullDescription": { + "text": "Reports the PHPDoc tags that have elements listed in non-canonical order. For example, for such tags as '@property', '@param', or '@var', the inspection will report the usages of '[name] [\"Type\"]' instead of '[\"Type\"] [name]'.", + "markdown": "Reports the PHPDoc tags that have elements listed in non-canonical order.\n\nFor example, for such tags as `@property`, `@param`, or `@var`, the inspection will report the usages of `[name] [\"Type\"]` instead of `[\"Type\"] [name]`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpNonCanonicalElementsOrderInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc/Code style", + "index": 11, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryLocalVariableInspection", + "shortDescription": { + "text": "Unnecessary local variable" + }, + "fullDescription": { + "text": "Reports the local variables that are used in exit statements, such as 'throw', 'return', or 'yield', immediately after assignment.", + "markdown": "Reports the local variables that are used in exit statements, such as `throw`, `return`, or `yield`, immediately after assignment." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryLocalVariableInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpAbstractStaticMethodInspection", + "shortDescription": { + "text": "Static function should not be abstract" + }, + "fullDescription": { + "text": "Reports the static methods that are declared as abstract.", + "markdown": "Reports the static methods that are declared as abstract." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpAbstractStaticMethodInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHP strict standards", + "index": 67, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpTooLongMemberReferenceChainInspection", + "shortDescription": { + "text": "Member reference chain is too long to analyze" + }, + "fullDescription": { + "text": "Reports method reference chains that are too long for IDE to analyze.", + "markdown": "Reports method reference chains that are too long for IDE to analyze." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpTooLongMemberReferenceChainInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpInArrayCanBeReplacedWithComparisonInspection", + "shortDescription": { + "text": "'in_array' can be replaced with comparison" + }, + "fullDescription": { + "text": "Reports the 'in_array()' calls that are provided with a single-element array as the '$haystack' argument. Such calls can be replaced with direct comparisons. See in_array (php.net) for details.", + "markdown": "Reports the `in_array()` calls that are provided with a single-element array as the `$haystack` argument. Such calls can be replaced with direct comparisons.\n\n\nSee [in_array (php.net)](https://www.php.net/manual/en/function.in-array.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpInArrayCanBeReplacedWithComparisonInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantTypeInUnionTypeInspection", + "shortDescription": { + "text": "Type declaration is redundant and could be simplified" + }, + "fullDescription": { + "text": "Reports union type declarations that contain redundant types, for example, a union type that contains both the class alias and the original class. See Union Types RFC: Duplicate and redundant types (php.net) for details.", + "markdown": "Reports union type declarations that contain redundant types, for example, a union type that contains both the class alias and the original class.\n\n\nSee [Union Types RFC: Duplicate and redundant types (php.net)](https://wiki.php.net/rfc/union_types_v2#duplicate_and_redundant_types) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantTypeInUnionTypeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIllegalStringOffsetInspection", + "shortDescription": { + "text": "Illegal string offset" + }, + "fullDescription": { + "text": "Reports the usages of non-'integer' offsets in string access expressions such as '$str[42]'. Starting from PHP 5.4, string offsets have to be either integers or integer-like strings. Since it's considered bad practice to use strings as a string offset, the inspection reports them, as well. See String access and modification by character (php.net) for details.", + "markdown": "Reports the usages of non-`integer` offsets in string access expressions such as `$str[42]`.\n\n\nStarting from PHP 5.4, string offsets have to be either integers or integer-like strings.\nSince it's considered bad practice to use strings as a string offset, the inspection reports them, as well.\n\nSee [String access and modification by character (php.net)](https://www.php.net/manual/en/language.types.string.php#language.types.string.substr) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpIllegalStringOffsetInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpModuloByOneInspection", + "shortDescription": { + "text": "Modulo operation with '1' as operand" + }, + "fullDescription": { + "text": "Reports the modulo expressions '%' that always evaluate to '0' or '1'.", + "markdown": "Reports the modulo expressions `%` that always evaluate to `0` or `1`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpModuloByOneInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantAssignmentToPromotedFieldInspection", + "shortDescription": { + "text": "Redundant assignment to promoted property" + }, + "fullDescription": { + "text": "Reports redundant assignments to class properties that duplicate automatic assignments performed through promoted constructor parameters. See Constructor Property Promotion (php.net) for details.", + "markdown": "Reports redundant assignments to class properties that duplicate automatic assignments performed through promoted constructor parameters.\n\n\nSee [Constructor Property Promotion (php.net)](https://wiki.php.net/rfc/constructor_promotion) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantAssignmentToPromotedFieldInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayPushWithOneElementInspection", + "shortDescription": { + "text": "'array_push()' with single element" + }, + "fullDescription": { + "text": "Reports the 'array_push()' calls that are used to add a single element to an array. In such cases, it is recommended to use '$array[] =' instead, which adds no overhead of calling a function. See array_push (php.net) for details.", + "markdown": "Reports the `array_push()` calls that are used to add a single element to an array. In such cases, it is recommended to use `$array[] =` instead, which adds no overhead of calling a function.\n\n\nSee [array_push (php.net)](https://www.php.net/manual/en/function.array-push.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayPushWithOneElementInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMatchExpressionWithOnlyDefaultArmInspection", + "shortDescription": { + "text": "'match' expression has only default arm and should be simplified" + }, + "fullDescription": { + "text": "Reports the 'match' expressions only containing a 'default' arm. Such expressions are redundant and should be simplified. See Match expression (php.net) for details.", + "markdown": "Reports the `match` expressions only containing a `default` arm. Such expressions are redundant and should be simplified.\n\n\nSee [Match expression (php.net)](https://wiki.php.net/rfc/match_expression_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpMatchExpressionWithOnlyDefaultArmInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNModifierCanBeReplacedWithNonCapturingGroupInspection", + "shortDescription": { + "text": "'n' modifier can be replaced with non-capturing groups" + }, + "fullDescription": { + "text": "Reports 'n' PCRE modifier, that can be replaced with usage of non-capturing groups instead of capturing in regexp pattern.", + "markdown": "Reports `n` PCRE modifier, that can be replaced with usage of non-capturing groups instead of capturing in regexp pattern." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpNModifierCanBeReplacedWithNonCapturingGroupInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantOptionalArgumentInspection", + "shortDescription": { + "text": "Redundant optional argument" + }, + "fullDescription": { + "text": "Reports redundant arguments that match the corresponding default values for optional parameters.", + "markdown": "Reports redundant arguments that match the corresponding default values for optional parameters." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantOptionalArgumentInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantReadonlyModifierInspection", + "shortDescription": { + "text": "'readonly' modifier is redundant" + }, + "fullDescription": { + "text": "Reports 'readonly' modifiers applied to properties in read-only classes. Those modifiers are redundant since all properties in read-only classes are implicitly read-only. See Readonly classes RFC (php.net) for details.", + "markdown": "Reports `readonly` modifiers applied to properties in read-only classes. Those modifiers are redundant since all properties in read-only classes are implicitly read-only.\n\n\nSee [Readonly classes RFC (php.net)](https://wiki.php.net/rfc/readonly_classes#proposal) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantReadonlyModifierInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessarySpreadOperatorForFunctionCallArgumentInspection", + "shortDescription": { + "text": "Unnecessary spread operator for function call argument" + }, + "fullDescription": { + "text": "Reports the usages of the spread operator ('...') on array literals in function call arguments that may be safely unwrapped.", + "markdown": "Reports the usages of the spread operator (`...`) on array literals in function call arguments that may be safely unwrapped." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessarySpreadOperatorForFunctionCallArgumentInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpStrictComparisonWithOperandsOfDifferentTypesInspection", + "shortDescription": { + "text": "Strict comparison of operands with incompatible types" + }, + "fullDescription": { + "text": "Reports the '===' or '!==' strict comparisons used on operands with incompatible types. See PHP type comparison tables (php.net) for details.", + "markdown": "Reports the `===` or `!==` strict comparisons used on operands with incompatible types.\n\n\nSee [PHP type comparison tables (php.net)](https://www.php.net/manual/en/types.comparisons.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpStrictComparisonWithOperandsOfDifferentTypesInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpExpectedValuesShouldBeUsedInspection", + "shortDescription": { + "text": "Expected values should be used" + }, + "fullDescription": { + "text": "Reports the values in assignment and comparison expressions that should be replaced with one of the expected values (that is, the values specified via the '#[ExpectedValues]' attribute). See Attributes (php.net) for details.", + "markdown": "Reports the values in assignment and comparison expressions that should be replaced with one of the expected values (that is, the values specified via the `#[ExpectedValues]` attribute).\n\n\nSee [Attributes (php.net)](https://wiki.php.net/rfc/attributes_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpExpectedValuesShouldBeUsedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNonCompoundUseInspection", + "shortDescription": { + "text": "Unnecessary statement use" + }, + "fullDescription": { + "text": "Reports the 'use' statements that contain non-fully qualified class names and thus have no effect. The inspection only reports classes imports; functions and constants imports are not considered. See Using namespaces: Aliasing/Importing (php.net) for details.", + "markdown": "Reports the `use` statements that contain non-fully qualified class names and thus have no effect. The inspection only reports classes imports; functions and constants imports are not considered.\n\n\nSee [Using namespaces: Aliasing/Importing (php.net)](http://www.php.net/manual/en/language.namespaces.importing.php#language.namespaces.importing) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpNonCompoundUseInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpInvalidInstanceofInspection", + "shortDescription": { + "text": "Argument of 'instanceof' should be only objects or strings" + }, + "fullDescription": { + "text": "Reports arguments of 'instanceof' that are not objects or strings", + "markdown": "Reports arguments of 'instanceof' that are not objects or strings" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpInvalidInstanceofInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MessDetectorValidationInspection", + "shortDescription": { + "text": "PHP Mess Detector validation" + }, + "fullDescription": { + "text": "Reports coding style problems detected by PHP Mess Detector. The inspection requires PHP Mess Detector to be properly installed and set up in the IDE under Settings | PHP | Quality Tools | Mess Detector. To learn more about installing PHP Mess Detector, see PHP Mess Detector installation (phpmd.org) for details. You can use a predefined set of rules or add your own by specifying valid ruleset.xml files. See the rules index (phpmd.org) and How to create a custom rule set (phpmd.org) for details.", + "markdown": "Reports coding style problems detected by PHP Mess Detector.\n\n\nThe inspection requires PHP Mess Detector to be properly installed and set up in the IDE under\n[Settings \\| PHP \\| Quality Tools \\| Mess Detector](settings://settings.php.quality.tools?Mess%20Detector).\n\n\nTo learn more about installing PHP Mess Detector, see [PHP Mess Detector installation (phpmd.org)](https://phpmd.org/download/index.html) for details.\n\n\nYou can use a predefined set of rules or add your own by specifying valid *ruleset.xml* files. See the [rules index (phpmd.org)](https://phpmd.org/rules/index.html) and [How to create a custom rule set (phpmd.org)](https://phpmd.org/documentation/creating-a-ruleset.html) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "MessDetectorValidationInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Quality tools", + "index": 70, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDeprecationInspection", + "shortDescription": { + "text": "Deprecated" + }, + "fullDescription": { + "text": "Reports the usages of deprecated entities. In most cases, such usages should be removed or replaced with other constructs.", + "markdown": "Reports the usages of deprecated entities.\n\n\nIn most cases, such usages should be removed or replaced with other constructs." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDeprecationInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDeprecatedCastInspection", + "shortDescription": { + "text": "Deprecated cast" + }, + "fullDescription": { + "text": "Reports deprecated cast expressions: '(unset)' cast expressions, which are deprecated in PHP 7.2 and later. '(real)' cast expressions, which are deprecated in PHP 7.4 and later. See Deprecated features in PHP 7.2.x (php.net) and Deprecations for PHP 7.4 (php.net) for details.", + "markdown": "Reports deprecated cast expressions:\n\n* `(unset)` cast expressions, which are deprecated in PHP 7.2 and later.\n* `(real)` cast expressions, which are deprecated in PHP 7.4 and later.\n\n\nSee [Deprecated features in PHP 7.2.x (php.net)](https://www.php.net/manual/en/migration72.deprecated.php#migration72.deprecated.unset-cast) and [Deprecations for PHP 7.4 (php.net)](https://wiki.php.net/rfc/deprecations_php_7_4#the_real_type) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDeprecatedCastInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitAssertEqualsInspection", + "shortDescription": { + "text": "Deprecated 'assertEquals/assertNotEquals' usage" + }, + "fullDescription": { + "text": "Reports deprecated usages of the 'assertEquals' and 'assertNotEquals' functions with '$delta', '$maxDepth', '$canonicalize', and '$ignoreCase' parameters. The optional '$delta', '$maxDepth', '$canonicalize', and '$ignoreCase' parameters of the 'assertEquals' and 'assertNotEquals' functions are deprecated and will be removed in PHPUnit 9. See Usage of the assertEquals function (phpunit.readthedocs.io) for details.", + "markdown": "Reports deprecated usages of the `assertEquals` and `assertNotEquals` functions with `$delta`, `$maxDepth`, `$canonicalize`, and `$ignoreCase` parameters.\n\nThe optional `$delta`, `$maxDepth`, `$canonicalize`, and `$ignoreCase` parameters\nof the `assertEquals` and `assertNotEquals` functions are deprecated and will be removed in PHPUnit 9.\n\n\nSee [Usage of the assertEquals function (phpunit.readthedocs.io)](https://phpunit.readthedocs.io/en/stable/assertions.html#assertequals) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitAssertEqualsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNestedDirNameCallsCanBeReplacedWithLevelParameterInspection", + "shortDescription": { + "text": "Nested 'dirname()' call can be replaced with 'levels' parameter usage" + }, + "fullDescription": { + "text": "Reports the nested 'dirname()' calls that can be omitted by using the 'levels' parameter instead.", + "markdown": "Reports the nested `dirname()` calls that can be omitted by using the `levels` parameter instead." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpNestedDirNameCallsCanBeReplacedWithLevelParameterInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFieldImmediatelyRewrittenInspection", + "shortDescription": { + "text": "Property is immediately rewritten " + }, + "fullDescription": { + "text": "Reports the write expressions on properties which are immediately overwritten before being accessed.", + "markdown": "Reports the write expressions on properties which are immediately overwritten before being accessed." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpFieldImmediatelyRewrittenInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpExpressionWithoutClarifyingParenthesesInspection", + "shortDescription": { + "text": "Expression without clarifying parentheses" + }, + "fullDescription": { + "text": "Reports potentially ambiguous expressions and proposes enclosing them in clarifying parentheses.", + "markdown": "Reports potentially ambiguous expressions and proposes enclosing them in clarifying parentheses." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpExpressionWithoutClarifyingParenthesesInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantAttributeParenthesisInspection", + "shortDescription": { + "text": "Redundant parentheses in attribute" + }, + "fullDescription": { + "text": "Reports empty arguments lists in attributes. See Attributes (php.net) for details.", + "markdown": "Reports empty arguments lists in attributes.\n\n\nSee [Attributes (php.net)](https://wiki.php.net/rfc/attributes_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantAttributeParenthesisInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpParameterNameChangedDuringInheritanceInspection", + "shortDescription": { + "text": "Parameter's name changed during inheritance" + }, + "fullDescription": { + "text": "Reports the methods' parameters whose names differ from the same parameters defined in parent methods. Starting with PHP 8.0, such code can cause runtime errors.", + "markdown": "Reports the methods' parameters whose names differ from the same parameters defined in parent methods. Starting with PHP 8.0, such code can cause runtime errors." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpParameterNameChangedDuringInheritanceInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpTraitsUseListInspection", + "shortDescription": { + "text": "One-per-line trait uses" + }, + "fullDescription": { + "text": "Reports the cases of several traits being imported via a single 'use' statement. According to PSR-12, each individual trait imported into a class MUST be included one-per-line, and each inclusion MUST have its own 'use' import statement. See PSR-12: Extended Coding Style (php-fig.org) for details.", + "markdown": "Reports the cases of several traits being imported via a single `use` statement.\n\n\nAccording to PSR-12, each individual trait imported into a class MUST be included one-per-line, and each inclusion MUST have its own `use` import statement.\n\n\nSee [PSR-12: Extended Coding Style (php-fig.org)](https://www.php-fig.org/psr/psr-12/#42-using-traits) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpTraitsUseListInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style/PSR-12", + "index": 61, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDisabledQualityToolComposerInspection", + "shortDescription": { + "text": "Quality tool inspection is disabled" + }, + "fullDescription": { + "text": "Highlights the quality tools' entries in composer.json in case the corresponding code inspections are disabled.", + "markdown": "Highlights the quality tools' entries in *composer.json* in case the corresponding code inspections are disabled." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDisabledQualityToolComposerInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Composer", + "index": 38, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpConcatenationWithEmptyStringCanBeInlinedInspection", + "shortDescription": { + "text": "Concatenation to empty string can be merged with assignment" + }, + "fullDescription": { + "text": "Reports the '.=' concatenation assignments performed right after assignment to an empty string literal. Such assignments can be merged together.", + "markdown": "Reports the `.=` concatenation assignments performed right after assignment to an empty string literal. Such assignments can be merged together." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpConcatenationWithEmptyStringCanBeInlinedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayIndexResetIsUnnecessaryInspection", + "shortDescription": { + "text": "Array internal pointer reset is unnecessary" + }, + "fullDescription": { + "text": "Reports the 'reset($array)' calls on arrays whose internal pointer is already set on the first element. Such calls are redundant and can be safely removed. See reset (php.net) for details.", + "markdown": "Reports the `reset($array)` calls on arrays whose internal pointer is already set on the first element. Such calls are redundant and can be safely removed.\n\n\nSee [reset (php.net)](https://www.php.net/manual/en/function.reset.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayIndexResetIsUnnecessaryInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNamedArgumentUsageInspection", + "shortDescription": { + "text": "Argument with name identifier" + }, + "fullDescription": { + "text": "Reports arguments with name identifiers.", + "markdown": "Reports arguments with name identifiers." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpNamedArgumentUsageInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnusedFieldDefaultValueInspection", + "shortDescription": { + "text": "Redundant property initializer" + }, + "fullDescription": { + "text": "Reports the fields with default initializers that are always overwritten in the class constructor.", + "markdown": "Reports the fields with default initializers that are always overwritten in the class constructor." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnusedFieldDefaultValueInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Unused symbols", + "index": 37, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpApplyingEmptyIndexOperatorOnStringInspection", + "shortDescription": { + "text": "Empty index operator not supported for strings" + }, + "fullDescription": { + "text": "Reports the usages of empty index operator ('[]') on strings. Starting from PHP 7.1, applying the empty index operator on a string throws a fatal error. See Creating/modifying with square bracket syntax (php.net) for details.", + "markdown": "Reports the usages of empty index operator (`[]`) on strings.\n\n\nStarting from PHP 7.1, applying the empty index operator on a string throws a fatal error.\n\nSee [Creating/modifying with square bracket syntax (php.net)](https://www.php.net/manual/en/language.types.array.php#language.types.array.syntax.modifying) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpApplyingEmptyIndexOperatorOnStringInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpTraitUseRuleInsideDifferentClassUseListInspection", + "shortDescription": { + "text": "Trait use rule resolved to method with different containing class " + }, + "fullDescription": { + "text": "Reports the trait method 'use' rules that are resolved to methods from a different containing class rather than the one specified in the 'use' declaration.", + "markdown": "Reports the trait method `use` rules that are resolved to methods from a different containing class rather than the one specified in the `use` declaration." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpTraitUseRuleInsideDifferentClassUseListInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitAssertArrayHasKeyInspection", + "shortDescription": { + "text": "Method 'assertArrayHasKey/assertArrayNotHasKey' can be used instead" + }, + "fullDescription": { + "text": "Reports the 'assertTrue()' and 'assertNotTrue()' methods calls that are provided with an 'array_key_exists()' call as an argument. Such calls can be replaced with calls to the dedicated 'assertArrayHasKey()' method. See assertArrayHasKey (phpunit.readthedocs.io) for details.", + "markdown": "Reports the `assertTrue()` and `assertNotTrue()` methods calls that are provided with an `array_key_exists()` call as an argument. Such calls can be replaced with calls to the dedicated `assertArrayHasKey()` method.\n\n\nSee [assertArrayHasKey (phpunit.readthedocs.io)](https://phpunit.readthedocs.io/en/stable/assertions.html#assertarrayhaskey) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitAssertArrayHasKeyInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpObjectFieldsAreOnlyWrittenInspection", + "shortDescription": { + "text": "Local object is used only for writing properties" + }, + "fullDescription": { + "text": "Reports the variable assignments to new objects that are used only for writing the object's properties without observable side effects.", + "markdown": "Reports the variable assignments to new objects that are used only for writing the object's properties without observable side effects." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpObjectFieldsAreOnlyWrittenInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryStaticReferenceInspection", + "shortDescription": { + "text": "Redundant 'static' in final class" + }, + "fullDescription": { + "text": "Reports 'static' usages inside final class", + "markdown": "Reports `static` usages inside final class" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryStaticReferenceInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDynamicFieldDeclarationInspection", + "shortDescription": { + "text": "Dynamic property declaration" + }, + "fullDescription": { + "text": "Reports the references to dynamic class properties declarations. Such declaration are deprecated starting from PHP 8.2 The inspection skips the objects of the 'stdClass' or derived types.", + "markdown": "Reports the references to dynamic class properties declarations. Such declaration are deprecated starting from PHP 8.2\n\n\nThe inspection skips the objects of the `stdClass` or derived types." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDynamicFieldDeclarationInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDocSignatureInspection", + "shortDescription": { + "text": "PHPDoc comment matches function/method signature" + }, + "fullDescription": { + "text": "Reports the parameters' names and types in a PHPDoc comment that do not match the ones in the function/method declaration.", + "markdown": "Reports the parameters' names and types in a PHPDoc comment that do not match the ones in the function/method declaration." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDocSignatureInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMultipleClassesDeclarationsInOneFile", + "shortDescription": { + "text": "Multiple classes declarations in one file" + }, + "fullDescription": { + "text": "Reports multiple class declarations in a single file, which violates the PSR-0/PSR-4 standards. See PSR-0/PSR-4 standards (php-fig.org) for details.", + "markdown": "Reports multiple class declarations in a single file, which violates the PSR-0/PSR-4 standards.\n\n\nSee [PSR-0/PSR-4 standards (php-fig.org)](https://www.php-fig.org/psr/psr-4/) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpMultipleClassesDeclarationsInOneFile", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayWriteIsNotUsedInspection", + "shortDescription": { + "text": "Array write access is not used" + }, + "fullDescription": { + "text": "Reports the array write access expressions that are not used in code afterwards. The most common source of such problems is modifying an array passed via a parameter: if an array is passed by value, the change will not be visible outside the function.", + "markdown": "Reports the array write access expressions that are not used in code afterwards. The most common source of such problems is modifying an array passed via a parameter: if an array is passed by value, the change will not be visible outside the function." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayWriteIsNotUsedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpReturnValueOfMethodIsNeverUsedInspection", + "shortDescription": { + "text": "Method's return value is never used" + }, + "fullDescription": { + "text": "Reports the private methods returning the values that are not used.", + "markdown": "Reports the private methods returning the values that are not used." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpReturnValueOfMethodIsNeverUsedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpClassCantBeUsedAsAttributeInspection", + "shortDescription": { + "text": "Class cannot be used as attribute" + }, + "fullDescription": { + "text": "Reports the attributes that are resolved to a class not annotated with '#[Attribute]'. See Attributes (php.net) for details.", + "markdown": "Reports the attributes that are resolved to a class not annotated with `#[Attribute]`.\n\n\nSee [Attributes (php.net)](https://wiki.php.net/rfc/attributes_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpClassCantBeUsedAsAttributeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitAssertFileEqualsInspection", + "shortDescription": { + "text": "Deprecated 'assertFileEquals/assertStringEqualsFile' usage" + }, + "fullDescription": { + "text": "Reports the deprecated usages of the 'assertFileEquals', 'assertFileNotEquals', 'assertStringEqualsFile', and 'assertStringNotEqualsFile' functions with the '$canonicalize' and '$ignoreCase' parameters. The optional '$canonicalize' and '$ignoreCase' parameters of the 'assertFileEquals' and 'assertFileNotEquals' functions are deprecated and will be removed in PHPUnit 9. See Usage of the assertFileEquals function (phpunit.readthedocs.io) or Usage of the assertFileEquals function (phpunit.readthedocs.io) for details.", + "markdown": "Reports the deprecated usages of the `assertFileEquals`, `assertFileNotEquals`, `assertStringEqualsFile`, and `assertStringNotEqualsFile` functions with the `$canonicalize` and `$ignoreCase` parameters.\n\nThe optional `$canonicalize` and `$ignoreCase` parameters\nof the `assertFileEquals` and `assertFileNotEquals` functions are deprecated and will be removed in PHPUnit 9.\n\n\nSee [Usage of the assertFileEquals function (phpunit.readthedocs.io)](https://phpunit.readthedocs.io/en/stable/assertions.html#assertfileequals) or [Usage of the assertFileEquals function (phpunit.readthedocs.io)](https://phpunit.readthedocs.io/en/stable/assertions.html#assertstringequalsfile) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitAssertFileEqualsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpVariableVariableInspection", + "shortDescription": { + "text": "Usage of a variable variable" + }, + "fullDescription": { + "text": "Reports the usages of variable variables (dynamic variable names such as '$$a').", + "markdown": "Reports the usages of variable variables (dynamic variable names such as `$$a`)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpVariableVariableInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDeprecatedSerializableUsageInspection", + "shortDescription": { + "text": "Deprecated 'Serializable' interface usage" + }, + "fullDescription": { + "text": "Reports the usages of deprecated 'Serializable' interface. Starting from PHP 8.1, classes that are non-abstract, implement 'Serializable', and do not implement '__serialize()' and '__unserialize()' will throw a deprecation warning. See Phasing out Serializable (php.net) for details.", + "markdown": "Reports the usages of deprecated `Serializable` interface.\n\n\nStarting from PHP 8.1, classes that are non-abstract, implement `Serializable`, and do not implement `__serialize()`\nand `__unserialize()` will throw a deprecation warning.\n\n\nSee [Phasing out Serializable (php.net)](https://wiki.php.net/rfc/custom_object_serialization) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDeprecatedSerializableUsageInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUndefinedCallbackInspection", + "shortDescription": { + "text": "Undefined callback" + }, + "fullDescription": { + "text": "Reports the functions, methods, properties, or classes that are referenced from a callback but are not found. Use the options below to customize the inspection: Ignore callback from *_exists and is_callable functions: if selected, the inspection will skip callback references from the 'method_exists', 'function_exists', 'property_exists', 'class_exists' and 'is_callable' functions. Don't report in case of ambiguity: if selected, the inspection will skip the parameters with multiple possible types, for example marked as 'callable|string'.", + "markdown": "Reports the functions, methods, properties, or classes that are referenced from a callback but are not found.\n\nUse the options below to customize the inspection:\n\n* **Ignore callback from \\*_exists and is_callable functions** : if selected, the inspection will skip callback references from the `method_exists`, `function_exists`, `property_exists`, `class_exists` and `is_callable` functions.\n* **Don't report in case of ambiguity** : if selected, the inspection will skip the parameters with multiple possible types, for example marked as `callable|string`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUndefinedCallbackInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpLoopCanBeConvertedToArrayMapInspection", + "shortDescription": { + "text": "Loop can be converted to 'array_map()' call" + }, + "fullDescription": { + "text": "Reports the 'foreach' loops that can be replaced with 'array_map()' calls.", + "markdown": "Reports the `foreach` loops that can be replaced with `array_map()` calls." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpLoopCanBeConvertedToArrayMapInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpOptionalBeforeRequiredParametersInspection", + "shortDescription": { + "text": "Optional before required parameter" + }, + "fullDescription": { + "text": "Reports the optional parameters that appear before the required parameters in a function/method declaration. See Default argument values (php.net) for details.", + "markdown": "Reports the optional parameters that appear before the required parameters in a function/method declaration.\n\n\nSee [Default argument values (php.net)](http://www.php.net/manual/en/functions.arguments.php#functions.arguments.default) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpOptionalBeforeRequiredParametersInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDocRedundantThrowsInspection", + "shortDescription": { + "text": "Redundant @throws tag(s)" + }, + "fullDescription": { + "text": "Reports '@throws' tags for exceptions that are not thrown by the function or method. The exception classes added to the Unchecked Exceptions list under Settings | PHP | Analysis are excluded from the inspection scope.", + "markdown": "Reports `@throws` tags for exceptions that are not thrown by the function or method.\n\nThe exception classes added to the **Unchecked Exceptions** list under\n[Settings \\| PHP \\| Analysis](settings://reference.webide.settings.project.settings.php?Unchecked%20Exceptions)\nare excluded from the inspection scope." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDocRedundantThrowsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpStrFunctionsInspection", + "shortDescription": { + "text": "'str*()' calls can be replaced with PHP 8 'str_*()' calls" + }, + "fullDescription": { + "text": "Reports the 'strpos' and 'substr' functions calls that can be replaced with the 'str_*' functions calls (introduced in PHP 8.0). See str_contains (php.net) and str_starts_with and str_ends_with functions (php.net) for details.", + "markdown": "Reports the `strpos` and `substr` functions calls that can be replaced with the `str_*` functions calls (introduced in PHP 8.0).\n\n\nSee [str_contains (php.net)](https://wiki.php.net/rfc/str_contains) and [str_starts_with and str_ends_with functions (php.net)](https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpStrFunctionsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessarySemicolonInspection", + "shortDescription": { + "text": "Unnecessary semicolon" + }, + "fullDescription": { + "text": "Reports unnecessary semicolons.", + "markdown": "Reports unnecessary semicolons." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessarySemicolonInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayMapCanBeConvertedToLoopInspection", + "shortDescription": { + "text": "'array_map()' call can be converted to loop" + }, + "fullDescription": { + "text": "Reports the 'array_map()' calls that can be replaced with 'foreach' loops.", + "markdown": "Reports the `array_map()` calls that can be replaced with `foreach` loops." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayMapCanBeConvertedToLoopInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpCSValidationInspection", + "shortDescription": { + "text": "PHP_CodeSniffer validation" + }, + "fullDescription": { + "text": "Reports coding style problems detected by PHP_CodeSniffer. The inspection requires PHP_CodeSniffer to be properly installed and set up in the IDE under Settings | PHP | Quality Tools | PHP_CodeSniffer. To learn more about installing PHP_CodeSniffer, see PHP_CodeSniffer installation (GitHub).", + "markdown": "Reports coding style problems detected by PHP_CodeSniffer.\n\n\nThe inspection requires PHP_CodeSniffer to be properly installed and set up in the IDE under\n[Settings \\| PHP \\| Quality Tools \\| PHP_CodeSniffer](settings://settings.php.quality.tools?PHP_CodeSniffer).\n\n\nTo learn more about installing PHP_CodeSniffer, see [PHP_CodeSniffer installation (GitHub)](https://github.com/squizlabs/PHP_CodeSniffer#installation)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpCSValidationInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Quality tools", + "index": 70, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryStringCastInspection", + "shortDescription": { + "text": "Redundant cast to string" + }, + "fullDescription": { + "text": "Reports the '(string)' casts and 'strval()' calls that are redundant since casting to string is performed implicitly.", + "markdown": "Reports the `(string)` casts and `strval()` calls that are redundant since casting to string is performed implicitly." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryStringCastInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNullIsNotCompatibleWithParameterInspection", + "shortDescription": { + "text": "'null' is not compatible with parameter's declared type" + }, + "fullDescription": { + "text": "Reports the variables that are initialised via passing them by reference to a parameter incompatible with 'null'.", + "markdown": "Reports the variables that are initialised via passing them by reference to a parameter incompatible with `null`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpNullIsNotCompatibleWithParameterInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPregReplaceWithEmptyReplacementInspection", + "shortDescription": { + "text": "'preg_replace()' can be replaced with '(l|r)trim' call" + }, + "fullDescription": { + "text": "Reports the 'preg_replace()' calls with empty 'replacement'. Such calls can be replaced with '(l|r)trim' calls.", + "markdown": "Reports the `preg_replace()` calls with empty `replacement`. Such calls can be replaced with `(l|r)trim` calls." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPregReplaceWithEmptyReplacementInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantClosingTagInspection", + "shortDescription": { + "text": "Redundant closing tag" + }, + "fullDescription": { + "text": "Reports PHP closing tag '?>' usages, which are redundant in files containing only PHP code.", + "markdown": "Reports PHP closing tag `?>` usages, which are redundant in files containing only PHP code." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantClosingTagInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryStopStatementInspection", + "shortDescription": { + "text": "Unnecessary 'return/continue' statement" + }, + "fullDescription": { + "text": "Reports unnecessary 'return' and 'continue' statements that can be safely removed.", + "markdown": "Reports unnecessary `return` and `continue` statements that can be safely removed." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryStopStatementInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDeprecatedAutoloadDeclarationInspection", + "shortDescription": { + "text": "Deprecated '__autoload()' function declaration" + }, + "fullDescription": { + "text": "Reports the '__autoload()' function declarations. Starting from PHP 7.4, declaring '__autoload()' functions is deprecated. Starting from PHP 8.0, declaring '__autoload()' functions is forbidden. See __autoload (php.net) for details.", + "markdown": "Reports the `__autoload()` function declarations.\n\n* Starting from PHP 7.4, declaring `__autoload()` functions is deprecated.\n* Starting from PHP 8.0, declaring `__autoload()` functions is forbidden.\n\n\nSee [__autoload (php.net)](https://www.php.net/manual/en/function.autoload.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDeprecatedAutoloadDeclarationInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpExpressionWithSameOperandsInspection", + "shortDescription": { + "text": "Logical expression has same operands" + }, + "fullDescription": { + "text": "Reports the expressions that use the same operands, but should rather use different operands (for example, '$var == $var'). These include comparison, logical, null-coalescing, subtraction, and division expressions.", + "markdown": "Reports the expressions that use the same operands, but should rather use different operands (for example, `$var == $var`). These include comparison, logical, null-coalescing, subtraction, and division expressions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpExpressionWithSameOperandsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArithmeticTypeCheckInspection", + "shortDescription": { + "text": "Arithmetic operation with unsupported operands" + }, + "fullDescription": { + "text": "Reports arithmetic and bitwise expressions with unsupported operands. Starting with PHP 8.0, using the arithmetic and bitwise operators '+', '-', '*', '/', '**', '%', '<<', '>>', '&', '|', '^', '~', '++', '--' when one of the operands is an array, resource, or non-overloaded object will result in a 'TypeError'. The only exception is the 'array + array' merge operation, which remains supported. See PHP's internal test source for the complete list of operations.", + "markdown": "Reports arithmetic and bitwise expressions with unsupported operands.\n\n\nStarting with PHP 8.0, using the arithmetic and bitwise operators `+`, `-`, `*`, `/`, `**`, `%`, `<<`, `>>`, `&`, `|`, `^`, `~`, `++`, `--`\nwhen one of the operands is an array, resource, or non-overloaded object will result in a `TypeError`. The only exception is the\n`array + array` merge operation, which remains supported.\n\n\nSee [PHP's internal test source](https://github.com/php/php-src/blob/master/Zend/tests/operator_unsupported_types.phpt) for the complete list of operations." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpArithmeticTypeCheckInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpConditionAlreadyCheckedInspection", + "shortDescription": { + "text": "Condition always evaluates to 'true/false'" + }, + "fullDescription": { + "text": "Reports the conditions that are already covered by earlier conditions and thus have no effect as well as the variables that are always true (or always false) when reached.", + "markdown": "Reports the conditions that are already covered by earlier conditions and thus have no effect as well as the variables that are always true (or always false) when reached." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpConditionAlreadyCheckedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantVariableDocTypeInspection", + "shortDescription": { + "text": "Redundant @var tag" + }, + "fullDescription": { + "text": "Reports the '@var' tags for variables whose type is already inferred from source code.", + "markdown": "Reports the `@var` tags for variables whose type is already inferred from source code." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantVariableDocTypeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMethodNamingConventionInspection", + "shortDescription": { + "text": "Method name is not following coding convention" + }, + "fullDescription": { + "text": "Reports the methods' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for methods. Use the inspection options to specify minimum/maximum length and the regular expression expected for methods' names. To ignore the names' length, specify 0. To learn more about regular expressions, refer to the Quick Start guide (regular-expressions.info).", + "markdown": "Reports the methods' names that are either too short, too long, or do not follow the specified regular expression pattern. Some coding styles have a special naming convention for methods.\n\n\nUse the inspection options to specify minimum/maximum length and the regular expression expected for methods' names.\nTo ignore the names' length, specify **0**.\n\n\nTo learn more about regular expressions, refer to the [Quick Start guide (regular-expressions.info)](https://www.regular-expressions.info/quickstart.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMethodNamingConventionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Naming conventions", + "index": 4, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpBooleanCanBeSimplifiedInspection", + "shortDescription": { + "text": "Boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports the boolean expressions that contain the 'true' or 'false' literals and can be simplified.", + "markdown": "Reports the boolean expressions that contain the `true` or `false` literals and can be simplified." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpBooleanCanBeSimplifiedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFuncGetArgCanBeReplacedWithParamInspection", + "shortDescription": { + "text": "'func_get_arg()' call can be replaced with parameter access" + }, + "fullDescription": { + "text": "Reports the 'func_get_arg()' calls that can be replaced with direct parameter access.", + "markdown": "Reports the `func_get_arg()` calls that can be replaced with direct parameter access." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpFuncGetArgCanBeReplacedWithParamInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitCoversByAccessModifierIsDeprecatedInspection", + "shortDescription": { + "text": "Deprecated @covers/@uses by access modifier annotation" + }, + "fullDescription": { + "text": "Reports the '@covers' and '@uses' PHPUnit doc tags that are using 'ClassName::<*>'. Such annotations won't be supported in PHPUnit 10 and later.", + "markdown": "Reports the `@covers` and `@uses` PHPUnit doc tags that are using `ClassName::<*>`. Such annotations won't be supported in PHPUnit 10 and later." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitCoversByAccessModifierIsDeprecatedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnusedPrivateMethodInspection", + "shortDescription": { + "text": "Unused private method" + }, + "fullDescription": { + "text": "Reports the private methods that are never used.", + "markdown": "Reports the private methods that are never used." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnusedPrivateMethodInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Unused symbols", + "index": 37, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpAssignmentReplaceableWithPrefixExpressionInspection", + "shortDescription": { + "text": "Assignment can be replaced with increment or decrement" + }, + "fullDescription": { + "text": "Reports the assignments that can be replaced with incrementing ('++') or decrementing ('--') operations.", + "markdown": "Reports the assignments that can be replaced with incrementing (`++`) or decrementing (`--`) operations." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpAssignmentReplaceableWithPrefixExpressionInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Replaceable assignments", + "index": 82, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRandArgumentsInReverseOrderInspection", + "shortDescription": { + "text": "Misordered 'rand' function arguments" + }, + "fullDescription": { + "text": "Reports the 'rand($min, $max)' family function calls in which the 'max' argument is less than 'min'. For such functions as 'mt_rand' and 'random_int', this will result in a fatal error.", + "markdown": "Reports the `rand($min, $max)` family function calls in which the `max` argument is less than `min`. For such functions as `mt_rand` and `random_int`, this will result in a fatal error." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpRandArgumentsInReverseOrderInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpAttributeIsNotRepeatableInspection", + "shortDescription": { + "text": "Non-repeatable attribute" + }, + "fullDescription": { + "text": "Reports repeated attributes without the 'Attribute::IS_REPEATABLE' flag in their arguments declaration. See Attributes (php.net) for details.", + "markdown": "Reports repeated attributes without the `Attribute::IS_REPEATABLE` flag in their arguments declaration.\n\n\nSee [Attributes (php.net)](https://wiki.php.net/rfc/attributes_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpAttributeIsNotRepeatableInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpObjectShapeCanBeAddedInspection", + "shortDescription": { + "text": "ObjectShape can be added" + }, + "fullDescription": { + "text": "Reports public properties of an object with specified types. Suggests specifying the shape of the returned object via the '#[ObjectShape]' attribute or an object shape in the PHPDoc comment. Example: '$a = new stdClass();\n $a->name = \"name\";\n $a->age = 2;' After the quick-fix is applied: '/** @var $a object{name: string, age: int} */\n $a = new stdClass();\n $a->name = \"name\";\n $a->age = 2;'", + "markdown": "Reports public properties of an object with specified types. Suggests specifying the shape of the returned object via the `#[ObjectShape]` attribute or an object shape in the PHPDoc comment.\n\n**Example:**\n\n\n $a = new stdClass();\n $a->name = \"name\";\n $a->age = 2;\n\nAfter the quick-fix is applied:\n\n\n /** @var $a object{name: string, age: int} */\n $a = new stdClass();\n $a->name = \"name\";\n $a->age = 2;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpObjectShapeCanBeAddedInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpInvalidMagicMethodModifiersInspection", + "shortDescription": { + "text": "Invalid magic method modifiers" + }, + "fullDescription": { + "text": "Reports the magic methods that are not declared as public or are declared as static.", + "markdown": "Reports the magic methods that are not declared as public or are declared as static." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpInvalidMagicMethodModifiersInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpWrongCatchClausesOrderInspection", + "shortDescription": { + "text": "Wrong catch clauses order" + }, + "fullDescription": { + "text": "Reports the exceptions that are already caught by a preceding exception and the exceptions that are caught twice. The 'catch' clauses must be ordered from more specific to more generic ones. Otherwise, some exceptions may not be caught by the most specific handler. See Exceptions (php.net) for details.", + "markdown": "Reports the exceptions that are already caught by a preceding exception and the exceptions that are caught twice.\n\n\nThe `catch` clauses must be ordered from more specific to more generic ones. Otherwise, some exceptions may not be caught by the most specific handler.\n\n\nSee [Exceptions (php.net)](http://www.php.net/manual/en/language.exceptions.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpWrongCatchClausesOrderInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Error handling", + "index": 72, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpVarUsageInspection", + "shortDescription": { + "text": "Usage of var" + }, + "fullDescription": { + "text": "Reports the usages of the 'var' keyword for declaring class properties. According to PSR-12, the 'var' keyword MUST NOT be used to declare a property. See PSR-12: Extended Coding Style (php-fig.org) for details.", + "markdown": "Reports the usages of the `var` keyword for declaring class properties.\n\nAccording to PSR-12, the `var` keyword MUST NOT be used to declare a property.\n\n\nSee [PSR-12: Extended Coding Style (php-fig.org)](https://www.php-fig.org/psr/psr-12/#43-properties-and-constants) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpVarUsageInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style/PSR-12", + "index": 61, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPregSplitWithoutRegExpInspection", + "shortDescription": { + "text": "'preg_split' can be replaced with 'explode'" + }, + "fullDescription": { + "text": "Reports 'preg_split()' calls that can be replaced with 'explode()'.", + "markdown": "Reports `preg_split()` calls that can be replaced with `explode()`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPregSplitWithoutRegExpInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnpackingArraysWithStringKeysInspection", + "shortDescription": { + "text": "Unpacking arrays with string keys is forbidden for PHP < 8.1" + }, + "fullDescription": { + "text": "Reports array unpacking with string keys in PHP < 8.1 See Array unpacking with string keys for details.", + "markdown": "Reports array unpacking with string keys in PHP \\< 8.1\n\n\nSee [Array unpacking with string keys](https://wiki.php.net/rfc/array_unpacking_string_keys) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpUnpackingArraysWithStringKeysInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSillyAssignmentInspection", + "shortDescription": { + "text": "Redundant assignment" + }, + "fullDescription": { + "text": "Reports the assignment statements, in which both sides are equal. Such assignments have no effect and can be removed.", + "markdown": "Reports the assignment statements, in which both sides are equal. Such assignments have no effect and can be removed." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpSillyAssignmentInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFullyQualifiedNameUsageInspection", + "shortDescription": { + "text": "Fully qualified name usage" + }, + "fullDescription": { + "text": "Reports the fully qualified class names that can be shortened by adding the 'use' statement.", + "markdown": "Reports the fully qualified class names that can be shortened by adding the `use` statement." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpFullyQualifiedNameUsageInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSuspiciousNameCombinationInspection", + "shortDescription": { + "text": "Suspicious names combination" + }, + "fullDescription": { + "text": "Reports the assignments and function calls where the name of the variable or parameter probably doesn't match the name of the assigned or passed value. The following sets of names are supported: 'needle', 'haystack' 'x', 'y' 'top', 'bottom', 'left', 'right' 'year', 'month', 'week', 'day', 'hour', 'minute', 'second'", + "markdown": "Reports the assignments and function calls where the name of the variable or parameter probably doesn't match the name of the assigned or passed value.\n\n\nThe following sets of names are supported:\n\n* `needle`, `haystack`\n* `x`, `y`\n* `top`, `bottom`, `left`, `right`\n* `year`, `month`, `week`, `day`, `hour`, `minute`, `second`" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpSuspiciousNameCombinationInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRangesInClassCanBeMergedInspection", + "shortDescription": { + "text": "Ranges in class can be merged" + }, + "fullDescription": { + "text": "Reports the alphabetic ranges or characters in regular expression character classes that only adjust the already existing ranges. Such elements can be merged with the adjusted ranges.", + "markdown": "Reports the alphabetic ranges or characters in regular expression character classes that only adjust the already existing ranges. Such elements can be merged with the adjusted ranges." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRangesInClassCanBeMergedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Regular expressions", + "index": 68, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPossiblePolymorphicInvocationInspection", + "shortDescription": { + "text": "Possible polymorphic call" + }, + "fullDescription": { + "text": "Reports polymorphic code usages. Such usages are ambiguous and can be potentially inoperable depending on the class instance passed as the argument.", + "markdown": "Reports polymorphic code usages. Such usages are ambiguous and can be potentially inoperable depending on the class instance passed as the argument." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPossiblePolymorphicInvocationInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDuplicateMatchConditionInspection", + "shortDescription": { + "text": "Duplicate condition" + }, + "fullDescription": { + "text": "Reports duplicate conditions in 'match' expressions. See Match expression (php.net) for details.", + "markdown": "Reports duplicate conditions in `match` expressions.\n\n\nSee [Match expression (php.net)](https://wiki.php.net/rfc/match_expression_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDuplicateMatchConditionInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDuplicateSwitchCaseBodyInspection", + "shortDescription": { + "text": "Duplicate branch in switch statement" + }, + "fullDescription": { + "text": "Reports the 'switch' statements containing the same code in different branches.", + "markdown": "Reports the `switch` statements containing the same code in different branches." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDuplicateSwitchCaseBodyInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPregMatchRedundantClosureInspection", + "shortDescription": { + "text": "Redundant closure '.*'" + }, + "fullDescription": { + "text": "Reports redundant leading and trailing '.*' in pattern for `preg_match` function.", + "markdown": "Reports redundant leading and trailing '.\\*' in pattern for \\`preg_match\\` function." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPregMatchRedundantClosureInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpStatementWithoutBracesInspection", + "shortDescription": { + "text": "Control statement body without braces" + }, + "fullDescription": { + "text": "Reports the control structures (such as loops or conditionals) whose bodies are not enclosed in braces. See Control structures (php.net) for details.", + "markdown": "Reports the control structures (such as loops or conditionals) whose bodies are not enclosed in braces.\n\n\nSee [Control structures (php.net)](https://www.php.net/manual/en/language.control-structures.php) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpStatementWithoutBracesInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpShortOpenEchoTagInspection", + "shortDescription": { + "text": "Short open 'echo' tag usage" + }, + "fullDescription": { + "text": "Reports short PHP 'echo' tag '' can be used" + }, + "fullDescription": { + "text": "Reports the null-checking conditional expressions that can be safely replaced with the '?->' nullsafe operator.", + "markdown": "Reports the null-checking conditional expressions that can be safely replaced with the `?->` nullsafe operator." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpNullSafeOperatorCanBeUsedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpCommentCanBeReplacedWithNamedArgumentInspection", + "shortDescription": { + "text": "Comment can be replaced with named argument" + }, + "fullDescription": { + "text": "Reports the inline comments before arguments in function calls that only contain the name of the parameter and thus serve as hints. In PHP 8.0 and later, named arguments can be used instead. See Named arguments (php.net) for details.", + "markdown": "Reports the inline comments before arguments in function calls that only contain the name of the parameter and thus serve as hints. In PHP 8.0 and later, named arguments can be used instead.\n\n\nSee [Named arguments (php.net)](https://wiki.php.net/rfc/match_expression_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpCommentCanBeReplacedWithNamedArgumentInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpLineCommentWillBeParsedAsAttributeInspection", + "shortDescription": { + "text": "Comment is parsed as attribute in PHP 8.0" + }, + "fullDescription": { + "text": "Reports line comments starting with '#['. In PHP 8.0 and later, such comments are parsed as attributes. See Attributes (php.net) for details.", + "markdown": "Reports line comments starting with `#[`. In PHP 8.0 and later, such comments are parsed as attributes.\n\n\nSee [Attributes (php.net)](https://wiki.php.net/rfc/attributes_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpLineCommentWillBeParsedAsAttributeInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayShapeCanBeAddedInspection", + "shortDescription": { + "text": "'#[ArrayShape]' attribute can be added" + }, + "fullDescription": { + "text": "Reports the methods and functions that are returning arrays with known non-trivial keys. Suggests specifying the shape of the returned array via the '#[ArrayShape]' attribute or an array shape in the PHPDoc comment.", + "markdown": "Reports the methods and functions that are returning arrays with known non-trivial keys. Suggests specifying the shape of the returned array via the `#[ArrayShape]` attribute or an array shape in the PHPDoc comment." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayShapeCanBeAddedInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantCatchClauseInspection", + "shortDescription": { + "text": "Redundant catch clause" + }, + "fullDescription": { + "text": "Reports the 'catch' clauses with exceptions that are never thrown from the corresponding 'try' block.", + "markdown": "Reports the `catch` clauses with exceptions that are never thrown from the corresponding `try` block." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantCatchClauseInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Error handling", + "index": 72, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnpackedArgumentTypeMismatchInspection", + "shortDescription": { + "text": "Invalid type of unpacked argument" + }, + "fullDescription": { + "text": "Reports unpacked function arguments and array elements whose type is neither 'array' nor 'Traversable'. Starting with PHP 8.0, such usages will result in 'Fatal error'.", + "markdown": "Reports unpacked function arguments and array elements whose type is neither `array` nor `Traversable`.\n\n\nStarting with PHP 8.0, such usages will result in `Fatal error`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUnpackedArgumentTypeMismatchInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryLeadingBackslashInUseStatementInspection", + "shortDescription": { + "text": "Unnecessary leading '\\' in 'use' statement" + }, + "fullDescription": { + "text": "Reports the 'use' statements with an unnecessary leading '\\'. For namespaced names (fully qualified namespace names containing a namespace separator, such as 'Foo\\Bar' as opposed to global names that do not, such as 'FooBar'), the leading backslash is unnecessary and not recommended, as import names must be fully qualified and are not processed relative to the current namespace. See Using namespaces: Aliasing/Importing (php.net) for details.", + "markdown": "Reports the `use` statements with an unnecessary leading `\\`.\n\n\nFor namespaced names (fully qualified namespace names containing a namespace separator, such as `Foo\\Bar` as opposed to global names that do not, such as `FooBar`), the leading backslash is unnecessary and not recommended, as import names must be fully qualified and are not processed relative to the current namespace.\n\n\nSee [Using namespaces: Aliasing/Importing (php.net)](https://www.php.net/manual/en/language.namespaces.importing.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryLeadingBackslashInUseStatementInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitAssertTrueWithIncompatibleTypeArgumentInspection", + "shortDescription": { + "text": "'assertTrue()' with incompatible argument type" + }, + "fullDescription": { + "text": "Reports the PHPUnit 'assertTrue()' calls whose arguments are of incompatible types. Since the 'assertTrue()' method relies on strict types comparison with 'true', such assertions will always fail.", + "markdown": "Reports the PHPUnit `assertTrue()` calls whose arguments are of incompatible types. Since the `assertTrue()` method relies on strict types comparison with `true`, such assertions will always fail." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUnitAssertTrueWithIncompatibleTypeArgumentInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDuplicateOperandInComparisonInspection", + "shortDescription": { + "text": "Duplicate operand in comparison" + }, + "fullDescription": { + "text": "Reports duplicate operands in binary expressions ('+', '-', '*', '/', '&&', '||', and '.') that are in turn used inside comparison expressions. Such operands do not affect the comparison result and can be safely removed.", + "markdown": "Reports duplicate operands in binary expressions (`+`, `-`, `*`, `/`, `&&`, `||`, and `.`) that are in turn used inside comparison expressions. Such operands do not affect the comparison result and can be safely removed." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDuplicateOperandInComparisonInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUndefinedClassInspection", + "shortDescription": { + "text": "Undefined class" + }, + "fullDescription": { + "text": "Reports the references to classes whose declarations are not found in the project files, configured include paths, or among the PHP predefined classes. Use the options below to customize the inspection: Ignore PHPDoc: if selected, the inspection will not report the undefined classes referenced in PHPDoc blocks.", + "markdown": "Reports the references to classes whose declarations are not found in the project files, configured include paths, or among the PHP predefined classes.\n\nUse the options below to customize the inspection:\n\n* **Ignore PHPDoc**: if selected, the inspection will not report the undefined classes referenced in PHPDoc blocks." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUndefinedClassInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNestedMinMaxCallInspection", + "shortDescription": { + "text": "Nested 'min/max' call" + }, + "fullDescription": { + "text": "Reports nested 'min'/'max' calls. Since the 'min'/'max' functions accept any number of arguments, such nested calls are redundant.", + "markdown": "Reports nested `min`/`max` calls. Since the `min`/`max` functions accept any number of arguments, such nested calls are redundant." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpNestedMinMaxCallInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPluralMixedCanBeReplacedWithArrayInspection", + "shortDescription": { + "text": "'mixed' type can be replaced with 'array'" + }, + "fullDescription": { + "text": "Reports the 'mixed[]' usages in PHPDoc blocks that can be safely replaced with 'array'.", + "markdown": "Reports the `mixed[]` usages in PHPDoc blocks that can be safely replaced with `array`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPluralMixedCanBeReplacedWithArrayInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpCompoundNamespaceDepthInspection", + "shortDescription": { + "text": "Compound namespace depth is more than 2" + }, + "fullDescription": { + "text": "Reports the usages of compound namespaces whose depth exceeds two levels. According to PSR-12, compound namespaces with a depth of more than two MUST NOT be used. See PSR-12: Extended Coding Style (php-fig.org) for details.", + "markdown": "Reports the usages of compound namespaces whose depth exceeds two levels.\n\nAccording to PSR-12, compound namespaces with a depth of more than two MUST NOT be used.\n\n\nSee [PSR-12: Extended Coding Style (php-fig.org)](https://www.php-fig.org/psr/psr-12/#3-declare-statements-namespace-and-import-statements) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpCompoundNamespaceDepthInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style/PSR-12", + "index": 61, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArgumentWithoutNamedIdentifierInspection", + "shortDescription": { + "text": "Argument without name identifier" + }, + "fullDescription": { + "text": "Reports arguments without name identifiers.", + "markdown": "Reports arguments without name identifiers." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpArgumentWithoutNamedIdentifierInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDuplicatedCharacterInStrFunctionCallInspection", + "shortDescription": { + "text": "Duplicate character in function call" + }, + "fullDescription": { + "text": "Reports duplicate characters provided in the 'characters' argument of functions like 'ltrim' or 'str_words_counts'. Such duplicates are most probably a mistake and can be safely removed.", + "markdown": "Reports duplicate characters provided in the `characters` argument of functions like `ltrim` or `str_words_counts`. Such duplicates are most probably a mistake and can be safely removed." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpDuplicatedCharacterInStrFunctionCallInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUndefinedConstantInspection", + "shortDescription": { + "text": "Undefined constant" + }, + "fullDescription": { + "text": "Reports the references to constants that are not found in the project files, configured include paths, or among the PHP predefined constants.", + "markdown": "Reports the references to constants that are not found in the project files, configured include paths, or among the PHP predefined constants." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpUndefinedConstantInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUncoveredEnumCasesInspection", + "shortDescription": { + "text": "Some enum cases are uncovered" + }, + "fullDescription": { + "text": "Reports the 'match' expressions that don't cover all 'enum' cases in 'match' arm conditions.", + "markdown": "Reports the `match` expressions that don't cover all `enum` cases in `match` arm conditions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUncoveredEnumCasesInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMethodOrClassCallIsNotCaseSensitiveInspection", + "shortDescription": { + "text": "Case mismatch in method call or class usage" + }, + "fullDescription": { + "text": "Reports the usages of functions, methods, classes, and namespaces that do not match the case used in their declarations.", + "markdown": "Reports the usages of functions, methods, classes, and namespaces that do not match the case used in their declarations." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMethodOrClassCallIsNotCaseSensitiveInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpAccessStaticViaInstanceInspection", + "shortDescription": { + "text": "Class static member accessed via instance" + }, + "fullDescription": { + "text": "Reports references to static methods and fields via a class instance rather than the class itself. Even though referring to static members via instance variables is allowed by PHP, this makes the code confusing, as the reader may think that the result of the method depends on the instance. The quick-fix replaces the instance variable with the class name. Example: 'class StaticClass {\n public static function someStaticFunction(): int\n {\n return 3;\n }\n\n }\n\n $var = new StaticClass\n $var::someStaticFunction();' After the quick-fix is applied: 'StaticClass::someStaticFunction()'", + "markdown": "Reports references to static methods and fields via a class instance rather than the class itself.\n\nEven though referring to static members via instance variables is allowed by PHP,\nthis makes the code confusing, as the reader may think that the result of the method depends on the instance.\n\nThe quick-fix replaces the instance variable with the class name.\n\nExample:\n\n\n class StaticClass {\n public static function someStaticFunction(): int\n {\n return 3;\n }\n\n }\n\n $var = new StaticClass\n $var::someStaticFunction();\n\nAfter the quick-fix is applied:\n\n\n StaticClass::someStaticFunction()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpAccessStaticViaInstanceInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRegExpRedundantModifierInspection", + "shortDescription": { + "text": "Redundant modifier" + }, + "fullDescription": { + "text": "Reports the 'i' (case insensitivity) modifiers that are used in regular expression patterns containing no letters. Such modifiers are redundant and can be safely removed.", + "markdown": "Reports the `i` (case insensitivity) modifiers that are used in regular expression patterns containing no letters. Such modifiers are redundant and can be safely removed." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpRegExpRedundantModifierInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Regular expressions", + "index": 68, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpAttributeCanBeAddedToOverriddenMemberInspection", + "shortDescription": { + "text": "Attribute can be added to overriding member " + }, + "fullDescription": { + "text": "Reports the methods' and parameters' attributes that can be propagated to overriding methods/parameters. See Attributes (php.net) for details.", + "markdown": "Reports the methods' and parameters' attributes that can be propagated to overriding methods/parameters.\n\n\nSee [Attributes (php.net)](https://wiki.php.net/rfc/attributes_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpAttributeCanBeAddedToOverriddenMemberInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedundantDocCommentInspection", + "shortDescription": { + "text": "Redundant PHPDoc comment" + }, + "fullDescription": { + "text": "Reports PHPDoc comments or their parts that contain the information already provided in declarations.", + "markdown": "Reports PHPDoc comments or their parts that contain the information already provided in declarations." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpRedundantDocCommentInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnusedPrivateFieldInspection", + "shortDescription": { + "text": "Unused private property" + }, + "fullDescription": { + "text": "Reports the private properties that are never used.", + "markdown": "Reports the private properties that are never used." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnusedPrivateFieldInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Unused symbols", + "index": 37, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSingleStatementWithBracesInspection", + "shortDescription": { + "text": "Single-statement body with braces" + }, + "fullDescription": { + "text": "Reports the control structures (such as loops or conditionals) whose bodies are enclosed in braces but only contain a single child statement. Using braces in such cases is not necessary. See Control structures (php.net) for details.", + "markdown": "Reports the control structures (such as loops or conditionals) whose bodies are enclosed in braces but only contain a single child statement. Using braces in such cases is not necessary.\n\n\nSee [Control structures (php.net)](https://www.php.net/manual/en/language.control-structures.php) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpSingleStatementWithBracesInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryBoolCastInspection", + "shortDescription": { + "text": "Redundant cast to boolean" + }, + "fullDescription": { + "text": "Reports the '(bool)'/'(boolean)' casts and 'boolval()' calls that are redundant since casting to 'bool' is performed implicitly.", + "markdown": "Reports the `(bool)`/`(boolean)` casts and `boolval()` calls that are redundant since casting to `bool` is performed implicitly." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryBoolCastInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnnecessaryElseBranchInspection", + "shortDescription": { + "text": "Unnecessary 'else' branch" + }, + "fullDescription": { + "text": "Reports the 'else' branches in 'if' statements whose bodies always execute a terminating statement such as 'return' or 'throw'. Such branches are redundant and can be safely omitted.", + "markdown": "Reports the `else` branches in `if` statements whose bodies always execute a terminating statement such as `return` or `throw`. Such branches are redundant and can be safely omitted." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnnecessaryElseBranchInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnusedMatchConditionInspection", + "shortDescription": { + "text": "Unused 'match' condition" + }, + "fullDescription": { + "text": "Reports the conditions in 'match' expressions that will never be matched. Similarly to PHP Engine behavior, the inspection uses strict comparison ('===') to check the types in 'match' conditions against the 'match' argument type, regardless of the 'strict_types' directive. Since no type coercion occurs, some conditions may be non-matched due to non-matching types. See Match expression (php.net) for details.", + "markdown": "Reports the conditions in `match` expressions that will never be matched.\n\n\nSimilarly to PHP Engine behavior, the inspection uses strict comparison (`===`) to check the types in `match` conditions against the `match` argument type, regardless of the `strict_types` directive. Since no type coercion occurs, some conditions may be non-matched due to non-matching types.\n\n\nSee [Match expression (php.net)](https://wiki.php.net/rfc/match_expression_v2) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnusedMatchConditionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpComposerDuplicatedRequirementInspection", + "shortDescription": { + "text": "Duplicate package entries in composer.json" + }, + "fullDescription": { + "text": "Reports duplicate package entries in the 'require' and 'require-dev' sections of composer.json.", + "markdown": "Reports duplicate package entries in the `require` and `require-dev` sections of *composer.json*." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpComposerDuplicatedRequirementInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Composer", + "index": 38, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpExpressionResultUnusedInspection", + "shortDescription": { + "text": "Expression result unused" + }, + "fullDescription": { + "text": "Reports the expressions that are calculated, but the calculation result is not used anywhere. Such errors can be caused, for example, by misspelling the '=' operator as '=='.", + "markdown": "Reports the expressions that are calculated, but the calculation result is not used anywhere.\n\nSuch errors can be caused, for example, by misspelling the `=` operator as `==`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpExpressionResultUnusedInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpInternalEntityUsedInspection", + "shortDescription": { + "text": "Usage of internal entity" + }, + "fullDescription": { + "text": "Reports the usages of the entities that are marked as '@internal' and are located in different source roots. The usages located in the same source root are not reported. In most cases, the reported usages should be removed or replaced with other constructs.", + "markdown": "Reports the usages of the entities that are marked as `@internal` and are located in different source roots. The usages located in the same source root are not reported.\n\n\nIn most cases, the reported usages should be removed or replaced with other constructs." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpInternalEntityUsedInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPointlessBooleanExpressionInConditionInspection", + "shortDescription": { + "text": "Pointless boolean expression inside 'if' condition" + }, + "fullDescription": { + "text": "Reports the boolean expressions inside 'if' conditions that contain '$expr == true' or '$expr == false'. Such expressions can be simplified to 'if($expr)' and 'if(!expr)'.", + "markdown": "Reports the boolean expressions inside `if` conditions that contain `$expr == true` or `$expr == false`. Such expressions can be simplified to `if($expr)` and `if(!expr)`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPointlessBooleanExpressionInConditionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpNamedArgumentsWithChangedOrderInspection", + "shortDescription": { + "text": "Named arguments order does not match parameters order" + }, + "fullDescription": { + "text": "Reports named argument with order that does not match parameter order", + "markdown": "Reports named argument with order that does not match parameter order" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpNamedArgumentsWithChangedOrderInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpCaseWithValueNotFoundInEnumInspection", + "shortDescription": { + "text": "Case with specified value not found in enum" + }, + "fullDescription": { + "text": "Reports the arguments of enum's 'from' method calls that are not found in target enum classes. See Enumerations (php.net) for details.", + "markdown": "Reports the arguments of enum's `from` method calls that are not found in target enum classes.\n\n\nSee [Enumerations (php.net)](https://wiki.php.net/rfc/enumerations) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpCaseWithValueNotFoundInEnumInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIdempotentOperationInspection", + "shortDescription": { + "text": "Idempotent operation in binary expression" + }, + "fullDescription": { + "text": "Reports the binary expression operands that do not change the expression result (such as '+ 0' or '. \"\"') and are therefore redundant.", + "markdown": "Reports the binary expression operands that do not change the expression result (such as `+ 0` or `. \"\"`) and are therefore redundant." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpIdempotentOperationInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpLoopCanBeReplacedWithImplodeInspection", + "shortDescription": { + "text": "Loop can be replaced with 'implode()'" + }, + "fullDescription": { + "text": "Reports the 'foreach' loops that can be safely replaced with 'implode()' calls. See implode (php.net) for details.", + "markdown": "Reports the `foreach` loops that can be safely replaced with `implode()` calls.\n\n\nSee [implode (php.net)](https://www.php.net/manual/en/function.implode.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpLoopCanBeReplacedWithImplodeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpConcatenationWithArithmeticInspection", + "shortDescription": { + "text": "Concatenation with arithmetic usage" + }, + "fullDescription": { + "text": "Reports the string concatenation expressions that are used together with '+', '-', '<<', and '>>' operators. Starting with PHP 8, the concatenation operation has lower precedence and such expressions can thus produce unexpected results. See Concatenation precedence (php.net) for details.", + "markdown": "Reports the string concatenation expressions that are used together with `+`, `-`, `<<`, and `>>` operators. Starting with PHP 8, the concatenation operation has lower precedence and such expressions can thus produce unexpected results.\n\n\nSee [Concatenation precedence (php.net)](https://wiki.php.net/rfc/concatenation_precedence) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpConcatenationWithArithmeticInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpToStringImplementationInspection", + "shortDescription": { + "text": "Method '__toString' implementation" + }, + "fullDescription": { + "text": "Reports the attempts to convert the objects having no '__toString' method implementation to 'string'. Prior to PHP 7.4, this would lead to a fatal 'E_RECOVERABLE_ERROR' level error. In PHP 7.4, a fatal non-recoverable 'ERROR' is thrown. In PHP 8.0, the return value follows the standard PHP type semantics and will be coerced into a string if possible and if strict typing is disabled. If the Check __toString exists for each expression type option is enabled, the inspection will check all possible types of the expression and report if at least one of them doesn't contain the '__toString' method implementation. See __toString (php.net) for details.", + "markdown": "Reports the attempts to convert the objects having no `__toString` method implementation to `string`.\n\n\nPrior to PHP 7.4, this would lead to a fatal `E_RECOVERABLE_ERROR` level error. In PHP 7.4, a fatal non-recoverable `ERROR` is thrown. In PHP 8.0, the return value follows the standard PHP type semantics and will be coerced into a string if possible and if strict typing is disabled.\n\n\nIf the **Check __toString exists for each expression type** option is enabled, the inspection will check all possible types of the expression and\nreport if at least one of them doesn't contain the `__toString` method implementation.\n\n\nSee [__toString (php.net)](https://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpToStringImplementationInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayAccessCanBeReplacedWithForeachValueInspection", + "shortDescription": { + "text": "Array access can be replaced with 'foreach' value" + }, + "fullDescription": { + "text": "Reports the array access expressions inside 'foreach' loops that can be replaced with a 'foreach' value.", + "markdown": "Reports the array access expressions inside `foreach` loops that can be replaced with a `foreach` value." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayAccessCanBeReplacedWithForeachValueInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitAssertCanBeReplacedWithFailInspection", + "shortDescription": { + "text": "Assertion can be replaced with 'fail'" + }, + "fullDescription": { + "text": "Reports the 'assertTrue()'/'assertFalse()' calls with the 'false'/'true' arguments in PHPUnit tests. Such usages can be replaced with 'fail()' calls to indicate that a test is expected to fail.", + "markdown": "Reports the `assertTrue()`/`assertFalse()` calls with the `false`/`true` arguments in PHPUnit tests. Such usages can be replaced with `fail()` calls to indicate that a test is expected to fail." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitAssertCanBeReplacedWithFailInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpLoopCanBeConvertedToArrayFilterInspection", + "shortDescription": { + "text": "Loop can be converted to 'array_filter()' call" + }, + "fullDescription": { + "text": "Reports the 'foreach' loops that can be replaced with 'array_filter()' calls.", + "markdown": "Reports the `foreach` loops that can be replaced with `array_filter()` calls." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpLoopCanBeConvertedToArrayFilterInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitInvalidMockingEntityInspection", + "shortDescription": { + "text": "Invalid PHPUnit mocking target" + }, + "fullDescription": { + "text": "Reports the methods and classes that are incorrectly mocked in PHPUnit tests. The following entities are reported: Enums and 'final' classes 'private', 'static', or 'final' methods Duplicate methods provided in the mocked methods lists via 'addMethods()', 'onlyMethods()', 'setMethods()', and so on.", + "markdown": "Reports the methods and classes that are incorrectly mocked in PHPUnit tests.\n\n\nThe following entities are reported:\n\n* Enums and `final` classes\n* `private`, `static`, or `final` methods\n* Duplicate methods provided in the mocked methods lists via `addMethods()`, `onlyMethods()`, `setMethods()`, and so on." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpUnitInvalidMockingEntityInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitAssertCanBeReplacedWithEmptyInspection", + "shortDescription": { + "text": "Assertion can be replaced with 'assertEmpty/assertNotEmpty'" + }, + "fullDescription": { + "text": "Reports the 'assertTrue'/'assertFalse' usages that can be replaced with 'assertEmpty'/'assertNotEmpty' in PHPUnit tests. See assertEmpty (phpunit.readthedocs.io) for details.", + "markdown": "Reports the `assertTrue`/`assertFalse` usages that can be replaced with `assertEmpty`/`assertNotEmpty` in PHPUnit tests.\n\n\nSee [assertEmpty (phpunit.readthedocs.io)](https://phpunit.readthedocs.io/en/stable/assertions.html#assertempty) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitAssertCanBeReplacedWithEmptyInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnusedLocalVariableInspection", + "shortDescription": { + "text": "Unused local variable" + }, + "fullDescription": { + "text": "Reports the variables that are considered unused in the following cases: The value of the variable is not used anywhere or is overwritten immediately. The reference stored in the variable is not used anywhere or is overwritten immediately.", + "markdown": "Reports the variables that are considered unused in the following cases:\n\n* The value of the variable is not used anywhere or is overwritten immediately.\n* The reference stored in the variable is not used anywhere or is overwritten immediately." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnusedLocalVariableInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Unused symbols", + "index": 37, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpAssignmentReplaceableWithOperatorAssignmentInspection", + "shortDescription": { + "text": "Assignment can be replaced with operator assignment" + }, + "fullDescription": { + "text": "Reports the assignments that can be replaced with combined operator assignments (for example, '+=').", + "markdown": "Reports the assignments that can be replaced with combined operator assignments (for example, `+=`)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpAssignmentReplaceableWithOperatorAssignmentInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Replaceable assignments", + "index": 82, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpIgnoredClassAliasDeclaration", + "shortDescription": { + "text": "Ignored class alias declaration" + }, + "fullDescription": { + "text": "Reports the class alias declarations that are ignored by the IDE because the actual class declaration with the same FQN exists. The inspection is intended to clarify the IDE’s behavior in the cases when both the class and the class alias declarations are present. When several declarations with the same FQN exist, the IDE usually fails to choose a single one between them. This leads to incorrect code completion, erroneous type inference, and so on. Since the class declaration prevails over the class alias declaration, the latter becomes redundant and therefore ignored by the IDE. Note that ignoring class alias declarations does not affect the behavior of the PHP interpreter.", + "markdown": "Reports the class alias declarations that are ignored by the IDE because the actual class declaration with the same FQN exists.\n\n\nThe inspection is intended to clarify the IDE's behavior in the cases when both the class and the class alias declarations are present.\nWhen several declarations with the same FQN exist, the IDE usually fails to choose a single one between them.\nThis leads to incorrect code completion, erroneous type inference, and so on. Since the class declaration prevails\nover the class alias declaration, the latter becomes redundant and therefore ignored by the IDE.\n\n\nNote that ignoring class alias declarations does not affect the behavior of the PHP interpreter." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpIgnoredClassAliasDeclaration", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpStatementHasEmptyBodyInspection", + "shortDescription": { + "text": "Statement has empty body" + }, + "fullDescription": { + "text": "Reports the statements that have empty bodies. While occasionally useful, such statements are often the result of typos and may cause confusion.", + "markdown": "Reports the statements that have empty bodies.\n\nWhile occasionally useful, such statements are often the result of typos and may cause confusion." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpStatementHasEmptyBodyInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPureFunctionMayProduceSideEffectsInspection", + "shortDescription": { + "text": "Pure function may produce side effects" + }, + "fullDescription": { + "text": "Reports the '#[Pure]' annotations used on functions that may produce side effects.", + "markdown": "Reports the `#[Pure]` annotations used on functions that may produce side effects." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpPureFunctionMayProduceSideEffectsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Attributes", + "index": 45, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpRedeclarationStdlibFunctionInspection", + "shortDescription": { + "text": "Redeclaration of standard library function" + }, + "fullDescription": { + "text": "Reports the redeclaration of standard library functions. Functions from the standard library cannot be redeclared in user code.", + "markdown": "Reports the redeclaration of standard library functions. Functions from the standard library cannot be redeclared in user code." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpRedeclarationStdlibFunctionInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpForeachNestedOuterKeyValueVariablesConflictInspection", + "shortDescription": { + "text": "Nested vs outer 'foreach' variables conflict" + }, + "fullDescription": { + "text": "Reports the variables that are used as a key or value both by the inner and outer 'foreach' loops. In most cases, this is an error or may result in an error in the future.", + "markdown": "Reports the variables that are used as a key or value both by the inner and outer `foreach` loops. In most cases, this is an error or may result in an error in the future." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpForeachNestedOuterKeyValueVariablesConflictInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSwitchWithCommonPartsInspection", + "shortDescription": { + "text": "'switch' with common parts" + }, + "fullDescription": { + "text": "Reports the 'switch' statements with duplicated common parts.", + "markdown": "Reports the 'switch' statements with duplicated common parts." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpSwitchWithCommonPartsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Control flow", + "index": 12, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMethodParametersCountMismatchInspection", + "shortDescription": { + "text": "Parameters number mismatch declaration" + }, + "fullDescription": { + "text": "Reports the function/method calls that take more parameters than specified in their declaration.", + "markdown": "Reports the function/method calls that take more parameters than specified in their declaration." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpMethodParametersCountMismatchInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpSwitchCaseWithoutDefaultBranchInspection", + "shortDescription": { + "text": "Switch statement without default branch" + }, + "fullDescription": { + "text": "Reports the 'switch' statements without a default branch.", + "markdown": "Reports the `switch` statements without a default branch." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpSwitchCaseWithoutDefaultBranchInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpParameterByRefIsNotUsedAsReferenceInspection", + "shortDescription": { + "text": "Unnecessary pass-by-ref" + }, + "fullDescription": { + "text": "Reports the variables that are passed by reference to a function/method but are not modified in the function/method body. In such cases, the '&' in parameter's declaration can be safely removed. See Passing by Reference (php.net) for details.", + "markdown": "Reports the variables that are passed by reference to a function/method but are not modified in the function/method body. In such cases, the `&` in parameter's declaration can be safely removed.\n\n\nSee [Passing by Reference (php.net)](https://www.php.net/manual/en/language.references.pass.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpParameterByRefIsNotUsedAsReferenceInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpExceptionImmediatelyRethrownInspection", + "shortDescription": { + "text": "Exception is immediately rethrown" + }, + "fullDescription": { + "text": "Reports the 'catch' statements that only rethrow a caught exception, which is located in a class hierarchy different from the subsequent exception types.", + "markdown": "Reports the `catch` statements that only rethrow a caught exception, which is located in a class hierarchy different from the subsequent exception types." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpExceptionImmediatelyRethrownInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpHierarchyChecksInspection", + "shortDescription": { + "text": "Class hierarchy checks" + }, + "fullDescription": { + "text": "Checks the classes' hierarchy: abstract methods implementation, the compatibility of implementing/overriding methods with their declarations in parent classes, and properties' types redeclarations. All reported violations result in PHP fatal errors. It is not recommended disabling or suppressing this inspection.", + "markdown": "Checks the classes' hierarchy: abstract methods implementation, the compatibility of implementing/overriding methods with their declarations in parent classes, and properties' types redeclarations.\n\nAll reported violations result in PHP fatal errors. It is not recommended disabling or suppressing this inspection." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpHierarchyChecksInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LaravelPintValidationInspection", + "shortDescription": { + "text": "Laravel Pint validation" + }, + "fullDescription": { + "text": "Reports coding style problems detected by Laravel Pint. The inspection requires Laravel Pint to be properly installed and set up in the IDE under Settings | PHP | Quality Tools | Laravel Pint. To learn more about Laravel Pint installation, see Laravel Pint.", + "markdown": "Reports coding style problems detected by Laravel Pint.\n\n\nThe inspection requires Laravel Pint to be properly installed and set up in the IDE under\n[Settings \\| PHP \\| Quality Tools \\| Laravel Pint](settings://settings.php.quality.tools?Laravel%20Pint).\n\n\nTo learn more about Laravel Pint installation, see [Laravel Pint](https://laravel.com/docs/10.x/pint#installation)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "LaravelPintValidationInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Quality tools", + "index": 70, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPropertyOnlyWrittenInspection", + "shortDescription": { + "text": "Property usages have same access" + }, + "fullDescription": { + "text": "Reports the private properties that are: written but never read read but never written", + "markdown": "Reports the private properties that are:\n\n* written but never read\n* read but never written" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpPropertyOnlyWrittenInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMultipleClassDeclarationsInspection", + "shortDescription": { + "text": "Multiple class declarations" + }, + "fullDescription": { + "text": "Reports the references to classes that have multiple declarations in project files. Use the options below to customize the inspection: Ignore PHPDoc: if selected, the inspection will not report multiple declarations of classes referenced in PHPDoc blocks.", + "markdown": "Reports the references to classes that have multiple declarations in project files.\n\nUse the options below to customize the inspection:\n\n* **Ignore PHPDoc**: if selected, the inspection will not report multiple declarations of classes referenced in PHPDoc blocks." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMultipleClassDeclarationsInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Undefined symbols", + "index": 26, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMissingFieldTypeInspection", + "shortDescription": { + "text": "Missing property's type declaration" + }, + "fullDescription": { + "text": "Reports the properties that have no type declaration.", + "markdown": "Reports the properties that have no type declaration." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpMissingFieldTypeInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpWrongForeachArgumentTypeInspection", + "shortDescription": { + "text": "Invalid argument supplied for 'foreach()'" + }, + "fullDescription": { + "text": "Reports the 'foreach' constructs used on variables of the 'string', 'float', 'int', or 'boolean' type. See foreach (php.net) for details.", + "markdown": "Reports the `foreach` constructs used on variables of the `string`, `float`, `int`, or `boolean` type.\n\n\nSee [foreach (php.net)](http://www.php.net/manual/en/control-structures.foreach.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpWrongForeachArgumentTypeInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Type compatibility", + "index": 23, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpInvalidStringOffsetUsageInspection", + "shortDescription": { + "text": "Invalid string offset usage" + }, + "fullDescription": { + "text": "Reports invalid string offset usages that will result in a runtime error. The following usages are reported: Using string offsets as objects or arrays Unsetting string offsets via 'unset' Passing string offsets by reference Creating references to or from string offsets Incrementing or decrementing string offsets Using combined operator assignments such as '+=' or '.=' on string offsets Assigning string offsets with empty strings or strings with length >1", + "markdown": "Reports invalid string offset usages that will result in a runtime error.\n\n\nThe following usages are reported:\n\n* Using string offsets as objects or arrays\n* Unsetting string offsets via `unset`\n* Passing string offsets by reference\n* Creating references to or from string offsets\n* Incrementing or decrementing string offsets\n* Using combined operator assignments such as `+=` or `.=` on string offsets\n* Assigning string offsets with empty strings or strings with length \\>1" + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpInvalidStringOffsetUsageInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpTooManyParametersInspection", + "shortDescription": { + "text": "Too many parameters in function declaration" + }, + "fullDescription": { + "text": "Reports the function/method declarations with the number of parameters exceeding the specified limit.", + "markdown": "Reports the function/method declarations with the number of parameters exceeding the specified limit." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpTooManyParametersInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code smell", + "index": 1, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpArrayFilterCanBeConvertedToLoopInspection", + "shortDescription": { + "text": "'array_filter()' call can be converted to loop" + }, + "fullDescription": { + "text": "Reports the 'array_filter()' calls that can be replaced with 'foreach' loops.", + "markdown": "Reports the `array_filter()` calls that can be replaced with `foreach` loops." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpArrayFilterCanBeConvertedToLoopInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Code style", + "index": 3, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpClassImplementsSolelyTraversableInspection", + "shortDescription": { + "text": "Class can't implement Traversable directly" + }, + "fullDescription": { + "text": "Reports the classes that are implementing the 'Traversable' interface alone, not as part of 'Iterator' or 'IteratorAggregate' interfaces. The 'Traversable' interface is an internal engine interface; it cannot be implemented in PHP scripts. See The Traversable interface (php.net) for details.", + "markdown": "Reports the classes that are implementing the `Traversable` interface alone, not as part of `Iterator` or `IteratorAggregate` interfaces.\n\n\nThe `Traversable` interface is an internal engine interface; it cannot be implemented in PHP scripts. See [The Traversable interface (php.net)](https://www.php.net/manual/en/class.traversable.php) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "PhpClassImplementsSolelyTraversableInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnusedSwitchBranchInspection", + "shortDescription": { + "text": "Unused 'switch' branch" + }, + "fullDescription": { + "text": "Reports the branches in 'switch' statements that do not belong to the set of enum cases and as a result are never executed. See Enumerations (php.net) for details.", + "markdown": "Reports the branches in `switch` statements that do not belong to the set of enum cases and as a result are never executed.\n\n\nSee [Enumerations (php.net)](https://wiki.php.net/rfc/enumerations) for details." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnusedSwitchBranchInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Probable bugs", + "index": 9, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpPromotedFieldUsageInspection", + "shortDescription": { + "text": "Promoted property usage" + }, + "fullDescription": { + "text": "Reports properties declared through promoted constructor parameters. Using promoted properties is only possible since PHP 8.0. In earlier PHP versions, it leads to a parse error. See Constructor Property Promotion (php.net) for details.", + "markdown": "Reports properties declared through promoted constructor parameters.\n\n\nUsing promoted properties is only possible since PHP 8.0. In earlier PHP versions, it leads to a parse error.\n\n\nSee [Constructor Property Promotion (php.net)](https://wiki.php.net/rfc/constructor_promotion) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpPromotedFieldUsageInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/General", + "index": 6, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpDocFieldTypeMismatchInspection", + "shortDescription": { + "text": "Type doesn't match property's declared type" + }, + "fullDescription": { + "text": "Reports the properties' types in PHPDoc '@var' tags that do not match the declared type of a property.", + "markdown": "Reports the properties' types in PHPDoc `@var` tags that do not match the declared type of a property." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpDocFieldTypeMismatchInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPDoc", + "index": 2, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpUnitDeprecatedDataProviderSignatureInspection", + "shortDescription": { + "text": "Deprecated usage of data provider since PHPUnit 10" + }, + "fullDescription": { + "text": "Reports the references to functions/methods in the '@dataProvider' PHPDoc tag that are resolved to non-static or non-public methods. Usage of these methods as PHPUnit data providers is deprecated starting from PHPUnit 10.", + "markdown": "Reports the references to functions/methods in the `@dataProvider` PHPDoc tag that are resolved to non-static or non-public methods. Usage of these methods as PHPUnit data providers is deprecated starting from PHPUnit 10." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "PhpUnitDeprecatedDataProviderSignatureInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/PHPUnit", + "index": 20, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.jetbrains.sh", + "version": "232.9881", + "rules": [ + { + "id": "ShellCheck", + "shortDescription": { + "text": "ShellCheck" + }, + "fullDescription": { + "text": "Reports shell script bugs detected by the integrated ShellCheck static analysis tool.", + "markdown": "Reports shell script bugs detected by the integrated [ShellCheck](https://github.com/koalaman/shellcheck) static analysis tool." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "ShellCheck", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Shell script", + "index": 5, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "Karma", + "version": "232.9881", + "rules": [ + { + "id": "KarmaConfigFile", + "shortDescription": { + "text": "Invalid Karma configuration file" + }, + "fullDescription": { + "text": "Reports a potential error in a file path ('basePath', 'files') for a Karma configuration file, for example, 'karma.conf.js'.", + "markdown": "Reports a potential error in a file path ('basePath', 'files') for a Karma configuration file, for example, `karma.conf.js`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "KarmaConfigFile", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Unit testing", + "index": 8, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.intellij.database", + "version": "232.9881", + "rules": [ + { + "id": "MysqlLoadDataPathInspection", + "shortDescription": { + "text": "LOAD statement path" + }, + "fullDescription": { + "text": "Reports paths that start with the tilde character in LOAD statements. Example (MySQL): 'CREATE TABLE table_name (id int);\nLOAD DATA LOCAL INFILE '~/Documents/some_file.txt'\nINTO TABLE table_name FIELDS TERMINATED BY ',' LINES TERMINATED BY '\\n'\nIGNORE 1 LINES;' Instead of the tilde character, use a full path to the file.", + "markdown": "Reports paths that start with the tilde character in LOAD statements.\n\nExample (MySQL):\n\n CREATE TABLE table_name (id int);\n LOAD DATA LOCAL INFILE '~/Documents/some_file.txt'\n INTO TABLE table_name FIELDS TERMINATED BY ',' LINES TERMINATED BY '\\n'\n IGNORE 1 LINES;\n\nInstead of the tilde character, use a full path to the file." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MysqlLoadDataPath", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "MySQL", + "index": 10, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MysqlSpaceAfterFunctionNameInspection", + "shortDescription": { + "text": "Whitespace between the function name and the open parenthesis" + }, + "fullDescription": { + "text": "Reports any whitespace in a function call between the function name and the open parenthesis, which is not supported by default. Example (MySQL): 'SELECT MAX (qty) FROM orders;'", + "markdown": "Reports any whitespace in a function call between the function name and the open parenthesis, which is not supported by default.\n\nExample (MySQL):\n\n SELECT MAX (qty) FROM orders;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "MysqlSpaceAfterFunctionName", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "MySQL", + "index": 10, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlMissingReturnInspection", + "shortDescription": { + "text": "Missing return statement" + }, + "fullDescription": { + "text": "Reports functions that have no RETURN statements. Example (Oracle): 'CREATE FUNCTION foo RETURN int AS\nBEGIN\nEND;' The 'foo' function must return the integer value but the function body returns nothing. To fix the error, add a RETURN statement (for example, 'return 1;'). 'CREATE FUNCTION foo RETURN int AS\nBEGIN\n RETURN 1;\nEND;'", + "markdown": "Reports functions that have no RETURN statements.\n\nExample (Oracle):\n\n CREATE FUNCTION foo RETURN int AS\n BEGIN\n END;\n\nThe `foo` function must return the integer value but the function body returns nothing. To fix the error,\nadd a RETURN statement (for example, `return 1;`).\n\n CREATE FUNCTION foo RETURN int AS\n BEGIN\n RETURN 1;\n END;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "SqlMissingReturn", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlCaseVsIfInspection", + "shortDescription": { + "text": "Using CASE instead of conditional function and vice versa" + }, + "fullDescription": { + "text": "Reports situations when CASE and IF are interchangeable. Example (MySQL): 'SELECT CASE\nWHEN C1 IS NULL THEN 1\nELSE 0\nEND\nFROM dual;' To keep your code short, you can replace the CASE structure with IF. You can do that by applying the Replace with 'IF' call intention action. The example code will look as follows: 'SELECT IF(C1 IS NULL, 1, 0)\nFROM dual;' To revert IF to CASE, click IF and apply the Replace with CASE expression intention action.", + "markdown": "Reports situations when CASE and IF are interchangeable.\n\nExample (MySQL):\n\n SELECT CASE\n WHEN C1 IS NULL THEN 1\n ELSE 0\n END\n FROM dual;\n\nTo keep your code short, you can replace the CASE structure with IF. You can do that by applying the **Replace with 'IF' call**\nintention action. The example code will look as follows:\n\n SELECT IF(C1 IS NULL, 1, 0)\n FROM dual;\n\nTo revert IF to CASE, click IF and apply the **Replace with CASE expression** intention action." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlCaseVsIf", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlShouldBeInGroupByInspection", + "shortDescription": { + "text": "Column should be in group by clause" + }, + "fullDescription": { + "text": "Reports columns that are not in the GROUP BY clause or inside an aggregate function call. Example (Microsoft SQL Server): 'CREATE TABLE t1 (a INT, b INT);\nSELECT a, b FROM t1 GROUP BY a;' If you run the SELECT query, you will receive an error because Microsoft SQL Server expects the 'b' column in GROUP BY or used inside an aggregate function. The following two examples will fix the error. 'SELECT a, b FROM t1 GROUP BY a, b;\nSELECT a, max(b) max_b FROM t1 GROUP BY a;'", + "markdown": "Reports columns that are not in the GROUP BY clause or inside an aggregate function call.\n\nExample (Microsoft SQL Server):\n\n CREATE TABLE t1 (a INT, b INT);\n SELECT a, b FROM t1 GROUP BY a;\n\nIf you run the SELECT query, you will receive an error because Microsoft SQL Server expects the `b` column in GROUP BY or used\ninside an aggregate function. The following two examples will fix the error.\n\n SELECT a, b FROM t1 GROUP BY a, b;\n SELECT a, max(b) max_b FROM t1 GROUP BY a;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlShouldBeInGroupBy", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlAutoIncrementDuplicateInspection", + "shortDescription": { + "text": "Auto-increment duplicate" + }, + "fullDescription": { + "text": "Reports tables that contain two columns with an automatic increment. In MySQL, Microsoft SQL Server, and Db2 dialects, a table can have only one field with a auto-increment option, and this field must be a key. Example (MySQL): 'CREATE TABLE my_table\n(\n id INT AUTO_INCREMENT,\n c2 INT AUTO_INCREMENT,\n);' The AUTO_INCREMENT constraint for 'c2' will be highlighted as 'c1' already has this constraint. To fix the warning, you can make 'id' a primary key and delete AUTO_INCREMENT for 'c2'. 'CREATE TABLE my_table\n(\n id INT AUTO_INCREMENT PRIMARY KEY,\n c2 INT,\n);'", + "markdown": "Reports tables that contain two columns with an automatic increment. In MySQL, Microsoft SQL Server, and Db2 dialects, a table can have only one field with a auto-increment option, and this field must be a key.\n\nExample (MySQL):\n\n CREATE TABLE my_table\n (\n id INT AUTO_INCREMENT,\n c2 INT AUTO_INCREMENT,\n );\n\nThe AUTO_INCREMENT constraint for `c2` will be highlighted as `c1` already has this constraint. To fix the warning,\nyou can make `id` a primary key and delete AUTO_INCREMENT for `c2`.\n\n CREATE TABLE my_table\n (\n id INT AUTO_INCREMENT PRIMARY KEY,\n c2 INT,\n );\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlAutoIncrementDuplicate", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlStringLengthExceededInspection", + "shortDescription": { + "text": "Implicit string truncation" + }, + "fullDescription": { + "text": "Reports variables that exceed the defined length in characters. Example (Microsoft SQL Server): 'CREATE PROCEDURE test() AS\nBEGIN\nDECLARE myVarOk VARCHAR(5) = 'abcde';\nDECLARE myVarExceeded VARCHAR(5) = 'abcde12345';\n\nSET myVarOk = 'xyz';\nSET myVarExceeded = '123456789';\nEND;' The 'myVarExceeded' variable is defined as 'VARCHAR(5)' but both assigned values (''abcde12345'' and ''123456789'') exceed this limitation. You can truncate assigned values or increase the defined length. To increase the length, use the Increase type length quick-fix. After the quick-fix is applied: 'CREATE PROCEDURE test() AS\nBEGIN\nDECLARE myVarOk VARCHAR(5) = 'abcde';\nDECLARE myVarExceeded VARCHAR(10) = 'abcde12345';\n\nSET myVarOk = 'xyz';\nSET myVarExceeded = '123456789';\nEND;'", + "markdown": "Reports variables that exceed the defined length in characters.\n\nExample (Microsoft SQL Server):\n\n CREATE PROCEDURE test() AS\n BEGIN\n DECLARE myVarOk VARCHAR(5) = 'abcde';\n DECLARE myVarExceeded VARCHAR(5) = 'abcde12345';\n\n SET myVarOk = 'xyz';\n SET myVarExceeded = '123456789';\n END;\n\nThe `myVarExceeded` variable is defined as `VARCHAR(5)` but both assigned values (`'abcde12345'` and\n`'123456789'`) exceed this limitation. You can truncate assigned values or increase the defined length.\nTo increase the length, use the **Increase type length** quick-fix.\n\nAfter the quick-fix is applied:\n\n CREATE PROCEDURE test() AS\n BEGIN\n DECLARE myVarOk VARCHAR(5) = 'abcde';\n DECLARE myVarExceeded VARCHAR(10) = 'abcde12345';\n\n SET myVarOk = 'xyz';\n SET myVarExceeded = '123456789';\n END;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlStringLengthExceeded", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlDtInspection", + "shortDescription": { + "text": "Ill-formed date/time literals" + }, + "fullDescription": { + "text": "Reports errors in date and time literals. This inspection is available in MySQL, Oracle, Db2, and H2. Example (MySQL): 'SELECT TIME '10 -12:13:14' FROM dual;\nSELECT TIME ' 12 : 13 : 14 ' FROM dual;\nSELECT TIME '12 13 14' FROM dual;\nSELECT TIME '12-13-14' FROM dual;\nSELECT TIME '12.13.14' FROM dual;\nSELECT TIME '12:13:' FROM dual;\nSELECT TIME '12:13' FROM dual;\nSELECT TIME '12:' FROM dual;' In this example, dates ignore the MySQL standard for date and time literals. Therefore, they will be highlighted. For more information about date and time literals in MySQL, see Date and Time Literals at dev.mysql.com. The following date and type literals are valid for MySQL. 'SELECT TIME '12:13:14' FROM dual;\nSELECT TIME '12:13:14.555' FROM dual;\nSELECT TIME '12:13:14.' FROM dual;\nSELECT TIME '-12:13:14' FROM dual;\nSELECT TIME '10 12:13:14' FROM dual;\nSELECT TIME '-10 12:13:14' FROM dual;'", + "markdown": "Reports errors in date and time literals. This inspection is available in MySQL, Oracle, Db2, and H2.\n\nExample (MySQL):\n\n SELECT TIME '10 -12:13:14' FROM dual;\n SELECT TIME ' 12 : 13 : 14 ' FROM dual;\n SELECT TIME '12 13 14' FROM dual;\n SELECT TIME '12-13-14' FROM dual;\n SELECT TIME '12.13.14' FROM dual;\n SELECT TIME '12:13:' FROM dual;\n SELECT TIME '12:13' FROM dual;\n SELECT TIME '12:' FROM dual;\n\nIn this example, dates ignore the MySQL standard for date and time literals. Therefore, they will be highlighted.\nFor more information about date and time literals in MySQL, see [Date and Time Literals at dev.mysql.com](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-literals.html).\n\nThe following date and type literals are valid for MySQL.\n\n SELECT TIME '12:13:14' FROM dual;\n SELECT TIME '12:13:14.555' FROM dual;\n SELECT TIME '12:13:14.' FROM dual;\n SELECT TIME '-12:13:14' FROM dual;\n SELECT TIME '10 12:13:14' FROM dual;\n SELECT TIME '-10 12:13:14' FROM dual;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlDateTime", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlInsertValuesInspection", + "shortDescription": { + "text": "VALUES clause cardinality" + }, + "fullDescription": { + "text": "Reports situations when a number of parameters in VALUES does not match a number of columns in a target table. Example (MySQL): 'CREATE TABLE foo(a INT, b INT, c INT);\n\nINSERT INTO foo VALUES (1,2,3,4)' The 'foo' table has three columns but in the INSERT INTO statement we pass four.", + "markdown": "Reports situations when a number of parameters in VALUES does not match a number of columns in a target table.\n\nExample (MySQL):\n\n CREATE TABLE foo(a INT, b INT, c INT);\n\n INSERT INTO foo VALUES (1,2,3,4)\n\nThe `foo` table has three columns but in the INSERT INTO statement we pass four." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlInsertValues", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlRedundantElseNullInspection", + "shortDescription": { + "text": "Redundant ELSE NULL clause" + }, + "fullDescription": { + "text": "Reports redundant ELSE NULL clauses. Example (MySQL): 'SELECT CASE WHEN 2 > 1 THEN 'OK' ELSE NULL END AS alias FROM foo;' The 'ELSE NULL' part will never be executed and may be omitted.", + "markdown": "Reports redundant ELSE NULL clauses.\n\nExample (MySQL):\n\n SELECT CASE WHEN 2 > 1 THEN 'OK' ELSE NULL END AS alias FROM foo;\n\nThe `ELSE NULL` part will never be executed and may be omitted." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlRedundantElseNull", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MysqlParsingInspection", + "shortDescription": { + "text": "Unsupported syntax in pre-8.0 versions" + }, + "fullDescription": { + "text": "Reports invalid usages of UNION in queries. The inspection works in MySQL versions that are earlier than 8.0. Example (MySQL): 'SELECT * FROM (SELECT 1 UNION (SELECT 1 UNION SELECT 2)) a;'", + "markdown": "Reports invalid usages of UNION in queries.\n\nThe inspection works in MySQL versions that are earlier than 8.0.\n\nExample (MySQL):\n\n\n SELECT * FROM (SELECT 1 UNION (SELECT 1 UNION SELECT 2)) a;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MysqlParsing", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "MySQL", + "index": 10, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlCallNotationInspection", + "shortDescription": { + "text": "Using of named and positional arguments" + }, + "fullDescription": { + "text": "Reports calls in which positional arguments go after the named ones. Works in PostgreSQL, Oracle, and Db2. Example (In PostgreSQL): 'CREATE FUNCTION foo(a int, b int, c int) RETURNS int\n LANGUAGE plpgsql AS\n$$\nBEGIN\n RETURN a + b + c;\nEND\n$$;\nSELECT foo(a => 1, b => 2, c => 3);\n -- `3` goes after the named argument\nSELECT foo(1, b => 2, 3);\n -- `1` and `3` go after the named argument\nSELECT foo(b => 2, 1, 3);'", + "markdown": "Reports calls in which positional arguments go after the named ones. Works in PostgreSQL, Oracle, and Db2.\n\nExample (In PostgreSQL):\n\n CREATE FUNCTION foo(a int, b int, c int) RETURNS int\n LANGUAGE plpgsql AS\n $$\n BEGIN\n RETURN a + b + c;\n END\n $$;\n SELECT foo(a => 1, b => 2, c => 3);\n -- `3` goes after the named argument\n SELECT foo(1, b => 2, 3);\n -- `1` and `3` go after the named argument\n SELECT foo(b => 2, 1, 3);\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "SqlCallNotation", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlShadowingAliasInspection", + "shortDescription": { + "text": "Column is shadowed by alias" + }, + "fullDescription": { + "text": "Reports SELECT aliases with names that match column names in the FROM clause. Example (MySQL): 'CREATE TABLE foo (a INT, b INT, c INT);\nSELECT a b, c FROM foo;' The 'a' column uses the 'b' alias but the 'b' name is also used by the column from the 'foo' table.", + "markdown": "Reports SELECT aliases with names that match column names in the FROM clause.\n\nExample (MySQL):\n\n CREATE TABLE foo (a INT, b INT, c INT);\n SELECT a b, c FROM foo;\n\nThe `a` column uses the `b` alias but the `b` name is also used by the column from the `foo`\ntable." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlShadowingAlias", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlUnreachableCodeInspection", + "shortDescription": { + "text": "Unreachable code" + }, + "fullDescription": { + "text": "Reports unreachable statements inside SQL routines. Example (Microsoft SQL Server): 'CREATE FUNCTION foo() RETURNS INT AS\nBEGIN\n THROW;\n RETURN 1;\nEND;' In Microsoft SQL Server, the 'THROW' statement raises an exception and transfers execution to the CATCH block of the TRY...CATCH construct. Therefore, the 'RETURN 1;' part will never be executed.", + "markdown": "Reports unreachable statements inside SQL routines.\n\nExample (Microsoft SQL Server):\n\n CREATE FUNCTION foo() RETURNS INT AS\n BEGIN\n THROW;\n RETURN 1;\n END;\n\nIn Microsoft SQL Server, the `THROW` statement raises an exception and transfers execution to the CATCH block of the TRY...CATCH\nconstruct. Therefore, the `RETURN 1;` part will never be executed." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlUnreachable", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlNoDataSourceInspection", + "shortDescription": { + "text": "No data sources configured" + }, + "fullDescription": { + "text": "Reports the absence of data sources in the Database tool window (View | Tool Windows | Database).", + "markdown": "Reports the absence of data sources in the **Database** tool window (**View \\| Tool Windows \\| Database**)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlNoDataSourceInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlResolveInspection", + "shortDescription": { + "text": "Unresolved reference" + }, + "fullDescription": { + "text": "Reports unresolved SQL references. Example (MySQL): 'CREATE TABLE users(id INT, name VARCHAR(40));\nCREATE TABLE admins(id INT, col1 INT);\n\nSELECT users.id, admins.id FROM admins WHERE admins.id > 1;' The 'users.id' column is unresolved because the 'users' table is missing in the FROM clause.", + "markdown": "Reports unresolved SQL references.\n\nExample (MySQL):\n\n CREATE TABLE users(id INT, name VARCHAR(40));\n CREATE TABLE admins(id INT, col1 INT);\n\n SELECT users.id, admins.id FROM admins WHERE admins.id > 1;\n\nThe `users.id` column is unresolved because the `users` table is missing in the FROM clause." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "SqlResolve", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlCurrentSchemaInspection", + "shortDescription": { + "text": "Current console schema introspected" + }, + "fullDescription": { + "text": "Reports schemas and databases in the current session that are not introspected. For example, this warning might occur when you try to create a table in the schema that is not introspected. Introspection is a method of inspecting a data source. When you perform introspection, structural information in the data source is inspected to detect tables, columns, functions, and other elements with their attributes.", + "markdown": "Reports schemas and databases in the current session that are not introspected.\n\nFor example, this warning might occur when you try to create a table in the schema that is not introspected.\n\nIntrospection is a method of inspecting a data source. When you perform introspection, structural information in the data source is\ninspected to detect tables, columns, functions, and other elements with their attributes." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlCurrentSchemaInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlMisleadingReferenceInspection", + "shortDescription": { + "text": "Misleading references" + }, + "fullDescription": { + "text": "Reports ambiguous references in SQL code. For example, when a name refer to both a table column and a routine parameter. The execution of such code might lead to errors or unexpected results due to counter-intuitive resolution logic. Usually, names with a more local scope have higher priority. Example (PostgreSQL): 'CREATE TABLE foo\n(\n id INT,\n name VARCHAR(5)\n);\nCREATE FUNCTION func(name VARCHAR(5)) RETURNS INT AS\n$$\nDECLARE\n b INT;\nBEGIN\n -- `name` is ambiguous as it is used as a column name and a parameter\n SELECT COUNT(*) INTO b FROM foo t WHERE t.name = name;\n RETURN b;\nEND;\n$$ LANGUAGE plpgsql;' In PostgreSQL, you can use the '#variable_conflict' directives to explicitly specify a correct reference. For example, use '#variable_conflict use_column' to refer to a column name, or '#variable_conflict use_variable' to refer to a parameter. 'CREATE TABLE foo\n(\n id INT,\n name VARCHAR(5)\n);\nCREATE FUNCTION func(name VARCHAR(5)) RETURNS INT AS\n$$\n #variable_conflict use_column\nDECLARE\n b INT;\nBEGIN\n SELECT COUNT(*) INTO b FROM foo t WHERE t.name = name;\n RETURN b;\nEND;\n$$ LANGUAGE plpgsql;'", + "markdown": "Reports ambiguous references in SQL code.\n\nFor example, when a name refer to both a table column and a routine parameter. The execution of such code might lead to errors or unexpected\nresults due to counter-intuitive resolution logic. Usually, names with a more local scope have higher priority.\n\nExample (PostgreSQL):\n\n CREATE TABLE foo\n (\n id INT,\n name VARCHAR(5)\n );\n CREATE FUNCTION func(name VARCHAR(5)) RETURNS INT AS\n $$\n DECLARE\n b INT;\n BEGIN\n -- `name` is ambiguous as it is used as a column name and a parameter\n SELECT COUNT(*) INTO b FROM foo t WHERE t.name = name;\n RETURN b;\n END;\n $$ LANGUAGE plpgsql;\n\nIn PostgreSQL, you can use the `#variable_conflict` directives to explicitly specify a correct reference. For example,\nuse `#variable_conflict use_column` to refer to a column name, or `#variable_conflict use_variable` to refer to a\nparameter.\n\n CREATE TABLE foo\n (\n id INT,\n name VARCHAR(5)\n );\n CREATE FUNCTION func(name VARCHAR(5)) RETURNS INT AS\n $$\n #variable_conflict use_column\n DECLARE\n b INT;\n BEGIN\n SELECT COUNT(*) INTO b FROM foo t WHERE t.name = name;\n RETURN b;\n END;\n $$ LANGUAGE plpgsql;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlMisleadingReference", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlRedundantLimitInspection", + "shortDescription": { + "text": "Redundant row limiting in queries" + }, + "fullDescription": { + "text": "Reports redundant row limiting clauses like FETCH and LIMIT in queries. Example (PostgreSQL): 'CREATE TABLE foo(a INT);\n\nSELECT * FROM foo WHERE EXISTS(SELECT * FROM foo LIMIT 2);\nSELECT * FROM foo WHERE EXISTS(SELECT * FROM foo FETCH FIRST 2 ROWS ONLY);' To fix the warning, you can add OFFSET to limiting clauses. If OFFSET is missing, then LIMIT is redundant because the usage of LIMIT does not influence the operation result of EXISTS. In case with OFFSET, we skip first 'N' rows and this will influence the output. 'SELECT * FROM foo WHERE EXISTS(SELECT * FROM foo OFFSET 1 ROW LIMIT 2);\nSELECT * FROM foo WHERE EXISTS(SELECT * FROM foo OFFSET 1 ROW FETCH FIRST 2 ROWS ONLY);'", + "markdown": "Reports redundant row limiting clauses like FETCH and LIMIT in queries.\n\nExample (PostgreSQL):\n\n CREATE TABLE foo(a INT);\n\n SELECT * FROM foo WHERE EXISTS(SELECT * FROM foo LIMIT 2);\n SELECT * FROM foo WHERE EXISTS(SELECT * FROM foo FETCH FIRST 2 ROWS ONLY);\n\nTo fix the warning, you can add OFFSET to limiting clauses. If OFFSET is missing, then LIMIT is redundant because\nthe usage of LIMIT does not influence the operation result of EXISTS. In case with OFFSET, we skip first `N` rows and this will\ninfluence the output.\n\n SELECT * FROM foo WHERE EXISTS(SELECT * FROM foo OFFSET 1 ROW LIMIT 2);\n SELECT * FROM foo WHERE EXISTS(SELECT * FROM foo OFFSET 1 ROW FETCH FIRST 2 ROWS ONLY);\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlRedundantLimit", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlInsertNullIntoNotNullInspection", + "shortDescription": { + "text": "Insert NULL into NOT NULL column" + }, + "fullDescription": { + "text": "Reports cases when you insert NULL values into columns that accept only NOT NULL values. Example (Microsoft SQL Server): 'CREATE TABLE br2 (\nid INT NOT NULL,\ncol1 NVARCHAR (20) NOT NULL,\ncol2 NVARCHAR (20) NOT NULL,\n);\n--\nINSERT INTO br2 (id, col1, col2)\nVALUES (1, NULL, NULL);' You cannot insert NULL values in 'col1' and 'col2' because they are defined as NOT NULL. If you run the script as is, you will receive an error. To fix this code, replace NULL in the VALUES part with some values (for example, '42' and ''bird''). INSERT INTO br2 (id, col1, col2)\nVALUES (1, 42, 'bird');", + "markdown": "Reports cases when you insert NULL values into columns that accept only NOT NULL values.\n\nExample (Microsoft SQL Server):\n\n CREATE TABLE br2 (\n id INT NOT NULL,\n col1 NVARCHAR (20) NOT NULL,\n col2 NVARCHAR (20) NOT NULL,\n );\n --\n INSERT INTO br2 (id, col1, col2)\n VALUES (1, NULL, NULL);\n\nYou cannot insert NULL values in `col1` and `col2` because they are defined as NOT NULL. If you run the script as\nis,\nyou will receive an error. To fix this code, replace NULL in the VALUES part with some values (for example, `42` and\n`'bird'`).\n\n```\nINSERT INTO br2 (id, col1, col2)\nVALUES (1, 42, 'bird');\n```" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlInsertNullIntoNotNull", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlDerivedTableAliasInspection", + "shortDescription": { + "text": "Each derived table should have alias" + }, + "fullDescription": { + "text": "Reports derived tables without aliases. Example (MySQL): 'CREATE TABLE table1 (id INT, name VARCHAR(20), cats FLOAT);\nCREATE TABLE table2 (id INT, age INTEGER);\n\nSELECT id AS ID, name, cats, age\nFROM (SELECT table1.id, name, cats, age\nFROM table1\nJOIN table2 ON table1.id = table2.id);' According to Derived Tables at dev.mysql.com, an alias is mandatory. You can add the alias by using the Introduce alias quick-fix. After the quick-fix is applied: 'SELECT id AS ID, name, cats, age\nFROM (SELECT table1.id, name, cats, age\nFROM table1\nJOIN table2 ON table1.id = table2.id);'", + "markdown": "Reports derived tables without aliases.\n\nExample (MySQL):\n\n CREATE TABLE table1 (id INT, name VARCHAR(20), cats FLOAT);\n CREATE TABLE table2 (id INT, age INTEGER);\n\n SELECT id AS ID, name, cats, age\n FROM (SELECT table1.id, name, cats, age\n FROM table1\n JOIN table2 ON table1.id = table2.id);\n\nAccording to [Derived Tables at dev.mysql.com](https://dev.mysql.com/doc/refman/8.0/en/derived-tables.html), an alias is\nmandatory. You can add the alias by using the **Introduce alias** quick-fix.\n\nAfter the quick-fix is applied:\n\n SELECT id AS ID, name, cats, age\n FROM (SELECT table1.id, name, cats, age\n FROM table1\n JOIN table2 ON table1.id = table2.id);\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlDerivedTableAlias", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlTriggerTransitionInspection", + "shortDescription": { + "text": "Suspicious code in triggers" + }, + "fullDescription": { + "text": "Reports incorrect usages of transition table variables in triggers. Example (HSQLDB): 'CREATE TABLE foo(a INT);\n\nCREATE TRIGGER trg\n AFTER DELETE ON foo\nBEGIN\n SELECT * FROM NEW;\nEND;\n\nCREATE TRIGGER trig AFTER INSERT ON foo\n REFERENCING OLD ROW AS newrow\n FOR EACH ROW WHEN (a > 1)\n INSERT INTO foo VALUES (1)' In HSQLDB, DELETE triggers may be used only with the OLD state while INSERT triggers may have only the NEW state. So, in the previous example, NEW in 'SELECT * FROM NEW;' will be highlighted as well as OLD in 'REFERENCING OLD ROW AS newrow'.", + "markdown": "Reports incorrect usages of transition table variables in triggers.\n\nExample (HSQLDB):\n\n CREATE TABLE foo(a INT);\n\n CREATE TRIGGER trg\n AFTER DELETE ON foo\n BEGIN\n SELECT * FROM NEW;\n END;\n\n CREATE TRIGGER trig AFTER INSERT ON foo\n REFERENCING OLD ROW AS newrow\n FOR EACH ROW WHEN (a > 1)\n INSERT INTO foo VALUES (1)\n\nIn HSQLDB, DELETE triggers may be used only with the OLD state while INSERT triggers may have only the NEW state. So, in the previous\nexample, NEW in `SELECT * FROM NEW;` will be highlighted as well as OLD in `REFERENCING OLD ROW AS newrow`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlTriggerTransition", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlNamedArgumentsInspection", + "shortDescription": { + "text": "Named arguments should be used" + }, + "fullDescription": { + "text": "Reports arguments that are used without names in routine calls. By default, this inspection is disabled. For more information about the difference between named and unnamed parameters, see Binding Parameters by Name (Named Parameters) at docs.microsoft.com . Example (Microsoft SQL Server): 'CREATE FUNCTION foo(n INT, m INT) RETURNS INT AS\nBEGIN\n RETURN n + m;\nEND;\n\nCREATE PROCEDURE test AS\nBEGIN\n foo n = 1, m = 2;\n\n--- The following call misses parameter names and will be highlighted\n foo 1, 2;\nEND;' Parameters '1, 2' in the 'foo 1, 2;' call are highlighted because they miss names.", + "markdown": "Reports arguments that are used without names in routine calls. By default, this inspection is disabled.\n\nFor more information about the difference between named and unnamed parameters, see [Binding Parameters by Name (Named Parameters) at docs.microsoft.com](https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/binding-parameters-by-name-named-parameters).\n\nExample (Microsoft SQL Server):\n\n CREATE FUNCTION foo(n INT, m INT) RETURNS INT AS\n BEGIN\n RETURN n + m;\n END;\n\n CREATE PROCEDURE test AS\n BEGIN\n foo n = 1, m = 2;\n\n --- The following call misses parameter names and will be highlighted\n foo 1, 2;\n END;\n\nParameters `1, 2` in the `foo 1, 2;` call are highlighted because they miss names." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlNamedArguments", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlCaseVsCoalesceInspection", + "shortDescription": { + "text": "Using CASE instead of COALESCE function and vice versa" + }, + "fullDescription": { + "text": "Reports situations when CASE and COALESCE calls are interchangeable. This inspection has the following intention actions: Replace with 'COALESCE' call and the opposite one Replace with CASE expression. Example (MySQL): 'SELECT\n -- this CASE may be replaced by COALESCE\n\tCASE\n\t\tWHEN C1 IS NOT NULL THEN C1\n\t\tELSE 0\n\t\tEND\nFROM dual;' In the example, the CASE statement can be replaced with 'SELECT COALESCE(C1, 0)' that produces the same output. If you prefer using CASE expressions, select the Prefer CASE expressions over COALESCE function option on the inspection page.", + "markdown": "Reports situations when CASE and COALESCE calls are interchangeable. This inspection has the following intention actions: **Replace\nwith 'COALESCE' call** and the opposite one **Replace with CASE expression** .\n\nExample (MySQL):\n\n SELECT\n -- this CASE may be replaced by COALESCE\n \tCASE\n \t\tWHEN C1 IS NOT NULL THEN C1\n \t\tELSE 0\n \t\tEND\n FROM dual;\n\nIn the example, the CASE statement can be replaced with `SELECT COALESCE(C1, 0)` that produces the same output.\n\nIf you prefer using CASE expressions, select the **Prefer CASE expressions over COALESCE function** option on\nthe inspection page." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlCaseVsCoalesce", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlRedundantAliasInspection", + "shortDescription": { + "text": "Redundant alias expressions" + }, + "fullDescription": { + "text": "Reports alias expressions that duplicate names of columns in tables and might be redundant. Example (PostgreSQL): 'CREATE TABLE foo(a INT, b INT);\n\nSELECT * FROM foo foo(a, b);\nSELECT * FROM foo foo(a);\nSELECT * FROM foo foo(x);\nSELECT * FROM foo foo(x, y);' The first two aliases use the same column names as in the 'foo' table. They are considered redundant because they column names are identical.", + "markdown": "Reports alias expressions that duplicate names of columns in tables and might be redundant.\n\nExample (PostgreSQL):\n\n CREATE TABLE foo(a INT, b INT);\n\n SELECT * FROM foo foo(a, b);\n SELECT * FROM foo foo(a);\n SELECT * FROM foo foo(x);\n SELECT * FROM foo foo(x, y);\n\nThe first two aliases use the same column names as in the `foo` table. They are considered redundant because they\ncolumn names are identical." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlRedundantAlias", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlTransactionStatementInTriggerInspection", + "shortDescription": { + "text": "Use of transaction management statements in triggers" + }, + "fullDescription": { + "text": "Reports usages of transaction management statements like COMMIT or ROLLBACK in trigger bodies. With COMMIT or ROLLBACK statements in a trigger body, the trigger will not compile. The fail happens because triggers start during transactions. When the trigger starts the current transaction is still not complete. As COMMIT terminates a transaction, both statements (COMMIT and ROLLBACK) would lead to an exception. Changes that are executed in a trigger should be committed (or rolled back) by the owning transaction that started the trigger. Example (Oracle): 'CREATE TABLE employee_audit\n(\n id INT NOT NULL,\n update_date DATE NOT NULL,\n old_name VARCHAR2(100),\n new_name VARCHAR2(100)\n);\n\nCREATE TABLE employees\n(\n id INT NOT NULL,\n name VARCHAR2(100) NOT NULL\n);\n\nCREATE OR REPLACE TRIGGER trig_commit\n AFTER UPDATE OF name\n ON employees\n FOR EACH ROW\nBEGIN\n INSERT INTO employee_audit VALUES (:old.id, SYSDATE, :old.name, :new.name);\n COMMIT;\nEND;\n\nCREATE OR REPLACE TRIGGER trig_rollback\n AFTER UPDATE OF name\n ON employees\n FOR EACH ROW\nBEGIN\n INSERT INTO employee_audit VALUES (:old.id, SYSDATE, :old.name, :new.name);\n ROLLBACK;\nEND;'", + "markdown": "Reports usages of transaction management statements like COMMIT or ROLLBACK in trigger bodies.\n\nWith COMMIT or ROLLBACK statements in a trigger body, the trigger will not compile.\nThe fail happens because triggers start during transactions. When the trigger starts the current transaction is still not complete. As\nCOMMIT\nterminates a transaction, both statements (COMMIT and ROLLBACK) would lead to an exception.\nChanges that are executed in a trigger should be committed (or rolled back) by the owning transaction that started the trigger.\n\nExample (Oracle):\n\n CREATE TABLE employee_audit\n (\n id INT NOT NULL,\n update_date DATE NOT NULL,\n old_name VARCHAR2(100),\n new_name VARCHAR2(100)\n );\n\n CREATE TABLE employees\n (\n id INT NOT NULL,\n name VARCHAR2(100) NOT NULL\n );\n\n CREATE OR REPLACE TRIGGER trig_commit\n AFTER UPDATE OF name\n ON employees\n FOR EACH ROW\n BEGIN\n INSERT INTO employee_audit VALUES (:old.id, SYSDATE, :old.name, :new.name);\n COMMIT;\n END;\n\n CREATE OR REPLACE TRIGGER trig_rollback\n AFTER UPDATE OF name\n ON employees\n FOR EACH ROW\n BEGIN\n INSERT INTO employee_audit VALUES (:old.id, SYSDATE, :old.name, :new.name);\n ROLLBACK;\n END;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlTransactionStatementInTrigger", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlRedundantCodeInCoalesceInspection", + "shortDescription": { + "text": "Redundant code in COALESCE call" + }, + "fullDescription": { + "text": "Reports all the arguments except for the first expression that does not evaluate to NULL in COALESCE functions. Example (MySQL): 'SELECT COALESCE(NULL, NULL, NULL, 42, NULL, 'string') as a;' The first NOT NULL argument is '42', all other arguments will be grayed out.", + "markdown": "Reports all the arguments except for the first expression that does not evaluate to NULL in COALESCE functions.\n\nExample (MySQL):\n\n SELECT COALESCE(NULL, NULL, NULL, 42, NULL, 'string') as a;\n\nThe first NOT NULL argument is `42`, all other arguments will be grayed out." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlRedundantCodeInCoalesce", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlAggregatesInspection", + "shortDescription": { + "text": "Aggregate-related problems" + }, + "fullDescription": { + "text": "Reports invalid usages of SQL aggregate functions. The following situations are considered: Columns that are used in HAVING and ORDER BY clauses but are missed in GROUP BY clauses. 'CREATE TABLE foo(id INT PRIMARY KEY, a INT, b INT);\nSELECT a, MAX(b) FROM foo GROUP BY a HAVING b > 0;\nSELECT * FROM foo GROUP BY a ORDER BY b;' This rule does not apply when grouping is made by the primary key. 'SELECT * FROM foo GROUP BY id ORDER BY b;' Aggregate functions in a wrong context. Usually, you can use aggregate functions in the following contexts: a list of expressions in SELECT; in HAVING and ORDER BY sections; and other dialect-specific cases. The following queries will display an error. 'SELECT a FROM foo WHERE MAX(b) > 0;\nSELECT a FROM foo GROUP BY MAX(a);' Nested calls of aggregate functions. 'SELECT MAX(SUM(a)) FROM foo GROUP BY a;' This rule does not apply to analytic functions. The following query is valid and correct. 'SELECT MAX(SUM(a) OVER ()) FROM foo;' Usages of HAVING without aggregate functions. In this case, consider rewriting your code using the WHERE section. 'SELECT a, MAX(b) FROM foo GROUP BY a HAVING a > 0;'", + "markdown": "Reports invalid usages of SQL aggregate functions.\n\nThe following situations are considered:\n\n* Columns that are used in HAVING and ORDER BY clauses but are missed in GROUP BY clauses.\n\n CREATE TABLE foo(id INT PRIMARY KEY, a INT, b INT);\n SELECT a, MAX(b) FROM foo GROUP BY a HAVING b > 0;\n SELECT * FROM foo GROUP BY a ORDER BY b;\n\n This rule does not apply when grouping is made by the primary key.\n\n SELECT * FROM foo GROUP BY id ORDER BY b;\n\n* Aggregate functions in a wrong context. Usually, you can use aggregate functions in the following contexts: a list of expressions in\n SELECT; in HAVING and ORDER BY sections; and other dialect-specific cases. The following queries will display an error.\n\n SELECT a FROM foo WHERE MAX(b) > 0;\n SELECT a FROM foo GROUP BY MAX(a);\n\n* Nested calls of aggregate functions.\n\n SELECT MAX(SUM(a)) FROM foo GROUP BY a;\n\n This rule does not apply to analytic functions. The following query is valid and correct.\n\n SELECT MAX(SUM(a) OVER ()) FROM foo;\n\n* Usages of HAVING without aggregate functions. In this case, consider rewriting your code using the WHERE section.\n\n SELECT a, MAX(b) FROM foo GROUP BY a HAVING a > 0;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlAggregates", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlConstantExpressionInspection", + "shortDescription": { + "text": "Constant expression" + }, + "fullDescription": { + "text": "Reports conditions and expressions that are always true, false or null. Example (MySQL): 'CREATE TABLE t1 (a TEXT, b INT, c BOOLEAN);\nSELECT a FROM t1 WHERE 'Cat' = 'Cat';\nSELECT a FROM t1 WHERE 'Cat' = null;' The ''Cat' = 'Cat'' is always true and will be reported. The ''Cat' = null' is always null and will be reported.", + "markdown": "Reports conditions and expressions that are always true, false or null.\n\nExample (MySQL):\n\n CREATE TABLE t1 (a TEXT, b INT, c BOOLEAN);\n SELECT a FROM t1 WHERE 'Cat' = 'Cat';\n SELECT a FROM t1 WHERE 'Cat' = null;\n\nThe `'Cat' = 'Cat'` is always true and will be reported.\n\nThe `'Cat' = null` is always null and will be reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlConstantExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlMissingColumnAliasesInspection", + "shortDescription": { + "text": "Missing column aliases" + }, + "fullDescription": { + "text": "Reports queries without explicit aliases in output expressions (for example, in the SELECT statement). Example (PostgreSQL): 'CREATE TABLE foo(a INT, b INT);\n\nSELECT 1, a + 1 AS A2, MAX(b) AS M\nFROM foo;'", + "markdown": "Reports queries without explicit aliases in output expressions (for example, in the SELECT statement).\n\nExample (PostgreSQL):\n\n CREATE TABLE foo(a INT, b INT);\n\n SELECT 1, a + 1 AS A2, MAX(b) AS M\n FROM foo;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlMissingColumnAliases", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlAddNotNullColumnInspection", + "shortDescription": { + "text": "Adding not null column without default value" + }, + "fullDescription": { + "text": "Reports attempts to create NOT NULL columns without DEFAULT values. Example (Microsoft SQL Server): 'CREATE TABLE foo (a INT, b INT)\n\nALTER TABLE foo ADD c INT NOT NULL;' By default, a column holds NULL values. In the example, we use the NOT NULL constraint that enforces a column not to accept NULL values. If we prohibit to use NULL values, we must set the DEFAULT value that SQL can use when we create a new record. 'ALTER TABLE foo ADD c INT NOT NULL DEFAULT 42;' You can quickly add the DEFAULT value by using the Add DEFAULT value quick-fix.", + "markdown": "Reports attempts to create NOT NULL columns without DEFAULT values.\n\nExample (Microsoft SQL Server):\n\n CREATE TABLE foo (a INT, b INT)\n\n ALTER TABLE foo ADD c INT NOT NULL;\n\nBy default, a column holds NULL values. In the example, we use the NOT NULL constraint that enforces a column not to accept NULL values.\nIf we prohibit to use NULL values, we must set the DEFAULT value that SQL can use when we create a new record.\n\n ALTER TABLE foo ADD c INT NOT NULL DEFAULT 42;\n\nYou can quickly add the DEFAULT value by using the **Add DEFAULT value** quick-fix." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlAddNotNullColumn", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OraMissingBodyInspection", + "shortDescription": { + "text": "Missing body for package/object type specification" + }, + "fullDescription": { + "text": "Reports package and object type specifications that are missing body declarations. Package specifications and object types that declare routines as well as package specifications with cursors must have body declarations where those routines and cursors are implemented. Absence of a body leads to a runtime error when routines or cursors are invoked in program code. Example (Oracle): 'CREATE OR REPLACE PACKAGE ppp IS\n FUNCTION foo(a INT) RETURN INT;\nEND;'", + "markdown": "Reports package and object type specifications that are missing body declarations.\n\nPackage specifications and object types that declare routines as well as package specifications with cursors must have body\ndeclarations where those routines and cursors are implemented. Absence of a body leads to a runtime error when routines or cursors are\ninvoked in program code.\n\nExample (Oracle):\n\n CREATE OR REPLACE PACKAGE ppp IS\n FUNCTION foo(a INT) RETURN INT;\n END;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlMissingBody", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Oracle", + "index": 73, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OraUnmatchedForwardDeclarationInspection", + "shortDescription": { + "text": "Forward declaration without definition" + }, + "fullDescription": { + "text": "Reports declarations of procedures and functions that are missing their implementation in code. In Oracle, you can declare a procedure or a function without its body, and write the implementation later. The inspection will report names of such procedures or functions that are left without implementation. Example (Oracle): 'DECLARE PROCEDURE foo(a int, b varchar2);\nBEGIN\n NULL;\nEND;' The 'foo' procedure is declared but is missing implementation. We can add the implementation to get rid of the error. 'DECLARE PROCEDURE foo(a int, b varchar2);\n PROCEDURE foo(a int, b varchar2) IS\nBEGIN\n NULL;\nEND;\nBEGIN\n NULL;\nEND;'", + "markdown": "Reports declarations of procedures and functions that are missing their implementation in code.\n\nIn Oracle, you can declare a procedure or a function without its body, and write the implementation later. The inspection will report names\nof such procedures or functions that are left without implementation.\n\nExample (Oracle):\n\n DECLARE PROCEDURE foo(a int, b varchar2);\n BEGIN\n NULL;\n END;\n\nThe `foo` procedure is declared but is missing implementation. We can add the implementation to get rid of the error.\n\n DECLARE PROCEDURE foo(a int, b varchar2);\n PROCEDURE foo(a int, b varchar2) IS\n BEGIN\n NULL;\n END;\n BEGIN\n NULL;\n END;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "SqlUnmatchedForwardDeclaration", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Oracle", + "index": 73, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MongoJSExtResolveInspection", + "shortDescription": { + "text": "Resolution problems" + }, + "fullDescription": { + "text": "Reports unresolved references in MongoDB and JavaScript code.", + "markdown": "Reports unresolved references in MongoDB and JavaScript code." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MongoJSResolve", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "MongoJS", + "index": 75, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlWithoutWhereInspection", + "shortDescription": { + "text": "Delete or update statement without where clauses" + }, + "fullDescription": { + "text": "Reports usages of DELETE or UPDATE statements without WHERE clauses. Without WHERE clauses, DELETE drops all the data from the table, and UPDATE overwrites values for all the table rows. Example (MySQL): 'CREATE TABLE t1 (a TEXT, b INT, c BOOLEAN);\nupdate t1 set a = 'Smith';\ndelete from t1;'", + "markdown": "Reports usages of DELETE or UPDATE statements without WHERE clauses.\n\nWithout WHERE clauses, DELETE drops all the data from the table, and UPDATE overwrites values for all the table rows.\n\nExample (MySQL):\n\n CREATE TABLE t1 (a TEXT, b INT, c BOOLEAN);\n update t1 set a = 'Smith';\n delete from t1;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlWithoutWhere", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlUnusedCteInspection", + "shortDescription": { + "text": "Unused common table expression" + }, + "fullDescription": { + "text": "Reports unused common table expressions (CTE) inside the query. Example (PostgreSQL): 'CREATE TABLE foo(a INT);\n\nWITH a AS (SELECT 1 AS x FROM foo)\nSELECT 1 + 2 FROM foo;' By using WITH, we create a temporary named result set with the name 'a', also known as a common table expression (CTE). But we do not use this CTE later in the code. The unused CTE is greyed out.", + "markdown": "Reports unused common table expressions (CTE) inside the query.\n\nExample (PostgreSQL):\n\n CREATE TABLE foo(a INT);\n\n WITH a AS (SELECT 1 AS x FROM foo)\n SELECT 1 + 2 FROM foo;\n\nBy using WITH, we create a temporary named result set with the name `a`, also known as a common table expression (CTE). But\nwe do not use this CTE later in the code. The unused CTE is greyed out." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlUnusedCte", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MongoJSResolveInspection", + "shortDescription": { + "text": "Resolution problems" + }, + "fullDescription": { + "text": "Reports unresolved references in MongoDB and JavaScript code. Example: 'db\nuse foo\n -- a reference to a non-existing collection\ndb.non_existing_collection\ndb['non_existing_collection']\ndb['non_existing_collection'].find().hasNext()' The 'non_existing_collection' collection does not exist in the database and will be reported.", + "markdown": "Reports unresolved references in MongoDB and JavaScript code.\n\nExample:\n\n db\n use foo\n -- a reference to a non-existing collection\n db.non_existing_collection\n db['non_existing_collection']\n db['non_existing_collection'].find().hasNext()\n\nThe `non_existing_collection` collection does not exist in the database and will be reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MongoJSResolve", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "MongoJS", + "index": 75, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MongoJSSideEffectsInspection", + "shortDescription": { + "text": "Statement with side effects" + }, + "fullDescription": { + "text": "Reports statements that can cause side effects while the data source is in read-only mode. For more information about enabling read-only mode, see Enable read-only mode for a connection in the IDE documentation. The Disable read-only mode quick-fix turns off the read-only mode for the respective data source. Example: 'db.my_collection.insertOne()'", + "markdown": "Reports statements that can cause side effects while the data source is in read-only mode.\n\nFor more information about enabling read-only mode, see\n[Enable\nread-only mode for a connection in the IDE documentation](https://www.jetbrains.com/help/datagrip/configuring-database-connections.html#enable-read-only-mode-for-a-connection).\n\nThe **Disable read-only mode** quick-fix turns off the read-only mode for the respective data source.\n\nExample:\n\n\n db.my_collection.insertOne()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MongoJSSideEffects", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "MongoJS", + "index": 75, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MongoJSExtSideEffectsInspection", + "shortDescription": { + "text": "Statement with side effects" + }, + "fullDescription": { + "text": "Reports statements that may cause side effects while the data source is in read-only mode. The quick-fix turns off the read-only mode for the respective data source. Example: 'db.my_collection.insertOne()'", + "markdown": "Reports statements that may cause side effects while the data source is in read-only mode.\n\nThe quick-fix turns off the read-only mode for the respective data source.\n\nExample:\n\n\n db.my_collection.insertOne()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MongoJSSideEffects", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "MongoJS", + "index": 75, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlUnusedSubqueryItemInspection", + "shortDescription": { + "text": "Unused subquery item" + }, + "fullDescription": { + "text": "Reports columns, aliases, and other subquery items that are not referenced in the outer query expression. Example (PostgreSQL): 'CREATE TABLE for_subquery(id INT);\nSELECT a, q FROM (SELECT 1 AS a, 10 AS b, 2 + 3 AS q, id\n FROM for_subquery) x;' We reference 'a' and 'q' aliases from a subquery. But the 'b' alias and the 'id' column are not referenced in the outer SELECT statement. Therefore, 'b' and 'id' are grayed out.", + "markdown": "Reports columns, aliases, and other subquery items that are not referenced in the outer query expression.\n\nExample (PostgreSQL):\n\n CREATE TABLE for_subquery(id INT);\n SELECT a, q FROM (SELECT 1 AS a, 10 AS b, 2 + 3 AS q, id\n FROM for_subquery) x;\n\nWe reference `a` and `q` aliases from a subquery. But the `b` alias and the `id` column are\nnot referenced in the outer SELECT statement. Therefore, `b` and `id` are grayed out." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlUnused", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlSideEffectsInspection", + "shortDescription": { + "text": "Statement with side effects" + }, + "fullDescription": { + "text": "Reports statements that might lead to modification of a database during a read-only connection. To enable read-only mode for a connection, right-click a data source in the Database tool window (View | Tool Windows | Database) and select Properties. In the Data Sources and Drivers dialog, click the Options tab and select the Read-only checkbox. Example (MySQL): 'CREATE TABLE foo(a INT);\nINSERT INTO foo VALUES (1);' As 'CREATE TABLE' and 'INSERT INTO' statements lead to a database modification, these statements will be highlighted in read-only connection mode.", + "markdown": "Reports statements that might lead to modification of a database during a read-only connection.\n\nTo enable read-only mode for a\nconnection,\nright-click a data source in the **Database** tool window (**View \\| Tool Windows \\| Database** ) and select **Properties** .\nIn the **Data Sources and Drivers** dialog, click the **Options** tab and select the **Read-only** checkbox.\n\nExample (MySQL):\n\n CREATE TABLE foo(a INT);\n INSERT INTO foo VALUES (1);\n\nAs `CREATE TABLE` and `INSERT INTO` statements lead to a database modification, these statements will be highlighted\nin read-only connection mode." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlSideEffects", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlIllegalCursorStateInspection", + "shortDescription": { + "text": "Illegal cursor state" + }, + "fullDescription": { + "text": "Reports illegal cursor states inside SQL routines. A routine has CLOSE or FETCH statements but a cursor might be closed. A routine has the OPEN statement but a cursor might be opened. Example (Microsoft SQL Server): 'CREATE TABLE t(col INT);\n\nCREATE PROCEDURE foo() AS\nBEGIN\nDECLARE my_cursor CURSOR FOR SELECT * FROM t;\nDECLARE a INT;\nFETCH my_cursor INTO a;\nCLOSE my_cursor;\nEND;' According to CLOSE (Transact-SQL) at docs.microsoft.com, CLOSE must be issued on an open cursor, and CLOSE is not allowed on cursors that have only been declared or are already closed. So, we need to open the cursor to fix the warning. 'CREATE PROCEDURE foo() AS\nBEGIN\nDECLARE my_cursor CURSOR FOR SELECT * FROM t;\nDECLARE a INT;\nOPEN my_cursor;\nFETCH my_cursor INTO a;\nCLOSE my_cursor;\nEND;'", + "markdown": "Reports illegal cursor states inside SQL routines.\n\n* A routine has CLOSE or FETCH statements but a cursor might be closed.\n* A routine has the OPEN statement but a cursor might be opened.\n\nExample (Microsoft SQL Server):\n\n CREATE TABLE t(col INT);\n\n CREATE PROCEDURE foo() AS\n BEGIN\n DECLARE my_cursor CURSOR FOR SELECT * FROM t;\n DECLARE a INT;\n FETCH my_cursor INTO a;\n CLOSE my_cursor;\n END;\n\nAccording to [CLOSE (Transact-SQL) at\ndocs.microsoft.com](https://docs.microsoft.com/en-us/sql/t-sql/language-elements/close-transact-sql), CLOSE must be issued on an open cursor, and CLOSE is not allowed on cursors that have only been declared or are\nalready closed. So, we need to open the cursor to fix the warning.\n\n CREATE PROCEDURE foo() AS\n BEGIN\n DECLARE my_cursor CURSOR FOR SELECT * FROM t;\n DECLARE a INT;\n OPEN my_cursor;\n FETCH my_cursor INTO a;\n CLOSE my_cursor;\n END;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlIllegalCursorState", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlJoinWithoutOnInspection", + "shortDescription": { + "text": "Unsafe 'join' clause in 'delete' statement" + }, + "fullDescription": { + "text": "Reports missing conditional checks for statements that might modify the whole database. For example, usages of JOIN clauses inside DELETE statements without ON or WHERE. Without conditional checks on JOIN, DELETE drops contents of the entire table. Example (MySQL): 'CREATE TABLE foo (a INT,b INT,c INT);\nCREATE TABLE bar (a INT,b INT,c INT);\n\nDELETE table1 FROM foo table1 INNER JOIN bar table2;'", + "markdown": "Reports missing conditional checks for statements that might modify the whole database.\n\nFor example, usages of JOIN clauses inside DELETE statements without ON or WHERE. Without conditional checks on JOIN, DELETE drops\ncontents of the entire table.\n\nExample (MySQL):\n\n CREATE TABLE foo (a INT,b INT,c INT);\n CREATE TABLE bar (a INT,b INT,c INT);\n\n DELETE table1 FROM foo table1 INNER JOIN bar table2;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlJoinWithoutOn", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlDropIndexedColumnInspection", + "shortDescription": { + "text": "Index is dependent on column" + }, + "fullDescription": { + "text": "Reports cases when you try to drop columns from indexed tables. This inspection is available in Microsoft SQL Server and Sybase ASE. Example (Microsoft SQL Server): 'CREATE TABLE test_index\n(\ncol INT NOT NULL,\ncol2 INT NOT NULL,\ncol3 INT NOT NULL UNIQUE,\ncol4 VARCHAR(200)\n);\n\nCREATE UNIQUE INDEX aaaa ON test_index (col, col2);\n\nALTER TABLE test_index\nDROP COLUMN col;' You cannot delete the 'col' column because it is in the indexed table. To delete the column, you need to delete the 'aaaa' index first (for example, DROP INDEX aaaa).", + "markdown": "Reports cases when you try to drop columns from indexed tables. This inspection is available in Microsoft SQL Server and Sybase ASE.\n\nExample (Microsoft SQL Server):\n\n CREATE TABLE test_index\n (\n col INT NOT NULL,\n col2 INT NOT NULL,\n col3 INT NOT NULL UNIQUE,\n col4 VARCHAR(200)\n );\n\n CREATE UNIQUE INDEX aaaa ON test_index (col, col2);\n\n ALTER TABLE test_index\n DROP COLUMN col;\n\nYou cannot delete the `col` column because it is in the indexed table. To delete the column, you need to delete the\n`aaaa` index first (for example, DROP INDEX aaaa)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlDropIndexedColumn", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlCheckUsingColumnsInspection", + "shortDescription": { + "text": "Check using clause columns" + }, + "fullDescription": { + "text": "Reports columns in the USING clause that does not exist in both tables. Example (MySQL): 'CREATE TABLE t1 (i INT, j INT);\nCREATE TABLE t2 (k INT, l INT);\nSELECT * FROM t1 JOIN t2 USING (j);' In USING clauses, a column name must be present in both tables, and the SELECT query will automatically join those tables by using the given column name. As we do not have the 'j' column in 't2', we can rewrite the query using ON. The ON clause can join tables where the column names do not match in both tables. 'SELECT * FROM t1 JOIN t2 ON t1.j = t2.l;'", + "markdown": "Reports columns in the USING clause that does not exist in both tables.\n\nExample (MySQL):\n\n CREATE TABLE t1 (i INT, j INT);\n CREATE TABLE t2 (k INT, l INT);\n SELECT * FROM t1 JOIN t2 USING (j);\n\nIn USING clauses, a column name must be present in both tables, and the SELECT query will automatically join\nthose tables by using the given column name. As we do not have the `j` column in `t2`, we can\nrewrite the query using ON. The ON clause can join tables where the column names do not match in both tables.\n\n SELECT * FROM t1 JOIN t2 ON t1.j = t2.l;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlCheckUsingColumns", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlConstantConditionInspection", + "shortDescription": { + "text": "Constant condition" + }, + "fullDescription": { + "text": "Reports conditions in WHERE or JOIN clauses that are always TRUE or always FALSE. Example (MySQL): 'CREATE TABLE t1 (a TEXT, b INT, c BOOLEAN);\nSELECT a FROM t1 WHERE 'Cat' = 'Cat';' The ''Cat' = 'Cat'' is always true and will be reported.", + "markdown": "Reports conditions in WHERE or JOIN clauses that are always TRUE or always FALSE.\n\nExample (MySQL):\n\n CREATE TABLE t1 (a TEXT, b INT, c BOOLEAN);\n SELECT a FROM t1 WHERE 'Cat' = 'Cat';\n\nThe `'Cat' = 'Cat'` is always true and will be reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlConstantCondition", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlDialectInspection", + "shortDescription": { + "text": "SQL dialect detection" + }, + "fullDescription": { + "text": "Reports situations when a dialect is not assigned to an SQL file. For example, when you open a new SQL file without assigning a dialect to it, you see a notification where the best matching dialect is advised. Click the Use link to use the advised dialect. Alternatively, click the Change dialect to link to select the other dialect.", + "markdown": "Reports situations when a dialect is not assigned to an SQL file.\n\nFor example, when you open a new SQL file without assigning a dialect\nto it, you see a notification where the best matching dialect is advised. Click the **Use \\** link to use the advised\ndialect. Alternatively, click the **Change dialect to** link to select the other dialect." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlDialectInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MongoJSExtDeprecationInspection", + "shortDescription": { + "text": "Deprecated element" + }, + "fullDescription": { + "text": "Reports usages of deprecated methods in MongoDB and JavaScript code. The quick-fix replaces deprecated methods with recommended alternatives. Example: 'db.my_collection.insert()' After the quick-fix is applied: 'db.my_collection.insertOne()'", + "markdown": "Reports usages of deprecated methods in MongoDB and JavaScript code.\n\nThe quick-fix replaces deprecated methods with recommended alternatives.\n\nExample:\n\n\n db.my_collection.insert()\n\nAfter the quick-fix is applied:\n\n\n db.my_collection.insertOne()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MongoJSDeprecation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "MongoJS", + "index": 75, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlDuplicateColumnInspection", + "shortDescription": { + "text": "Duplicating column name in SELECT" + }, + "fullDescription": { + "text": "Reports duplicated names of column aliases in SELECT lists. Example (Sybase ASE): 'CREATE TABLE t1 (a TEXT, b INT, c INT);\n\nSELECT a AS x, b AS x FROM t1;' The 'x' alias name is used for 'a' and 'b' columns. These assignments are highlighted as errors because you cannot use identical alias names for columns in Sybase ASE.", + "markdown": "Reports duplicated names of column aliases in SELECT lists.\n\nExample (Sybase ASE):\n\n CREATE TABLE t1 (a TEXT, b INT, c INT);\n\n SELECT a AS x, b AS x FROM t1;\n\nThe `x` alias name is used for `a` and `b` columns. These assignments are highlighted as errors because\nyou cannot use identical alias names for columns in Sybase ASE." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlDuplicateColumn", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MongoJSDeprecationInspection", + "shortDescription": { + "text": "Deprecated element" + }, + "fullDescription": { + "text": "Reports usages of deprecated methods in MongoDB and JavaScript code. The quick-fix replaces deprecated methods with recommended alternatives. Example: 'db.my_collection.insert()' After the quick-fix is applied: 'db.my_collection.insertOne()'", + "markdown": "Reports usages of deprecated methods in MongoDB and JavaScript code.\n\nThe quick-fix replaces deprecated methods with recommended alternatives.\n\nExample:\n\n db.my_collection.insert()\n\nAfter the quick-fix is applied:\n\n db.my_collection.insertOne()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MongoJSDeprecation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "MongoJS", + "index": 75, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlTypeInspection", + "shortDescription": { + "text": "Types compatibility" + }, + "fullDescription": { + "text": "Reports type-related errors.", + "markdown": "Reports type-related errors." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlType", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlUnicodeStringLiteralInspection", + "shortDescription": { + "text": "Unicode usage in SQL" + }, + "fullDescription": { + "text": "Reports string literals that use national characters without the 'N' prefix. Without the N prefix, the string is converted to the default code page of the database. This default code page may not recognize certain characters. For more information, see nchar and nvarchar (Transact-SQL) at docs.microsoft.com. Example (Microsoft SQL Server): 'SELECT 'abcde' AS a;\nSELECT N'abcde' AS b;\nSELECT 'абвгд' AS c;\nSELECT N'абвгд' AS d;' The 'SELECT 'абвгд' AS c;' does not have the 'N' prefix, the ''абвгд'' part will be highlighted.", + "markdown": "Reports string literals that use national characters without the `N` prefix.\n\nWithout the N prefix, the string is converted to the default\ncode page of the database. This default code page may not recognize certain characters. For more information, see\n[nchar and nvarchar\n(Transact-SQL)\nat docs.microsoft.com](https://docs.microsoft.com/en-us/sql/t-sql/data-types/nchar-and-nvarchar-transact-sql).\n\nExample (Microsoft SQL Server):\n\n SELECT 'abcde' AS a;\n SELECT N'abcde' AS b;\n SELECT 'абвгд' AS c;\n SELECT N'абвгд' AS d;\n\nThe `SELECT 'абвгд' AS c;` does not have the `N` prefix, the `'абвгд'` part will be highlighted." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlUnicodeStringLiteral", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlUnusedVariableInspection", + "shortDescription": { + "text": "Unused variable" + }, + "fullDescription": { + "text": "Reports unused arguments, variables, or parameters. Example (PostgreSQL): 'CREATE FUNCTION foo(PARAMUSED INT, PARAMUNUSED INT) RETURNS INT AS\n$$\nBEGIN\n RETURN PARAMUSED;\nEND\n$$ LANGUAGE plpgsql;' The 'PARAMUNUSED' parameter is not used in the function and might be deleted.", + "markdown": "Reports unused arguments, variables, or parameters.\n\nExample (PostgreSQL):\n\n CREATE FUNCTION foo(PARAMUSED INT, PARAMUNUSED INT) RETURNS INT AS\n $$\n BEGIN\n RETURN PARAMUSED;\n END\n $$ LANGUAGE plpgsql;\n\nThe `PARAMUNUSED` parameter is not used in the function and might be deleted." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlUnused", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PgSelectFromProcedureInspection", + "shortDescription": { + "text": "Postgres: Select from procedure call" + }, + "fullDescription": { + "text": "Reports situations when you make SELECT from a function or a DBLINK without an alias with a type (for example, 'AS t1(s VARCHAR)'). This requirement does not apply to scalar functions. Example (PostgreSQL): 'CREATE FUNCTION produce_a_table() RETURNS RECORD AS $$\nSELECT 1;\n$$ LANGUAGE sql;\nSELECT * FROM produce_a_table() AS s (c1 INT);\nSELECT * FROM produce_a_table() AS s (c1);\nSELECT * FROM DBLINK('dbname=mydb', 'SELECT proname, prosrc FROM pg_proc') AS t1;' The 'AS s (c1 INT)' has a typed alias, while 'AS s (c1)' and 'AS t1' do not. In this case, the second call of 'produce_a_table()' and 'DBLINK()' will be highlighted.", + "markdown": "Reports situations when you make SELECT from a function or a DBLINK without an alias with a type (for example, `AS t1(s VARCHAR)`).\n\nThis requirement does not apply to scalar functions.\n\nExample (PostgreSQL):\n\n CREATE FUNCTION produce_a_table() RETURNS RECORD AS $$\n SELECT 1;\n $$ LANGUAGE sql;\n SELECT * FROM produce_a_table() AS s (c1 INT);\n SELECT * FROM produce_a_table() AS s (c1);\n SELECT * FROM DBLINK('dbname=mydb', 'SELECT proname, prosrc FROM pg_proc') AS t1;\n\nThe `AS s (c1 INT)` has a typed alias, while `AS s (c1)` and `AS t1` do not.\nIn this case, the second call of `produce_a_table()` and `DBLINK()` will be highlighted." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "PgSelectFromProcedure", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PostgreSQL", + "index": 84, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlInsertIntoGeneratedColumnInspection", + "shortDescription": { + "text": "Insertion into generated columns" + }, + "fullDescription": { + "text": "Reports INSERT statements that assign values to generated columns. Generated columns can be read, but their values can not be directly written. Example (PostgreSQL): 'CREATE TABLE foo\n(\n col1 INT,\n col2 INT GENERATED ALWAYS AS (col1 + 1) STORED\n);\nINSERT INTO foo(col1, col2) VALUES (1, 2);'\n You cannot insert '2' into the 'col2' column because this column is generated. For this script to work, you can change '2' to DEFAULT. 'INSERT INTO foo(col1, col2) VALUES (1, DEFAULT);'", + "markdown": "Reports INSERT statements that assign values to generated columns. Generated columns can be read, but their values can not be directly written.\n\nExample (PostgreSQL):\n\n CREATE TABLE foo\n (\n col1 INT,\n col2 INT GENERATED ALWAYS AS (col1 + 1) STORED\n );\n INSERT INTO foo(col1, col2) VALUES (1, 2);\n\nYou cannot insert `2` into the `col2` column because this column is generated.\nFor this script to work, you can change `2` to DEFAULT.\n`INSERT INTO foo(col1, col2) VALUES (1, DEFAULT);`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlInsertIntoGeneratedColumn", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MsBuiltinInspection", + "shortDescription": { + "text": "Builtin functions" + }, + "fullDescription": { + "text": "Reports truncations of string arguments in ISNULL functions. The ISNULL syntax is 'ISNULL(check_expression, replacement_value)'. According to ISNULL at docs.microsoft.com, 'replacement_value' will be truncated if 'replacement_value' is longer than 'check_expression'. Example (Microsoft SQL Server): 'DECLARE @name1 VARCHAR(2) = NULL;\nDECLARE @name2 VARCHAR(10) = 'Example';\nDECLARE @name3 VARCHAR(2) = 'Hi';\n\n -- `@name2` is VARCHAR(10) and will be truncated\nSELECT ISNULL(@name1, @name2);\n\n -- `@name3` is VARCHAR(2) as `@name1` and will not be truncated\nSELECT ISNULL(@name1, @name3);'", + "markdown": "Reports truncations of string arguments in ISNULL functions.\n\nThe ISNULL syntax is `ISNULL(check_expression, replacement_value)`.\n\nAccording to [ISNULL at\ndocs.microsoft.com](https://docs.microsoft.com/en-us/sql/t-sql/functions/isnull-transact-sql), `replacement_value` will be truncated if `replacement_value` is longer than\n`check_expression`.\n\nExample (Microsoft SQL Server):\n\n DECLARE @name1 VARCHAR(2) = NULL;\n DECLARE @name2 VARCHAR(10) = 'Example';\n DECLARE @name3 VARCHAR(2) = 'Hi';\n\n -- `@name2` is VARCHAR(10) and will be truncated\n SELECT ISNULL(@name1, @name2);\n\n -- `@name3` is VARCHAR(2) as `@name1` and will not be truncated\n SELECT ISNULL(@name1, @name3);\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MssqlBuiltin", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL server", + "index": 85, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlMultipleLimitClausesInspection", + "shortDescription": { + "text": "Multiple row limiting/offset clauses in queries" + }, + "fullDescription": { + "text": "Reports usages of multiple row limiting clauses in a single query. Example (Microsoft SQL Server): 'create table foo(a int);\nselect top 1 * from foo order by a offset 10 rows fetch next 20 rows only;' The SELECT TOP clause is used to specify that only 1 record must be returned. The FETCH clause specifies the number of rows to return after the OFFSET clause has been processed. But as we already have the SELECT TOP limiting clause, the FETCH clause might be redundant.", + "markdown": "Reports usages of multiple row limiting clauses in a single query.\n\nExample (Microsoft SQL Server):\n\n create table foo(a int);\n select top 1 * from foo order by a offset 10 rows fetch next 20 rows only;\n\nThe SELECT TOP clause is used to specify that only 1 record must be\nreturned. The FETCH clause specifies the number of rows to return after the OFFSET\nclause has been processed. But as we already have the SELECT TOP limiting clause, the FETCH clause might be redundant." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlMultipleLimitClauses", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlIdentifierInspection", + "shortDescription": { + "text": "Identifier should be quoted" + }, + "fullDescription": { + "text": "Reports situations when you use SQL reserved keywords as identifier names in your query. Example (Microsoft SQL Server): 'CREATE TABLE select (identity INT IDENTITY NOT NULL, order INT NOT NULL);' We use 'select', 'identity', and 'order' as table and column names. But they are also reserved keywords in Microsoft SQL Server. Therefore, in order to use them as object names in the query, you must quote these identifiers. To quote them, you can use the Quote identifier quick-fix. After the quick-fix is applied: 'CREATE TABLE [select] ([identity] INT IDENTITY NOT NULL, [order] INT NOT NULL);'", + "markdown": "Reports situations when you use SQL reserved keywords as identifier names in your query.\n\nExample (Microsoft SQL Server):\n\n CREATE TABLE select (identity INT IDENTITY NOT NULL, order INT NOT NULL);\n\nWe use `select`, `identity`, and `order` as table and column names.\nBut they are also reserved keywords in Microsoft SQL Server.\nTherefore, in order to use them as object names in the query, you must quote these identifiers. To quote them, you can use the\n**Quote identifier** quick-fix.\n\nAfter the quick-fix is applied:\n\n CREATE TABLE [select] ([identity] INT IDENTITY NOT NULL, [order] INT NOT NULL);\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlIdentifier", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlStorageInspection", + "shortDescription": { + "text": "SQL source modification detection" + }, + "fullDescription": { + "text": "Reports situations when source code of a database object has been changed. The inspection is triggered when you perform database or object introspection. The introspection is run when you open source code of an object, run statements, and perform code refactoring. Also, you can run introspection by right-clicking an object and selecting Refresh. The inspection covers the following situations: Object source code was changed in the database but code in the editor was not updated. Works in PostgreSQL, Microsoft SQL Server, Oracle, and Sybase ASE. You changed the object source code, introspected the database, but source code has been already changed by someone else. The database introspector was updated in the IDE and you need to download new object properties that were missing in the previous introspector version.", + "markdown": "Reports situations when source code of a database object has been changed.\n\nThe inspection is triggered when you perform database or object introspection. The introspection is run when you open source code of an\nobject, run statements, and perform code refactoring.\nAlso, you can run introspection by right-clicking an object and selecting **Refresh**.\n\nThe inspection covers the following situations:\n\n* Object source code was changed in the database but code in the editor was not updated. Works in PostgreSQL, Microsoft SQL Server, Oracle, and Sybase ASE.\n* You changed the object source code, introspected the database, but source code has been already changed by someone else.\n* The database introspector was updated in the IDE and you need to download new object properties that were missing in the previous introspector version." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlStorageInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MsOrderByInspection", + "shortDescription": { + "text": "ORDER BY in queries" + }, + "fullDescription": { + "text": "Reports usages when the 'ORDER BY' clause is used without 'TOP', 'OFFSET', or 'FOR XML' in views, inline functions, derived tables, subqueries, and common table expressions. For more information about usages of 'ORDER BY', see SELECT - ORDER BY Clause (Transact-SQL) at docs.microsoft.com. Example (Microsoft SQL server): 'CREATE TABLE foo (a INT NOT NULL, b INT NOT NULL);\n\nSELECT *\nFROM (SELECT a, b\nFROM foo A\nWHERE a < 89\nORDER BY b) ALIAS;' In a subquery, ORDER BY will be highlighted as an error. You can add TOP, OFFSET, or FOR XML to a subquery. Alternatively, use the Delete element quick-fix to delete the ORDER BY section. After the quick-fix is applied: 'SELECT *\nFROM (SELECT a, b\nFROM foo A\nWHERE a < 89) ALIAS;'", + "markdown": "Reports usages when the `ORDER BY` clause is used without `TOP`, `OFFSET`, or `FOR XML` in views, inline functions, derived tables, subqueries, and common table expressions.\n\nFor more information about usages of `ORDER BY`, see [SELECT - ORDER BY Clause (Transact-SQL) at\ndocs.microsoft.com](https://docs.microsoft.com/en-us/sql/t-sql/queries/select-order-by-clause-transact-sql).\n\nExample (Microsoft SQL server):\n\n CREATE TABLE foo (a INT NOT NULL, b INT NOT NULL);\n\n SELECT *\n FROM (SELECT a, b\n FROM foo A\n WHERE a < 89\n ORDER BY b) ALIAS;\n\nIn a subquery, ORDER BY will be highlighted as an error. You can add TOP, OFFSET, or FOR XML to a subquery.\nAlternatively, use the **Delete element** quick-fix to delete the ORDER BY section.\n\nAfter the quick-fix is applied:\n\n SELECT *\n FROM (SELECT a, b\n FROM foo A\n WHERE a < 89) ALIAS;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "MsOrderBy", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "SQL server", + "index": 85, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlSignatureInspection", + "shortDescription": { + "text": "Function signature" + }, + "fullDescription": { + "text": "Reports signature issues for built-in functions. The inspection will report a wrong number of arguments, invalid keywords, wrong data types, and other issues. Example (MySQL): 'CREATE TABLE foo (a INT, b INT, c INT)\n\nSELECT IFNULL() FROM foo; -- error\nSELECT IFNULL(a) FROM foo; -- error\nSELECT IFNULL(a, b) FROM foo; -- OK\nSELECT IFNULL(a, b, c) FROM foo; -- error' In MySQL, the 'IFNULL()' function accepts strictly two arguments. So, only the 'SELECT IFNULL(a, b) FROM foo;' query is correct.", + "markdown": "Reports signature issues for built-in functions.\n\nThe inspection will report a wrong number of arguments, invalid keywords, wrong data types, and other issues.\n\nExample (MySQL):\n\n CREATE TABLE foo (a INT, b INT, c INT)\n\n SELECT IFNULL() FROM foo; -- error\n SELECT IFNULL(a) FROM foo; -- error\n SELECT IFNULL(a, b) FROM foo; -- OK\n SELECT IFNULL(a, b, c) FROM foo; -- error\n\nIn MySQL, the `IFNULL()` function accepts strictly two arguments. So, only the `SELECT IFNULL(a, b) FROM foo;`\nquery is correct." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlSignature", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlRedundantOrderingDirectionInspection", + "shortDescription": { + "text": "Redundant ordering direction" + }, + "fullDescription": { + "text": "Reports redundant ordering directions like ASC and DESC in ORDER BY clauses. Example (MySQL): 'CREATE TABLE foo(a INT, b INT, c INT);\nSELECT * FROM foo ORDER BY a ASC, b DESC, c ASC;' The ORDER BY keyword sorts the records in the ascending order by default. So, the 'ASC' keyword for 'a' and 'c' columns is redundant.", + "markdown": "Reports redundant ordering directions like ASC and DESC in ORDER BY clauses.\n\nExample (MySQL):\n\n CREATE TABLE foo(a INT, b INT, c INT);\n SELECT * FROM foo ORDER BY a ASC, b DESC, c ASC;\n\nThe ORDER BY keyword sorts the records in the ascending order by default. So, the `ASC` keyword for `a` and\n`c` columns is redundant." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlRedundantOrderingDirection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlDeprecateTypeInspection", + "shortDescription": { + "text": "Deprecated type" + }, + "fullDescription": { + "text": "Reports usages of types that are deprecated and might disappear in future versions of DBMS. Reported types: LONG in Oracle (see Deprecated and Desupported Features at docs.oracle.com). TEXT, NTEXT, and IMAGE in Microsoft SQL Server (see Deprecated Database Engine Features in SQL Server 2016 at docs.microsoft.com). Example (Oracle): 'CREATE TABLE ot.foo(\na NUMBER GENERATED BY DEFAULT AS IDENTITY,\nb LONG NOT NULL\n);'", + "markdown": "Reports usages of types that are deprecated and might disappear in future versions of DBMS.\n\nReported types:\n\n* LONG in Oracle (see [Deprecated\n and Desupported Features at docs.oracle.com](https://docs.oracle.com/cd/A91202_01/901_doc/server.901/a90120/ch4_dep.htm#6690)).\n* TEXT, NTEXT, and IMAGE in Microsoft SQL Server (see [Deprecated Database Engine Features in SQL Server 2016 at docs.microsoft.com](https://docs.microsoft.com/en-us/sql/database-engine/deprecated-database-engine-features-in-sql-server-2016?view=sql-server-ver15)).\n\nExample (Oracle):\n\n CREATE TABLE ot.foo(\n a NUMBER GENERATED BY DEFAULT AS IDENTITY,\n b LONG NOT NULL\n );\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlDeprecateType", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OraOverloadInspection", + "shortDescription": { + "text": "Overloading errors" + }, + "fullDescription": { + "text": "Reports invalid cases of subprogram overloading in Oracle. Example (Oracle): 'DECLARE\n SUBTYPE fff IS BINARY_INTEGER;\n SUBTYPE ggg IS NATURAL;\n PROCEDURE foo (a IN ggg) IS BEGIN NULL; END;\n PROCEDURE foo (a IN fff) IS BEGIN NULL; END;\nBEGIN\n NULL;\nEND;' You cannot overload subprograms which parameters differ only in subtypes. For example, you cannot overload procedures where one accepts a BINARY INTEGER parameter and the other accepts a NATURAL parameter. For more information about restrictions on procedure overloading, see Restrictions on Overloading at docs.oracle.com.", + "markdown": "Reports invalid cases of subprogram overloading in Oracle.\n\nExample (Oracle):\n\n DECLARE\n SUBTYPE fff IS BINARY_INTEGER;\n SUBTYPE ggg IS NATURAL;\n PROCEDURE foo (a IN ggg) IS BEGIN NULL; END;\n PROCEDURE foo (a IN fff) IS BEGIN NULL; END;\n BEGIN\n NULL;\n END;\n\nYou cannot overload subprograms which parameters differ only in subtypes. For example, you cannot overload procedures where one accepts a\nBINARY INTEGER parameter and the other accepts a NATURAL parameter. For more information about restrictions on procedure overloading,\nsee [Restrictions on Overloading at docs.oracle.com](https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/subprograms.htm)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlOverload", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Oracle", + "index": 73, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlGotoInspection", + "shortDescription": { + "text": "Usages of GOTO statements" + }, + "fullDescription": { + "text": "Reports usages of backward GOTO statements and GOTO statements used to exit a loop. The extensive use of GOTO statements is generally not recommended. For details, see GOTO statement in SQL procedures at ibm.com. Instead of jumping back to a previous statement using GOTO, consider using a loop. Instead of exiting the WHILE loop with GOTO, consider using other control-of-flow statements (for example, RETURN or BREAK). Example (Oracle): 'CREATE PROCEDURE test(n INT) AS\nDECLARE\n x INT;\nBEGIN\n x := 0;\n GOTO a;\n <
> x := 1;\n IF (n = 0) THEN\n GOTO a;\n END IF;\n WHILE TRUE\n LOOP\n GOTO b;\n END LOOP;\n <> x := 3;\nEND;'", + "markdown": "Reports usages of backward GOTO statements and GOTO statements used to exit a loop.\n\nThe extensive use of GOTO statements is generally\nnot recommended. For details, see [GOTO statement in\nSQL\nprocedures at ibm.com](https://www.ibm.com/docs/no/db2/11.5?topic=procedures-goto-statement-in-sql).\n\nInstead of jumping back to a previous statement using GOTO, consider using a loop.\n\nInstead of exiting the WHILE loop with GOTO, consider using other control-of-flow statements (for example, RETURN or BREAK).\n\nExample (Oracle):\n\n CREATE PROCEDURE test(n INT) AS\n DECLARE\n x INT;\n BEGIN\n x := 0;\n GOTO a;\n <> x := 1;\n IF (n = 0) THEN\n GOTO a;\n END IF;\n WHILE TRUE\n LOOP\n GOTO b;\n END LOOP;\n <> x := 3;\n END;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlGoto", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlAmbiguousColumnInspection", + "shortDescription": { + "text": "Ambiguous reference" + }, + "fullDescription": { + "text": "Reports columns that have identical names but belong to different tables. Example (MySQL): 'CREATE TABLE foo(id INT PRIMARY KEY);\nCREATE TABLE bar(id INT PRIMARY KEY);\n\nSELECT foo.id, bar.id FROM foo, bar WHERE id > 0;' The 'id' column appears in 'foo' and 'bar' tables. You need to qualify the column name to make the query correct. 'SELECT foo.id, bar.id FROM foo, bar WHERE foo.id > 0;'", + "markdown": "Reports columns that have identical names but belong to different tables.\n\nExample (MySQL):\n\n CREATE TABLE foo(id INT PRIMARY KEY);\n CREATE TABLE bar(id INT PRIMARY KEY);\n\n SELECT foo.id, bar.id FROM foo, bar WHERE id > 0;\n\nThe `id` column appears in `foo` and `bar` tables. You need to qualify the column name to\nmake the query correct.\n\n SELECT foo.id, bar.id FROM foo, bar WHERE foo.id > 0;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlAmbiguousColumn", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SqlNullComparisonInspection", + "shortDescription": { + "text": "Null comparison" + }, + "fullDescription": { + "text": "Reports comparisons with NULL that can be replaced with IS NULL or IS NOT NULL operators. Example (Microsoft SQL Server): 'CREATE TABLE foo ( id int );\n\nSELECT * FROM foo WHERE NULL = NULL;\nSELECT * FROM foo WHERE NULL != NULL;' The 'NULL = NULL' can be replaced with 'IS NULL', the 'NULL != NULL' comparison with 'IS NOT NULL'. To do this replacement, you can use Use IS NULL operator or Use IS NOT NULL operator quick-fixes. 'SELECT * FROM foo WHERE NULL IS NULL;\nSELECT * FROM foo WHERE NULL IS NOT NULL;'", + "markdown": "Reports comparisons with NULL that can be replaced with IS NULL or IS NOT NULL operators.\n\nExample (Microsoft SQL Server):\n\n CREATE TABLE foo ( id int );\n\n SELECT * FROM foo WHERE NULL = NULL;\n SELECT * FROM foo WHERE NULL != NULL;\n\nThe `NULL = NULL` can be replaced with `IS NULL`, the `NULL != NULL` comparison\nwith `IS NOT NULL`. To do this replacement, you can use **Use IS NULL operator** or **Use IS NOT NULL operator**\nquick-fixes.\n\n SELECT * FROM foo WHERE NULL IS NULL;\n SELECT * FROM foo WHERE NULL IS NOT NULL;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SqlNullComparison", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "SQL", + "index": 34, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "org.jetbrains.plugins.sass", + "version": "232.9881", + "rules": [ + { + "id": "SassScssResolvedByNameOnly", + "shortDescription": { + "text": "Missing import" + }, + "fullDescription": { + "text": "Reports a reference to a variable, mixin, or function that is declared in another file but this file isn't explicitly imported in the current file. Example: '* {\n margin: $var-in-other-file;\n}'", + "markdown": "Reports a reference to a variable, mixin, or function that is declared in another file but this file isn't explicitly [imported](https://sass-lang.com/documentation/at-rules/import) in the current file.\n\n**Example:**\n\n\n * {\n margin: $var-in-other-file;\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "SassScssResolvedByNameOnly", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "Sass/SCSS", + "index": 13, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SassScssUnresolvedVariable", + "shortDescription": { + "text": "Unresolved variable" + }, + "fullDescription": { + "text": "Reports an unresolved Sass/SCSS variable reference. Example: '* {\n margin: $unknown-var;\n}'", + "markdown": "Reports an unresolved [Sass/SCSS variable](https://sass-lang.com/documentation/variables) reference.\n\n**Example:**\n\n\n * {\n margin: $unknown-var;\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SassScssUnresolvedVariable", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Sass/SCSS", + "index": 13, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SassScssUnresolvedMixin", + "shortDescription": { + "text": "Unresolved mixin" + }, + "fullDescription": { + "text": "Reports an unresolved Sass/SCSS mixin reference. Example: '* {\n @include unknown-mixin;\n}'", + "markdown": "Reports an unresolved [Sass/SCSS mixin](https://sass-lang.com/documentation/at-rules/mixin) reference.\n\n**Example:**\n\n\n * {\n @include unknown-mixin;\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SassScssUnresolvedMixin", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Sass/SCSS", + "index": 13, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SassScssUnresolvedPlaceholderSelector", + "shortDescription": { + "text": "Unresolved placeholder selector" + }, + "fullDescription": { + "text": "Reports an unresolved Sass/SCSS placeholder selector reference. Example: '* {\n @extend %unknown-placeholder-selector;\n}'", + "markdown": "Reports an unresolved [Sass/SCSS placeholder selector](https://sass-lang.com/documentation/variables) reference.\n\n**Example:**\n\n\n * {\n @extend %unknown-placeholder-selector;\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SassScssUnresolvedPlaceholderSelector", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Sass/SCSS", + "index": 13, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.intellij", + "version": "232.9881.131", + "rules": [ + { + "id": "HtmlUnknownBooleanAttribute", + "shortDescription": { + "text": "Incorrect boolean attribute" + }, + "fullDescription": { + "text": "Reports an HTML non-boolean attribute without a value. Suggests configuring attributes that should not be reported.", + "markdown": "Reports an HTML non-boolean attribute without a value. Suggests configuring attributes that should not be reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlUnknownBooleanAttribute", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DuplicatedCode", + "shortDescription": { + "text": "Duplicated code fragment" + }, + "fullDescription": { + "text": "Reports duplicated blocks of code from the selected scope: the same file or the entire project. The inspection features quick-fixes that help you to set the size of detected duplicates, navigate to repetitive code fragments, and compare them in a tool window. The inspection options allow you to select the scope of the reported duplicated fragments and set the initial size for the duplicated language constructs.", + "markdown": "Reports duplicated blocks of code from the selected scope: the same file or the entire project.\n\nThe inspection features quick-fixes that help you to set the size of detected duplicates, navigate to repetitive code fragments, and compare them in a tool window.\n\nThe inspection options allow you to select the scope of the reported duplicated fragments and set the initial size for the duplicated language constructs." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "DuplicatedCode", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "InconsistentLineSeparators", + "shortDescription": { + "text": "Inconsistent line separators" + }, + "fullDescription": { + "text": "Reports files with line separators different from the ones that are specified in the project's settings. For example, the inspection will be triggered if you set the line separator to '\\n' in Settings | Editor | Code Style | Line separator, while the file you are editing uses '\\r\\n' as a line separator. The inspection also warns you about mixed line separators within a file.", + "markdown": "Reports files with line separators different from the ones that are specified in the project's settings.\n\nFor example, the inspection will be triggered if you set the line separator to `\\n` in\n[Settings \\| Editor \\| Code Style \\| Line separator](settings://preferences.sourceCode?Line%20separator),\nwhile the file you are editing uses `\\r\\n` as a line separator.\n\nThe inspection also warns you about mixed line separators within a file." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "InconsistentLineSeparators", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSuppression", + "shortDescription": { + "text": "Redundant suppression" + }, + "fullDescription": { + "text": "Reports usages of the following elements that can be safely removed because the inspection they affect is no longer applicable in this context: '@SuppressWarning' annotation, or '// noinspection' line comment, or '/** noinspection */' JavaDoc comment Example: 'public class C {\n // symbol is already private,\n // but annotation is still around\n @SuppressWarnings({\"WeakerAccess\"})\n private boolean CONST = true;\n void f() {\n CONST = false;\n }\n}'", + "markdown": "Reports usages of the following elements that can be safely removed because the inspection they affect is no longer applicable in this context:\n\n* `@SuppressWarning` annotation, or\n* `// noinspection` line comment, or\n* `/** noinspection */` JavaDoc comment\n\nExample:\n\n\n public class C {\n // symbol is already private,\n // but annotation is still around\n @SuppressWarnings({\"WeakerAccess\"})\n private boolean CONST = true;\n void f() {\n CONST = false;\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "RedundantSuppression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProblematicWhitespace", + "shortDescription": { + "text": "Problematic whitespace" + }, + "fullDescription": { + "text": "Reports the following problems: Tabs used for indentation when the code style is configured to use only spaces. Spaces used for indentation when the code style is configured to use only tabs. Spaces used for indentation and tabs used for alignment when the code style is configured to use smart tabs.", + "markdown": "Reports the following problems:\n\n* Tabs used for indentation when the code style is configured to use only spaces.\n* Spaces used for indentation when the code style is configured to use only tabs.\n* Spaces used for indentation and tabs used for alignment when the code style is configured to use smart tabs." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ProblematicWhitespace", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlUnknownTarget", + "shortDescription": { + "text": "Unresolved file in a link" + }, + "fullDescription": { + "text": "Reports an unresolved file in a link.", + "markdown": "Reports an unresolved file in a link." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlUnknownTarget", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LongLine", + "shortDescription": { + "text": "Line is longer than allowed by code style" + }, + "fullDescription": { + "text": "Reports lines that are longer than the Hard wrap at parameter specified in Settings | Editor | Code Style | General.", + "markdown": "Reports lines that are longer than the **Hard wrap at** parameter specified in [Settings \\| Editor \\| Code Style \\| General](settings://preferences.sourceCode?Hard%20wrap%20at)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "LongLine", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XmlWrongRootElement", + "shortDescription": { + "text": "Wrong root element" + }, + "fullDescription": { + "text": "Reports a root tag name different from the name specified in the '' tag.", + "markdown": "Reports a root tag name different from the name specified in the `` tag." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "XmlWrongRootElement", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlUnknownAttribute", + "shortDescription": { + "text": "Unknown attribute" + }, + "fullDescription": { + "text": "Reports an unknown HTML attribute. Suggests configuring attributes that should not be reported.", + "markdown": "Reports an unknown HTML attribute. Suggests configuring attributes that should not be reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlUnknownAttribute", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpRedundantEscape", + "shortDescription": { + "text": "Redundant character escape" + }, + "fullDescription": { + "text": "Reports redundant character escape sequences that can be replaced with unescaped characters preserving the meaning. Many escape sequences that are necessary outside of a character class are redundant inside square brackets '[]' of a character class. Although unescaped opening curly braces '{' outside of character classes are allowed in some dialects (JavaScript, Python, and so on), it can cause confusion and make the pattern less portable, because there are dialects that require escaping curly braces as characters. For this reason the inspection does not report escaped opening curly braces. Example: '\\-\\;[\\.]' After the quick-fix is applied: '-;[.]' The Ignore escaped closing brackets '}' and ']' option specifies whether to report '\\}' and '\\]' outside of a character class when they are allowed to be unescaped by the RegExp dialect. New in 2017.3", + "markdown": "Reports redundant character escape sequences that can be replaced with unescaped characters preserving the meaning. Many escape sequences that are necessary outside of a character class are redundant inside square brackets `[]` of a character class.\n\n\nAlthough unescaped opening curly braces `{` outside of character classes are allowed in some dialects (JavaScript, Python, and so on),\nit can cause confusion and make the pattern less portable, because there are dialects that require escaping curly braces as characters.\nFor this reason the inspection does not report escaped opening curly braces.\n\n**Example:**\n\n\n \\-\\;[\\.]\n\nAfter the quick-fix is applied:\n\n\n -;[.]\n\n\nThe **Ignore escaped closing brackets '}' and '\\]'** option specifies whether to report `\\}` and `\\]` outside of a character class\nwhen they are allowed to be unescaped by the RegExp dialect.\n\nNew in 2017.3" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpRedundantEscape", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CustomRegExpInspection", + "shortDescription": { + "text": "Custom RegExp inspection" + }, + "fullDescription": { + "text": "Custom Regex Inspection", + "markdown": "Custom Regex Inspection" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "CustomRegExpInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IncorrectFormatting", + "shortDescription": { + "text": "Incorrect formatting" + }, + "fullDescription": { + "text": "Reports formatting issues that appear if your code doesn't follow your project's code style settings. This inspection is not compatible with languages that require third-party formatters for code formatting, for example, Go or C with CLangFormat enabled.", + "markdown": "Reports formatting issues that appear if your code doesn't\nfollow your project's code style settings.\n\n\nThis inspection is not compatible with languages that require\nthird-party formatters for code formatting, for example, Go or\nC with CLangFormat enabled." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "IncorrectFormatting", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlExtraClosingTag", + "shortDescription": { + "text": "Redundant closing tag" + }, + "fullDescription": { + "text": "Reports redundant closing tags on empty elements, for example, 'img' or 'br'. Example: '\n \n

\n \n ' After the quick-fix is applied: '\n \n
\n \n '", + "markdown": "Reports redundant closing tags on empty elements, for example, `img` or `br`.\n\n**Example:**\n\n\n \n \n

\n \n \n\nAfter the quick-fix is applied:\n\n\n \n \n
\n \n \n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlExtraClosingTag", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpUnexpectedAnchor", + "shortDescription": { + "text": "Begin or end anchor in unexpected position" + }, + "fullDescription": { + "text": "Reports '^' or '\\A' anchors not at the beginning of the pattern and '$', '\\Z' or '\\z' anchors not at the end of the pattern. In the wrong position these RegExp anchors prevent the pattern from matching anything. In case of the '^' and '$' anchors, most likely the literal character was meant and the escape forgotten. Example: '(Price $10)' New in 2018.1", + "markdown": "Reports `^` or `\\A` anchors not at the beginning of the pattern and `$`, `\\Z` or `\\z` anchors not at the end of the pattern. In the wrong position these RegExp anchors prevent the pattern from matching anything. In case of the `^` and `$` anchors, most likely the literal character was meant and the escape forgotten.\n\n**Example:**\n\n\n (Price $10)\n\n\nNew in 2018.1" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpUnexpectedAnchor", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SpellCheckingInspection", + "shortDescription": { + "text": "Typo" + }, + "fullDescription": { + "text": "Reports typos and misspellings in your code, comments, and literals and fixes them with one click.", + "markdown": "Reports typos and misspellings in your code, comments, and literals and fixes them with one click." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "SpellCheckingInspection", + "ideaSeverity": "TYPO", + "qodanaSeverity": "Low" + } + }, + "relationships": [ + { + "target": { + "id": "Proofreading", + "index": 57, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CheckXmlFileWithXercesValidator", + "shortDescription": { + "text": "Failed external validation" + }, + "fullDescription": { + "text": "Reports a discrepancy in an XML file with the specified DTD or schema detected by the Xerces validator.", + "markdown": "Reports a discrepancy in an XML file with the specified DTD or schema detected by the Xerces validator." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CheckXmlFileWithXercesValidator", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlUnknownTag", + "shortDescription": { + "text": "Unknown tag" + }, + "fullDescription": { + "text": "Reports an unknown HTML tag. Suggests configuring tags that should not be reported.", + "markdown": "Reports an unknown HTML tag. Suggests configuring tags that should not be reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlUnknownTag", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpEscapedMetaCharacter", + "shortDescription": { + "text": "Escaped meta character" + }, + "fullDescription": { + "text": "Reports escaped meta characters. Some RegExp coding styles specify that meta characters should be placed inside a character class, to make the regular expression easier to understand. This inspection does not warn about the meta character '[', ']' and '^', because those would need additional escaping inside a character class. Example: '\\d+\\.\\d+' After the quick-fix is applied: '\\d+[.]\\d+' New in 2017.1", + "markdown": "Reports escaped meta characters. Some RegExp coding styles specify that meta characters should be placed inside a character class, to make the regular expression easier to understand. This inspection does not warn about the meta character `[`, `]` and `^`, because those would need additional escaping inside a character class.\n\n**Example:**\n\n\n \\d+\\.\\d+\n\nAfter the quick-fix is applied:\n\n\n \\d+[.]\\d+\n\nNew in 2017.1" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "RegExpEscapedMetaCharacter", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XmlHighlighting", + "shortDescription": { + "text": "XML highlighting" + }, + "fullDescription": { + "text": "Reports XML validation problems in the results of a batch code inspection.", + "markdown": "Reports XML validation problems in the results of a batch code inspection." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "XmlHighlighting", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XmlDuplicatedId", + "shortDescription": { + "text": "Duplicate 'id' attribute" + }, + "fullDescription": { + "text": "Reports a duplicate 'id' attribute in XML.", + "markdown": "Reports a duplicate `id` attribute in XML." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "XmlDuplicatedId", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpDuplicateCharacterInClass", + "shortDescription": { + "text": "Duplicate character in character class" + }, + "fullDescription": { + "text": "Reports duplicate characters inside a RegExp character class. Duplicate characters are unnecessary and can be removed without changing the semantics of the regex. Example: '[aabc]' After the quick-fix is applied: '[abc]'", + "markdown": "Reports duplicate characters inside a RegExp character class. Duplicate characters are unnecessary and can be removed without changing the semantics of the regex.\n\n**Example:**\n\n\n [aabc]\n\nAfter the quick-fix is applied:\n\n\n [abc]\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpDuplicateCharacterInClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XmlUnboundNsPrefix", + "shortDescription": { + "text": "Unbound namespace prefix" + }, + "fullDescription": { + "text": "Reports an unbound namespace prefix in XML.", + "markdown": "Reports an unbound namespace prefix in XML." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "XmlUnboundNsPrefix", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RequiredAttributes", + "shortDescription": { + "text": "Missing required attribute" + }, + "fullDescription": { + "text": "Reports a missing mandatory attribute in an XML/HTML tag. Suggests configuring attributes that should not be reported.", + "markdown": "Reports a missing mandatory attribute in an XML/HTML tag. Suggests configuring attributes that should not be reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "RequiredAttributes", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XmlUnusedNamespaceDeclaration", + "shortDescription": { + "text": "Unused schema declaration" + }, + "fullDescription": { + "text": "Reports an unused namespace declaration or location hint in XML.", + "markdown": "Reports an unused namespace declaration or location hint in XML." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "XmlUnusedNamespaceDeclaration", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpRedundantClassElement", + "shortDescription": { + "text": "Redundant '\\d', '[:digit:]', or '\\D' class elements" + }, + "fullDescription": { + "text": "Reports redundant '\\d' or '[:digit:]' that are used in one class with '\\w' or '[:word:]' ('\\D' with '\\W') and can be removed. Example: '[\\w\\d]' After the quick-fix is applied: '[\\w]' New in 2022.2", + "markdown": "Reports redundant `\\d` or `[:digit:]` that are used in one class with `\\w` or `[:word:]` (`\\D` with `\\W`) and can be removed.\n\n**Example:**\n\n\n [\\w\\d]\n\nAfter the quick-fix is applied:\n\n\n [\\w]\n\nNew in 2022.2" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "RegExpRedundantClassElement", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpSimplifiable", + "shortDescription": { + "text": "Regular expression can be simplified" + }, + "fullDescription": { + "text": "Reports regular expressions that can be simplified. Example: '[a] xx* [ah-hz]' After the quick-fix is applied: 'a x+ [ahz]' New in 2022.1", + "markdown": "Reports regular expressions that can be simplified.\n\n**Example:**\n\n\n [a] xx* [ah-hz]\n\nAfter the quick-fix is applied:\n\n\n a x+ [ahz]\n\nNew in 2022.1" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "suppressToolId": "RegExpSimplifiable", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpEmptyAlternationBranch", + "shortDescription": { + "text": "Empty branch in alternation" + }, + "fullDescription": { + "text": "Reports empty branches in a RegExp alternation. An empty branch will only match the empty string, and in most cases that is not what is desired. This inspection will not report a single empty branch at the start or the end of an alternation. Example: '(alpha||bravo)' After the quick-fix is applied: '(alpha|bravo)' New in 2017.2", + "markdown": "Reports empty branches in a RegExp alternation. An empty branch will only match the empty string, and in most cases that is not what is desired. This inspection will not report a single empty branch at the start or the end of an alternation.\n\n**Example:**\n\n\n (alpha||bravo)\n\nAfter the quick-fix is applied:\n\n\n (alpha|bravo)\n\nNew in 2017.2" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpEmptyAlternationBranch", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XmlPathReference", + "shortDescription": { + "text": "Unresolved file reference" + }, + "fullDescription": { + "text": "Reports an unresolved file reference in XML.", + "markdown": "Reports an unresolved file reference in XML." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "XmlPathReference", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpUnnecessaryNonCapturingGroup", + "shortDescription": { + "text": "Unnecessary non-capturing group" + }, + "fullDescription": { + "text": "Reports unnecessary non-capturing groups, which have no influence on the match result. Example: 'Everybody be cool, (?:this) is a robbery!' After the quick-fix is applied: 'Everybody be cool, this is a robbery!' New in 2021.1", + "markdown": "Reports unnecessary non-capturing groups, which have no influence on the match result.\n\n**Example:**\n\n\n Everybody be cool, (?:this) is a robbery!\n\nAfter the quick-fix is applied:\n\n\n Everybody be cool, this is a robbery!\n\nNew in 2021.1" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpUnnecessaryNonCapturingGroup", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TodoComment", + "shortDescription": { + "text": "TODO comment" + }, + "fullDescription": { + "text": "Reports TODO comments in your code. You can configure the format for TODO comments in Settings | Editor | TODO. Enable the Only warn on TODO comments without any details option to only warn on empty TODO comments, that don't provide any description on the task that should be done. Disable to report all TODO comments.", + "markdown": "Reports **TODO** comments in your code.\n\nYou can configure the format for **TODO** comments in [Settings \\| Editor \\| TODO](settings://preferences.toDoOptions).\n\nEnable the **Only warn on TODO comments without any details** option to only warn on empty TODO comments, that\ndon't provide any description on the task that should be done. Disable to report all TODO comments." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "TodoComment", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Json5StandardCompliance", + "shortDescription": { + "text": "Compliance with JSON5 standard" + }, + "fullDescription": { + "text": "Reports inconsistency with the language specification in a JSON5 file.", + "markdown": "Reports inconsistency with [the language specification](http://json5.org) in a JSON5 file." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "Json5StandardCompliance", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JSON and JSON5", + "index": 71, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlWrongAttributeValue", + "shortDescription": { + "text": "Wrong attribute value" + }, + "fullDescription": { + "text": "Reports an incorrect HTML attribute value.", + "markdown": "Reports an incorrect HTML attribute value." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlWrongAttributeValue", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XmlDefaultAttributeValue", + "shortDescription": { + "text": "Redundant attribute with default value" + }, + "fullDescription": { + "text": "Reports a redundant assignment of the default value to an XML attribute.", + "markdown": "Reports a redundant assignment of the default value to an XML attribute." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "XmlDefaultAttributeValue", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JsonSchemaCompliance", + "shortDescription": { + "text": "Compliance with JSON schema" + }, + "fullDescription": { + "text": "Reports inconsistence between a JSON file and the JSON schema that is assigned to it.", + "markdown": "Reports inconsistence between a JSON file and the [JSON schema](https://json-schema.org) that is assigned to it. " + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JsonSchemaCompliance", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JSON and JSON5", + "index": 71, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyDirectory", + "shortDescription": { + "text": "Empty directory" + }, + "fullDescription": { + "text": "Reports empty directories. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor. Use the Only report empty directories located under a source folder option to have only directories under source roots reported.", + "markdown": "Reports empty directories.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor.\n\nUse the **Only report empty directories located under a source folder** option to have only directories under source\nroots reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EmptyDirectory", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CheckDtdRefs", + "shortDescription": { + "text": "Unresolved DTD reference" + }, + "fullDescription": { + "text": "Reports inconsistency in a DTD-specific reference, for example, in a reference to an XML entity or to a DTD element declaration. Works in DTD an XML files.", + "markdown": "Reports inconsistency in a DTD-specific reference, for example, in a reference to an XML entity or to a DTD element declaration. Works in DTD an XML files." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CheckDtdRefs", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NonAsciiCharacters", + "shortDescription": { + "text": "Non-ASCII characters" + }, + "fullDescription": { + "text": "Reports code elements that use non-ASCII symbols in an unusual context. Example: Non-ASCII characters used in identifiers, strings, or comments. Identifiers written in different languages, such as 'myСollection' with the letter 'C' written in Cyrillic. Comments or strings containing Unicode symbols, such as long dashes and arrows.", + "markdown": "Reports code elements that use non-ASCII symbols in an unusual context.\n\nExample:\n\n* Non-ASCII characters used in identifiers, strings, or comments.\n* Identifiers written in different languages, such as `my`**С**`ollection` with the letter **C** written in Cyrillic.\n* Comments or strings containing Unicode symbols, such as long dashes and arrows." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NonAsciiCharacters", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Internationalization", + "index": 74, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LossyEncoding", + "shortDescription": { + "text": "Lossy encoding" + }, + "fullDescription": { + "text": "Reports characters that cannot be displayed because of the current document encoding. Examples: If you type international characters in a document with the US-ASCII charset, some characters will be lost on save. If you load a UTF-8-encoded file using the ISO-8859-1 one-byte charset, some characters will be displayed incorrectly. You can fix this by changing the file encoding either by specifying the encoding directly in the file, e.g. by editing 'encoding=' attribute in the XML prolog of XML file, or by changing the corresponding options in Settings | Editor | File Encodings.", + "markdown": "Reports characters that cannot be displayed because of the current document encoding.\n\nExamples:\n\n* If you type international characters in a document with the **US-ASCII** charset, some characters will be lost on save.\n* If you load a **UTF-8** -encoded file using the **ISO-8859-1** one-byte charset, some characters will be displayed incorrectly.\n\nYou can fix this by changing the file encoding\neither by specifying the encoding directly in the file, e.g. by editing `encoding=` attribute in the XML prolog of XML file,\nor by changing the corresponding options in **Settings \\| Editor \\| File Encodings**." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "LossyEncoding", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Internationalization", + "index": 74, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IgnoreFileDuplicateEntry", + "shortDescription": { + "text": "Ignore file duplicates" + }, + "fullDescription": { + "text": "Reports duplicate entries (patterns) in the ignore file (e.g. .gitignore, .hgignore). Duplicate entries in these files are redundant and can be removed. Example: '# Output directories\n /out/\n /target/\n /out/'", + "markdown": "Reports duplicate entries (patterns) in the ignore file (e.g. .gitignore, .hgignore). Duplicate entries in these files are redundant and can be removed.\n\nExample:\n\n\n # Output directories\n /out/\n /target/\n /out/\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "IgnoreFileDuplicateEntry", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Version control", + "index": 77, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JsonStandardCompliance", + "shortDescription": { + "text": "Compliance with JSON standard" + }, + "fullDescription": { + "text": "Reports the following discrepancies of a JSON file with the language specification: A line or block comment (configurable). Multiple top-level values (expect for JSON Lines files, configurable for others). A trailing comma in an object or array (configurable). A single quoted string. A property key is a not a double quoted strings. A NaN or Infinity/-Infinity numeric value as a floating point literal (configurable).", + "markdown": "Reports the following discrepancies of a JSON file with [the language specification](https://tools.ietf.org/html/rfc7159):\n\n* A line or block comment (configurable).\n* Multiple top-level values (expect for JSON Lines files, configurable for others).\n* A trailing comma in an object or array (configurable).\n* A single quoted string.\n* A property key is a not a double quoted strings.\n* A NaN or Infinity/-Infinity numeric value as a floating point literal (configurable)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "JsonStandardCompliance", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JSON and JSON5", + "index": 71, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JsonSchemaDeprecation", + "shortDescription": { + "text": "Deprecated JSON property" + }, + "fullDescription": { + "text": "Reports a deprecated property in a JSON file. Note that deprecation mechanism is not defined in the JSON Schema specification yet, and this inspection uses a non-standard extension 'deprecationMessage'.", + "markdown": "Reports a deprecated property in a JSON file. \nNote that deprecation mechanism is not defined in the JSON Schema specification yet, and this inspection uses a non-standard extension 'deprecationMessage'." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JsonSchemaDeprecation", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JSON and JSON5", + "index": 71, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JsonSchemaRefReference", + "shortDescription": { + "text": "Unresolved '$ref' and '$schema' references" + }, + "fullDescription": { + "text": "Reports an unresolved '$ref' or '$schema' path in a JSON schema.", + "markdown": "Reports an unresolved `$ref` or `$schema` path in a JSON schema. " + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JsonSchemaRefReference", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JSON and JSON5", + "index": 71, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SSBasedInspection", + "shortDescription": { + "text": "Structural search inspection" + }, + "fullDescription": { + "text": "Allows configuring Structural Search/Structural Replace templates that you can apply to the file you are editing. All matches will be highlighted and marked with the template name that you have configured. If you configure the Structural Replace pattern as well, the corresponding replace option will be available as a quick-fix.", + "markdown": "Allows configuring **Structural Search/Structural Replace** templates that you can apply to the file you are editing.\n\nAll matches will be highlighted and marked with the template name that you have configured.\nIf you configure the **Structural Replace** pattern as well, the corresponding replace option will be available as a quick-fix." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SSBasedInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Structural search", + "index": 78, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CheckValidXmlInScriptTagBody", + "shortDescription": { + "text": "Malformed content of 'script' tag" + }, + "fullDescription": { + "text": "Reports contents of 'script' tags that are invalid XML. Example: '' After the quick-fix is applied: ''", + "markdown": "Reports contents of `script` tags that are invalid XML. \n\n**Example:**\n\n\n \n\nAfter the quick-fix is applied:\n\n\n \n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CheckValidXmlInScriptTagBody", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpSuspiciousBackref", + "shortDescription": { + "text": "Suspicious back reference" + }, + "fullDescription": { + "text": "Reports back references that will not be resolvable at runtime. This means that the back reference can never match anything. A back reference will not be resolvable when the group is defined after the back reference, or if the group is defined in a different branch of an alternation. Example of a group defined after its back reference: '\\1(abc)' Example of a group and a back reference in different branches: 'a(b)c|(xy)\\1z' New in 2022.1", + "markdown": "Reports back references that will not be resolvable at runtime. This means that the back reference can never match anything. A back reference will not be resolvable when the group is defined after the back reference, or if the group is defined in a different branch of an alternation.\n\n**Example of a group defined after its back reference:**\n\n\n \\1(abc)\n\n**Example of a group and a back reference in different branches:**\n\n\n a(b)c|(xy)\\1z\n\nNew in 2022.1" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpSuspiciousBackref", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpSingleCharAlternation", + "shortDescription": { + "text": "Single character alternation" + }, + "fullDescription": { + "text": "Reports single char alternation in a RegExp. It is simpler to use a character class instead. This may also provide better matching performance. Example: 'a|b|c|d' After the quick-fix is applied: '[abcd]' New in 2017.1", + "markdown": "Reports single char alternation in a RegExp. It is simpler to use a character class instead. This may also provide better matching performance.\n\n**Example:**\n\n\n a|b|c|d\n\nAfter the quick-fix is applied:\n\n\n [abcd]\n\n\nNew in 2017.1" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpSingleCharAlternation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CheckTagEmptyBody", + "shortDescription": { + "text": "Empty element content" + }, + "fullDescription": { + "text": "Reports XML elements without contents. Example: '\n \n ' After the quick-fix is applied: '\n \n '", + "markdown": "Reports XML elements without contents.\n\n**Example:**\n\n\n \n \n \n\nAfter the quick-fix is applied:\n\n\n \n \n \n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CheckTagEmptyBody", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnresolvedReference", + "shortDescription": { + "text": "Unresolved reference" + }, + "fullDescription": { + "text": "Reports an unresolved reference to a named pattern ('define') in RELAX-NG files that use XML syntax. Suggests creating the referenced 'define' element.", + "markdown": "Reports an unresolved reference to a named pattern (`define`) in RELAX-NG files that use XML syntax. Suggests creating the referenced `define` element." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "UnresolvedReference", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "RELAX NG", + "index": 81, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlMissingClosingTag", + "shortDescription": { + "text": "Missing closing tag" + }, + "fullDescription": { + "text": "Reports an HTML element without a closing tag. Some coding styles require that HTML elements have closing tags even where this is optional. Example: '\n \n

Behold!\n \n ' After the quick-fix is applied: '\n \n

Behold!

\n \n '", + "markdown": "Reports an HTML element without a closing tag. Some coding styles require that HTML elements have closing tags even where this is optional.\n\n**Example:**\n\n\n \n \n

Behold!\n \n \n\nAfter the quick-fix is applied:\n\n\n \n \n

Behold!

\n \n \n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "HtmlMissingClosingTag", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlUnknownAnchorTarget", + "shortDescription": { + "text": "Unresolved fragment in a link" + }, + "fullDescription": { + "text": "Reports an unresolved last part of an URL after the '#' sign.", + "markdown": "Reports an unresolved last part of an URL after the `#` sign." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlUnknownAnchorTarget", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XmlInvalidId", + "shortDescription": { + "text": "Unresolved 'id' reference" + }, + "fullDescription": { + "text": "Reports an unresolved 'id' reference in XML.", + "markdown": "Reports an unresolved `id` reference in XML." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "XmlInvalidId", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReassignedToPlainText", + "shortDescription": { + "text": "Reassigned to plain text" + }, + "fullDescription": { + "text": "Reports files that were explicitly re-assigned to Plain Text File Type. This association is unnecessary because the platform auto-detects text files by content automatically. You can dismiss this warning by removing the file type association in Settings | Editor | File Types | Text.", + "markdown": "Reports files that were explicitly re-assigned to Plain Text File Type. This association is unnecessary because the platform auto-detects text files by content automatically.\n\nYou can dismiss this warning by removing the file type association\nin **Settings \\| Editor \\| File Types \\| Text**." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ReassignedToPlainText", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Annotator", + "shortDescription": { + "text": "Annotator" + }, + "fullDescription": { + "text": "Reports issues essential to this file (e.g., syntax errors) in the result of a batch code inspection run. These issues are usually always highlighted in the editor and can't be configured, unlike inspections. These options control the scope of checks performed by this inspection: Option \"Report syntax errors\": report parser-related issues. Option \"Report issues from language-specific annotators\": report issues found by annotators configured for the relevant language. See Custom Language Support: Annotators for details. Option \"Report other highlighting problems\": report issues specific to the language of the current file (e.g., type mismatches or unreported exceptions). See Custom Language Support: Highlighting for details.", + "markdown": "Reports issues essential to this file (e.g., syntax errors) in the result of a batch code inspection run. These issues are usually always highlighted in the editor and can't be configured, unlike inspections. These options control the scope of checks performed by this inspection:\n\n* Option \"**Report syntax errors**\": report parser-related issues.\n* Option \"**Report issues from language-specific annotators** \": report issues found by annotators configured for the relevant language. See [Custom Language Support: Annotators](https://plugins.jetbrains.com/docs/intellij/annotator.html) for details.\n* Option \"**Report other highlighting problems** \": report issues specific to the language of the current file (e.g., type mismatches or unreported exceptions). See [Custom Language Support: Highlighting](https://plugins.jetbrains.com/docs/intellij/syntax-highlighting-and-error-highlighting.html#semantic-highlighting) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "Annotator", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JsonDuplicatePropertyKeys", + "shortDescription": { + "text": "Duplicate keys in object literals" + }, + "fullDescription": { + "text": "Reports a duplicate key in an object literal.", + "markdown": "Reports a duplicate key in an object literal." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JsonDuplicatePropertyKeys", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JSON and JSON5", + "index": 71, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XmlDeprecatedElement", + "shortDescription": { + "text": "Deprecated symbol" + }, + "fullDescription": { + "text": "Reports a deprecated XML element or attribute. Symbols can be marked by XML comment or documentation tag with text 'deprecated'.", + "markdown": "Reports a deprecated XML element or attribute.\n\nSymbols can be marked by XML comment or documentation tag with text 'deprecated'." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "XmlDeprecatedElement", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "XML", + "index": 40, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpRedundantNestedCharacterClass", + "shortDescription": { + "text": "Redundant nested character class" + }, + "fullDescription": { + "text": "Reports unnecessary nested character classes. Example: '[a-c[x-z]]' After the quick-fix is applied: '[a-cx-z]' New in 2020.2", + "markdown": "Reports unnecessary nested character classes.\n\n**Example:**\n\n\n [a-c[x-z]]\n\nAfter the quick-fix is applied:\n\n\n [a-cx-z]\n\nNew in 2020.2" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpRedundantNestedCharacterClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpOctalEscape", + "shortDescription": { + "text": "Octal escape" + }, + "fullDescription": { + "text": "Reports octal escapes, which are easily confused with back references. Use hexadecimal escapes to avoid confusion. Example: '\\07' After the quick-fix is applied: '\\x07' New in 2017.1", + "markdown": "Reports octal escapes, which are easily confused with back references. Use hexadecimal escapes to avoid confusion.\n\n**Example:**\n\n\n \\07\n\nAfter the quick-fix is applied:\n\n\n \\x07\n\nNew in 2017.1" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "RegExpOctalEscape", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedDefine", + "shortDescription": { + "text": "Unused define" + }, + "fullDescription": { + "text": "Reports an unused named pattern ('define') in a RELAX-NG file (XML or Compact Syntax). 'define' elements that are used through an include in another file are ignored.", + "markdown": "Reports an unused named pattern (`define`) in a RELAX-NG file (XML or Compact Syntax). `define` elements that are used through an include in another file are ignored." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "UnusedDefine", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RELAX NG", + "index": 81, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpAnonymousGroup", + "shortDescription": { + "text": "Anonymous capturing group or numeric back reference" + }, + "fullDescription": { + "text": "Reports anonymous capturing groups and numeric back references in a RegExp. These are only reported when the RegExp dialect supports named group and named group references. Named groups and named back references improve code readability and are recommended to use instead. When a capture is not needed, matching can be more performant and use less memory by using a non-capturing group, i.e. '(?:xxx)' instead of '(xxx)'. Example: '(\\d\\d\\d\\d)\\1' A better regex pattern could look like this: '(?\\d\\d\\d\\d)\\k' New in 2017.2", + "markdown": "Reports anonymous capturing groups and numeric back references in a RegExp. These are only reported when the RegExp dialect supports named group and named group references. Named groups and named back references improve code readability and are recommended to use instead. When a capture is not needed, matching can be more performant and use less memory by using a non-capturing group, i.e. `(?:xxx)` instead of `(xxx)`.\n\n**Example:**\n\n\n (\\d\\d\\d\\d)\\1\n\nA better regex pattern could look like this:\n\n\n (?\\d\\d\\d\\d)\\k\n\nNew in 2017.2" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpAnonymousGroup", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpDuplicateAlternationBranch", + "shortDescription": { + "text": "Duplicate branch in alternation" + }, + "fullDescription": { + "text": "Reports duplicate branches in a RegExp alternation. Duplicate branches slow down matching and obscure the intent of the expression. Example: '(alpha|bravo|charlie|alpha)' After the quick-fix is applied: '(alpha|bravo|charlie)' New in 2017.1", + "markdown": "Reports duplicate branches in a RegExp alternation. Duplicate branches slow down matching and obscure the intent of the expression.\n\n**Example:**\n\n\n (alpha|bravo|charlie|alpha)\n\nAfter the quick-fix is applied:\n\n\n (alpha|bravo|charlie)\n\nNew in 2017.1" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpDuplicateAlternationBranch", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RegExpRepeatedSpace", + "shortDescription": { + "text": "Consecutive spaces" + }, + "fullDescription": { + "text": "Reports multiple consecutive spaces in a RegExp. Because spaces are not visible by default, it can be hard to see how many spaces are required. The RegExp can be made more clear by replacing the consecutive spaces with a single space and a counted quantifier. Example: '( )' After the quick-fix is applied: '( {5})' New in 2017.1", + "markdown": "Reports multiple consecutive spaces in a RegExp. Because spaces are not visible by default, it can be hard to see how many spaces are required. The RegExp can be made more clear by replacing the consecutive spaces with a single space and a counted quantifier.\n\n**Example:**\n\n\n ( )\n\nAfter the quick-fix is applied:\n\n\n ( {5})\n\n\nNew in 2017.1" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "RegExpRepeatedSpace", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "RegExp", + "index": 46, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CheckEmptyScriptTag", + "shortDescription": { + "text": "Empty tag" + }, + "fullDescription": { + "text": "Reports empty tags that do not work in some browsers. Example: '\n \n '", + "markdown": "Reports empty tags that do not work in some browsers.\n\n**Example:**\n\n\n \n \n \n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CheckEmptyScriptTag", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "JavaScript", + "version": "232.9881", + "rules": [ + { + "id": "JSUnusedAssignment", + "shortDescription": { + "text": "Unused assignment" + }, + "fullDescription": { + "text": "Reports a variable whose value is never used after assignment. Suggests removing the unused variable to shorten the code and to avoid redundant allocations. The following cases are reported: A variable is never read after assignment. The value of a variable is always overwritten with another assignment before the variable is read next time. The initializer of a variable is redundant (for one of the above-mentioned reasons).", + "markdown": "Reports a variable whose value is never used after assignment. \nSuggests removing the unused variable to shorten the code and to avoid redundant allocations.\n\nThe following cases are reported:\n\n* A variable is never read after assignment.\n* The value of a variable is always overwritten with another assignment before the variable is read next time.\n* The initializer of a variable is redundant (for one of the above-mentioned reasons)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSUnusedAssignment", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Unused symbols", + "index": 15, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FlowJSError", + "shortDescription": { + "text": "Flow type checker" + }, + "fullDescription": { + "text": "Reports errors from Flow.", + "markdown": "Reports errors from [Flow](https://flowtype.org/)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "FlowJSError", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Flow type checker", + "index": 17, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReuseOfLocalVariableJS", + "shortDescription": { + "text": "Reuse of local variable" + }, + "fullDescription": { + "text": "Reports reusing a local variable and overwriting its value with a new value that is not related to the original variable usage. Reusing a local variable in this way may be confusing because the intended semantics of the local variable may vary with each usage. It may also cause bugs, if code changes result in values that were expected to be overwritten while they are actually live. It is good practices to keep variable lifetimes as short as possible, and not reuse local variables for the sake of brevity.", + "markdown": "Reports reusing a local variable and overwriting its value with a new value that is not related to the original variable usage. Reusing a local variable in this way may be confusing because the intended semantics of the local variable may vary with each usage. It may also cause bugs, if code changes result in values that were expected to be overwritten while they are actually live. It is good practices to keep variable lifetimes as short as possible, and not reuse local variables for the sake of brevity." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ReuseOfLocalVariableJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Data flow", + "index": 18, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ShiftOutOfRangeJS", + "shortDescription": { + "text": "Shift operation by possibly wrong constant" + }, + "fullDescription": { + "text": "Reports a shift operation where the second operand is a constant outside the reasonable range, for example, an integer shift operation outside the range '0..31', shifting by negative or overly large values.", + "markdown": "Reports a shift operation where the second operand is a constant outside the reasonable range, for example, an integer shift operation outside the range `0..31`, shifting by negative or overly large values." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ShiftOutOfRangeJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Bitwise operation issues", + "index": 22, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSClosureCompilerSyntax", + "shortDescription": { + "text": "Incorrect usage of JSDoc tags" + }, + "fullDescription": { + "text": "Reports warnings implied by Google Closure Compiler annotations including correct use of '@abstract', '@interface', and '@implements' tags.", + "markdown": "Reports warnings implied by *Google Closure Compiler* annotations including correct use of `@abstract`, `@interface`, and `@implements` tags." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSClosureCompilerSyntax", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6ConvertLetToConst", + "shortDescription": { + "text": "'let' is used instead of 'const'" + }, + "fullDescription": { + "text": "Reports a 'let' declaration that can be made 'const'.", + "markdown": "Reports a `let` declaration that can be made `const`. " + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6ConvertLetToConst", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/ES2015 migration aids", + "index": 25, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSXDomNesting", + "shortDescription": { + "text": "Invalid DOM element nesting" + }, + "fullDescription": { + "text": "Detects HTML elements in JSX files which are not nested properly according to the DOM specification. React reports runtime warnings on incorrectly nested elements.", + "markdown": "Detects HTML elements in JSX files which are not nested properly according to the DOM specification. React reports runtime warnings on incorrectly nested elements." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSXDomNesting", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/React", + "index": 29, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BadExpressionStatementJS", + "shortDescription": { + "text": "Expression statement which is not assignment or call" + }, + "fullDescription": { + "text": "Reports an expression statement that is neither an assignment nor a call. Such statements usually indicate an error.", + "markdown": "Reports an expression statement that is neither an assignment nor a call. Such statements usually indicate an error." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "BadExpressionStatementJS", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Validity issues", + "index": 30, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConfusingFloatingPointLiteralJS", + "shortDescription": { + "text": "Confusing floating point literal" + }, + "fullDescription": { + "text": "Reports any floating point number that does not have a decimal point, or any numbers before the decimal point, or and numbers after the decimal point. Such literals may be confusing, and violate several coding standards.", + "markdown": "Reports any floating point number that does not have a decimal point, or any numbers before the decimal point, or and numbers after the decimal point. Such literals may be confusing, and violate several coding standards." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ConfusingFloatingPointLiteralJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ContinueOrBreakFromFinallyBlockJS", + "shortDescription": { + "text": "'continue' or 'break' inside 'finally' block" + }, + "fullDescription": { + "text": "Reports a 'break' or 'continue' statement inside a 'finally' block. Such statements are very confusing, may hide exceptions, and complicate debugging.", + "markdown": "Reports a `break` or `continue` statement inside a `finally` block. Such statements are very confusing, may hide exceptions, and complicate debugging." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ContinueOrBreakFromFinallyBlockJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Try statement issues", + "index": 35, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryLocalVariableJS", + "shortDescription": { + "text": "Redundant local variable" + }, + "fullDescription": { + "text": "Reports an unnecessary local variable that does not make a function more comprehensible: a local variable that is immediately returned a local variable that is immediately assigned to another variable and is not used anymore a local variable that always has the same value as another local variable or parameter. Use the checkbox below to have this inspection ignore variables that are immediately returned or thrown. Some coding styles suggest using such variables for clarity and ease of debugging.", + "markdown": "Reports an unnecessary local variable that does not make a function more comprehensible:\n\n* a local variable that is immediately returned\n* a local variable that is immediately assigned to another variable and is not used anymore\n* a local variable that always has the same value as another local variable or parameter.\n\n\nUse the checkbox below to have this inspection ignore variables that are immediately\nreturned or thrown. Some coding styles suggest using such variables for clarity and\nease of debugging." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "UnnecessaryLocalVariableJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Data flow", + "index": 18, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSMethodCanBeStatic", + "shortDescription": { + "text": "Method can be made 'static'" + }, + "fullDescription": { + "text": "Reports a class method that can be safely made 'static'. A method can be 'static' if it does not reference any of its class' non-static methods and non-static fields and is not overridden in a subclass. Use the first checkbox below to inspect only 'private' methods.", + "markdown": "Reports a class method that can be safely made `static`. A method can be `static` if it does not reference any of its class' non-static methods and non-static fields and is not overridden in a subclass.\n\n\nUse the first checkbox below to inspect only `private` methods." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSMethodCanBeStatic", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSXUnresolvedComponent", + "shortDescription": { + "text": "Unresolved JSX component" + }, + "fullDescription": { + "text": "Reports an unresolved reference to a JSX component. Suggests adding a missing import statement if the referenced component is defined in the project or its dependencies or creating a new component with this name. The template for a new component can be modified in Editor | File and Code Templates.", + "markdown": "Reports an unresolved reference to a JSX component. Suggests adding a missing import statement if the referenced component is defined in the project or its dependencies or creating a new component with this name.\n\nThe template for a new component can be modified in Editor \\| File and Code Templates." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSXUnresolvedComponent", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryLabelOnBreakStatementJS", + "shortDescription": { + "text": "Unnecessary label on 'break' statement" + }, + "fullDescription": { + "text": "Reports a labeled 'break' statement whose labels may be removed without changing the flow of control.", + "markdown": "Reports a labeled `break` statement whose labels may be removed without changing the flow of control." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "UnnecessaryLabelOnBreakStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ContinueStatementJS", + "shortDescription": { + "text": "'continue' statement" + }, + "fullDescription": { + "text": "Reports a 'continue' statement.", + "markdown": "Reports a `continue` statement." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ContinueStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "index": 41, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSUndeclaredVariable", + "shortDescription": { + "text": "Implicitly declared global JavaScript variable" + }, + "fullDescription": { + "text": "Reports an implicit declaration of a global variable. Example: 'var aaa = 1; // good\n bbb = 2; // bad, if bbb is not declared with 'var' somewhere'", + "markdown": "Reports an implicit declaration of a global variable.\n\nExample:\n\n\n var aaa = 1; // good\n bbb = 2; // bad, if bbb is not declared with 'var' somewhere\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSUndeclaredVariable", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DivideByZeroJS", + "shortDescription": { + "text": "Division by zero" + }, + "fullDescription": { + "text": "Reports division by zero or a remainder by zero.", + "markdown": "Reports division by zero or a remainder by zero." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "DivideByZeroJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSReferencingMutableVariableFromClosure", + "shortDescription": { + "text": "Referencing mutable variable from closure" + }, + "fullDescription": { + "text": "Reports access to outer mutable variables from functions. Example: 'for (var i = 1; i <= 3; i++) {\n setTimeout(function() {\n console.log(i); // bad\n }, 0);\n }'", + "markdown": "Reports access to outer mutable variables from functions.\n\nExample:\n\n\n for (var i = 1; i <= 3; i++) {\n setTimeout(function() {\n console.log(i); // bad\n }, 0);\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSReferencingMutableVariableFromClosure", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ChainedEqualityJS", + "shortDescription": { + "text": "Chained equality" + }, + "fullDescription": { + "text": "Reports a chained equality comparison (i.e. 'a==b==c'). Such comparisons are confusing.", + "markdown": "Reports a chained equality comparison (i.e. `a==b==c`). Such comparisons are confusing." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ChainedEqualityComparisonsJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SillyAssignmentJS", + "shortDescription": { + "text": "Variable is assigned to itself" + }, + "fullDescription": { + "text": "Reports an assignment in the form 'x = x'.", + "markdown": "Reports an assignment in the form `x = x`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SillyAssignmentJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Assignment issues", + "index": 48, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6ConvertRequireIntoImport", + "shortDescription": { + "text": "'require()' is used instead of 'import'" + }, + "fullDescription": { + "text": "Reports a 'require()' statement. Suggests converting it to a 'require()' call with an 'import' statement. Enable 'Convert require() inside inner scopes with Fix all action' to convert all 'require()' calls inside the nested functions and statements when using the 'Fix all' action. Please note that converting 'require()' statements inside inner scopes to 'import' statements may cause changes in the semantics of the code. Import statements are static module dependencies and are hoisted, which means that they are moved to the top of the current module. 'require()' calls load modules dynamically. They can be executed conditionally, and their scope is defined by the expression in which they are used. Clear the 'Convert require() inside inner scopes with Fix all action' checkbox to prevent any changes in these complex cases when using the 'Fix all' action.", + "markdown": "Reports a `require()` statement. Suggests converting it to a `require()` call with an `import` statement. \n\nEnable 'Convert require() inside inner scopes with Fix all action' to convert all `require()` calls inside the nested functions and statements when using the 'Fix all' action. \n\nPlease note that converting `require()` statements inside inner scopes to `import` statements may cause changes in the semantics of the code. Import statements are static module dependencies and are hoisted, which means that they are moved to the top of the current module. `require()` calls load modules dynamically. They can be executed conditionally, and their scope is defined by the expression in which they are used. \nClear the 'Convert require() inside inner scopes with Fix all action' checkbox to prevent any changes in these complex cases when using the 'Fix all' action." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6ConvertRequireIntoImport", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/ES2015 migration aids", + "index": 25, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptCheckImport", + "shortDescription": { + "text": "Unresolved imported name" + }, + "fullDescription": { + "text": "Reports an unresolved name or binding in an 'import' declaration in TypeScript code.", + "markdown": "Reports an unresolved name or binding in an `import` declaration in TypeScript code." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "TypeScriptCheckImport", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSXSyntaxUsed", + "shortDescription": { + "text": "JSX syntax used" + }, + "fullDescription": { + "text": "Reports a usage of a JSX tag in JavaScript code.", + "markdown": "Reports a usage of a JSX tag in JavaScript code." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "JSXSyntaxUsed", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSJoinVariableDeclarationAndAssignment", + "shortDescription": { + "text": "Variable declaration can be merged with the first assignment to the variable" + }, + "fullDescription": { + "text": "Reports a variable that is declared without an initializer and is used much further in the code or in a single nested scope. Suggests moving the variable closer to its usages and joining it with the initializer expression.", + "markdown": "Reports a variable that is declared without an initializer and is used much further in the code or in a single nested scope. Suggests moving the variable closer to its usages and joining it with the initializer expression." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSJoinVariableDeclarationAndAssignment", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSRedundantSwitchStatement", + "shortDescription": { + "text": "'switch' statement is redundant and can be replaced" + }, + "fullDescription": { + "text": "Reports a 'switch' statement with an empty body, or with only one 'case' branch, or with a 'default' branch only.", + "markdown": "Reports a `switch` statement with an empty body, or with only one `case` branch, or with a `default` branch only." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSRedundantSwitchStatement", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Switch statement issues", + "index": 53, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSUnusedGlobalSymbols", + "shortDescription": { + "text": "Unused global symbol" + }, + "fullDescription": { + "text": "Reports an unused globally accessible public function, variable, class, or property.", + "markdown": "Reports an unused globally accessible public function, variable, class, or property." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSUnusedGlobalSymbols", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Unused symbols", + "index": 15, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6ConvertModuleExportToExport", + "shortDescription": { + "text": "'module.exports' is used instead of 'export'" + }, + "fullDescription": { + "text": "Reports a 'module.export' statement. Suggests replacing it with an 'export' or 'export default' statement. Please note that the quick-fix for converting 'module.export' into 'export' is not available for 'module.export' inside functions or statements because 'export' statements can only be at the top level of a module.", + "markdown": "Reports a `module.export` statement. Suggests replacing it with an `export` or `export default` statement. \n\nPlease note that the quick-fix for converting `module.export` into `export` is not available for `module.export` inside functions or statements because `export` statements can only be at the top level of a module." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6ConvertModuleExportToExport", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/ES2015 migration aids", + "index": 25, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DocumentWriteJS", + "shortDescription": { + "text": "Call to 'document.write()'" + }, + "fullDescription": { + "text": "Reports a method call to 'document.write()' or 'document.writeln()'. Most usages of such calls are performed better with explicit DOM calls, such as 'getElementByID()' and 'createElement()'. Additionally, the 'write()' and 'writeln()' calls will not work with XML DOMs, including DOMs for XHTML if viewed as XML. This can result in difficulty to point out bugs.", + "markdown": "Reports a method call to `document.write()` or `document.writeln()`. Most usages of such calls are performed better with explicit DOM calls, such as `getElementByID()` and `createElement()`. Additionally, the `write()` and `writeln()` calls will not work with XML DOMs, including DOMs for XHTML if viewed as XML. This can result in difficulty to point out bugs." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "DocumentWriteJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/DOM issues", + "index": 54, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BlockStatementJS", + "shortDescription": { + "text": "Unnecessary block statement" + }, + "fullDescription": { + "text": "Reports a block statement that is not used as the body of 'if', 'for', 'while', 'do', 'with', or 'try' statements, or as the body of a function declaration. Starting from ECMAScript 6, JavaScript blocks introduce new scopes for 'let' and 'const' variables, but still free-standing block statements may be confusing and result in subtle bugs when used with 'var' variables.", + "markdown": "Reports a block statement that is not used as the body of `if`, `for`, `while`, `do`, `with`, or `try` statements, or as the body of a function declaration. Starting from ECMAScript 6, JavaScript blocks introduce new scopes for `let` and `const` variables, but still free-standing block statements may be confusing and result in subtle bugs when used with `var` variables." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "BlockStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "InfiniteRecursionJS", + "shortDescription": { + "text": "Infinite recursion" + }, + "fullDescription": { + "text": "Reports a function which must either recurse infinitely or throw an exception. Such functions may not return normally.", + "markdown": "Reports a function which must either recurse infinitely or throw an exception. Such functions may not return normally." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "InfiniteRecursionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedConditionalExpressionJS", + "shortDescription": { + "text": "Nested conditional expression" + }, + "fullDescription": { + "text": "Reports a ternary conditional expression within another ternary condition. Such nested conditionals may be extremely confusing, and best replaced by more explicit conditional logic.", + "markdown": "Reports a ternary conditional expression within another ternary condition. Such nested conditionals may be extremely confusing, and best replaced by more explicit conditional logic." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NestedConditionalExpressionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IncompatibleMaskJS", + "shortDescription": { + "text": "Incompatible bitwise mask operation" + }, + "fullDescription": { + "text": "Reports a bitwise mask expression which for sure evaluates to 'true' or 'false'. Expressions are of the form '(var & constant1) == constant2' or '(var | constant1) == constant2', where 'constant1' and 'constant2' are incompatible bitmask constants. Example: '// Incompatible mask: as the last byte in mask is zero,\n// something like 0x1200 would be possible, but not 0x1234\nif ((mask & 0xFF00) == 0x1234) {...}'", + "markdown": "Reports a bitwise mask expression which for sure evaluates to `true` or `false`. Expressions are of the form `(var & constant1) == constant2` or `(var | constant1) == constant2`, where `constant1` and `constant2` are incompatible bitmask constants.\n\nExample:\n\n\n // Incompatible mask: as the last byte in mask is zero,\n // something like 0x1200 would be possible, but not 0x1234\n if ((mask & 0xFF00) == 0x1234) {...}\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "IncompatibleBitwiseMaskOperation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Bitwise operation issues", + "index": 22, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TextLabelInSwitchStatementJS", + "shortDescription": { + "text": "Text label in 'switch' statement" + }, + "fullDescription": { + "text": "Reports a labeled statement inside a 'switch' statement, which often results from a typo. Example: 'switch(x)\n {\n case 1:\n case2: //typo!\n case 3:\n break;\n }'", + "markdown": "Reports a labeled statement inside a `switch` statement, which often results from a typo.\n\nExample:\n\n\n switch(x)\n {\n case 1:\n case2: //typo!\n case 3:\n break;\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "TextLabelInSwitchStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Switch statement issues", + "index": 53, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6PossiblyAsyncFunction", + "shortDescription": { + "text": "'await' in non-async function" + }, + "fullDescription": { + "text": "Reports a usage of 'await' in a function that was possibly intended to be async but is actually missing the 'async' modifier. Although 'await' can be used as an identifier, it is likely that it was intended to be used as an operator, so the containing function should be made 'async'.", + "markdown": "Reports a usage of `await` in a function that was possibly intended to be async but is actually missing the `async` modifier. Although `await` can be used as an identifier, it is likely that it was intended to be used as an operator, so the containing function should be made `async`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6PossiblyAsyncFunction", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Async code and promises", + "index": 55, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FlowJSFlagCommentPlacement", + "shortDescription": { + "text": "Misplaced @flow flag" + }, + "fullDescription": { + "text": "Reports a '@flow' flag comment that is not located at the top of a file.", + "markdown": "Reports a `@flow` flag comment that is not located at the top of a file." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "FlowJSFlagCommentPlacement", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Flow type checker", + "index": 17, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSDuplicatedDeclaration", + "shortDescription": { + "text": "Duplicate declaration" + }, + "fullDescription": { + "text": "Reports multiple declarations in a scope.", + "markdown": "Reports multiple declarations in a scope." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSDuplicatedDeclaration", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSOctalInteger", + "shortDescription": { + "text": "Octal integer" + }, + "fullDescription": { + "text": "Reports a deprecated octal integer literal prefixed with '0' instead of '0o'. Such literals are not allowed in modern ECMAScript code, and using them in the strict mode is an error. To force this inspection for ES5 and ES3 language levels, select the 'Warn about obsolete octal literals in ES5- code' checkbox below.", + "markdown": "Reports a deprecated octal integer literal prefixed with `0` instead of `0o`. \nSuch literals are not allowed in modern ECMAScript code, and using them in the strict mode is an error. \nTo force this inspection for ES5 and ES3 language levels, select the 'Warn about obsolete octal literals in ES5- code' checkbox below." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "JSOctalInteger", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Validity issues", + "index": 30, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptValidateGenericTypes", + "shortDescription": { + "text": "Incorrect generic type argument" + }, + "fullDescription": { + "text": "Reports an invalid type argument in a function, interface, or class declaration.", + "markdown": "Reports an invalid type argument in a function, interface, or class declaration." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "TypeScriptValidateGenericTypes", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSMismatchedCollectionQueryUpdate", + "shortDescription": { + "text": "Mismatched query and update of collection" + }, + "fullDescription": { + "text": "Reports a collection of fields or variables whose contents are either queried and not updated or updated and not queried. Such mismatched queries and updates are pointless and may indicate either dead code or a typographical error. Query methods are automatically detected, based on whether they return something, or a callback is passed to them. Use the table below to specify which methods are update methods.", + "markdown": "Reports a collection of fields or variables whose contents are either queried and not updated or updated and not queried. Such mismatched queries and updates are pointless and may indicate either dead code or a typographical error.\n\n\nQuery methods are automatically detected, based on whether they return something, or a callback is passed to them.\nUse the table below to specify which methods are update methods." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSMismatchedCollectionQueryUpdate", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSMissingSwitchDefault", + "shortDescription": { + "text": "'switch' statement has no 'default' branch" + }, + "fullDescription": { + "text": "Reports a 'switch' statement without a 'default' clause when some possible values are not enumerated.", + "markdown": "Reports a `switch` statement without a `default` clause when some possible values are not enumerated." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSMissingSwitchDefault", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Switch statement issues", + "index": 53, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSXNamespaceValidation", + "shortDescription": { + "text": "Missing JSX namespace" + }, + "fullDescription": { + "text": "Reports a usage of a JSX construction without importing namespace. Having the namespace in the file scope ensures proper code compilation.", + "markdown": "Reports a usage of a JSX construction without importing namespace. Having the namespace in the file scope ensures proper code compilation." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSXNamespaceValidation", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Imports and dependencies", + "index": 59, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6PreferShortImport", + "shortDescription": { + "text": "Import can be shortened" + }, + "fullDescription": { + "text": "Reports an ES6 import whose 'from' part can be shortened. Suggests importing the parent directory.", + "markdown": "Reports an ES6 import whose `from` part can be shortened. Suggests importing the parent directory." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ES6PreferShortImport", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PointlessBitwiseExpressionJS", + "shortDescription": { + "text": "Bitwise expression can be simplified" + }, + "fullDescription": { + "text": "Reports an expression that includes 'and' with zero, 'or' by zero, or shifting by zero. Such expressions may result from not fully completed automated refactorings.", + "markdown": "Reports an expression that includes `and` with zero, `or` by zero, or shifting by zero. Such expressions may result from not fully completed automated refactorings." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "PointlessBitwiseExpressionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Bitwise operation issues", + "index": 22, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSStringConcatenationToES6Template", + "shortDescription": { + "text": "String concatenation is used instead of template literal" + }, + "fullDescription": { + "text": "Reports a string concatenation. Suggests replacing it with a template literal Example '\"result: \" + a + \".\"' After applying the quick-fix the code looks as follows: '`result: ${a}.`'", + "markdown": "Reports a string concatenation. Suggests replacing it with a [template literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)\n\nExample\n\n \"result: \" + a + \".\" \n\nAfter applying the quick-fix the code looks as follows:\n\n `result: ${a}.` \n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSStringConcatenationToES6Template", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/ES2015 migration aids", + "index": 25, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssignmentWithOperatorAssignmentJS", + "shortDescription": { + "text": "Assignment could be replaced with operator assignment" + }, + "fullDescription": { + "text": "Reports an assignment operation that can be replaced by an operator assignment to make your code shorter and probably clearer. Example: 'x = x + 3;'\n 'x = x / 3;'\n After the quick fix is applied the result looks like: 'x += 3;'\n 'x /= 3;'", + "markdown": "Reports an assignment operation that can be replaced by an operator assignment to make your code shorter and probably clearer.\n\n\nExample:\n\n x = x + 3;\n x = x / 3;\n\nAfter the quick fix is applied the result looks like:\n\n x += 3;\n x /= 3;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "AssignmentReplaceableWithOperatorAssignmentJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Assignment issues", + "index": 48, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSFileReferences", + "shortDescription": { + "text": "Unresolved file reference" + }, + "fullDescription": { + "text": "Reports an unresolved file reference in a JavaScript file, including CommonJS and AMD modules references.", + "markdown": "Reports an unresolved file reference in a JavaScript file, including CommonJS and AMD modules references." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSFileReferences", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionWithInconsistentReturnsJS", + "shortDescription": { + "text": "Function with inconsistent returns" + }, + "fullDescription": { + "text": "Reports a function that returns a value in some cases while in other cases no value is returned. This usually indicates an error. Example: 'function foo() {\n if (true)\n return 3;\n return;\n}'", + "markdown": "Reports a function that returns a value in some cases while in other cases no value is returned. This usually indicates an error.\n\nExample:\n\n\n function foo() {\n if (true)\n return 3;\n return;\n }\n\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "FunctionWithInconsistentReturnsJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Validity issues", + "index": 30, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyTryBlockJS", + "shortDescription": { + "text": "Empty 'try' block" + }, + "fullDescription": { + "text": "Reports an empty 'try' block, which usually indicates an error.", + "markdown": "Reports an empty `try` block, which usually indicates an error." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EmptyTryBlockJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Try statement issues", + "index": 35, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6ClassMemberInitializationOrder", + "shortDescription": { + "text": "Use of possibly unassigned property in a static initializer" + }, + "fullDescription": { + "text": "Reports a class member initializer which references another non-hoisted class member while the latter may be not initialized yet. Initialization of class members happens consequently for fields, so a field cannot reference another field that is declared later.", + "markdown": "Reports a class member initializer which references another non-hoisted class member while the latter may be not initialized yet. \n\nInitialization of class members happens consequently for fields, so a field cannot reference another field that is declared later." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ES6ClassMemberInitializationOrder", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReservedWordUsedAsNameJS", + "shortDescription": { + "text": "Reserved word used as name" + }, + "fullDescription": { + "text": "Reports a JavaScript reserved word used as a name. The JavaScript specification reserves a number of words which are currently not used as keywords. Using those words as identifiers may result in broken code if later versions of JavaScript start using them as keywords.", + "markdown": "Reports a JavaScript reserved word used as a name. The JavaScript specification reserves a number of words which are currently not used as keywords. Using those words as identifiers may result in broken code if later versions of JavaScript start using them as keywords." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ReservedWordAsName", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Validity issues", + "index": 30, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedFunctionJS", + "shortDescription": { + "text": "Nested function" + }, + "fullDescription": { + "text": "Reports a function nested inside another function. Although JavaScript allows functions to be nested, such constructs may be confusing. Use the checkbox below to ignore anonymous nested functions.", + "markdown": "Reports a function nested inside another function. Although JavaScript allows functions to be nested, such constructs may be confusing.\n\n\nUse the checkbox below to ignore anonymous nested functions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NestedFunctionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IncrementDecrementResultUsedJS", + "shortDescription": { + "text": "Result of increment or decrement used" + }, + "fullDescription": { + "text": "Reports an increment ('++') or decrement ('--') expression where the result of the assignment is used in a containing expression. Such assignments can result in confusion due to the order of operations, as evaluation of the assignment may affect the outer expression in unexpected ways. Example: 'var a = b++'", + "markdown": "Reports an increment (`++`) or decrement (`--`) expression where the result of the assignment is used in a containing expression. Such assignments can result in confusion due to the order of operations, as evaluation of the assignment may affect the outer expression in unexpected ways. Example: `var a = b++`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "IncrementDecrementResultUsedJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousTypeOfGuard", + "shortDescription": { + "text": "Unsound type guard check" + }, + "fullDescription": { + "text": "Reports a 'typeof' or 'instanceof' unsound type guard check. The 'typeof x' type guard can be unsound in one of the following two cases: 'typeof x' never corresponds to the specified value (for example, 'typeof x === 'number'' when 'x' is of the type 'string | boolean') 'typeof x' always corresponds to the specified value (for example, 'typeof x === 'string'' when 'x' is of the type 'string') The 'x instanceof A' type guard can be unsound in one of the following two cases: The type of 'x' is not related to 'A' The type of 'x' is 'A' or a subtype of 'A'", + "markdown": "Reports a `typeof` or `instanceof` unsound type guard check. The `typeof x` type guard can be unsound in one of the following two cases:\n\n* `typeof x` never corresponds to the specified value (for example, `typeof x === 'number'` when `x` is of the type 'string \\| boolean')\n* `typeof x` always corresponds to the specified value (for example, `typeof x === 'string'` when `x` is of the type 'string')\n\n
\n\nThe `x instanceof A` type guard can be unsound in one of the following two cases:\n\n* The type of `x` is not related to `A`\n* The type of `x` is `A` or a subtype of `A`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "SuspiciousTypeOfGuard", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6DestructuringVariablesMerge", + "shortDescription": { + "text": "Destructuring properties with the same key" + }, + "fullDescription": { + "text": "Reports multiple destructuring properties with identical keys. Suggests merging the properties.", + "markdown": "Reports multiple destructuring properties with identical keys. Suggests merging the properties." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6DestructuringVariablesMerge", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LoopStatementThatDoesntLoopJS", + "shortDescription": { + "text": "Loop statement that doesn't loop" + }, + "fullDescription": { + "text": "Reports a 'for', 'while', or 'do' statement whose bodies are guaranteed to execute at most once. Normally, this indicates an error.", + "markdown": "Reports a `for`, `while`, or `do` statement whose bodies are guaranteed to execute at most once. Normally, this indicates an error." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "LoopStatementThatDoesntLoopJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSNonASCIINames", + "shortDescription": { + "text": "Identifiers with non-ASCII symbols" + }, + "fullDescription": { + "text": "Reports a non-ASCII symbol in a name. If the 'Allow only ASCII names' option is selected, reports all names that contain non-ASCII symbols. Otherwise reports all names that contain both ASCII and non-ASCII symbols.", + "markdown": "Reports a non-ASCII symbol in a name. \n\nIf the 'Allow only ASCII names' option is selected, reports all names that contain non-ASCII symbols. \nOtherwise reports all names that contain both ASCII and non-ASCII symbols." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSNonASCIINames", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Naming conventions", + "index": 63, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptRedundantGenericType", + "shortDescription": { + "text": "Redundant type arguments" + }, + "fullDescription": { + "text": "Reports a type argument that is equal to the default one and can be removed. Example: 'type Foo = T;\nlet z: Foo;'", + "markdown": "Reports a type argument that is equal to the default one and can be removed.\n\n\nExample:\n\n\n type Foo = T;\n let z: Foo;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "TypeScriptRedundantGenericType", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptUMDGlobal", + "shortDescription": { + "text": "Referenced UMD global variable" + }, + "fullDescription": { + "text": "Reports a usage of a Universal Module Definition (UMD) global variable if the current file is a module (ECMAScript or CommonJS). Referencing UMD variables without explicit imports can lead to a runtime error if the library isn't included implicitly.", + "markdown": "Reports a usage of a Universal Module Definition (UMD) global variable if the current file is a module (ECMAScript or CommonJS). Referencing UMD variables without explicit imports can lead to a runtime error if the library isn't included implicitly." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "TypeScriptUMDGlobal", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryReturnJS", + "shortDescription": { + "text": "Unnecessary 'return' statement" + }, + "fullDescription": { + "text": "Reports an unnecessary 'return' statement, that is, a 'return' statement that returns no value and occurs just before the function would have \"fallen through\" the bottom. These statements may be safely removed.", + "markdown": "Reports an unnecessary `return` statement, that is, a `return` statement that returns no value and occurs just before the function would have \"fallen through\" the bottom. These statements may be safely removed." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "UnnecessaryReturnStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSLastCommaInObjectLiteral", + "shortDescription": { + "text": "Unneeded last comma in object literal" + }, + "fullDescription": { + "text": "Reports usages of a trailing comma in object literals. The warning is reported only when the JavaScript language version is set to ECMAScript 5.1. Trailing commas in object literals are allowed by the specification, however, some browsers might throw an error when a trailing comma is used. You can configure formatting options for trailing commas in Code Style | JavaScript or TypeScript | Punctuation.", + "markdown": "Reports usages of a trailing comma in object literals.\n\nThe warning is reported only when the JavaScript language version is set to ECMAScript 5.1.\n\nTrailing commas in object literals are allowed by the specification, however, some browsers might throw an error when a trailing comma is used.\n\nYou can configure formatting options for trailing commas in **Code Style** \\| **JavaScript** or **TypeScript** \\| **Punctuation**." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSLastCommaInObjectLiteral", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6MissingAwait", + "shortDescription": { + "text": "Missing await for an async function call" + }, + "fullDescription": { + "text": "Reports an 'async' function call without an expected 'await' prefix inside an 'async' function. Such call returns a 'Promise' and control flow is continued immediately. Example: 'async function bar() { /* ... */ }\nasync function foo() {\n bar(); // bad\n}' After the quick-fix is applied, the 'await' prefix is added: 'async function bar() { /* ... */ }\nasync function foo() {\n await bar(); // good\n}' When the 'Report for promises in return statements' checkbox is selected, also suggests adding 'await' in return statements. While this is generally not necessary, it gives two main benefits. You won't forget to add 'await' when surrounding your code with 'try-catch'. An explicit 'await' helps V8 runtime to provide async stack traces.", + "markdown": "Reports an `async` function call without an expected `await` prefix inside an `async` function. Such call returns a `Promise` and control flow is continued immediately.\n\nExample:\n\n\n async function bar() { /* ... */ }\n async function foo() {\n bar(); // bad\n }\n\n\nAfter the quick-fix is applied, the `await` prefix is added:\n\n\n async function bar() { /* ... */ }\n async function foo() {\n await bar(); // good\n }\n\n
\n\nWhen the 'Report for promises in return statements' checkbox is selected, also suggests adding `await` in return statements. \nWhile this is generally not necessary, it gives two main benefits. \n\n* You won't forget to add `await` when surrounding your code with `try-catch`.\n* An explicit `await` helps V8 runtime to provide [async stack traces](https://bit.ly/v8-zero-cost-async-stack-traces)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6MissingAwait", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Async code and promises", + "index": 55, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TailRecursionJS", + "shortDescription": { + "text": "Tail recursion" + }, + "fullDescription": { + "text": "Reports a tail recursion, that is, when a function calls itself as its last action before returning. A tail recursion can always be replaced by looping, which will be considerably faster. Some JavaScript engines perform this optimization, while others do not. Thus, tail recursive solutions may have considerably different performance characteristics in different environments.", + "markdown": "Reports a tail recursion, that is, when a function calls itself as its last action before returning. A tail recursion can always be replaced by looping, which will be considerably faster. Some JavaScript engines perform this optimization, while others do not. Thus, tail recursive solutions may have considerably different performance characteristics in different environments." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "TailRecursionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FlowJSCoverage", + "shortDescription": { + "text": "Code is not covered by Flow" + }, + "fullDescription": { + "text": "Reports JavaScript code fragments that are not covered by the Flow type checker. To use this inspection, configure the Flow executable in Settings | Languages & Frameworks | JavaScript.", + "markdown": "Reports JavaScript code fragments that are not covered by the Flow type checker. To use this inspection, configure the Flow executable in [Settings \\| Languages \\& Frameworks \\| JavaScript](settings://Settings.JavaScript)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "FlowJSCoverage", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Flow type checker", + "index": 17, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "StandardJS", + "shortDescription": { + "text": "Standard code style" + }, + "fullDescription": { + "text": "Reports a discrepancy detected by the JavaScript Standard Style linter. The highlighting severity in the editor is based on the severity level the linter reports.", + "markdown": "Reports a discrepancy detected by the [JavaScript Standard Style](https://standardjs.com/) linter. \n\nThe highlighting severity in the editor is based on the severity level the linter reports." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "StandardJS", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code quality tools", + "index": 65, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedAssignmentJS", + "shortDescription": { + "text": "Nested assignment" + }, + "fullDescription": { + "text": "Reports an assignment expression nested inside another expression, for example, 'a = b = 1'. Such expressions may be confusing and violate the general design principle that a given construct should do precisely one thing.", + "markdown": "Reports an assignment expression nested inside another expression, for example, `a = b = 1`. Such expressions may be confusing and violate the general design principle that a given construct should do precisely one thing." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NestedAssignmentJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Assignment issues", + "index": 48, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DefaultNotLastCaseInSwitchJS", + "shortDescription": { + "text": "'default' not last case in 'switch'" + }, + "fullDescription": { + "text": "Reports a 'switch' statement where the 'default' case comes before another case instead of being the very last case, which may cause confusion.", + "markdown": "Reports a `switch` statement where the `default` case comes before another case instead of being the very last case, which may cause confusion." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "DefaultNotLastCaseInSwitchJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Switch statement issues", + "index": 53, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConfusingPlusesOrMinusesJS", + "shortDescription": { + "text": "Confusing sequence of '+' or '-'" + }, + "fullDescription": { + "text": "Reports a suspicious combination of '+' or '-' characters in JavaScript code (for example, 'a+++b'. Such sequences are confusing, and their semantics may change through changes in the whitespace.", + "markdown": "Reports a suspicious combination of `+` or `-` characters in JavaScript code (for example, `a+++b`. Such sequences are confusing, and their semantics may change through changes in the whitespace." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ConfusingPlusesOrMinusesJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyFinallyBlockJS", + "shortDescription": { + "text": "Empty 'finally' block" + }, + "fullDescription": { + "text": "Reports an empty 'finally' block, which usually indicates an error.", + "markdown": "Reports an empty `finally` block, which usually indicates an error." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EmptyFinallyBlockJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Try statement issues", + "index": 35, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSCommentMatchesSignature", + "shortDescription": { + "text": "Mismatched JSDoc and function signature" + }, + "fullDescription": { + "text": "Reports mismatch between the names and the number of parameters within a JSDoc comment and the actual parameters of a function. Suggests updating parameters in JSDoc comment. Example: '/**\n * @param height Height in pixels\n */\nfunction sq(height, width) {} // width is not documented' After the quick-fix is applied: '/**\n * @param height Height in pixels\n * @param width\n */\nfunction sq(height, width) {}'", + "markdown": "Reports mismatch between the names and the number of parameters within a JSDoc comment and the actual parameters of a function. Suggests updating parameters in JSDoc comment.\n\n**Example:**\n\n\n /**\n * @param height Height in pixels\n */\n function sq(height, width) {} // width is not documented\n\nAfter the quick-fix is applied:\n\n\n /**\n * @param height Height in pixels\n * @param width\n */\n function sq(height, width) {}\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSCommentMatchesSignature", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptConfig", + "shortDescription": { + "text": "Inconsistent tsconfig.json properties" + }, + "fullDescription": { + "text": "Reports inconsistency of a 'paths', 'checkJs', or 'extends' property in a tsconfig.json file. The 'checkJs' property requires 'allowJs'. The 'extends' property should be a valid file reference.", + "markdown": "Reports inconsistency of a `paths`, `checkJs`, or `extends` property in a tsconfig.json file. \nThe `checkJs` property requires `allowJs`. \nThe `extends` property should be a valid file reference." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "TypeScriptConfig", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ForLoopThatDoesntUseLoopVariableJS", + "shortDescription": { + "text": "'for' loop where update or condition does not use loop variable" + }, + "fullDescription": { + "text": "Reports a 'for' loop where the condition or update does not use the 'for' loop variable.", + "markdown": "Reports a `for` loop where the condition or update does not use the `for` loop variable." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ForLoopThatDoesntUseLoopVariableJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptAbstractClassConstructorCanBeMadeProtected", + "shortDescription": { + "text": "Abstract class constructor can be made protected" + }, + "fullDescription": { + "text": "Reports a public constructor of an abstract class and suggests making it protected (because it is useless to have it public).", + "markdown": "Reports a public constructor of an abstract class and suggests making it protected (because it is useless to have it public)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "TypeScriptAbstractClassConstructorCanBeMadeProtected", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionWithMultipleReturnPointsJS", + "shortDescription": { + "text": "Function with multiple return points" + }, + "fullDescription": { + "text": "Reports a function with multiple return points. Such functions are hard to understand and maintain.", + "markdown": "Reports a function with multiple return points. Such functions are hard to understand and maintain." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "FunctionWithMultipleReturnPointsJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Function metrics", + "index": 69, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSIgnoredPromiseFromCall", + "shortDescription": { + "text": "Result of method call returning a promise is ignored" + }, + "fullDescription": { + "text": "Reports a function call that returns a 'Promise' that is not used later. Such calls are usually unintended and indicate an error.", + "markdown": "Reports a function call that returns a `Promise` that is not used later. Such calls are usually unintended and indicate an error." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSIgnoredPromiseFromCall", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Async code and promises", + "index": 55, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ThreeNegationsPerFunctionJS", + "shortDescription": { + "text": "Function with more than three negations" + }, + "fullDescription": { + "text": "Reports a function with three or more negation operations ('!' or '!='). Such functions may be unnecessarily confusing.", + "markdown": "Reports a function with three or more negation operations (`!` or `!=`). Such functions may be unnecessarily confusing." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "FunctionWithMoreThanThreeNegationsJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Function metrics", + "index": 69, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSRemoveUnnecessaryParentheses", + "shortDescription": { + "text": "Unnecessary parentheses" + }, + "fullDescription": { + "text": "Reports redundant parentheses. In expressions: 'var x = ((1) + 2) + 3' In arrow function argument lists: 'var incrementer = (x) => x + 1' In TypeScript and Flow type declarations: 'type Card = (Suit & Rank) | (Suit & Number)'", + "markdown": "Reports redundant parentheses.\n\nIn expressions:\n\n var x = ((1) + 2) + 3\n\nIn arrow function argument lists:\n\n var incrementer = (x) => x + 1\n\nIn TypeScript and Flow type declarations:\n\n type Card = (Suit & Rank) | (Suit & Number)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSRemoveUnnecessaryParentheses", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OverlyComplexBooleanExpressionJS", + "shortDescription": { + "text": "Overly complex boolean expression" + }, + "fullDescription": { + "text": "Reports a boolean expression with too many terms. Such expressions may be confusing and bug-prone. Use the field below to specify the maximum number of terms allowed in an arithmetic expression.", + "markdown": "Reports a boolean expression with too many terms. Such expressions may be confusing and bug-prone.\n\n\nUse the field below to specify the maximum number of terms allowed in an arithmetic expression." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "OverlyComplexBooleanExpressionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OverlyComplexArithmeticExpressionJS", + "shortDescription": { + "text": "Overly complex arithmetic expression" + }, + "fullDescription": { + "text": "Reports an arithmetic expression with too many terms. Such expressions may be confusing and bug-prone. Use the field below to specify the maximum number of terms allowed in an arithmetic expression.", + "markdown": "Reports an arithmetic expression with too many terms. Such expressions may be confusing and bug-prone.\n\n\nUse the field below to specify the maximum number of terms allowed in an arithmetic expression." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "OverlyComplexArithmeticExpressionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "StringLiteralBreaksHTMLJS", + "shortDescription": { + "text": "String literal which breaks HTML parsing" + }, + "fullDescription": { + "text": "Reports a string literal that contains a '\n\nThe following usages are ignored:\n\n* Inside a return statement\n* In some binary operations\n* For overridden non-void functions" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSVoidFunctionReturnValueUsed", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReturnFromFinallyBlockJS", + "shortDescription": { + "text": "'return' inside 'finally' block" + }, + "fullDescription": { + "text": "Reports a 'return' statement inside a 'finally' block. Such 'return' statements may mask exceptions thrown, and complicate debugging.", + "markdown": "Reports a `return` statement inside a `finally` block. Such `return` statements may mask exceptions thrown, and complicate debugging." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ReturnInsideFinallyBlockJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Try statement issues", + "index": 35, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSValidateTypes", + "shortDescription": { + "text": "Type mismatch" + }, + "fullDescription": { + "text": "Reports incorrect type of: a parameter in a function call a return value an assigned expression TypeScript code is ignored.", + "markdown": "Reports incorrect type of:\n\n* a parameter in a function call\n* a return value\n* an assigned expression\n\nTypeScript code is ignored." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSValidateTypes", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstantConditionalExpressionJS", + "shortDescription": { + "text": "Constant conditional expression" + }, + "fullDescription": { + "text": "Reports a conditional expression in the format 'true? result1: result2' or 'false? result1: result2. Suggests simplifying the expression.'", + "markdown": "Reports a conditional expression in the format `true? result1: result2` or `false? result1: result2``.\nSuggests simplifying the expression.\n`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ConstantConditionalExpressionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSTestFailedLine", + "shortDescription": { + "text": "Highlight failure line in test code" + }, + "fullDescription": { + "text": "Reports a failed method call or an assertion in a test.", + "markdown": "Reports a failed method call or an assertion in a test." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSTestFailedLine", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Unit testing", + "index": 8, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfStatementWithTooManyBranchesJS", + "shortDescription": { + "text": "'if' statement with too many branches" + }, + "fullDescription": { + "text": "Reports an 'if' statement with too many branches. Such statements may be confusing, and often indicate inadequate levels of design abstraction. Use the field below to specify the maximum number of branches expected.", + "markdown": "Reports an `if` statement with too many branches. Such statements may be confusing, and often indicate inadequate levels of design abstraction.\n\n\nUse the field below to specify the maximum number of branches expected." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "IfStatementWithTooManyBranchesJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSValidateJSDoc", + "shortDescription": { + "text": "Syntax errors and unresolved references in JSDoc" + }, + "fullDescription": { + "text": "Reports a syntax discrepancy in a documentation comment.", + "markdown": "Reports a syntax discrepancy in a documentation comment." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSValidateJSDoc", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NonBlockStatementBodyJS", + "shortDescription": { + "text": "Statement body without braces" + }, + "fullDescription": { + "text": "Reports a 'if', 'while', 'for', or 'with' statements whose body is not a block statement. Using code block in statement bodies is usually safer for downstream maintenance.", + "markdown": "Reports a `if`, `while`, `for`, or `with` statements whose body is not a block statement. Using code block in statement bodies is usually safer for downstream maintenance." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NonBlockStatementBodyJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BreakStatementJS", + "shortDescription": { + "text": "'break' statement" + }, + "fullDescription": { + "text": "Reports a 'break' statements. Ignores 'break' statements that end case blocks.", + "markdown": "Reports a `break` statements. Ignores `break` statements that end case blocks." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "BreakStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "index": 41, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FlowJSConfig", + "shortDescription": { + "text": "Missing .flowconfig" + }, + "fullDescription": { + "text": "Reports a JavaScript file with a '@flow' flag that doesn't have an associated '.flowconfig' file in the project.", + "markdown": "Reports a JavaScript file with a `@flow` flag that doesn't have an associated `.flowconfig` file in the project." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "FlowJSConfig", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Flow type checker", + "index": 17, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSPotentiallyInvalidUsageOfClassThis", + "shortDescription": { + "text": "Potentially invalid reference to 'this' of a class from closure" + }, + "fullDescription": { + "text": "Reports an attempt to reference a member of an ECMAScript class via the 'this.' qualifier in a nested function that is not a lambda. 'this' in a nested function that is not a lambda is the function's own 'this' and doesn't relate to the outer class.", + "markdown": "Reports an attempt to reference a member of an ECMAScript class via the `this.` qualifier in a nested function that is not a lambda. \n`this` in a nested function that is not a lambda is the function's own `this` and doesn't relate to the outer class." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSPotentiallyInvalidUsageOfClassThis", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DebuggerStatementJS", + "shortDescription": { + "text": "'debugger' statement" + }, + "fullDescription": { + "text": "Reports a 'debugger' statement used for interaction with the Javascript debuggers. Such statements should not appear in production code.", + "markdown": "Reports a `debugger` statement used for interaction with the Javascript debuggers. Such statements should not appear in production code." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "DebuggerStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "index": 41, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryContinueJS", + "shortDescription": { + "text": "Unnecessary 'continue' statement" + }, + "fullDescription": { + "text": "Reports an unnecessary 'continue' statement at the end of a loop. Suggests removing such statements.", + "markdown": "Reports an unnecessary `continue` statement at the end of a loop. Suggests removing such statements." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "UnnecessaryContinueJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptValidateTypes", + "shortDescription": { + "text": "Type mismatch" + }, + "fullDescription": { + "text": "Reports a parameter, return value, or assigned expression of incorrect type.", + "markdown": "Reports a parameter, return value, or assigned expression of incorrect type." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "TypeScriptValidateTypes", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BreakStatementWithLabelJS", + "shortDescription": { + "text": "'break' statement with label" + }, + "fullDescription": { + "text": "Reports a labeled 'break' statement.", + "markdown": "Reports a labeled `break` statement." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "BreakStatementWithLabelJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "index": 41, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "StatementsPerFunctionJS", + "shortDescription": { + "text": "Overly long function" + }, + "fullDescription": { + "text": "Reports an overly long function. Function length is calculated by counting up the number of non-empty statements in the function. Functions that are too long are error-prone and difficult to test. Use the field below to specify the maximum acceptable number of statements in a function.", + "markdown": "Reports an overly long function. Function length is calculated by counting up the number of non-empty statements in the function. Functions that are too long are error-prone and difficult to test.\n\n\nUse the field below to specify the maximum acceptable number of statements in a function." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "FunctionTooLongJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Function metrics", + "index": 69, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSDeclarationsAtScopeStart", + "shortDescription": { + "text": "'var' declared not at the beginning of a function" + }, + "fullDescription": { + "text": "Checks that declarations of local variables declared with var are at the top of a function scope. By default, variable declarations are always moved (\"hoisted\") invisibly to the top of their containing scope when the code is executed. Therefore, declaring them at the top of the scope helps represent this behavior in the code.", + "markdown": "Checks that declarations of local variables declared with **var** are at the top of a function scope. \n\nBy default, variable declarations are always moved (\"hoisted\") invisibly to the top of their containing scope when the code is executed. Therefore, declaring them at the top of the scope helps represent this behavior in the code." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSDeclarationsAtScopeStart", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ContinueStatementWithLabelJS", + "shortDescription": { + "text": "'continue' statement with label" + }, + "fullDescription": { + "text": "Reports a labeled 'continue' statement.", + "markdown": "Reports a labeled `continue` statement." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ContinueStatementWithLabelJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "index": 41, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSObjectNullOrUndefined", + "shortDescription": { + "text": "Object is 'null' or 'undefined'" + }, + "fullDescription": { + "text": "Reports an error caused by invoking a method, accessing a property, or calling a function on an object that is 'undefined' or 'null'.", + "markdown": "Reports an error caused by invoking a method, accessing a property, or calling a function on an object that is `undefined` or `null`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSObjectNullOrUndefined", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptMissingConfigOption", + "shortDescription": { + "text": "Missing tsconfig.json option " + }, + "fullDescription": { + "text": "Reports a usage that requires an explicit option in 'tsconfig.json'. For example, to use JSX in '.tsx' files, 'tsconfig.json' must contain '\"jsx\"' property.", + "markdown": "Reports a usage that requires an explicit option in `tsconfig.json`. For example, to use JSX in `.tsx` files, `tsconfig.json` must contain `\"jsx\"` property." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "TypeScriptMissingConfigOption", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6ShorthandObjectProperty", + "shortDescription": { + "text": "Property can be replaced with shorthand" + }, + "fullDescription": { + "text": "Reports an object property that can be converted to ES6 shorthand style and provides a quick-fix to do it. Example: 'var obj = {foo:foo}' After applying the quick-fix the code looks as follows: 'var obj = {foo}'", + "markdown": "Reports an object property that can be converted to ES6 shorthand style and provides a quick-fix to do it.\n\nExample:\n\n\n var obj = {foo:foo}\n\nAfter applying the quick-fix the code looks as follows:\n\n\n var obj = {foo}\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6ShorthandObjectProperty", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AssignmentToForLoopParameterJS", + "shortDescription": { + "text": "Assignment to 'for' loop parameter" + }, + "fullDescription": { + "text": "Reports an assignment to a variable declared as a 'for' loop parameter. Although occasionally intended, this construct can be extremely confusing, and is often a result of an error.", + "markdown": "Reports an assignment to a variable declared as a `for` loop parameter. Although occasionally intended, this construct can be extremely confusing, and is often a result of an error." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "AssignmentToForLoopParameterJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Assignment issues", + "index": 48, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSPotentiallyInvalidConstructorUsage", + "shortDescription": { + "text": "Potentially invalid constructor usage" + }, + "fullDescription": { + "text": "Reports a usage of a potentially invalid constructor function, for example: a function that is not a constructor after 'new', using a constructor's prototype or calling a constructor without 'new'. A constructor function is assumed to have an upper case name (optional) or have an explicit JSDoc '@constructor' tag.", + "markdown": "Reports a usage of a potentially invalid constructor function, for example: a function that is not a constructor after `new`, using a constructor's prototype or calling a constructor without `new`. A constructor function is assumed to have an upper case name (optional) or have an explicit JSDoc `@constructor` tag." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSPotentiallyInvalidConstructorUsage", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PointlessArithmeticExpressionJS", + "shortDescription": { + "text": "Pointless arithmetic expression" + }, + "fullDescription": { + "text": "Reports an arithmetic expression that include adding or subtracting zero, multiplying by zero or one, division by one, and shift by zero. Such expressions may result from not fully completed automated refactoring.", + "markdown": "Reports an arithmetic expression that include adding or subtracting zero, multiplying by zero or one, division by one, and shift by zero. Such expressions may result from not fully completed automated refactoring." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "PointlessArithmeticExpressionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NodeCoreCodingAssistance", + "shortDescription": { + "text": "Unresolved Node.js APIs" + }, + "fullDescription": { + "text": "Suggests configuring coding assistance for Node.js, for example, 'require' and/or core modules ('path', 'http', 'fs', etc.). See https://nodejs.org/api/ for the complete list.", + "markdown": "Suggests configuring coding assistance for Node.js, for example, `require` and/or core modules ('path', 'http', 'fs', etc.).\n\n\nSee for the complete list." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NodeCoreCodingAssistance", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Node.js", + "index": 80, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSPrimitiveTypeWrapperUsage", + "shortDescription": { + "text": "Primitive type object wrapper used" + }, + "fullDescription": { + "text": "Reports an improper usage of a wrapper for primitive types or a property of a primitive type being modified, as in the latter case the assigned value will be lost.", + "markdown": "Reports an improper usage of a wrapper for primitive types or a property of a primitive type being modified, as in the latter case the assigned value will be lost." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSPrimitiveTypeWrapperUsage", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptSmartCast", + "shortDescription": { + "text": "Narrowed type" + }, + "fullDescription": { + "text": "Reports a usage of a variable where the variable type is narrowed by a type guard. Note that severity level doesn't affect this inspection.", + "markdown": "Reports a usage of a variable where the variable type is narrowed by a type guard. Note that severity level doesn't affect this inspection." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "TypeScriptSmartCast", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6ConvertIndexedForToForOf", + "shortDescription": { + "text": "Indexed 'for' is used instead of 'for..of'" + }, + "fullDescription": { + "text": "Reports an indexed 'for' loop used on an array. Suggests replacing it with a 'for..of' loop. 'for..of' loops are introduced in ECMAScript 6 and iterate over 'iterable' objects.", + "markdown": "Reports an indexed [for](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for) loop used on an array. Suggests replacing it with a [for..of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) loop. \n`for..of` loops are introduced in ECMAScript 6 and iterate over `iterable` objects." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6ConvertIndexedForToForOf", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/ES2015 migration aids", + "index": 25, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSLastCommaInArrayLiteral", + "shortDescription": { + "text": "Unneeded last comma in array literal" + }, + "fullDescription": { + "text": "Reports a usage of a trailing comma in an array literal. The warning is reported only when the JavaScript language version is set to ECMAScript 5.1. Although trailing commas in arrays are allowed by the specification, some browsers may throw an error when a trailing comma is used. You can configure formatting options for trailing commas in Code Style | JavaScript or TypeScript | Punctuation.", + "markdown": "Reports a usage of a trailing comma in an array literal.\n\nThe warning is reported only when the JavaScript language version is set to ECMAScript 5.1.\n\nAlthough trailing commas in arrays are allowed by the specification, some browsers may throw an error when a trailing comma is used.\n\nYou can configure formatting options for trailing commas in **Code Style** \\| **JavaScript** or **TypeScript** \\| **Punctuation**." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSLastCommaInArrayLiteral", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConditionalExpressionJS", + "shortDescription": { + "text": "Conditional expression" + }, + "fullDescription": { + "text": "Reports a ternary conditional expression. Some coding standards prohibit such expressions in favor of explicit 'if' statements.", + "markdown": "Reports a ternary conditional expression. Some coding standards prohibit such expressions in favor of explicit `if` statements." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ConditionalExpressionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "index": 41, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6ConvertVarToLetConst", + "shortDescription": { + "text": "'var' is used instead of 'let' or 'const'" + }, + "fullDescription": { + "text": "Reports a 'var' declaration that is used instead of 'let' or 'const'. Both 'let' and 'const' are block-scoped and behave more strictly. Suggests replacing all 'var' declarations with 'let' or 'const' declarations, depending on the semantics of a particular value. The declarations may be moved to the top of the function or placed before the first usage of the variable to avoid Reference errors. Select the 'Conservatively convert var with Fix all action' option to prevent any changes in these complex cases when using the 'Fix all' action.", + "markdown": "Reports a `var` declaration that is used instead of `let` or `const`. \nBoth `let` and `const` are block-scoped and behave more strictly. \n\nSuggests replacing all `var` declarations with `let` or `const` declarations, depending on the semantics of a particular value. The declarations may be moved to the top of the function or placed before the first usage of the variable to avoid Reference errors. \nSelect the 'Conservatively convert var with Fix all action' option to prevent any changes in these complex cases when using the 'Fix all' action." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6ConvertVarToLetConst", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/ES2015 migration aids", + "index": 25, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PointlessBooleanExpressionJS", + "shortDescription": { + "text": "Pointless statement or boolean expression" + }, + "fullDescription": { + "text": "Reports a pointless or pointlessly complicated boolean expression or statement. Example: 'let a = !(false && x);\n let b = false || x;' After the quick fix is applied the result looks like: 'let a = true;\n let b = x;'", + "markdown": "Reports a pointless or pointlessly complicated boolean expression or statement.\n\nExample:\n\n\n let a = !(false && x);\n let b = false || x;\n\nAfter the quick fix is applied the result looks like:\n\n\n let a = true;\n let b = x;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "PointlessBooleanExpressionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DynamicallyGeneratedCodeJS", + "shortDescription": { + "text": "Execution of dynamically generated code" + }, + "fullDescription": { + "text": "Reports a call of the 'eval()', 'setTimeout()', or 'setInterval()' function or an allocation of a 'Function' object. These functions are used to execute arbitrary strings of JavaScript text, which often dynamically generated. This can be very confusing, and may be a security risk. Ignores the cases when a callback function is provided to these methods statically, without code generation.", + "markdown": "Reports a call of the `eval()`, `setTimeout()`, or `setInterval()` function or an allocation of a `Function` object. These functions are used to execute arbitrary strings of JavaScript text, which often dynamically generated. This can be very confusing, and may be a security risk. \n\nIgnores the cases when a callback function is provided to these methods statically, without code generation." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "DynamicallyGeneratedCodeJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NegatedConditionalExpressionJS", + "shortDescription": { + "text": "Negated conditional expression" + }, + "fullDescription": { + "text": "Reports a conditional expression whose condition is negated. Suggests flipping the order of branches in the conditional expression to increase the clarity of the statement. Example: '!condition ? 2 : 1'", + "markdown": "Reports a conditional expression whose condition is negated. Suggests flipping the order of branches in the conditional expression to increase the clarity of the statement. Example: `!condition ? 2 : 1`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NegatedConditionalExpressionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSUrlImportUsage", + "shortDescription": { + "text": "URL import is used" + }, + "fullDescription": { + "text": "Checks used URL imports in the JavaScript language. Suggests downloading the module for the specified remote URL. Such association enables the IDE to provide proper code completion and navigation. URLs in import specifiers are supported only for ECMAScript modules in the JavaScript language.", + "markdown": "Checks used URL imports in the JavaScript language. Suggests downloading the module for the specified remote URL. Such association enables the IDE to provide proper code completion and navigation. \n\nURLs in import specifiers are supported only for ECMAScript modules in the JavaScript language." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSUrlImportUsage", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Imports and dependencies", + "index": 59, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryLabelOnContinueStatementJS", + "shortDescription": { + "text": "Unnecessary label on 'continue' statement" + }, + "fullDescription": { + "text": "Reports a labeled 'continue' statement whose labels may be removed without changing the flow of control.", + "markdown": "Reports a labeled `continue` statement whose labels may be removed without changing the flow of control." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "UnnecessaryLabelOnContinueStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSPotentiallyInvalidTargetOfIndexedPropertyAccess", + "shortDescription": { + "text": "Possibly incorrect target of indexed property access" + }, + "fullDescription": { + "text": "Reports a potentially invalid indexed property access, for example, 'Array[1]'.", + "markdown": "Reports a potentially invalid indexed property access, for example, `Array[1]`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSPotentiallyInvalidTargetOfIndexedPropertyAccess", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSAccessibilityCheck", + "shortDescription": { + "text": "Inaccessible @private and @protected members referenced" + }, + "fullDescription": { + "text": "Reports a reference to a JavaScript member that is marked with a '@private' or '@protected' tag but does not comply with visibility rules that these tags imply.", + "markdown": "Reports a reference to a JavaScript member that is marked with a `@private` or `@protected` tag but does not comply with visibility rules that these tags imply." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSAccessibilityCheck", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionWithMultipleLoopsJS", + "shortDescription": { + "text": "Function with multiple loops" + }, + "fullDescription": { + "text": "Reports a function with multiple loop statements.", + "markdown": "Reports a function with multiple loop statements." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "FunctionWithMultipleLoopsJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Function metrics", + "index": 69, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LabeledStatementJS", + "shortDescription": { + "text": "Labeled statement" + }, + "fullDescription": { + "text": "Reports a labeled statement.", + "markdown": "Reports a labeled statement." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "LabeledStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "index": 41, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedCatchParameterJS", + "shortDescription": { + "text": "Unused 'catch' parameter" + }, + "fullDescription": { + "text": "Reports a 'catch' parameter that is not used in the corresponding block. The 'catch' parameters named 'ignore' or 'ignored' are ignored. Use the checkbox below to disable this inspection for 'catch' blocks with comments.", + "markdown": "Reports a `catch` parameter that is not used in the corresponding block. The `catch` parameters named `ignore` or `ignored` are ignored.\n\n\nUse the checkbox below to disable this inspection for `catch`\nblocks with comments." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "UnusedCatchParameterJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Try statement issues", + "index": 35, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NpmUsedModulesInstalled", + "shortDescription": { + "text": "Missing module dependency" + }, + "fullDescription": { + "text": "Reports a module from a 'require()' call or an 'import' statement that is not installed or is not listed in package.json dependencies. Suggests installing the module and/or including it into package.json. For 'require()' calls, works only in the files from the scope of Node.js Core JavaScript library.", + "markdown": "Reports a module from a `require()` call or an `import` statement that is not installed or is not listed in package.json dependencies.\n\nSuggests installing the module and/or including it into package.json.\n\nFor `require()` calls, works only in the files from the scope of *Node.js Core* JavaScript library." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "NpmUsedModulesInstalled", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Imports and dependencies", + "index": 59, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WithStatementJS", + "shortDescription": { + "text": "'with' statement" + }, + "fullDescription": { + "text": "Reports a 'with' statements. Such statements result in potentially confusing implicit bindings, and may behave strangely in setting new variables.", + "markdown": "Reports a `with` statements. Such statements result in potentially confusing implicit bindings, and may behave strangely in setting new variables." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "WithStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "index": 41, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSConstantReassignment", + "shortDescription": { + "text": "Attempt to assign to const or readonly variable" + }, + "fullDescription": { + "text": "Reports reassigning a value to a constant or a readonly variable.", + "markdown": "Reports reassigning a value to a constant or a readonly variable." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "JSConstantReassignment", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Validity issues", + "index": 30, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MagicNumberJS", + "shortDescription": { + "text": "Magic number" + }, + "fullDescription": { + "text": "Reports a \"magic number\" that is a numeric literal used without being named by a constant declaration. Magic numbers can result in code whose intention is unclear, and may result in errors if a magic number is changed in one code location but remains unchanged in another. The numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000, 0.0 and 1.0 are ignored.", + "markdown": "Reports a \"magic number\" that is a numeric literal used without being named by a constant declaration. Magic numbers can result in code whose intention is unclear, and may result in errors if a magic number is changed in one code location but remains unchanged in another. The numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000, 0.0 and 1.0 are ignored." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "MagicNumberJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionNamingConventionJS", + "shortDescription": { + "text": "Function naming convention" + }, + "fullDescription": { + "text": "Reports a function whose name is too short, too long, or does not follow the specified regular expression pattern. Use the fields provided below to specify minimum length, maximum length, and a regular expression for function names. Use the standard 'java.util.regex' format for regular expressions.", + "markdown": "Reports a function whose name is too short, too long, or does not follow the specified regular expression pattern.\n\n\nUse the fields provided below to specify minimum length, maximum length, and a regular expression\nfor function names. Use the standard `java.util.regex` format for regular expressions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "FunctionNamingConventionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Naming conventions", + "index": 63, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptLibrary", + "shortDescription": { + "text": "Missing global library" + }, + "fullDescription": { + "text": "Reports a TypeScript library file that is required for a symbol but is not listed under the 'lib' compiler option in 'tsconfig.json'.", + "markdown": "Reports a TypeScript library file that is required for a symbol but is not listed under the `lib` compiler option in `tsconfig.json`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "TypeScriptLibrary", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptMissingAugmentationImport", + "shortDescription": { + "text": "Missing augmentation import" + }, + "fullDescription": { + "text": "Reports a usage from augmentation module without an explicit import.", + "markdown": "Reports a usage from [augmentation module](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation) without an explicit import." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "TypeScriptMissingAugmentationImport", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AnonymousFunctionJS", + "shortDescription": { + "text": "Anonymous function" + }, + "fullDescription": { + "text": "Reports an anonymous function. An explicit name of a function expression may be helpful for debugging. Ignores function expressions without names if they have a 'name' property specified in the ECMAScript 6 standard. For example, 'var bar = function() {};' is not reported.", + "markdown": "Reports an anonymous function. An explicit name of a function expression may be helpful for debugging. Ignores function expressions without names if they have a `name` property specified in the ECMAScript 6 standard. For example, `var bar = function() {};` is not reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "AnonymousFunctionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially undesirable code constructs", + "index": 41, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectAllocationIgnoredJS", + "shortDescription": { + "text": "Result of object allocation ignored" + }, + "fullDescription": { + "text": "Reports object allocation where the result of the allocated object is ignored, for example, 'new Error();' as a statement, without any assignment. Such allocation expressions may indicate an odd object initialization strategy.", + "markdown": "Reports object allocation where the result of the allocated object is ignored, for example, `new Error();` as a statement, without any assignment. Such allocation expressions may indicate an odd object initialization strategy." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ObjectAllocationIgnored", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSTypeOfValues", + "shortDescription": { + "text": "'typeof' comparison with non-standard value" + }, + "fullDescription": { + "text": "Reports a comparison of a 'typeof' expression with a literal string which is not one of the standard types: 'undefined', 'object', 'boolean', 'number', 'string', 'function', or 'symbol'. Such comparisons always return 'false'.", + "markdown": "Reports a comparison of a `typeof` expression with a literal string which is not one of the standard types: `undefined`, `object`, `boolean`, `number`, `string`, `function`, or `symbol`. Such comparisons always return `false`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSTypeOfValues", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyCatchBlockJS", + "shortDescription": { + "text": "Empty 'catch' block" + }, + "fullDescription": { + "text": "Reports an empty 'catch' block. This indicates that errors are simply ignored instead of handling them. Any comment in a 'catch' block mutes the inspection.", + "markdown": "Reports an empty `catch` block. This indicates that errors are simply ignored instead of handling them. \n\nAny comment in a `catch` block mutes the inspection." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EmptyCatchBlockJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Try statement issues", + "index": 35, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSHint", + "shortDescription": { + "text": "JSHint" + }, + "fullDescription": { + "text": "Reports a problem detected by the JSHint linter.", + "markdown": "Reports a problem detected by the [JSHint](https://jshint.com/) linter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "JSHint", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code quality tools", + "index": 65, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Eslint", + "shortDescription": { + "text": "ESLint" + }, + "fullDescription": { + "text": "Reports a discrepancy detected by the ESLint linter. The highlighting is based on the rule severity specified in the ESLint configuration file for each individual rule. Clear the 'Use rule severity from the configuration file' checkbox to use the severity configured in this inspection for all ESLint rules.", + "markdown": "Reports a discrepancy detected by the [ESLint](https://eslint.org) linter. \n\nThe highlighting is based on the rule severity specified in the [ESLint configuration file](https://eslint.org/docs/user-guide/configuring) for each individual rule. \n\nClear the 'Use rule severity from the configuration file' checkbox to use the severity configured in this inspection for all ESLint rules." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "Eslint", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code quality tools", + "index": 65, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSEqualityComparisonWithCoercion.TS", + "shortDescription": { + "text": "Equality operator may cause type coercion" + }, + "fullDescription": { + "text": "Reports a usage of equality operators may cause unexpected type coercions. Suggests replacing '==' or '!=' equality operators with type-safe '===' or '!==' operators. Depending on the option selected, one of the following cases will be reported: All usages of '==' and '!=' operators. All usages except comparison with null. Some code styles allow using 'x == null' as a replacement for 'x === null || x === undefined'. Only suspicious expressions, such as: '==' or '!=' comparisons with '0', '''', 'null', 'true', 'false', or 'undefined'.", + "markdown": "Reports a usage of equality operators may cause unexpected type coercions. Suggests replacing `==` or `!=` equality operators with type-safe `===` or `!==` operators.\n\nDepending on the option selected, one of the following cases will be reported:\n\n* All usages of `==` and `!=` operators.\n* All usages except comparison with null. Some code styles allow using `x == null` as a replacement for `x === null || x === undefined`.\n* Only suspicious expressions, such as: `==` or `!=` comparisons with `0`, `''`, `null`, `true`, `false`, or `undefined`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EqualityComparisonWithCoercionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ExceptionCaughtLocallyJS", + "shortDescription": { + "text": "Exception used for local control-flow" + }, + "fullDescription": { + "text": "Reports a 'throw' statement whose exceptions are always caught by the containing 'try' statement. Using 'throw' statements as a 'goto' to change the local flow of control is confusing.", + "markdown": "Reports a `throw` statement whose exceptions are always caught by the containing `try` statement. Using `throw` statements as a `goto` to change the local flow of control is confusing." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ExceptionCaughtLocallyJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Try statement issues", + "index": 35, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ThrowFromFinallyBlockJS", + "shortDescription": { + "text": "'throw' inside 'finally' block" + }, + "fullDescription": { + "text": "Reports s 'throw' statement inside a 'finally' block. Such 'throw' statements may mask exceptions thrown, and complicate debugging.", + "markdown": "Reports s `throw` statement inside a `finally` block. Such `throw` statements may mask exceptions thrown, and complicate debugging." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ThrowInsideFinallyBlockJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Try statement issues", + "index": 35, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CyclomaticComplexityJS", + "shortDescription": { + "text": "Overly complex function" + }, + "fullDescription": { + "text": "Reports a function with too many branching points in a function (too high cyclomatic complexity). Such functions may be confusing and hard to test. Use the field provided below to specify the maximum acceptable cyclomatic complexity for a function.", + "markdown": "Reports a function with too many branching points in a function (too high cyclomatic complexity). Such functions may be confusing and hard to test.\n\n\nUse the field provided below to specify the maximum acceptable cyclomatic complexity for a function." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "OverlyComplexFunctionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Function metrics", + "index": 69, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageJsonMismatchedDependency", + "shortDescription": { + "text": "Mismatched dependencies in package.json" + }, + "fullDescription": { + "text": "Reports a dependency from package.json that is not installed or doesn't match the specified version range.", + "markdown": "Reports a dependency from package.json that is not installed or doesn't match the specified [version range](https://docs.npmjs.com/about-semantic-versioning)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "PackageJsonMismatchedDependency", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Imports and dependencies", + "index": 59, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSPotentiallyInvalidUsageOfThis", + "shortDescription": { + "text": "Potentially invalid reference to 'this' from closure" + }, + "fullDescription": { + "text": "Reports a 'this' in closure that is used for referencing properties of outer context. Example: 'function Outer() {\n this.outerProp = 1;\n function inner() {\n // bad, because 'outerProp' of Outer\n // won't be updated here\n // on calling 'new Outer()' as may be expected\n this.outerProp = 2;\n }\n inner();\n}'", + "markdown": "Reports a `this` in closure that is used for referencing properties of outer context.\n\nExample:\n\n\n function Outer() {\n this.outerProp = 1;\n function inner() {\n // bad, because 'outerProp' of Outer\n // won't be updated here\n // on calling 'new Outer()' as may be expected\n this.outerProp = 2;\n }\n inner();\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSPotentiallyInvalidUsageOfThis", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSUnresolvedLibraryURL", + "shortDescription": { + "text": "Missed locally stored library for HTTP link" + }, + "fullDescription": { + "text": "Reports a URL of an external JavaScript library that is not associated with any locally stored file. Suggests downloading the library. Such association enables the IDE to provide proper code completion and navigation.", + "markdown": "Reports a URL of an external JavaScript library that is not associated with any locally stored file. Suggests downloading the library. Such association enables the IDE to provide proper code completion and navigation." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSUnresolvedLibraryURL", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "InfiniteLoopJS", + "shortDescription": { + "text": "Infinite loop statement" + }, + "fullDescription": { + "text": "Reports a 'for', 'while', or 'do' statement which can only exit by throwing an exception. Such statements often indicate coding errors.", + "markdown": "Reports a `for`, `while`, or `do` statement which can only exit by throwing an exception. Such statements often indicate coding errors." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "InfiniteLoopJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSArrowFunctionBracesCanBeRemoved", + "shortDescription": { + "text": "Redundant braces around arrow function body" + }, + "fullDescription": { + "text": "Reports an arrow function whose body only consists of braces and exactly one statement. Suggests converting to concise syntax without braces. 'let incrementer = (x) => {return x + 1};' After the quick-fix is applied, the code fragment looks as follows: 'let incrementer = (x) => x + 1;'", + "markdown": "Reports an arrow function whose body only consists of braces and exactly one statement. Suggests converting to concise syntax without braces.\n\n\n let incrementer = (x) => {return x + 1};\n\nAfter the quick-fix is applied, the code fragment looks as follows:\n\n\n let incrementer = (x) => x + 1;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSArrowFunctionBracesCanBeRemoved", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Stylelint", + "shortDescription": { + "text": "Stylelint" + }, + "fullDescription": { + "text": "Reports a discrepancy detected by the Stylelint linter. The highlighting is based on the rule severity specified in the Stylelint configuration file for each individual rule.", + "markdown": "Reports a discrepancy detected by the [Stylelint](http://stylelint.io) linter. \n\nThe highlighting is based on the rule severity specified in the [Stylelint configuration file](https://stylelint.io/user-guide/configure) for each individual rule." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "Stylelint", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Code quality tools", + "index": 83, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSClassNamingConvention", + "shortDescription": { + "text": "Class naming convention" + }, + "fullDescription": { + "text": "Reports a class or a function that is annotated with a JSDoc '@constructor' or '@class' tag whose names are too short, too long, or do not follow the specified regular expression pattern. Use the fields provided below to specify minimum length, maximum length, and a regular expression expected for classes names. Use the standard 'java.util.regex' format for regular expressions.", + "markdown": "Reports a class or a function that is annotated with a JSDoc `@constructor` or `@class` tag whose names are too short, too long, or do not follow the specified regular expression pattern.\n\n\nUse the fields provided below to specify minimum length, maximum length, and a regular expression\nexpected for classes names. Use the standard `java.util.regex` format for regular expressions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSClassNamingConvention", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Naming conventions", + "index": 63, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptValidateJSTypes", + "shortDescription": { + "text": "Type mismatch in 'any' type" + }, + "fullDescription": { + "text": "Reports a function call with a parameter, return value, or assigned expression or incorrect type, if the context symbol can be implicitly resolved to the 'any' type. declare var test: any;\ntest.hasOwnProperty(true); //reports 'true'", + "markdown": "Reports a function call with a parameter, return value, or assigned expression or incorrect type, if the context symbol can be implicitly resolved to the `any` type.\n\n```\ndeclare var test: any;\ntest.hasOwnProperty(true); //reports 'true'\n```" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "TypeScriptValidateJSTypes", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "XHTMLIncompatabilitiesJS", + "shortDescription": { + "text": "Incompatible XHTML usages" + }, + "fullDescription": { + "text": "Reports common JavaScript DOM patterns which may present problems with XHTML documents. In particular, the patterns detected will behave completely differently depending on whether the document is loaded as XML or HTML. This can result in subtle bugs where script behaviour is dependent on the MIME-type of the document, rather than its content. Patterns detected include document.body, document.images, document.applets, document.links, document.forms, and document.anchors.", + "markdown": "Reports common JavaScript DOM patterns which may present problems with XHTML documents. In particular, the patterns detected will behave completely differently depending on whether the document is loaded as XML or HTML. This can result in subtle bugs where script behaviour is dependent on the MIME-type of the document, rather than its content. Patterns detected include **document.body** , **document.images** , **document.applets** , **document.links** , **document.forms** , and **document.anchors**." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "XHTMLIncompatabilitiesJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/DOM issues", + "index": 54, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptJSXUnresolvedComponent", + "shortDescription": { + "text": "Unresolved JSX component" + }, + "fullDescription": { + "text": "Reports an unresolved reference to a JSX component. Suggests adding an import statement if the referenced component is defined in the project or its dependencies or creating a new component with the specified name. The template for a new component can be modified in Editor | File and Code Templates.", + "markdown": "Reports an unresolved reference to a JSX component. Suggests adding an import statement if the referenced component is defined in the project or its dependencies or creating a new component with the specified name.\n\nThe template for a new component can be modified in Editor \\| File and Code Templates." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "TypeScriptJSXUnresolvedComponent", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptFieldCanBeMadeReadonly", + "shortDescription": { + "text": "Field can be readonly" + }, + "fullDescription": { + "text": "Reports a private field that can be made readonly (for example, if the field is assigned only in the constructor).", + "markdown": "Reports a private field that can be made readonly (for example, if the field is assigned only in the constructor)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "TypeScriptFieldCanBeMadeReadonly", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NegatedIfStatementJS", + "shortDescription": { + "text": "Negated 'if' statement" + }, + "fullDescription": { + "text": "Reports if statements which have an else branch and a negated condition. Flipping the order of the if and else branches will usually increase the clarity of such statements.", + "markdown": "Reports **if** statements which have an **else** branch and a negated condition. Flipping the order of the **if** and **else** branches will usually increase the clarity of such statements." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NegatedIfStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConditionalExpressionWithIdenticalBranchesJS", + "shortDescription": { + "text": "Conditional expression with identical branches" + }, + "fullDescription": { + "text": "Reports a ternary conditional expression with identical 'then' and 'else' branches.", + "markdown": "Reports a ternary conditional expression with identical `then` and `else` branches." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ConditionalExpressionWithIdenticalBranchesJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSIncompatibleTypesComparison", + "shortDescription": { + "text": "Comparison of expressions having incompatible types" + }, + "fullDescription": { + "text": "Reports a comparison with operands of incompatible types or an operand with a type without possible common values.", + "markdown": "Reports a comparison with operands of incompatible types or an operand with a type without possible common values." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSIncompatibleTypesComparison", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSAnnotator", + "shortDescription": { + "text": "ECMAScript specification is not followed" + }, + "fullDescription": { + "text": "Reports basic syntax issues and inconsistencies with language specification, such as invalid usages of keywords, usages of incompatible numeric format, or multiple parameters to getters/setters. Generally, such errors must always be reported and shouldn't be disabled. But in some cases, such as issues due to the dynamic nature of JavaScript, the use of not yet supported language features, or bugs in IDE's checker, it may be handy to disable reporting these very basic errors.", + "markdown": "Reports basic syntax issues and inconsistencies with language specification, such as invalid usages of keywords, usages of incompatible numeric format, or multiple parameters to getters/setters. \nGenerally, such errors must always be reported and shouldn't be disabled. But in some cases, such as issues due to the dynamic nature of JavaScript, the use of not yet supported language features, or bugs in IDE's checker, it may be handy to disable reporting these very basic errors." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "JSAnnotator", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSUnfilteredForInLoop", + "shortDescription": { + "text": "Unfiltered for..in loop" + }, + "fullDescription": { + "text": "Reports unfiltered 'for-in' loops. The use of this construct results in processing not only own properties of an object but properties from its prototype as well. It may be unexpected in some specific cases, for example, in utility methods that copy or modify all properties or when 'Object''s prototype may be incorrectly modified. For example, the following code will print 42 and myMethod: 'Object.prototype.myMethod = function myMethod() {};\nlet a = { foo: 42 };\nfor (let i in a) {\n console.log(a[i]);\n}' Suggests replacing the whole loop with a 'Object.keys()' method or adding a 'hasOwnProperty()' check. After applying the quick-fix the code looks as follows: 'for (let i in a) {\n if (a.hasOwnProperty(i)) {\n console.log(a[i]);\n }\n}'", + "markdown": "Reports unfiltered `for-in` loops. \n\nThe use of this construct results in processing not only own properties of an object but properties from its prototype as well. It may be unexpected in some specific cases, for example, in utility methods that copy or modify all properties or when `Object`'s prototype may be incorrectly modified. For example, the following code will print **42** and **myMethod** : \n\n\n Object.prototype.myMethod = function myMethod() {};\n let a = { foo: 42 };\n for (let i in a) {\n console.log(a[i]);\n }\n\nSuggests replacing the whole loop with a `Object.keys()` method or adding a `hasOwnProperty()` check. After applying the quick-fix the code looks as follows:\n\n\n for (let i in a) {\n if (a.hasOwnProperty(i)) {\n console.log(a[i]);\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSUnfilteredForInLoop", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSFunctionExpressionToArrowFunction", + "shortDescription": { + "text": "Function expression is used instead of arrow function" + }, + "fullDescription": { + "text": "Reports a function expression. Suggests converting it to an arrow function. Example: 'arr.map(function(el) {return el + 1})' After applying the quick-fix the code looks as follows: 'arr.map(el => el + 1)'", + "markdown": "Reports a [function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function) expression. Suggests converting it to an [arrow function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions).\n\nExample:\n\n arr.map(function(el) {return el + 1})\n\nAfter applying the quick-fix the code looks as follows:\n\n arr.map(el => el + 1)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSFunctionExpressionToArrowFunction", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/ES2015 migration aids", + "index": 25, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6TopLevelAwaitExpression", + "shortDescription": { + "text": "Top-level 'await' expression" + }, + "fullDescription": { + "text": "Reports a usage of a top-level 'await' expression. While the new 'top-level async' proposal is on its way, using 'await' outside async functions is not allowed.", + "markdown": "Reports a usage of a top-level `await` expression. While the new 'top-level async' proposal is on its way, using `await` outside async functions is not allowed." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "ES6TopLevelAwaitExpression", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Async code and promises", + "index": 55, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6ConvertToForOf", + "shortDescription": { + "text": "'for..in' is used instead of 'for..of'" + }, + "fullDescription": { + "text": "Reports a usage of a 'for..in' loop on an array. Suggests replacing it with a 'for..of' loop. 'for..of' loops, which are introduced in ECMAScript 6, iterate over 'iterable' objects. For arrays, this structure is preferable to 'for..in', because it works only with array values but not with array object's properties.", + "markdown": "Reports a usage of a [for..in](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in) loop on an array. Suggests replacing it with a [for..of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) loop. \n`for..of` loops, which are introduced in ECMAScript 6, iterate over `iterable` objects. For arrays, this structure is preferable to `for..in`, because it works only with array values but not with array object's properties." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6ConvertToForOf", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/ES2015 migration aids", + "index": 25, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ParameterNamingConventionJS", + "shortDescription": { + "text": "Function parameter naming convention" + }, + "fullDescription": { + "text": "Reports a function parameter whose name is too short, too long, or doesn't follow the specified regular expression pattern. Use the fields provided below to specify minimum length, maximum length and regular expression expected for local variables names. Use the standard 'java.util.regex' format regular expressions.", + "markdown": "Reports a function parameter whose name is too short, too long, or doesn't follow the specified regular expression pattern.\n\n\nUse the fields provided below to specify minimum length, maximum length and regular expression\nexpected for local variables names. Use the standard `java.util.regex` format regular expressions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ParameterNamingConventionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Naming conventions", + "index": 63, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSUndefinedPropertyAssignment", + "shortDescription": { + "text": "Undefined property assignment" + }, + "fullDescription": { + "text": "Reports an assignment to a property that is not defined in the type of a variable. Example: '/**\n * @type {{ property1: string, property2: number }}\n */\nlet myVariable = create();\n\nmyVariable.newProperty = 3; // bad'", + "markdown": "Reports an assignment to a property that is not defined in the type of a variable.\n\nExample:\n\n\n /**\n * @type {{ property1: string, property2: number }}\n */\n let myVariable = create();\n\n myVariable.newProperty = 3; // bad\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSUndefinedPropertyAssignment", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ParametersPerFunctionJS", + "shortDescription": { + "text": "Function with too many parameters" + }, + "fullDescription": { + "text": "Reports a function with too many parameters. Such functions often indicate problems with design. Use the field below to specify the maximum acceptable number of parameters for a function.", + "markdown": "Reports a function with too many parameters. Such functions often indicate problems with design.\n\n\nUse the field below to specify the maximum acceptable number of parameters for a function." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "OverlyComplexFunctionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Function metrics", + "index": 69, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ThisExpressionReferencesGlobalObjectJS", + "shortDescription": { + "text": "'this' expression which references the global object" + }, + "fullDescription": { + "text": "Reports a 'this' expression outside an object literal or a constructor body. Such 'this' expressions reference the top-level \"global\" JavaScript object, but are mostly useless.", + "markdown": "Reports a `this` expression outside an object literal or a constructor body. Such `this` expressions reference the top-level \"global\" JavaScript object, but are mostly useless." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ThisExpressionReferencesGlobalObjectJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Validity issues", + "index": 30, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSDeprecatedSymbols", + "shortDescription": { + "text": "Deprecated symbol used" + }, + "fullDescription": { + "text": "Reports a usage of a deprecated function variable.", + "markdown": "Reports a usage of a deprecated function variable." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSDeprecatedSymbols", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LocalVariableNamingConventionJS", + "shortDescription": { + "text": "Local variable naming convention" + }, + "fullDescription": { + "text": "Reports a local variable whose name is too short, too long, or doesn't follow the specified regular expression pattern. Use the fields provided below to specify minimum length, maximum length, and a regular expression expected for local variables names. Use the standard 'java.util.regex' format regular expressions.", + "markdown": "Reports a local variable whose name is too short, too long, or doesn't follow the specified regular expression pattern.\n\n\nUse the fields provided below to specify minimum length, maximum length, and a regular expression\nexpected for local variables names. Use the standard `java.util.regex` format regular expressions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "LocalVariableNamingConventionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Naming conventions", + "index": 63, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UpdateDependencyToLatestVersion", + "shortDescription": { + "text": "Update package.json dependencies to latest versions" + }, + "fullDescription": { + "text": "Suggests to upgrade your package.json dependencies to the latest versions, ignoring specified versions.", + "markdown": "Suggests to upgrade your package.json dependencies to the latest versions, ignoring specified versions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "UpdateDependencyToLatestVersion", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Imports and dependencies", + "index": 59, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSSuspiciousNameCombination", + "shortDescription": { + "text": "Suspicious variable/parameter name combination" + }, + "fullDescription": { + "text": "Reports an assignment or a function call where the name of the target variable or the function parameter does not match the name of the value assigned to it. Example: 'var x = 0;\n var y = x;' or 'var x = 0, y = 0;\n var rc = new Rectangle(y, x, 20, 20);' Here the inspection guesses that 'x' and 'y' are mixed up. Specify the names that should not be used together. An error is reported if a parameter name or an assignment target name contains words from one group while the name of the assigned or passed variable contains words from another group.", + "markdown": "Reports an assignment or a function call where the name of the target variable or the function parameter does not match the name of the value assigned to it.\n\nExample:\n\n\n var x = 0;\n var y = x;\n\nor\n\n\n var x = 0, y = 0;\n var rc = new Rectangle(y, x, 20, 20);\n\nHere the inspection guesses that `x` and `y` are mixed up.\n\nSpecify the names that should not be used together. An error is reported\nif a parameter name or an assignment target name contains words from one group while the name of the assigned or passed\nvariable contains words from another group." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSSuspiciousNameCombination", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSUnresolvedExtXType", + "shortDescription": { + "text": "Unresolved Ext JS xtype" + }, + "fullDescription": { + "text": "Reports an Ext JS 'xtype' reference that doesn't have a corresponding class.", + "markdown": "Reports an Ext JS `xtype` reference that doesn't have a corresponding class." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSUnresolvedExtXType", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6RedundantNestingInTemplateLiteral", + "shortDescription": { + "text": "Redundant nesting in template literal" + }, + "fullDescription": { + "text": "Reports nested instances of a string or a template literal. Suggests inlining the nested instances into the containing template string. Example: 'let a = `Hello, ${`Brave ${\"New\"}`} ${\"World\"}!`' After applying the quick-fix the code looks as follows: 'let a = `Hello, Brave New World!`'", + "markdown": "Reports nested instances of a string or a template literal. Suggests inlining the nested instances into the containing template string.\n\nExample:\n\n\n let a = `Hello, ${`Brave ${\"New\"}`} ${\"World\"}!`\n\nAfter applying the quick-fix the code looks as follows:\n\n\n let a = `Hello, Brave New World!`\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6RedundantNestingInTemplateLiteral", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestingDepthJS", + "shortDescription": { + "text": "Overly nested function" + }, + "fullDescription": { + "text": "Reports a function whose body contains statements that are too deeply nested within other statements. Such functions may be confusing and indicate that refactoring may be necessary. Use the field provided below to specify the maximum acceptable nesting depth allowed in a function.", + "markdown": "Reports a function whose body contains statements that are too deeply nested within other statements. Such functions may be confusing and indicate that refactoring may be necessary.\n\n\nUse the field provided below to specify the maximum acceptable nesting depth allowed in a function." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "OverlyNestedFunctionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Function metrics", + "index": 69, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptSuspiciousConstructorParameterAssignment", + "shortDescription": { + "text": "Assigned constructor field parameter" + }, + "fullDescription": { + "text": "Reports a common mistake in TypeScript code, when a class field is declared as a constructor parameter, and then this parameter is assigned. In this case, the corresponding field won't be assigned, only the local parameter value is modified. 'class Foo {\n constructor(private p: number) {\n p = 1; //must be this.p = 1;\n }\n}'", + "markdown": "Reports a common mistake in TypeScript code, when a class field is declared as a constructor parameter, and then this parameter is assigned. \nIn this case, the corresponding field *won't* be assigned, only the local parameter value is modified.\n\n\n class Foo {\n constructor(private p: number) {\n p = 1; //must be this.p = 1;\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "TypeScriptSuspiciousConstructorParameterAssignment", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ChainedFunctionCallJS", + "shortDescription": { + "text": "Chained function call" + }, + "fullDescription": { + "text": "Reports a function call whose target is another function call, for example, 'foo().bar()'", + "markdown": "Reports a function call whose target is another function call, for example, `foo().bar()`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ChainedFunctionCallJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedFunctionCallJS", + "shortDescription": { + "text": "Nested function call" + }, + "fullDescription": { + "text": "Reports a function call that is used as an argument in another function call, for example, 'foo(bar())'", + "markdown": "Reports a function call that is used as an argument in another function call, for example, `foo(bar())`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NestedFunctionCallJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSEqualityComparisonWithCoercion", + "shortDescription": { + "text": "Equality operator may cause type coercion" + }, + "fullDescription": { + "text": "Reports a usage of an equality operator that may cause unexpected type coercions. Suggests replacing '==' and '!=' with type-safe equality operators '===' and '!=='. Depending on the option selected, one of the following cases will be reported: All usages of '==' and '!=' operators. All usages except comparison with null. Some code styles allow using 'x == null' as a replacement for 'x === null || x === undefined'. Only suspicious expressions, such as: '==' or '!=' comparisons with '0', '''', 'null', 'true', 'false', or 'undefined'.", + "markdown": "Reports a usage of an equality operator that may cause unexpected type coercions. Suggests replacing `==` and `!=` with type-safe equality operators `===` and `!==`.\n\nDepending on the option selected, one of the following cases will be reported:\n\n* All usages of `==` and `!=` operators.\n* All usages except comparison with null. Some code styles allow using `x == null` as a replacement for `x === null || x === undefined`.\n* Only suspicious expressions, such as: `==` or `!=` comparisons with `0`, `''`, `null`, `true`, `false`, or `undefined`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EqualityComparisonWithCoercionJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstantOnLHSOfComparisonJS", + "shortDescription": { + "text": "Constant on left side of comparison" + }, + "fullDescription": { + "text": "Reports a comparison operation with a constant value in the left-hand side. According to coding conventions, constants should be in the right-hand side of comparisons.", + "markdown": "Reports a comparison operation with a constant value in the left-hand side. According to coding conventions, constants should be in the right-hand side of comparisons." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ConstantOnLefSideOfComparisonJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSCheckFunctionSignatures", + "shortDescription": { + "text": "Signature mismatch" + }, + "fullDescription": { + "text": "Reports a JavaScript call expression where the arguments do not match the signature of the referenced function, including the types of arguments and their number. Also, reports if the overloading function doesn't match the overloaded one in terms of parameters and return types. TypeScript code is ignored.", + "markdown": "Reports a JavaScript call expression where the arguments do not match the signature of the referenced function, including the types of arguments and their number. Also, reports if the overloading function doesn't match the overloaded one in terms of parameters and return types.\n\nTypeScript code is ignored." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSCheckFunctionSignatures", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AssignmentResultUsedJS", + "shortDescription": { + "text": "Result of assignment used" + }, + "fullDescription": { + "text": "Reports an assignment expression where the result of the assignment is used in the containing expression. Such assignments often indicate coding errors, for example, '=' instead of '=='. Moreover, they can result in confusion due to the order of operations, as evaluation of the assignment may affect the outer expression in unexpected ways. Expressions in parentheses are ignored.", + "markdown": "Reports an assignment expression where the result of the assignment is used in the containing expression. Such assignments often indicate coding errors, for example, `=` instead of `==`. Moreover, they can result in confusion due to the order of operations, as evaluation of the assignment may affect the outer expression in unexpected ways.\n\nExpressions in parentheses are ignored." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "AssignmentResultUsedJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Assignment issues", + "index": 48, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstantOnRHSOfComparisonJS", + "shortDescription": { + "text": "Constant on right side of comparison" + }, + "fullDescription": { + "text": "Reports a comparison operation with a constant in the right-hand side. According to coding conventions, constants should only be in the left-hand side of comparisons.", + "markdown": "Reports a comparison operation with a constant in the right-hand side. According to coding conventions, constants should only be in the left-hand side of comparisons." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "ConstantOnRightSideOfComparisonJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Code style issues", + "index": 47, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSUnnecessarySemicolon", + "shortDescription": { + "text": "Unnecessary semicolon" + }, + "fullDescription": { + "text": "Reports an unneeded semicolon.", + "markdown": "Reports an unneeded semicolon." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSUnnecessarySemicolon", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptUnresolvedReference", + "shortDescription": { + "text": "Unresolved TypeScript reference" + }, + "fullDescription": { + "text": "Reports an unresolved reference in TypeScript code.", + "markdown": "Reports an unresolved reference in TypeScript code." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "TypeScriptUnresolvedReference", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSNonStrictModeUsed", + "shortDescription": { + "text": "Non-strict mode used" + }, + "fullDescription": { + "text": "Reports a JavaScript file that is not in the 'strict' mode.", + "markdown": "Reports a JavaScript file that is not in the `strict` mode." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSNonStrictModeUsed", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ES6RedundantAwait", + "shortDescription": { + "text": "Redundant 'await' expression" + }, + "fullDescription": { + "text": "Reports a redundant usage of 'await', such as 'await await', or awaiting a non-promise result. When the 'Report for promises' option is selected, suggests removing 'await' before promises when applicable (in 'return' statements, and with 'Promise.resolve/reject'). Removing 'await' in such contexts causes two problems. Surrounding your code with 'try-catch' and forgetting to add 'await' will change code semantics while you may fail to notice that. Having an explicit 'await' may prevent the V8 runtime from providing async stack traces.", + "markdown": "Reports a redundant usage of `await`, such as `await await`, or awaiting a non-promise result.\n\n\nWhen the 'Report for promises' option is selected, suggests removing `await` before promises when applicable\n(in `return` statements, and with `Promise.resolve/reject`).\n\nRemoving `await` in such contexts causes two problems.\n\n* Surrounding your code with `try-catch` and forgetting to add `await` will change code semantics while you may fail to notice that.\n* Having an explicit `await` may prevent the V8 runtime from providing [async stack traces](http://bit.ly/v8-zero-cost-async-stack-traces)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "ES6RedundantAwait", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Async code and promises", + "index": 55, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedSwitchStatementJS", + "shortDescription": { + "text": "Nested 'switch' statement" + }, + "fullDescription": { + "text": "Reports a 'switch' statement that is nested in another 'switch' statement. Nested 'switch' statements may be very confusing, particularly if indenting is inconsistent.", + "markdown": "Reports a `switch` statement that is nested in another `switch` statement. Nested `switch` statements may be very confusing, particularly if indenting is inconsistent." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "NestedSwitchStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Switch statement issues", + "index": 53, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AssignmentToFunctionParameterJS", + "shortDescription": { + "text": "Assignment to function parameter" + }, + "fullDescription": { + "text": "Reports an assignment to a function parameter, including increment and decrement operations. Although occasionally intended, this construct can be extremely confusing, and is often a result of an error.", + "markdown": "Reports an assignment to a function parameter, including increment and decrement operations. Although occasionally intended, this construct can be extremely confusing, and is often a result of an error." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "AssignmentToFunctionParameterJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Assignment issues", + "index": 48, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FallThroughInSwitchStatementJS", + "shortDescription": { + "text": "Fallthrough in 'switch' statement" + }, + "fullDescription": { + "text": "Reports a 'switch' statement where control can proceed from a branch to the next one. Such \"fall-through\" often indicates an error, for example, a missing 'break' or 'return'.", + "markdown": "Reports a `switch` statement where control can proceed from a branch to the next one. Such \"fall-through\" often indicates an error, for example, a missing `break` or `return`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "FallThroughInSwitchStatementJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Switch statement issues", + "index": 53, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CallerJS", + "shortDescription": { + "text": "Use of 'caller' property" + }, + "fullDescription": { + "text": "Reports a usage of the 'caller' property in a JavaScript function. Using this property to access the stack frame of the calling method can be extremely confusing and result in subtle bugs.", + "markdown": "Reports a usage of the `caller` property in a JavaScript function. Using this property to access the stack frame of the calling method can be extremely confusing and result in subtle bugs." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CallerJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TypeScriptExplicitMemberType", + "shortDescription": { + "text": "Explicit types" + }, + "fullDescription": { + "text": "Reports a type annotation that doesn't match the current code style for explicit types. Type declarations are not necessary when the type that is inferred from the context exactly matches the type annotation, for example: 'var pi: number = 3.14' In some cases it is preferable to always have explicit types - this prevents accidental type changes and makes code more explicit.", + "markdown": "Reports a type annotation that doesn't match the current code style for explicit types.\n\n\nType declarations are not necessary when the type that is inferred from the context exactly matches the type annotation, for example:\n\n\n var pi: number = 3.14\n\nIn some cases it is preferable to always have explicit types - this prevents accidental type changes and makes code more explicit." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "TypeScriptExplicitMemberType", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/TypeScript", + "index": 51, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSDuplicateCaseLabel", + "shortDescription": { + "text": "Duplicate 'case' label" + }, + "fullDescription": { + "text": "Reports a duplicated 'case' label on a 'switch' statement, which normally indicates an error.", + "markdown": "Reports a duplicated `case` label on a `switch` statement, which normally indicates an error." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSDuplicateCaseLabel", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Switch statement issues", + "index": 53, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSMissingSwitchBranches", + "shortDescription": { + "text": "'switch' statement has missing branches" + }, + "fullDescription": { + "text": "Reports a 'switch' statement on a variable of the type 'enum' or 'union' when the statement doesn't cover some value options from the type.", + "markdown": "Reports a `switch` statement on a variable of the type `enum` or `union` when the statement doesn't cover some value options from the type." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "JSMissingSwitchBranches", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Switch statement issues", + "index": 53, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSSwitchVariableDeclarationIssue", + "shortDescription": { + "text": "Variable is declared and being used in different 'case' clauses" + }, + "fullDescription": { + "text": "Reports a variable that is declared in one 'case' clause of a 'switch' statement but is used in another 'case' clause of the same statement. For block-scoped variables, this results in throwing a 'ReferenceError'. For 'var' variables, it indicates a potential error. Disable the inspection for 'var' variables if this pattern is used intentionally.", + "markdown": "Reports a variable that is declared in one `case` clause of a `switch` statement but is used in another `case` clause of the same statement. For block-scoped variables, this results in throwing a `ReferenceError`. For `var` variables, it indicates a potential error.\n\nDisable the inspection for `var` variables if this pattern is used intentionally." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSSwitchVariableDeclarationIssue", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Switch statement issues", + "index": 53, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSJQueryEfficiency", + "shortDescription": { + "text": "JQuery selector can be optimized" + }, + "fullDescription": { + "text": "Reports a duplicated jQuery selector that can be cached or a usage of an attribute or a pseudo-selector (optional).", + "markdown": "Reports a duplicated jQuery selector that can be cached or a usage of an attribute or a pseudo-selector (optional)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSJQueryEfficiency", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnreachableCodeJS", + "shortDescription": { + "text": "Unreachable code" + }, + "fullDescription": { + "text": "Reports code that can never be executed, which almost certainly indicates an error", + "markdown": "Reports code that can never be executed, which almost certainly indicates an error" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "UnreachableCodeJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Control flow issues", + "index": 39, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSSuspiciousEqPlus", + "shortDescription": { + "text": "Suspicious '=+' assignment" + }, + "fullDescription": { + "text": "Reports an assignment in the form 'a =+ b'. Suggests replacing with 'a += b'.", + "markdown": "Reports an assignment in the form `a =+ b`. Suggests replacing with `a += b`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSSuspiciousEqPlus", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Probable bugs", + "index": 44, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyStatementBodyJS", + "shortDescription": { + "text": "Statement with empty body" + }, + "fullDescription": { + "text": "Reports an 'if', 'while', 'for', or 'with' statement with an empty body. Such statements often result from typos, and may cause confusion. Use the checkbox below to specify whether the statements with empty block statements as bodies should be reported.", + "markdown": "Reports an `if`, `while`, `for`, or `with` statement with an empty body. Such statements often result from typos, and may cause confusion.\n\n\nUse the checkbox below to specify whether the statements with empty block statements as bodies\nshould be reported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "StatementWithEmptyBodyJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Potentially confusing code constructs", + "index": 31, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JSUnusedLocalSymbols", + "shortDescription": { + "text": "Unused local symbol" + }, + "fullDescription": { + "text": "Reports an unused locally accessible parameter, local variable, function, class, or private member declaration.", + "markdown": "Reports an unused locally accessible parameter, local variable, function, class, or private member declaration." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JSUnusedLocalSymbols", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/Unused symbols", + "index": 15, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "gherkin", + "version": "232.9881", + "rules": [ + { + "id": "GherkinScenarioToScenarioOutline", + "shortDescription": { + "text": "Scenario with Examples section" + }, + "fullDescription": { + "text": "Reports Gherkin scenarios that contain an 'Examples' section. Use the quick-fix to convert 'Scenario' to 'Scenario Outline'.", + "markdown": "Reports Gherkin scenarios that contain an `Examples` section.\n\nUse the quick-fix to convert `Scenario` to `Scenario Outline`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "GherkinScenarioToScenarioOutline", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Cucumber", + "index": 16, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CucumberTableInspection", + "shortDescription": { + "text": "Unused or missing columns in Cucumber tables" + }, + "fullDescription": { + "text": "Reports tables in 'Examples' sections in Cucumber .feature files with unused or missing columns.", + "markdown": "Reports tables in `Examples` sections in Cucumber .feature files with unused or missing columns." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CucumberTableInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Cucumber", + "index": 16, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "GherkinBrokenTableInspection", + "shortDescription": { + "text": "Gherkin table is broken" + }, + "fullDescription": { + "text": "Reports a table if there is at least one row with the number of cells different from the number of cells in the table header.", + "markdown": "Reports a table if there is at least one row with the number of cells different from the number of cells in the table header." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "GherkinBrokenTableInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Cucumber", + "index": 16, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "GherkinMisplacedBackground", + "shortDescription": { + "text": "Misplaced background section" + }, + "fullDescription": { + "text": "Reports 'Background' sections that are located incorrectly. The 'Background' section must be located before the 'Scenario' section.", + "markdown": "Reports `Background` sections that are located incorrectly. The `Background` section must be located before the `Scenario` section." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "GherkinMisplacedBackground", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Cucumber", + "index": 16, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CucumberMissedExamples", + "shortDescription": { + "text": "Missing examples section" + }, + "fullDescription": { + "text": "Reports scenario outlines in Cucumber .feature files that do not have the 'Examples' section. Use the quick-fix to automatically create the 'Examples' section with a pre-filled table header.", + "markdown": "Reports scenario outlines in Cucumber .feature files that do not have the `Examples` section.\n\nUse the quick-fix to automatically create the `Examples` section with a pre-filled table header." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CucumberMissedExamples", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Cucumber", + "index": 16, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CucumberUndefinedStep", + "shortDescription": { + "text": "Undefined step" + }, + "fullDescription": { + "text": "Reports steps in Cucumber (or some other Gherkin) .feature files that do not have matching step definitions. Use the quick-fix to automatically create a new step definition.", + "markdown": "Reports steps in Cucumber (or some other Gherkin) .feature files that do not have matching step definitions.\n\nUse the quick-fix to automatically create a new step definition." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CucumberUndefinedStep", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Cucumber", + "index": 16, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CucumberExamplesColon", + "shortDescription": { + "text": "Missing ':' after examples keyword" + }, + "fullDescription": { + "text": "Reports 'Examples' sections in Cucumber .feature files if they do not have ':' after the 'Examples' keyword.", + "markdown": "Reports `Examples` sections in Cucumber .feature files if they do not have ':' after the `Examples` keyword." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CucumberExamplesColon", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Cucumber", + "index": 16, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "org.editorconfig.editorconfigjetbrains", + "version": "232.9881", + "rules": [ + { + "id": "EditorConfigRootDeclarationUniqueness", + "shortDescription": { + "text": "Extra top-level declaration" + }, + "fullDescription": { + "text": "Reports multiple top-level declarations. There can be only one optional “root=true” top-level declaration in the EditorConfig file. Using multiple top-level declarations is not allowed.", + "markdown": "Reports multiple top-level declarations. There can be only one optional \"root=true\" top-level declaration in the EditorConfig file. Using multiple top-level declarations is not allowed." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigRootDeclarationUniqueness", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigNumerousWildcards", + "shortDescription": { + "text": "Too many wildcards" + }, + "fullDescription": { + "text": "Reports sections that contain too many wildcards. Using a lot of wildcards may lead to performance issues.", + "markdown": "Reports sections that contain too many wildcards. Using a lot of wildcards may lead to performance issues." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "EditorConfigNumerousWildcards", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigKeyCorrectness", + "shortDescription": { + "text": "Unknown property" + }, + "fullDescription": { + "text": "Reports properties that are not supported by the IDE. Note: some “ij” domain properties may require specific language plugins.", + "markdown": "Reports properties that are not supported by the IDE. Note: some \"ij\" domain properties may require specific language plugins." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigKeyCorrectness", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigEncoding", + "shortDescription": { + "text": "File encoding doesn't match EditorConfig charset" + }, + "fullDescription": { + "text": "Checks that current file encoding matches the encoding defined in \"charset\" property of .editorconfig file.", + "markdown": "Checks that current file encoding matches the encoding defined in \"charset\" property of .editorconfig file." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigEncoding", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigRootDeclarationCorrectness", + "shortDescription": { + "text": "Unexpected top-level declaration" + }, + "fullDescription": { + "text": "Reports unexpected top-level declarations. Top-level declarations other than “root=true” are not allowed in the EditorConfig file.", + "markdown": "Reports unexpected top-level declarations. Top-level declarations other than \"root=true\" are not allowed in the EditorConfig file." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigRootDeclarationCorrectness", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigPatternRedundancy", + "shortDescription": { + "text": "Duplicate or redundant pattern" + }, + "fullDescription": { + "text": "Reports file patterns that are redundant as there already are other patterns that define the same scope of files or even a broader one. For example, in '[{*.java,*}]' the first '*.java' pattern defines a narrower scope compared to '*'. That is why it is redundant and can be removed.", + "markdown": "Reports file patterns that are redundant as there already are other patterns that define the same scope of files or even a broader one. For example, in `[{*.java,*}]` the first `*.java` pattern defines a narrower scope compared to `*`. That is why it is redundant and can be removed." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigPatternRedundancy", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigDeprecatedDescriptor", + "shortDescription": { + "text": "Deprecated property" + }, + "fullDescription": { + "text": "Reports EditorConfig properties that are no longer supported.", + "markdown": "Reports EditorConfig properties that are no longer supported." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigDeprecatedDescriptor", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigShadowedOption", + "shortDescription": { + "text": "Overridden property" + }, + "fullDescription": { + "text": "Reports properties that are already defined in other sections. For example: '[*.java]\nindent_size=4\n[{*.java,*.js}]\nindent_size=2' The second section includes all '*.java' files too but it also redefines indent_size. As a result the value 2 will be used for files matching '*.java'.", + "markdown": "Reports properties that are already defined in other sections.\n\nFor example:\n\n\n [*.java]\n indent_size=4\n [{*.java,*.js}]\n indent_size=2\n\nThe second section includes all `*.java` files too but it also redefines indent_size. As a result the value 2 will be used for files matching `*.java`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigShadowedOption", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigEmptyHeader", + "shortDescription": { + "text": "Empty header" + }, + "fullDescription": { + "text": "Reports sections with an empty header. Section header must contain file path globs in the format similar to one supported by 'gitignore'.", + "markdown": "Reports sections with an empty header. Section header must contain file path globs in the format similar to one supported by `gitignore`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigEmptyHeader", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigValueUniqueness", + "shortDescription": { + "text": "Non-unique list value" + }, + "fullDescription": { + "text": "Reports duplicates in lists of values.", + "markdown": "Reports duplicates in lists of values." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigValueUniqueness", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigMissingRequiredDeclaration", + "shortDescription": { + "text": "Required declarations are missing" + }, + "fullDescription": { + "text": "Reports properties that miss the required declarations. Refer to the documentation for more information.", + "markdown": "Reports properties that miss the required declarations. Refer to the documentation for more information." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigMissingRequiredDeclaration", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigSpaceInHeader", + "shortDescription": { + "text": "Space in file pattern" + }, + "fullDescription": { + "text": "Reports space characters in wildcard patterns that affect pattern matching. If these characters are not intentional, they should be removed.", + "markdown": "Reports space characters in wildcard patterns that affect pattern matching. If these characters are not intentional, they should be removed." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "EditorConfigSpaceInHeader", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigOptionRedundancy", + "shortDescription": { + "text": "Redundant property" + }, + "fullDescription": { + "text": "Reports properties that are redundant when another applicable section already contains the same property and value. For example: '[*]\nindent_size=4\n[*.java]\nindent_size=4' are both applicable to '*.java' files and define the same 'indent_size' value.", + "markdown": "Reports properties that are redundant when another applicable section already contains the same property and value.\n\n\nFor example:\n\n\n [*]\n indent_size=4\n [*.java]\n indent_size=4\n\nare both applicable to `*.java` files and define the same `indent_size` value." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigOptionRedundancy", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigUnexpectedComma", + "shortDescription": { + "text": "Unexpected comma" + }, + "fullDescription": { + "text": "Reports commas that cannot be used in the current context. Commas are allowed only as separators for values in lists.", + "markdown": "Reports commas that cannot be used in the current context. Commas are allowed only as separators for values in lists." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigUnexpectedComma", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigCharClassRedundancy", + "shortDescription": { + "text": "Unnecessary character class" + }, + "fullDescription": { + "text": "Reports character classes that consist of a single character. Such classes can be simplified to a character, for example '[a]'→'a'.", + "markdown": "Reports character classes that consist of a single character. Such classes can be simplified to a character, for example `[a]`→`a`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigCharClassRedundancy", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigPartialOverride", + "shortDescription": { + "text": "Overlapping sections" + }, + "fullDescription": { + "text": "Reports subsets of files specified in the current section that overlap with other subsets in other sections. For example: '[{foo,bar}]' and '[{foo,bas}]' both contain “foo”.", + "markdown": "Reports subsets of files specified in the current section that overlap with other subsets in other sections. For example: `[{foo,bar}]` and `[{foo,bas}]` both contain \"foo\"." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "EditorConfigPartialOverride", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigEmptySection", + "shortDescription": { + "text": "Empty section" + }, + "fullDescription": { + "text": "Reports sections that do not contain any EditorConfig properties.", + "markdown": "Reports sections that do not contain any EditorConfig properties." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigEmptySection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigShadowingOption", + "shortDescription": { + "text": "Overriding property" + }, + "fullDescription": { + "text": "Reports properties that override the same properties defined earlier in the file. For example: '[*.java]\nindent_size=4\n[{*.java,*.js}]\nindent_size=2' The second section includes the same files as '[*.java]' but also sets indent_size to value 2. Thus the first declaration 'indent_size=4'will be ignored.", + "markdown": "Reports properties that override the same properties defined earlier in the file.\n\nFor example:\n\n\n [*.java]\n indent_size=4\n [{*.java,*.js}]\n indent_size=2\n\nThe second section includes the same files as `[*.java]` but also sets indent_size to value 2. Thus the first declaration `indent_size=4`will be ignored." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigShadowingOption", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigListAcceptability", + "shortDescription": { + "text": "Unexpected value list" + }, + "fullDescription": { + "text": "Reports lists of values that are used in properties in which lists are not supported. In this case, only a single value can be specified.", + "markdown": "Reports lists of values that are used in properties in which lists are not supported. In this case, only a single value can be specified." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigListAcceptability", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigPatternEnumerationRedundancy", + "shortDescription": { + "text": "Unnecessary braces" + }, + "fullDescription": { + "text": "Reports pattern lists that are either empty '{}' or contain just one pattern, for example '{foo}' in contrast to a list containing multiple patterns, for example '{foo,bar}'. In this case braces are handled as a part of the name. For example, the pattern '*.{a}' will match the file 'my.{a}' but not 'my.a'.", + "markdown": "Reports pattern lists that are either empty `{}` or contain just one pattern, for example `{foo}` in contrast to a list containing multiple patterns, for example `{foo,bar}`. In this case braces are handled as a part of the name. For example, the pattern `*.{a}` will match the file `my.{a}` but not `my.a`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigPatternEnumerationRedundancy", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigReferenceCorrectness", + "shortDescription": { + "text": "Invalid reference" + }, + "fullDescription": { + "text": "Reports identifiers that are either unknown or have a wrong type.", + "markdown": "Reports identifiers that are either unknown or have a wrong type." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigReferenceCorrectness", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigPairAcceptability", + "shortDescription": { + "text": "Unexpected key-value pair" + }, + "fullDescription": { + "text": "Reports key-value pairs that are not allowed in the current context.", + "markdown": "Reports key-value pairs that are not allowed in the current context." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigPairAcceptability", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigNoMatchingFiles", + "shortDescription": { + "text": "No matching files" + }, + "fullDescription": { + "text": "Reports sections with wildcard patterns that do not match any files under the directory in which the '.editorconfig' file is located.", + "markdown": "Reports sections with wildcard patterns that do not match any files under the directory in which the `.editorconfig` file is located." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigNoMatchingFiles", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigWildcardRedundancy", + "shortDescription": { + "text": "Redundant wildcard" + }, + "fullDescription": { + "text": "Reports wildcards that become redundant when the “**” wildcard is used in the same section. The “**” wildcard defines a broader set of files than any other wildcard. That is why, any other wildcard used in the same section has no affect and can be removed.", + "markdown": "Reports wildcards that become redundant when the \"\\*\\*\" wildcard is used in the same section.\n\n\nThe \"\\*\\*\" wildcard defines a broader set of files than any other wildcard.\nThat is why, any other wildcard used in the same section has no affect and can be removed." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigWildcardRedundancy", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigHeaderUniqueness", + "shortDescription": { + "text": "EditorConfig section is not unique" + }, + "fullDescription": { + "text": "Reports sections that define the same file pattern as other sections.", + "markdown": "Reports sections that define the same file pattern as other sections." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigHeaderUniqueness", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigValueCorrectness", + "shortDescription": { + "text": "Invalid property value" + }, + "fullDescription": { + "text": "Reports property values that do not meet value restrictions. For example, some properties may be only “true” or “false”, others contain only integer numbers etc. If a value has a limited set of variants, use code completion to see all of them.", + "markdown": "Reports property values that do not meet value restrictions. For example, some properties may be only \"true\" or \"false\", others contain only integer numbers etc. If a value has a limited set of variants, use code completion to see all of them." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigValueCorrectness", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigVerifyByCore", + "shortDescription": { + "text": "Invalid .editorconfig file" + }, + "fullDescription": { + "text": "Verifies the whole file using the backing EditorConfig core library and reports any failures. Any such failure would prevent EditorConfig properties from being correctly applied.", + "markdown": "Verifies the whole file using the backing EditorConfig core library and reports any failures. Any such failure would prevent EditorConfig properties from being correctly applied." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "EditorConfigVerifyByCore", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigCharClassLetterRedundancy", + "shortDescription": { + "text": "Duplicate character class letter" + }, + "fullDescription": { + "text": "Reports wildcard patterns in the EditorConfig section that contain a duplicate character in the character class, for example '[aa]'.", + "markdown": "Reports wildcard patterns in the EditorConfig section that contain a duplicate character in the character class, for example `[aa]`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigCharClassLetterRedundancy", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EditorConfigUnusedDeclaration", + "shortDescription": { + "text": "Unused declaration" + }, + "fullDescription": { + "text": "Reports unused declarations. Such declarations can be removed.", + "markdown": "Reports unused declarations. Such declarations can be removed." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "EditorConfigUnusedDeclaration", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "EditorConfig", + "index": 19, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "org.intellij.plugins.postcss", + "version": "232.9881", + "rules": [ + { + "id": "PostCssUnresolvedModuleValueReference", + "shortDescription": { + "text": "Unresolved CSS module value" + }, + "fullDescription": { + "text": "Reports an unresolved reference to a CSS Module Value ('@value' declaration). Example: '@value foo from unknown;'", + "markdown": "Reports an unresolved reference to a [CSS Module Value](https://github.com/css-modules/postcss-modules-values) (`@value` declaration).\n\nExample:\n\n\n @value foo from unknown;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "PostCssUnresolvedModuleValueReference", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PostCSS", + "index": 21, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PostCssNesting", + "shortDescription": { + "text": "Invalid nested rule" + }, + "fullDescription": { + "text": "Reports a nested style rule whose syntax doesn't comply with the PostCSS Nested or the PostCSS Nesting specification. Example: '.phone {\n &_title {}\n}'", + "markdown": "Reports a nested style rule whose syntax doesn't comply with the [PostCSS Nested](https://github.com/postcss/postcss-nested) or the [PostCSS Nesting](https://github.com/csstools/postcss-nesting) specification.\n\nExample:\n\n\n .phone {\n &_title {}\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "PostCssNesting", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PostCSS", + "index": 21, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PostCssCustomMedia", + "shortDescription": { + "text": "Invalid custom media" + }, + "fullDescription": { + "text": "Reports a syntax error in a PostCSS Custom Media query. Example: '@custom-media --small-viewport (max-width: 30em);'", + "markdown": "Reports a syntax error in a [PostCSS Custom Media](https://github.com/postcss/postcss-custom-media) query.\n\nExample:\n\n\n @custom-media --small-viewport (max-width: 30em);\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "PostCssCustomMedia", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PostCSS", + "index": 21, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PostCssCustomSelector", + "shortDescription": { + "text": "Invalid custom selector" + }, + "fullDescription": { + "text": "Reports a syntax error in PostCSS Custom Selector. Example: '@custom-selector :--heading h1, h2, h3;'", + "markdown": "Reports a syntax error in [PostCSS Custom Selector](https://github.com/postcss/postcss-custom-selectors).\n\nExample:\n\n\n @custom-selector :--heading h1, h2, h3;\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "PostCssCustomSelector", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PostCSS", + "index": 21, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PostCssMediaRange", + "shortDescription": { + "text": "Invalid media query range" + }, + "fullDescription": { + "text": "Checks range context syntax, which may alternatively be used for media features with a 'range' type. Example: '@media screen and (500px <= width <= 1200px) {}'", + "markdown": "Checks [range context](https://github.com/postcss/postcss-media-minmax) syntax, which may alternatively be used for media features with a 'range' type.\n\nExample:\n\n\n @media screen and (500px <= width <= 1200px) {}\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "PostCssMediaRange", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "PostCSS", + "index": 21, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "HtmlTools", + "version": "232.9881", + "rules": [ + { + "id": "HtmlRequiredAltAttribute", + "shortDescription": { + "text": "Missing required 'alt' attribute" + }, + "fullDescription": { + "text": "Reports a missing 'alt' attribute in a 'img' or 'applet' tag or in a 'area' element of an image map. Suggests adding a required attribute with a text alternative for the contents of the tag. Based on WCAG 2.0: H24, H35, H36, H37.", + "markdown": "Reports a missing `alt` attribute in a `img` or `applet` tag or in a `area` element of an image map. Suggests adding a required attribute with a text alternative for the contents of the tag. Based on WCAG 2.0: [H24](https://www.w3.org/TR/WCAG20-TECHS/H24.html), [H35](https://www.w3.org/TR/WCAG20-TECHS/H35.html), [H36](https://www.w3.org/TR/WCAG20-TECHS/H36.html), [H37](https://www.w3.org/TR/WCAG20-TECHS/H37.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlRequiredAltAttribute", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML/Accessibility", + "index": 28, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlDeprecatedTag", + "shortDescription": { + "text": "Obsolete tag" + }, + "fullDescription": { + "text": "Reports an obsolete HTML5 tag. Suggests replacing the obsolete tag with a CSS or another tag.", + "markdown": "Reports an obsolete HTML5 tag. Suggests replacing the obsolete tag with a CSS or another tag." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlDeprecatedTag", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CheckImageSize", + "shortDescription": { + "text": "Mismatched image size" + }, + "fullDescription": { + "text": "Reports a 'width' and 'height' attribute value of a 'img' tag that is different from the actual width and height of the referenced image.", + "markdown": "Reports a `width` and `height` attribute value of a `img` tag that is different from the actual width and height of the referenced image." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CheckImageSize", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlRequiredSummaryAttribute", + "shortDescription": { + "text": "Missing required 'summary' attribute" + }, + "fullDescription": { + "text": "Reports a missing 'summary' attribute in a 'table' tag. Suggests adding a'summary' attribute. Based on WCAG 2.0: H73.", + "markdown": "Reports a missing `summary` attribute in a `table` tag. Suggests adding a`summary` attribute. Based on WCAG 2.0: [H73](https://www.w3.org/TR/WCAG20-TECHS/H73.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "HtmlRequiredSummaryAttribute", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "HTML/Accessibility", + "index": 28, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlNonExistentInternetResource", + "shortDescription": { + "text": "Unresolved web link" + }, + "fullDescription": { + "text": "Reports an unresolved web link. Works by making network requests in the background.", + "markdown": "Reports an unresolved web link. Works by making network requests in the background." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlNonExistentInternetResource", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlFormInputWithoutLabel", + "shortDescription": { + "text": "Missing associated label" + }, + "fullDescription": { + "text": "Reports a form element ('input', 'textarea', or 'select') without an associated label. Suggests creating a new label. Based on WCAG 2.0: H44.", + "markdown": "Reports a form element (`input`, `textarea`, or `select`) without an associated label. Suggests creating a new label. Based on WCAG 2.0: [H44](https://www.w3.org/TR/WCAG20-TECHS/H44.html). " + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlFormInputWithoutLabel", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML/Accessibility", + "index": 28, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlRequiredTitleAttribute", + "shortDescription": { + "text": "Missing required 'title' attribute" + }, + "fullDescription": { + "text": "Reports a missing title attribute 'frame', 'iframe', 'dl', and 'a' tags. Suggests adding a title attribute. Based on WCAG 2.0: H33, H40, and H64.", + "markdown": "Reports a missing title attribute `frame`, `iframe`, `dl`, and `a` tags. Suggests adding a title attribute. Based on WCAG 2.0: [H33](https://www.w3.org/TR/WCAG20-TECHS/H33.html), [H40](https://www.w3.org/TR/WCAG20-TECHS/H40.html), and [H64](https://www.w3.org/TR/WCAG20-TECHS/H64.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "HtmlRequiredTitleAttribute", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "HTML/Accessibility", + "index": 28, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlRequiredLangAttribute", + "shortDescription": { + "text": "Missing required 'lang' attribute" + }, + "fullDescription": { + "text": "Reports a missing 'lang' (or 'xml:lang') attribute in a 'html' tag. Suggests adding a required attribute to state the default language of the document. Based on WCAG 2.0: H57.", + "markdown": "Reports a missing `lang` (or `xml:lang`) attribute in a `html` tag. Suggests adding a required attribute to state the default language of the document. Based on WCAG 2.0: [H57](https://www.w3.org/TR/WCAG20-TECHS/H57.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlRequiredLangAttribute", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML/Accessibility", + "index": 28, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlRequiredTitleElement", + "shortDescription": { + "text": "Missing required 'title' element" + }, + "fullDescription": { + "text": "Reports a missing 'title' element inside a 'head' section. Suggests adding a 'title' element. The title should describe the document. Based on WCAG 2.0: H25.", + "markdown": "Reports a missing `title` element inside a `head` section. Suggests adding a `title` element. The title should describe the document. Based on WCAG 2.0: [H25](https://www.w3.org/TR/WCAG20-TECHS/H25.html)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlRequiredTitleElement", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML/Accessibility", + "index": 28, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlDeprecatedAttribute", + "shortDescription": { + "text": "Obsolete attribute" + }, + "fullDescription": { + "text": "Reports an obsolete HTML5 attribute.", + "markdown": "Reports an obsolete HTML5 attribute." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "HtmlDeprecatedAttribute", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HtmlPresentationalElement", + "shortDescription": { + "text": "Presentational tag" + }, + "fullDescription": { + "text": "Reports a presentational HTML tag. Suggests replacing the presentational tag with a CSS or another tag.", + "markdown": "Reports a presentational HTML tag. Suggests replacing the presentational tag with a CSS or another tag." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "HtmlPresentationalElement", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "HTML", + "index": 14, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.intellij.css", + "version": "232.9881", + "rules": [ + { + "id": "CssInvalidHtmlTagReference", + "shortDescription": { + "text": "Invalid type selector" + }, + "fullDescription": { + "text": "Reports a CSS type selector that matches an unknown HTML element.", + "markdown": "Reports a CSS [type selector](https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors) that matches an unknown HTML element." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssInvalidHtmlTagReference", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssInvalidFunction", + "shortDescription": { + "text": "Invalid function" + }, + "fullDescription": { + "text": "Reports an unknown CSS function or an incorrect function parameter.", + "markdown": "Reports an unknown [CSS function](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Functions) or an incorrect function parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssInvalidFunction", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssMissingSemicolon", + "shortDescription": { + "text": "Missing semicolon" + }, + "fullDescription": { + "text": "Reports a missing semicolon at the end of a declaration.", + "markdown": "Reports a missing semicolon at the end of a declaration." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssMissingSemicolon", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Code style issues", + "index": 42, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssMissingComma", + "shortDescription": { + "text": "Missing comma in selector list" + }, + "fullDescription": { + "text": "Reports a multi-line selector. Most likely this means that several single-line selectors are actually intended but a comma is missing at the end of one or several lines. Example: 'input /* comma has probably been forgotten */\n.button {\n margin: 1px;\n}'", + "markdown": "Reports a multi-line selector. Most likely this means that several single-line selectors are actually intended but a comma is missing at the end of one or several lines.\n\n**Example:**\n\n\n input /* comma has probably been forgotten */\n .button {\n margin: 1px;\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssMissingComma", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Probable bugs", + "index": 52, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssConvertColorToHexInspection", + "shortDescription": { + "text": "Color could be replaced with #-hex" + }, + "fullDescription": { + "text": "Reports an 'rgb()', 'hsl()', or other color function. Suggests replacing a color function with an equivalent hexadecimal notation. Example: 'rgb(12, 15, 255)' After the quick-fix is applied: '#0c0fff'.", + "markdown": "Reports an `rgb()`, `hsl()`, or other color function.\n\nSuggests replacing a color function with an equivalent hexadecimal notation.\n\n**Example:**\n\n rgb(12, 15, 255)\n\nAfter the quick-fix is applied:\n\n #0c0fff.\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssConvertColorToHexInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssConvertColorToRgbInspection", + "shortDescription": { + "text": "Color could be replaced with rgb()" + }, + "fullDescription": { + "text": "Reports an 'hsl()' or 'hwb()' color function or a hexadecimal color notation. Suggests replacing such color value with an equivalent 'rgb()' or 'rgba()' color function. Example: '#0c0fff' After the quick-fix is applied: 'rgb(12, 15, 255)'.", + "markdown": "Reports an `hsl()` or `hwb()` color function or a hexadecimal color notation.\n\nSuggests replacing such color value with an equivalent `rgb()` or `rgba()` color function.\n\n**Example:**\n\n #0c0fff\n\nAfter the quick-fix is applied:\n\n rgb(12, 15, 255).\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssConvertColorToRgbInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssUnusedSymbol", + "shortDescription": { + "text": "Unused selector" + }, + "fullDescription": { + "text": "Reports a CSS class or an element IDs that appears in selectors but is not used in HTML. Note that complete inspection results are available only when running it via Code | Inspect Code or Code | Analyze Code | Run Inspection by Name. Due to performance reasons, style sheet files are not inspected on the fly.", + "markdown": "Reports a CSS class or an element IDs that appears in selectors but is not used in HTML.\n\n\nNote that complete inspection results are available only when running it via **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name**.\nDue to performance reasons, style sheet files are not inspected on the fly." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssUnusedSymbol", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssInvalidAtRule", + "shortDescription": { + "text": "Unknown at-rule" + }, + "fullDescription": { + "text": "Reports an unknown CSS at-rule.", + "markdown": "Reports an unknown [CSS at-rule](https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssInvalidAtRule", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssUnknownTarget", + "shortDescription": { + "text": "Unresolved file reference" + }, + "fullDescription": { + "text": "Reports an unresolved file reference, for example, an incorrect path in an '@import' statement.", + "markdown": "Reports an unresolved file reference, for example, an incorrect path in an `@import` statement." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssUnknownTarget", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssNegativeValue", + "shortDescription": { + "text": "Negative property value" + }, + "fullDescription": { + "text": "Reports a negative value of a CSS property that is not expected to be less than zero, for example, object width or height.", + "markdown": "Reports a negative value of a CSS property that is not expected to be less than zero, for example, object width or height." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssNegativeValue", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssNoGenericFontName", + "shortDescription": { + "text": "Missing generic font family name" + }, + "fullDescription": { + "text": "Verifies that the 'font-family' property contains a generic font family name as a fallback alternative. Generic font family names are: 'serif', 'sans-serif', 'cursive', 'fantasy', and 'monospace'.", + "markdown": "Verifies that the [font-family](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family) property contains a generic font family name as a fallback alternative.\n\n\nGeneric font family names are: `serif`, `sans-serif`, `cursive`, `fantasy`,\nand `monospace`." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssNoGenericFontName", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Probable bugs", + "index": 52, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssInvalidCharsetRule", + "shortDescription": { + "text": "Misplaced or incorrect @charset" + }, + "fullDescription": { + "text": "Reports a misplaced '@charset' at-rule or an incorrect charset value.", + "markdown": "Reports a misplaced `@charset` at-rule or an incorrect charset value." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssInvalidCharsetRule", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssInvalidPseudoSelector", + "shortDescription": { + "text": "Invalid pseudo-selector" + }, + "fullDescription": { + "text": "Reports an incorrect CSS pseudo-class pseudo-element.", + "markdown": "Reports an incorrect CSS [pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes) [pseudo-element](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssInvalidPseudoSelector", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssRedundantUnit", + "shortDescription": { + "text": "Redundant measure unit" + }, + "fullDescription": { + "text": "Reports a measure unit of a zero value where units are not required by the specification. Example: 'width: 0px'", + "markdown": "Reports a measure unit of a zero value where units are not required by the specification.\n\n**Example:**\n\n width: 0px\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssRedundantUnit", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Code style issues", + "index": 42, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssInvalidPropertyValue", + "shortDescription": { + "text": "Invalid property value" + }, + "fullDescription": { + "text": "Reports an incorrect CSS property value.", + "markdown": "Reports an incorrect CSS property value." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssInvalidPropertyValue", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssBrowserCompatibilityForProperties", + "shortDescription": { + "text": "Property is incompatible with selected browsers" + }, + "fullDescription": { + "text": "Reports a CSS property that is not supported by the specified browsers. Based on the MDN Compatibility Data.", + "markdown": "Reports a CSS property that is not supported by the specified browsers. Based on the [MDN Compatibility Data](https://github.com/mdn/browser-compat-data)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssBrowserCompatibilityForProperties", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssReplaceWithShorthandUnsafely", + "shortDescription": { + "text": "Properties may probably be replaced with a shorthand" + }, + "fullDescription": { + "text": "Reports a set of longhand CSS properties and suggests replacing an incomplete set of longhand CSS properties with a shorthand form, which is however not 100% equivalent in this case. For example, 2 properties: 'outline-color' and 'outline-style' may be replaced with a single 'outline'. Such replacement is not 100% equivalent because shorthands reset all omitted sub-values to their initial states. In this example, switching to the 'outline' shorthand means that 'outline-width' is also set to its initial value, which is 'medium'. This inspection doesn't handle full sets of longhand properties (when switching to shorthand is 100% safe). For such cases see the 'Properties may be safely replaced with a shorthand' inspection instead.", + "markdown": "Reports a set of longhand CSS properties and suggests replacing an incomplete set of longhand CSS properties with a shorthand form, which is however not 100% equivalent in this case.\n\n\nFor example, 2 properties: `outline-color` and `outline-style` may be replaced with a single `outline`.\nSuch replacement is not 100% equivalent because shorthands reset all omitted sub-values to their initial states.\nIn this example, switching to the `outline` shorthand means that `outline-width` is also set to its initial value,\nwhich is `medium`.\n\n\nThis inspection doesn't handle full sets of longhand properties (when switching to shorthand is 100% safe).\nFor such cases see the 'Properties may be safely replaced with a shorthand' inspection instead." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "CssReplaceWithShorthandUnsafely", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssUnknownUnit", + "shortDescription": { + "text": "Unknown unit" + }, + "fullDescription": { + "text": "Reports an unknown unit", + "markdown": "Reports an unknown unit" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssUnknownUnit", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssInvalidMediaFeature", + "shortDescription": { + "text": "Invalid media feature" + }, + "fullDescription": { + "text": "Reports an unknown CSS media feature or an incorrect media feature value.", + "markdown": "Reports an unknown [CSS media feature](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries) or an incorrect media feature value." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssInvalidMediaFeature", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssDeprecatedValue", + "shortDescription": { + "text": "Deprecated value" + }, + "fullDescription": { + "text": "Reports a deprecated CSS value. Suggests replacing the deprecated value with valid equivalent.", + "markdown": "Reports a deprecated CSS value. Suggests replacing the deprecated value with valid equivalent." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssDeprecatedValue", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssNonIntegerLengthInPixels", + "shortDescription": { + "text": "Non-integer length in pixels" + }, + "fullDescription": { + "text": "Reports a non-integer length in pixels. Example: 'width: 3.14px'", + "markdown": "Reports a non-integer length in pixels.\n\n**Example:**\n\n width: 3.14px\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "CssNonIntegerLengthInPixels", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Probable bugs", + "index": 52, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssInvalidImport", + "shortDescription": { + "text": "Misplaced @import" + }, + "fullDescription": { + "text": "Reports a misplaced '@import' statement. According to the specification, '@import' rules must precede all other types of rules, except '@charset' rules.", + "markdown": "Reports a misplaced `@import` statement.\n\n\nAccording to the [specification](https://developer.mozilla.org/en-US/docs/Web/CSS/@import),\n`@import` rules must precede all other types of rules, except `@charset` rules." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssInvalidImport", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssUnresolvedCustomProperty", + "shortDescription": { + "text": "Unresolved custom property" + }, + "fullDescription": { + "text": "Reports an unresolved reference to a custom property among the arguments of the 'var()' function.", + "markdown": "Reports an unresolved reference to a [custom property](https://developer.mozilla.org/en-US/docs/Web/CSS/--*) among the arguments of the `var()` function." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssUnresolvedCustomProperty", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssOverwrittenProperties", + "shortDescription": { + "text": "Overwritten property" + }, + "fullDescription": { + "text": "Reports a duplicated CSS property within a ruleset. Respects shorthand properties. Example: '.foo {\n margin-bottom: 1px;\n margin-bottom: 1px; /* duplicates margin-bottom */\n margin: 0; /* overrides margin-bottom */\n}'", + "markdown": "Reports a duplicated CSS property within a ruleset. Respects shorthand properties.\n\n**Example:**\n\n\n .foo {\n margin-bottom: 1px;\n margin-bottom: 1px; /* duplicates margin-bottom */\n margin: 0; /* overrides margin-bottom */\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssOverwrittenProperties", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssUnresolvedClassInComposesRule", + "shortDescription": { + "text": "Unresolved class in 'composes' rule" + }, + "fullDescription": { + "text": "Reports a CSS class reference in the 'composes' rule that cannot be resolved to any valid target. Example: '.className {/* ... */}\n\n .otherClassName {\n composes: className;\n }'", + "markdown": "Reports a CSS class reference in the ['composes'](https://github.com/css-modules/css-modules#composition) rule that cannot be resolved to any valid target.\n\n**Example:**\n\n\n .className {/* ... */}\n\n .otherClassName {\n composes: className;\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "CssUnresolvedClassInComposesRule", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssReplaceWithShorthandSafely", + "shortDescription": { + "text": "Properties may be safely replaced with a shorthand" + }, + "fullDescription": { + "text": "Reports a set of longhand properties. Suggests replacing a complete set of longhand CSS properties with an equivalent shorthand form. For example, 4 properties: 'padding-top', 'padding-right', 'padding-bottom', and 'padding-left' can be safely replaced with a single 'padding' property. Note that this inspection doesn't show up if the set of longhand properties is incomplete (e.g. only 3 'padding-xxx' properties in a ruleset) because switching to a shorthand may change the result. For such cases consider the 'Properties may probably be replaced with a shorthand' inspection.", + "markdown": "Reports a set of longhand properties. Suggests replacing a complete set of longhand CSS properties with an equivalent shorthand form.\n\n\nFor example, 4 properties: `padding-top`, `padding-right`, `padding-bottom`, and\n`padding-left`\ncan be safely replaced with a single `padding` property.\n\n\nNote that this inspection doesn't show up if the set of longhand properties is incomplete\n(e.g. only 3 `padding-xxx` properties in a ruleset)\nbecause switching to a shorthand may change the result.\nFor such cases consider the 'Properties may probably be replaced with a shorthand'\ninspection." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "CssReplaceWithShorthandSafely", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "CSS", + "index": 32, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssUnknownProperty", + "shortDescription": { + "text": "Unknown property" + }, + "fullDescription": { + "text": "Reports an unknown CSS property or a property used in a wrong context. Add the unknown property to the 'Custom CSS properties' list to skip validation.", + "markdown": "Reports an unknown CSS property or a property used in a wrong context.\n\nAdd the unknown property to the 'Custom CSS properties' list to skip validation." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssUnknownProperty", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CssInvalidNestedSelector", + "shortDescription": { + "text": "Invalid nested selector" + }, + "fullDescription": { + "text": "Reports a nested selector starting with an identifier or a functional notation.", + "markdown": "Reports a nested selector starting with an identifier or a functional notation." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CssInvalidNestedSelector", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "CSS/Invalid elements", + "index": 33, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "org.jetbrains.plugins.yaml", + "version": "232.9881", + "rules": [ + { + "id": "YAMLSchemaValidation", + "shortDescription": { + "text": "Validation by JSON Schema" + }, + "fullDescription": { + "text": "Reports inconsistencies between a YAML file and a JSON Schema if the schema is specified. Scheme example: '{\n \"properties\": {\n \"SomeNumberProperty\": {\n \"type\": \"number\"\n }\n }\n }' The following is an example with the corresponding warning: 'SomeNumberProperty: hello world'", + "markdown": "Reports inconsistencies between a YAML file and a JSON Schema if the schema is specified.\n\n**Scheme example:**\n\n\n {\n \"properties\": {\n \"SomeNumberProperty\": {\n \"type\": \"number\"\n }\n }\n }\n\n**The following is an example with the corresponding warning:**\n\n\n SomeNumberProperty: hello world\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "YAMLSchemaValidation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "YAML", + "index": 36, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "YAMLUnresolvedAlias", + "shortDescription": { + "text": "Unresolved alias" + }, + "fullDescription": { + "text": "Reports unresolved aliases in YAML files. Example: 'some_key: *unknown_alias'", + "markdown": "Reports unresolved aliases in YAML files.\n\n**Example:**\n\n\n some_key: *unknown_alias\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "YAMLUnresolvedAlias", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "YAML", + "index": 36, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "YAMLSchemaDeprecation", + "shortDescription": { + "text": "Deprecated YAML key" + }, + "fullDescription": { + "text": "Reports deprecated keys in YAML files. Deprecation is checked only if there exists a JSON schema associated with the corresponding YAML file. Note that the deprecation mechanism is not defined in the JSON Schema specification yet, and this inspection uses a non-standard 'deprecationMessage' extension. Scheme deprecation example: '{\n \"properties\": {\n \"SomeDeprecatedProperty\": {\n \"deprecationMessage\": \"Baz\",\n \"description\": \"Foo bar\"\n }\n }\n }' The following is an example with the corresponding warning: 'SomeDeprecatedProperty: some value'", + "markdown": "Reports deprecated keys in YAML files.\n\nDeprecation is checked only if there exists a JSON schema associated with the corresponding YAML file.\n\nNote that the deprecation mechanism is not defined in the JSON Schema specification yet,\nand this inspection uses a non-standard `deprecationMessage` extension.\n\n**Scheme deprecation example:**\n\n\n {\n \"properties\": {\n \"SomeDeprecatedProperty\": {\n \"deprecationMessage\": \"Baz\",\n \"description\": \"Foo bar\"\n }\n }\n }\n\n**The following is an example with the corresponding warning:**\n\n\n SomeDeprecatedProperty: some value\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "YAMLSchemaDeprecation", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "YAML", + "index": 36, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "YAMLIncompatibleTypes", + "shortDescription": { + "text": "Suspicious type mismatch" + }, + "fullDescription": { + "text": "Reports a mismatch between a scalar value type in YAML file and types of the values in the similar positions. Example: 'myElements:\n - value1\n - value2\n - false # <- reported, because it is a boolean value, while other values are strings'", + "markdown": "Reports a mismatch between a scalar value type in YAML file and types of the values in the similar positions.\n\n**Example:**\n\n\n myElements:\n - value1\n - value2\n - false # <- reported, because it is a boolean value, while other values are strings\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "YAMLIncompatibleTypes", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "YAML", + "index": 36, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "YAMLRecursiveAlias", + "shortDescription": { + "text": "Recursive alias" + }, + "fullDescription": { + "text": "Reports recursion in YAML aliases. Alias can't be recursive and be used inside the data referenced by a corresponding anchor. Example: 'some_key: &some_anchor\n sub_key1: value1\n sub_key2: *some_anchor'", + "markdown": "Reports recursion in YAML aliases.\n\nAlias can't be recursive and be used inside the data referenced by a corresponding anchor.\n\n**Example:**\n\n\n some_key: &some_anchor\n sub_key1: value1\n sub_key2: *some_anchor\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "YAMLRecursiveAlias", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "YAML", + "index": 36, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "YAMLDuplicatedKeys", + "shortDescription": { + "text": "Duplicated YAML keys" + }, + "fullDescription": { + "text": "Reports duplicated keys in YAML files. Example: 'same_key: some value\n same_key: another value'", + "markdown": "Reports duplicated keys in YAML files.\n\n**Example:**\n\n\n same_key: some value\n same_key: another value\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "YAMLDuplicatedKeys", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "YAML", + "index": 36, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "YAMLUnusedAnchor", + "shortDescription": { + "text": "Unused anchor" + }, + "fullDescription": { + "text": "Reports unused anchors. Example: 'some_key: &some_anchor\n key1: value1'", + "markdown": "Reports unused anchors.\n\n**Example:**\n\n\n some_key: &some_anchor\n key1: value1\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "YAMLUnusedAnchor", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "YAML", + "index": 36, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "org.jetbrains.plugins.less", + "version": "232.9881", + "rules": [ + { + "id": "LessUnresolvedVariable", + "shortDescription": { + "text": "Unresolved variable" + }, + "fullDescription": { + "text": "Reports a reference to a Less variable that is not resolved. Example: '* {\n margin: @unknown-var;\n}'", + "markdown": "Reports a reference to a [Less variable](http://lesscss.org/features/#variables-feature) that is not resolved.\n\n**Example:**\n\n\n * {\n margin: @unknown-var;\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "LessUnresolvedVariable", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Less", + "index": 43, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LessResolvedByNameOnly", + "shortDescription": { + "text": "Missing import" + }, + "fullDescription": { + "text": "Reports a reference to a variable or mixin that is declared in another file, which is not explicitly imported in the current file. Example: '* {\n margin: @var-in-other-file;\n}'", + "markdown": "Reports a reference to a variable or mixin that is declared in another file, which is not explicitly [imported](http://lesscss.org/features/#import-atrules-feature) in the current file.\n\n**Example:**\n\n\n * {\n margin: @var-in-other-file;\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "LessResolvedByNameOnly", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "Less", + "index": 43, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LessUnresolvedMixin", + "shortDescription": { + "text": "Unresolved mixin" + }, + "fullDescription": { + "text": "Reports a reference to a Less mixin that is not resolved. Example: '* {\n .unknown-mixin();\n}'", + "markdown": "Reports a reference to a [Less mixin](http://lesscss.org/features/#mixins-feature) that is not resolved.\n\n**Example:**\n\n\n * {\n .unknown-mixin();\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "LessUnresolvedMixin", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Less", + "index": 43, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.jetbrains.php.joomla", + "version": "232.9881", + "rules": [ + { + "id": "FileHeaderInspection", + "shortDescription": { + "text": "Missing @copyright/@license tags" + }, + "fullDescription": { + "text": "Reports the file header DocBlocks that do not contain the '@copyright' and '@license' tags required by the Joomla! DocBlocks standard. See Joomla! Coding Standards (developer.joomla.org) for details.", + "markdown": "Reports the file header DocBlocks that do not contain the `@copyright` and `@license` tags required by the Joomla! DocBlocks standard.\n\n\nSee [Joomla! Coding Standards (developer.joomla.org)](https://developer.joomla.org/coding-standards/docblocks.html) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "FileHeaderInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "Joomla!", + "index": 49, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MissingSinceTagDocInspection", + "shortDescription": { + "text": "Missing @since tag" + }, + "fullDescription": { + "text": "Reports the class, class property, and class method DocBlocks that do not contain the '@since' tag required by the Joomla! DocBlocks standard. See Joomla! Coding Standards (developer.joomla.org) for details.", + "markdown": "Reports the class, class property, and class method DocBlocks that do not contain the `@since` tag required by the Joomla! DocBlocks standard.\n\nSee [Joomla! Coding Standards (developer.joomla.org)](https://developer.joomla.org/coding-standards/docblocks.html) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "MissingSinceTagDocInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "Joomla!", + "index": 49, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.jetbrains.php.architecture", + "version": "232.9881", + "rules": [ + { + "id": "PhpComplexClassInspection", + "shortDescription": { + "text": "Complex class should be refactored" + }, + "fullDescription": { + "text": "Reports the classes that are too complex. Class complexity is evaluated based on three metrics: TCC (Tight class cohesion) — the measure of class cohesiveness (more is better). WMC (Weighted Method count) — the sum of cyclomatic complexities for all methods in a class (less is better). ATFD (Access to foreign data) — the number of properties from another class that are accessed in the current class (less is better).", + "markdown": "Reports the classes that are too complex.\n\nClass complexity is evaluated based on three metrics:\n\n* TCC (Tight class cohesion) --- the measure of class cohesiveness (more is better).\n* WMC (Weighted Method count) --- the sum of cyclomatic complexities for all methods in a class (less is better).\n* ATFD (Access to foreign data) --- the number of properties from another class that are accessed in the current class (less is better)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpComplexClassInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Refactoring opportunities", + "index": 50, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpMemberCanBePulledUpInspection", + "shortDescription": { + "text": "Member can be pulled up" + }, + "fullDescription": { + "text": "Reports the class methods and properties that should be pulled up to the parent class or interface.", + "markdown": "Reports the class methods and properties that should be pulled up to the parent class or interface." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpMemberCanBePulledUpInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Refactoring opportunities", + "index": 50, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFeatureEnvyLocalInspection", + "shortDescription": { + "text": "Method has Feature Envy on another class" + }, + "fullDescription": { + "text": "Reports the \"Feature Envy\" code smell. Feature envy is defined as occurring when a method calls methods on another class more times than on the source class. It often indicates that the intended functionality is located in the wrong class. Calls to library classes, parent classes, and contained or containing classes are not counted by this inspection.", + "markdown": "Reports the \"Feature Envy\" code smell. Feature envy is defined as occurring when a method calls methods on another class more times than on the source class. It often indicates that the intended functionality is located in the wrong class.\n\n\nCalls to library classes, parent classes, and contained or containing classes are not counted by this inspection." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpFeatureEnvyLocalInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Refactoring opportunities", + "index": 50, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpClassHasTooManyDeclaredMembersInspection", + "shortDescription": { + "text": "Class has too many declared members" + }, + "fullDescription": { + "text": "Reports the classes that have too many properties or methods.", + "markdown": "Reports the classes that have too many properties or methods." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpClassHasTooManyDeclaredMembersInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Refactoring opportunities", + "index": 50, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpFunctionCyclomaticComplexityInspection", + "shortDescription": { + "text": "Function has too high cyclomatic complexity" + }, + "fullDescription": { + "text": "Reports the methods that have high cyclomatic complexity and can probably be simplified. See Cyclomatic complexity (wikipedia.org) for details.", + "markdown": "Reports the methods that have high cyclomatic complexity and can probably be simplified.\n\n\nSee [Cyclomatic complexity (wikipedia.org)](https://en.wikipedia.org/wiki/Cyclomatic_complexity) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpFunctionCyclomaticComplexityInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Refactoring opportunities", + "index": 50, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpHalsteadMetricInspection", + "shortDescription": { + "text": "Halstead metric" + }, + "fullDescription": { + "text": "Reports the methods with high Halstead Complexity metric. See Halstead measure (wikipedia.org) for details.", + "markdown": "Reports the methods with high Halstead Complexity metric.\n\n\nSee [Halstead measure (wikipedia.org)](https://en.wikipedia.org/wiki/Halstead_complexity_measures) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpHalsteadMetricInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Refactoring opportunities", + "index": 50, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpComplexFunctionInspection", + "shortDescription": { + "text": "Complex function should be refactored" + }, + "fullDescription": { + "text": "Reports the functions or methods that are too complex. Complexity is evaluated based on four metrics: Lines of code — the number of code lines in a function/method (less is better) Maximum Nesting depth — the maximum number of nested statements in a function/method body (less is better) Cyclomatic complexity — the function/method cyclomatic complexity (less is better) Number of variables — the number of variables used in function/method body", + "markdown": "Reports the functions or methods that are too complex.\n\nComplexity is evaluated based on four metrics:\n\n* Lines of code --- the number of code lines in a function/method (less is better)\n* Maximum Nesting depth --- the maximum number of nested statements in a function/method body (less is better)\n* Cyclomatic complexity --- the function/method cyclomatic complexity (less is better)\n* Number of variables --- the number of variables used in function/method body" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpComplexFunctionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Refactoring opportunities", + "index": 50, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpLackOfCohesionInspection", + "shortDescription": { + "text": "LCOM metric" + }, + "fullDescription": { + "text": "Reports the classes that have high Lack of Cohesion metric value, which represents the degree of cohesiveness of a class. It uses class dependency graph components for class cohesiveness measure (M. Hitz and B. Montazeri definition of LCOM metric)", + "markdown": "Reports the classes that have high Lack of Cohesion metric value, which represents the degree of cohesiveness of a class.\n\n\nIt uses class dependency graph components for class cohesiveness measure (M. Hitz and B. Montazeri definition of LCOM metric)" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpLackOfCohesionInspection", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Refactoring opportunities", + "index": 50, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "org.intellij.qodana", + "version": "232.9881", + "rules": [ + { + "id": "JsCoverageInspection", + "shortDescription": { + "text": "Check JavaScript and TypeScript source code coverage" + }, + "fullDescription": { + "text": "Reports methods, classes and files whose coverage is below a certain threshold.", + "markdown": "Reports methods, classes and files whose coverage is below a certain threshold." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "JsCoverageInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Code Coverage", + "index": 56, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpCoverageInspection", + "shortDescription": { + "text": "Check the PHP source code coverage" + }, + "fullDescription": { + "text": "Reports methods, classes and files whose coverage is below a certain threshold.", + "markdown": "Reports methods, classes and files whose coverage is below a certain threshold." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpCoverageInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Code Coverage", + "index": 56, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "QodanaSanity", + "shortDescription": { + "text": "Sanity" + }, + "fullDescription": { + "text": "Reports issues essential to this file like syntax errors, unresolved methods and variables, etc...", + "markdown": "Reports issues essential to this file like syntax errors, unresolved methods and variables, etc..." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "QodanaSanity", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Qodana", + "index": 86, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.jetbrains.php.behat", + "version": "232.9881", + "rules": [ + { + "id": "BehatDocStepCanBeConvertedToAttributeInspection", + "shortDescription": { + "text": "Behat doc step can be converted to attribute version" + }, + "fullDescription": { + "text": "Reports Behat doc tags that can be replaced with attribute version", + "markdown": "Reports Behat doc tags that can be replaced with attribute version" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "BehatDocStepCanBeConvertedToAttributeInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Behat", + "index": 58, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.jetbrains.plugins.ini4idea", + "version": "232.9881", + "rules": [ + { + "id": "DuplicateSectionInFile", + "shortDescription": { + "text": "Duplicate section in file" + }, + "fullDescription": { + "text": "Reports duplicate sections in the 'ini' file.", + "markdown": "Reports duplicate sections in the `ini` file." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "DuplicateSectionInFile", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Ini files", + "index": 60, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DuplicateKeyInSection", + "shortDescription": { + "text": "Duplicate directive in section" + }, + "fullDescription": { + "text": "Reports duplicate properties in the 'ini' file section.", + "markdown": "Reports duplicate properties in the `ini` file section." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "DuplicateKeyInSection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Ini files", + "index": 60, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.intellij.php.psalm", + "version": "232.9881", + "rules": [ + { + "id": "PsalmAdvanceCallableParamsInspection", + "shortDescription": { + "text": "Function call is not compatible with 'callable' declaration" + }, + "fullDescription": { + "text": "Reports the parameters in function calls whose types are not compatible with the ones defined via 'Closure'.", + "markdown": "Reports the parameters in function calls whose types are not compatible with the ones defined via `Closure`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PsalmAdvanceCallableParamsInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Psalm", + "index": 62, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PsalmGlobal", + "shortDescription": { + "text": "Psalm validation" + }, + "fullDescription": { + "text": "Runs Psalm to find code problems. The inspection requires Psalm to be properly installed and set up in the IDE under Settings | PHP | Quality Tools | Psalm. To learn more about installing Psalm, see: https://psalm.dev/docs/running_psalm/installation/", + "markdown": "Runs Psalm to find code problems. \n\nThe inspection requires Psalm to be properly installed and set up in the IDE under [Settings \\| PHP \\| Quality Tools \\| Psalm](settings://settings.php.quality.tools?Psalm).\n\nTo learn more about installing Psalm, see:\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PsalmGlobal", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Quality tools", + "index": 70, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.intellij.taintAnalysis", + "version": "232.9881", + "rules": [ + { + "id": "PhpTaintFunctionInspection", + "shortDescription": { + "text": "Vulnerabilities scanner" + }, + "fullDescription": { + "text": "Call of this function may be unsafe.", + "markdown": "Call of this function may be unsafe." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "PhpTaintFunctionInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Taint analysis", + "index": 64, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PhpVulnerablePathsInspection", + "shortDescription": { + "text": "Vulnerable paths scanner" + }, + "fullDescription": { + "text": "Global taint analysis inspection.", + "markdown": "Global taint analysis inspection." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "PhpVulnerablePathsInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Taint analysis", + "index": 64, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.jetbrains.php.blade", + "version": "232.9881", + "rules": [ + { + "id": "BladeUnpairedParenthesesInStringLiteral", + "shortDescription": { + "text": "Parse error due to unpaired parentheses in string literals" + }, + "fullDescription": { + "text": "Reports the unpaired parentheses in string literals that produce blade parser errors. See laravel issue (github.com) for details.", + "markdown": "Reports the unpaired parentheses in string literals that produce blade parser errors.\n\n\nSee [laravel issue (github.com)](https://github.com/laravel/framework/issues/18317) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "suppressToolId": "BladeUnpairedParenthesesInStringLiteral", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Blade files", + "index": 66, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BladeControlDirectives", + "shortDescription": { + "text": "Control directive missing" + }, + "fullDescription": { + "text": "Reports the Blade control directives that are not closed with the corresponding '@end...' directives. See Blade directives (laravel.com) for details.", + "markdown": "Reports the Blade control directives that are not closed with the corresponding `@end...` directives.\n\n\nSee [Blade directives (laravel.com)](https://laravel.com/docs/blade#blade-directives) for details." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "BladeControlDirectives", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Blade files", + "index": 66, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "tanvd.grazi", + "version": "232.9881", + "rules": [ + { + "id": "LanguageDetectionInspection", + "shortDescription": { + "text": "Natural language detection" + }, + "fullDescription": { + "text": "Detects natural languages and suggests enabling corresponding grammar and spelling checks.", + "markdown": "Detects natural languages and suggests enabling corresponding grammar and spelling checks." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "LanguageDetectionInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Proofreading", + "index": 57, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "GrazieInspection", + "shortDescription": { + "text": "Grammar" + }, + "fullDescription": { + "text": "Reports grammar mistakes in your text. You can configure the inspection in Settings | Editor | Natural Languages | Grammar.", + "markdown": "Reports grammar mistakes in your text. You can configure the inspection in [Settings \\| Editor \\| Natural Languages \\| Grammar](settings://reference.settingsdialog.project.grazie)." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "GrazieInspection", + "ideaSeverity": "GRAMMAR_ERROR", + "qodanaSeverity": "Info" + } + }, + "relationships": [ + { + "target": { + "id": "Proofreading", + "index": 57, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "org.jetbrains.plugins.vue", + "version": "232.9881", + "rules": [ + { + "id": "VueMissingComponentImportInspection", + "shortDescription": { + "text": "Missing component import" + }, + "fullDescription": { + "text": "Reports Vue components, which require to be imported in Vue templates. It provides a quick fix to add the missing import.", + "markdown": "Reports Vue components, which require to be imported in Vue templates. It provides a quick fix to add the missing import." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "VueMissingComponentImportInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Vue", + "index": 76, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "VueUnrecognizedDirective", + "shortDescription": { + "text": "Unrecognized directive" + }, + "fullDescription": { + "text": "Reports an unrecognized Vue directive.", + "markdown": "Reports an unrecognized Vue directive." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "VueUnrecognizedDirective", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Vue", + "index": 76, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "VueDuplicateTag", + "shortDescription": { + "text": "Duplicate template/script tag" + }, + "fullDescription": { + "text": "Reports multiple usages of the 'template' or 'script' tag in a Vue file. Vue Component specification indicates that each '*.vue' file can contain at most one 'template' or 'script' block at a time.", + "markdown": "Reports multiple usages of the `template` or `script` tag in a Vue file.\n\n[Vue Component specification](https://vue-loader.vuejs.org/spec.html) indicates that each `*.vue` file can contain at most one `template` or `script` block at a time." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "VueDuplicateTag", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Vue", + "index": 76, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "VueDeprecatedSymbol", + "shortDescription": { + "text": "Deprecated symbol" + }, + "fullDescription": { + "text": "Reports a deprecated Vue symbol.", + "markdown": "Reports a deprecated Vue symbol." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "VueDeprecatedSymbol", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Vue", + "index": 76, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "VueDataFunction", + "shortDescription": { + "text": "Data function" + }, + "fullDescription": { + "text": "Reports a Vue component data property that is not a function. Suggests wrapping an object literal with a function. When defining a component, 'data' must be declared as a function that returns the initial data object, because the same definition will be used for creating numerous instances. If a plain object is still used for 'data', that very object will be shared by reference across all instances created! With a 'data' function, every time a new instance is created we can simply call it to return a fresh copy of the initial data.", + "markdown": "Reports a Vue component [data](https://vuejs.org/v2/api/#data) property that is not a function. Suggests wrapping an object literal with a function.\n\nWhen defining a component, `data` must be declared as a function that returns the initial data object, because the same definition will be used for creating numerous instances. If a plain object is still used for `data`, that very object will be shared by reference across all instances created! With a `data` function, every time a new instance is created we can simply call it to return a fresh copy of the initial data." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "VueDataFunction", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Vue", + "index": 76, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "VueUnrecognizedSlot", + "shortDescription": { + "text": "Unrecognized slot" + }, + "fullDescription": { + "text": "Reports an unrecognized Vue slot.", + "markdown": "Reports an unrecognized Vue slot." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "VueUnrecognizedSlot", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "Vue", + "index": 76, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.intellij.plugins.dependencyAnalysis", + "version": "232.9881", + "rules": [ + { + "id": "CheckThirdPartySoftwareList", + "shortDescription": { + "text": "Check third party software list" + }, + "fullDescription": { + "text": "Check project for possible problems: user's third party software list does not match the collected project metadata", + "markdown": "Check project for possible problems: user's third party software list does not match the collected project metadata" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CheckThirdPartySoftwareList", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Dependency analysis", + "index": 79, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CheckDependencyLicenses", + "shortDescription": { + "text": "Check dependency licenses" + }, + "fullDescription": { + "text": "Check dependencies licenses for possible problems: missing or prohibited licenses, or other compliance issues", + "markdown": "Check dependencies licenses for possible problems: missing or prohibited licenses, or other compliance issues" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "CheckDependencyLicenses", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Dependency analysis", + "index": 79, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CheckModuleLicenses", + "shortDescription": { + "text": "Check module licenses" + }, + "fullDescription": { + "text": "Check module licenses for possible problems: missing licenses or other compliance issues", + "markdown": "Check module licenses for possible problems: missing licenses or other compliance issues" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "CheckModuleLicenses", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Dependency analysis", + "index": 79, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "org.intellij.intelliLang", + "version": "232.9881", + "rules": [ + { + "id": "InjectedReferences", + "shortDescription": { + "text": "Injected references" + }, + "fullDescription": { + "text": "Reports unresolved references injected by Language Injections. Example: '@Language(\"file-reference\")\n String fileName = \"/home/user/nonexistent.file\"; // highlighted if file doesn't exist'", + "markdown": "Reports unresolved references injected by [Language Injections](https://www.jetbrains.com/help/idea/using-language-injections.html).\n\nExample:\n\n\n @Language(\"file-reference\")\n String fileName = \"/home/user/nonexistent.file\"; // highlighted if file doesn't exist\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "InjectedReferences", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "General", + "index": 27, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.intellij.php.tools.quality.phpstan", + "version": "232.9881", + "rules": [ + { + "id": "PhpStanGlobal", + "shortDescription": { + "text": "PHPStan validation" + }, + "fullDescription": { + "text": "Runs PHPStan to find code problems. The inspection requires PHPStan to be properly installed and set up in the IDE under Settings | PHP | Quality Tools | PHPStan. To learn more about installing PHPStan, see: https://phpstan.org/user-guide/getting-started", + "markdown": "Runs PHPStan to find code problems. \n\nThe inspection requires PHPStan to be properly installed and set up in the IDE under [Settings \\| PHP \\| Quality Tools \\| PHPStan](settings://settings.php.quality.tools?PHPStan).\n\nTo learn more about installing PHPStan, see:\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "suppressToolId": "PhpStanGlobal", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" + } + }, + "relationships": [ + { + "target": { + "id": "PHP/Quality tools", + "index": 70, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "intellij.webpack", + "version": "232.9881", + "rules": [ + { + "id": "WebpackConfigHighlighting", + "shortDescription": { + "text": "Webpack config compliance with JSON Schema" + }, + "fullDescription": { + "text": "Validates options in webpack config files (which name should start with `webpack`, e.g. `webpack.config.js`) against webpack options schema. Disable this inspection to turn off validation and code completion inside the configuration object.", + "markdown": "Validates options in webpack config files (which name should start with \\`webpack\\`, e.g. \\`webpack.config.js\\`) against [webpack options schema](https://github.com/webpack/webpack/blob/master/schemas/WebpackOptions.json). \n\nDisable this inspection to turn off validation and code completion inside the configuration object." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "WebpackConfigHighlighting", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "JavaScript and TypeScript/General", + "index": 24, + "toolComponent": { + "name": "QDPHP" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + } + ] + }, + "invocations": [ + { + "exitCode": 0, + "toolExecutionNotifications": [ + { + "message": { + "text": "Reporting from [] 'sanity' inspections was suspended due to high problems count." + }, + "level": "error" + } + ], + "executionSuccessful": true + } + ], + "language": "en-US", + "versionControlProvenance": [ + { + "repositoryUri": "https://github.com/zephir-lang/zephir", + "revisionId": "f018ec731c3e9e75a8d910234a97959421bf87d6", + "branch": "phpcs-2", + "properties": { + "repoUrl": "https://github.com/zephir-lang/zephir", + "lastAuthorName": "Nikolaos Dimopoulos", + "vcsType": "Git", + "lastAuthorEmail": "nikos@niden.net" + } + } + ], + "results": [ + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Detectors/WriteDetector.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 110, + "startColumn": 9, + "charOffset": 3033, + "charLength": 504, + "snippet": { + "text": "if (isset($expression['parameters'])) {\n foreach ($expression['parameters'] as $parameter) {\n $usePass = self::DETECT_PARAM_PASS == ($this->detectionFlags & self::DETECT_PARAM_PASS);\n if ($usePass && 'variable' == $parameter['parameter']['type']) {\n $this->increaseMutations($parameter['parameter']['value']);\n } else {\n $this->passExpression($parameter['parameter']);\n }\n }\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 110, + "startColumn": 1, + "charOffset": 3025, + "charLength": 512, + "snippet": { + "text": " if (isset($expression['parameters'])) {\n foreach ($expression['parameters'] as $parameter) {\n $usePass = self::DETECT_PARAM_PASS == ($this->detectionFlags & self::DETECT_PARAM_PASS);\n if ($usePass && 'variable' == $parameter['parameter']['type']) {\n $this->increaseMutations($parameter['parameter']['value']);\n } else {\n $this->passExpression($parameter['parameter']);\n }\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Detectors/WriteDetector.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 250, + "startColumn": 9, + "charOffset": 7299, + "charLength": 504, + "snippet": { + "text": "if (isset($expression['parameters'])) {\n foreach ($expression['parameters'] as $parameter) {\n $usePass = self::DETECT_PARAM_PASS == ($this->detectionFlags & self::DETECT_PARAM_PASS);\n if ($usePass && 'variable' == $parameter['parameter']['type']) {\n $this->increaseMutations($parameter['parameter']['value']);\n } else {\n $this->passExpression($parameter['parameter']);\n }\n }\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 250, + "startColumn": 1, + "charOffset": 7291, + "charLength": 512, + "snippet": { + "text": " if (isset($expression['parameters'])) {\n foreach ($expression['parameters'] as $parameter) {\n $usePass = self::DETECT_PARAM_PASS == ($this->detectionFlags & self::DETECT_PARAM_PASS);\n if ($usePass && 'variable' == $parameter['parameter']['type']) {\n $this->increaseMutations($parameter['parameter']['value']);\n } else {\n $this->passExpression($parameter['parameter']);\n }\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0b6c76a9b6ff1c0934e331c0194370f70afb2736498afbf1cca75dc21cec6b2c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 9, + "charOffset": 1278, + "charLength": 959, + "snippet": { + "text": "switch ($exprVariable->getType()) {\n case 'variable':\n $variableVariable = $compilationContext->symbolTable->getVariableForRead(\n $exprVariable->getCode(),\n $compilationContext,\n $expression\n );\n switch ($variableVariable->getType()) {\n case 'variable':\n break;\n\n default:\n throw new CompilerException(\n 'Variable type: ' . $variableVariable->getType() . ' cannot be used as object',\n $propertyAccess['left']\n );\n }\n break;\n\n default:\n throw new CompilerException(\n 'Cannot use expression: ' . $exprVariable->getType() . ' as an object',\n $propertyAccess['left']\n );\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1270, + "charLength": 967, + "snippet": { + "text": " switch ($exprVariable->getType()) {\n case 'variable':\n $variableVariable = $compilationContext->symbolTable->getVariableForRead(\n $exprVariable->getCode(),\n $compilationContext,\n $expression\n );\n switch ($variableVariable->getType()) {\n case 'variable':\n break;\n\n default:\n throw new CompilerException(\n 'Variable type: ' . $variableVariable->getType() . ' cannot be used as object',\n $propertyAccess['left']\n );\n }\n break;\n\n default:\n throw new CompilerException(\n 'Cannot use expression: ' . $exprVariable->getType() . ' as an object',\n $propertyAccess['left']\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 9, + "charOffset": 1285, + "charLength": 957, + "snippet": { + "text": "switch ($exprVariable->getType()) {\n case 'variable':\n $variableVariable = $compilationContext->symbolTable->getVariableForRead(\n $exprVariable->getCode(),\n $compilationContext,\n $expression\n );\n switch ($variableVariable->getType()) {\n case 'variable':\n break;\n default:\n throw new CompilerException(\n 'Variable type: ' . $variableVariable->getType() . ' cannot be used as object',\n $propertyAccess['left']\n );\n }\n break;\n default:\n throw new CompilerException(\n 'Cannot use expression: ' . $exprVariable->getType() . ' as an object',\n $propertyAccess['left']\n );\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1277, + "charLength": 965, + "snippet": { + "text": " switch ($exprVariable->getType()) {\n case 'variable':\n $variableVariable = $compilationContext->symbolTable->getVariableForRead(\n $exprVariable->getCode(),\n $compilationContext,\n $expression\n );\n switch ($variableVariable->getType()) {\n case 'variable':\n break;\n default:\n throw new CompilerException(\n 'Variable type: ' . $variableVariable->getType() . ' cannot be used as object',\n $propertyAccess['left']\n );\n }\n break;\n default:\n throw new CompilerException(\n 'Cannot use expression: ' . $exprVariable->getType() . ' as an object',\n $propertyAccess['left']\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2b8f91a04d1c03dc3973b4e140aa755d17f338a989ddc5c4fd9964ccfb24174d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 9, + "charOffset": 1168, + "charLength": 545, + "snippet": { + "text": "$call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable(true, $context);\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $context->headersManager->add('kernel/object');\n\n $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);\n\n\n $symbol = $context->backend->getVariableCode($symbolVariable);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 1160, + "charLength": 553, + "snippet": { + "text": " $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable(true, $context);\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $context->headersManager->add('kernel/object');\n\n $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);\n\n\n $symbol = $context->backend->getVariableCode($symbolVariable);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetNsClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 9, + "charOffset": 1279, + "charLength": 544, + "snippet": { + "text": "$call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable(true, $context);\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $context->headersManager->add('kernel/object');\n $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);\n\n $symbol = $context->backend->getVariableCode($symbolVariable);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1271, + "charLength": 552, + "snippet": { + "text": " $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable(true, $context);\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $context->headersManager->add('kernel/object');\n $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);\n\n $symbol = $context->backend->getVariableCode($symbolVariable);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2bf2b02bd3334a9221abb5cb5f10e8c05ca2896198f7589354802f75d6487c72" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 587, + "startColumn": 41, + "charOffset": 27657, + "charLength": 1099, + "snippet": { + "text": "$compilationContext->headersManager->add('kernel/operators');\n\n $expected = $this->getExpected($compilationContext, $expression);\n $compilationContext->backend->zvalOperator(\n $this->zvalOperator,\n $expected,\n $variableLeft,\n $variableRight,\n $compilationContext\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n $expected->setDynamicTypes(\n $this->getDynamicTypes($variableLeft, $variableRight)\n );\n\n return new CompiledExpression('variable', $expected->getName(), $expression);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 587, + "startColumn": 1, + "charOffset": 27617, + "charLength": 1139, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n\n $expected = $this->getExpected($compilationContext, $expression);\n $compilationContext->backend->zvalOperator(\n $this->zvalOperator,\n $expected,\n $variableLeft,\n $variableRight,\n $compilationContext\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n $expected->setDynamicTypes(\n $this->getDynamicTypes($variableLeft, $variableRight)\n );\n\n return new CompiledExpression('variable', $expected->getName(), $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 689, + "startColumn": 41, + "charOffset": 33220, + "charLength": 1099, + "snippet": { + "text": "$compilationContext->headersManager->add('kernel/operators');\n\n $expected = $this->getExpected($compilationContext, $expression);\n $compilationContext->backend->zvalOperator(\n $this->zvalOperator,\n $expected,\n $variableLeft,\n $variableRight,\n $compilationContext\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n $expected->setDynamicTypes(\n $this->getDynamicTypes($variableLeft, $variableRight)\n );\n\n return new CompiledExpression('variable', $expected->getName(), $expression);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 689, + "startColumn": 1, + "charOffset": 33180, + "charLength": 1139, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n\n $expected = $this->getExpected($compilationContext, $expression);\n $compilationContext->backend->zvalOperator(\n $this->zvalOperator,\n $expected,\n $variableLeft,\n $variableRight,\n $compilationContext\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n $expected->setDynamicTypes(\n $this->getDynamicTypes($variableLeft, $variableRight)\n );\n\n return new CompiledExpression('variable', $expected->getName(), $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2e35988b7244037b15d2063b4904d4bbd8e20e3422a0bc82aa94c5ed2a6ead6b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Detectors/WriteDetector.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 324, + "startColumn": 21, + "charOffset": 10210, + "charLength": 596, + "snippet": { + "text": "if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['value'])) {\n $this->increaseMutations($statement['value']);\n }\n if (isset($statement['key'])) {\n $this->increaseMutations($statement['key']);\n }\n if (isset($statement['statements'])) {\n $this->passStatementBlock($statement['statements']);\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 324, + "startColumn": 1, + "charOffset": 10190, + "charLength": 616, + "snippet": { + "text": " if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['value'])) {\n $this->increaseMutations($statement['value']);\n }\n if (isset($statement['key'])) {\n $this->increaseMutations($statement['key']);\n }\n if (isset($statement['statements'])) {\n $this->passStatementBlock($statement['statements']);\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/MutateGathererPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 318, + "startColumn": 21, + "charOffset": 9234, + "charLength": 596, + "snippet": { + "text": "if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['value'])) {\n $this->increaseMutations($statement['value']);\n }\n if (isset($statement['key'])) {\n $this->increaseMutations($statement['key']);\n }\n if (isset($statement['statements'])) {\n $this->passStatementBlock($statement['statements']);\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 318, + "startColumn": 1, + "charOffset": 9214, + "charLength": 616, + "snippet": { + "text": " if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['value'])) {\n $this->increaseMutations($statement['value']);\n }\n if (isset($statement['key'])) {\n $this->increaseMutations($statement['key']);\n }\n if (isset($statement['statements'])) {\n $this->passStatementBlock($statement['statements']);\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3b7c056f40fdbab64936205983e403c063605d0e27cacc4a5179cca125a2286b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArrayAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 176, + "startColumn": 17, + "charOffset": 5402, + "charLength": 768, + "snippet": { + "text": "if ('return_value' != $symbolVariable->getName()) {\n $line = $compilationContext->symbolTable->getLastCallLine();\n if (false === $line || ($line > 0 && $line < $expression['line'])) {\n $numberMutations = $compilationContext->symbolTable->getExpectedMutations(\n $symbolVariable->getName()\n );\n if (1 == $numberMutations) {\n if ($symbolVariable->getNumberMutations() == $numberMutations) {\n $symbolVariable->setMemoryTracked(false);\n $readOnly = true;\n }\n }\n }\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 176, + "startColumn": 1, + "charOffset": 5386, + "charLength": 784, + "snippet": { + "text": " if ('return_value' != $symbolVariable->getName()) {\n $line = $compilationContext->symbolTable->getLastCallLine();\n if (false === $line || ($line > 0 && $line < $expression['line'])) {\n $numberMutations = $compilationContext->symbolTable->getExpectedMutations(\n $symbolVariable->getName()\n );\n if (1 == $numberMutations) {\n if ($symbolVariable->getNumberMutations() == $numberMutations) {\n $symbolVariable->setMemoryTracked(false);\n $readOnly = true;\n }\n }\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 189, + "startColumn": 17, + "charOffset": 6802, + "charLength": 768, + "snippet": { + "text": "if ('return_value' != $symbolVariable->getName()) {\n $line = $compilationContext->symbolTable->getLastCallLine();\n if (false === $line || ($line > 0 && $line < $expression['line'])) {\n $numberMutations = $compilationContext->symbolTable->getExpectedMutations(\n $symbolVariable->getName()\n );\n if (1 == $numberMutations) {\n if ($symbolVariable->getNumberMutations() == $numberMutations) {\n $symbolVariable->setMemoryTracked(false);\n $readOnly = true;\n }\n }\n }\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 189, + "startColumn": 1, + "charOffset": 6786, + "charLength": 784, + "snippet": { + "text": " if ('return_value' != $symbolVariable->getName()) {\n $line = $compilationContext->symbolTable->getLastCallLine();\n if (false === $line || ($line > 0 && $line < $expression['line'])) {\n $numberMutations = $compilationContext->symbolTable->getExpectedMutations(\n $symbolVariable->getName()\n );\n if (1 == $numberMutations) {\n if ($symbolVariable->getNumberMutations() == $numberMutations) {\n $symbolVariable->setMemoryTracked(false);\n $readOnly = true;\n }\n }\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4c84af03a538a10ccbd7475768837a6f57838da11904651cdd871fb94359d988" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 286, + "startColumn": 17, + "charOffset": 11122, + "charLength": 490, + "snippet": { + "text": "$codePrinter->increaseLevel();\n $context->backend->updateProperty($symbolVariable, $propertyName, 'true', $context);\n $codePrinter->decreaseLevel();\n $codePrinter->output('} else {');\n $codePrinter->increaseLevel();\n $context->backend->updateProperty($symbolVariable, $propertyName, 'false', $context);\n $codePrinter->decreaseLevel();\n $codePrinter->output('}');\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 286, + "startColumn": 1, + "charOffset": 11106, + "charLength": 506, + "snippet": { + "text": " $codePrinter->increaseLevel();\n $context->backend->updateProperty($symbolVariable, $propertyName, 'true', $context);\n $codePrinter->decreaseLevel();\n $codePrinter->output('} else {');\n $codePrinter->increaseLevel();\n $context->backend->updateProperty($symbolVariable, $propertyName, 'false', $context);\n $codePrinter->decreaseLevel();\n $codePrinter->output('}');\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 333, + "startColumn": 25, + "charOffset": 13556, + "charLength": 554, + "snippet": { + "text": "$codePrinter->increaseLevel();\n $context->backend->updateProperty($symbolVariable, $propertyName, 'true', $context);\n $codePrinter->decreaseLevel();\n $codePrinter->output('} else {');\n $codePrinter->increaseLevel();\n $context->backend->updateProperty($symbolVariable, $propertyName, 'false', $context);\n $codePrinter->decreaseLevel();\n $codePrinter->output('}');\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 333, + "startColumn": 1, + "charOffset": 13532, + "charLength": 578, + "snippet": { + "text": " $codePrinter->increaseLevel();\n $context->backend->updateProperty($symbolVariable, $propertyName, 'true', $context);\n $codePrinter->decreaseLevel();\n $codePrinter->output('} else {');\n $codePrinter->increaseLevel();\n $context->backend->updateProperty($symbolVariable, $propertyName, 'false', $context);\n $codePrinter->decreaseLevel();\n $codePrinter->output('}');\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "55ed0ef421d34698aedf96bf5abb99907ebd5656aa4b5bd83081c6e80f247132" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Detectors/WriteDetector.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 352, + "startColumn": 21, + "charOffset": 11308, + "charLength": 688, + "snippet": { + "text": "if (isset($statement['statements'])) {\n $this->passStatementBlock($statement['statements']);\n }\n if (isset($statement['catches'])) {\n foreach ($statement['catches'] as $catch) {\n if (isset($catch['variable'])) {\n $this->increaseMutations($catch['variable']['value']);\n }\n if (isset($catch['statements'])) {\n $this->passStatementBlock($catch['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 352, + "startColumn": 1, + "charOffset": 11288, + "charLength": 708, + "snippet": { + "text": " if (isset($statement['statements'])) {\n $this->passStatementBlock($statement['statements']);\n }\n if (isset($statement['catches'])) {\n foreach ($statement['catches'] as $catch) {\n if (isset($catch['variable'])) {\n $this->increaseMutations($catch['variable']['value']);\n }\n if (isset($catch['statements'])) {\n $this->passStatementBlock($catch['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/MutateGathererPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 346, + "startColumn": 21, + "charOffset": 10332, + "charLength": 688, + "snippet": { + "text": "if (isset($statement['statements'])) {\n $this->passStatementBlock($statement['statements']);\n }\n if (isset($statement['catches'])) {\n foreach ($statement['catches'] as $catch) {\n if (isset($catch['variable'])) {\n $this->increaseMutations($catch['variable']['value']);\n }\n if (isset($catch['statements'])) {\n $this->passStatementBlock($catch['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 346, + "startColumn": 1, + "charOffset": 10312, + "charLength": 708, + "snippet": { + "text": " if (isset($statement['statements'])) {\n $this->passStatementBlock($statement['statements']);\n }\n if (isset($statement['catches'])) {\n foreach ($statement['catches'] as $catch) {\n if (isset($catch['variable'])) {\n $this->increaseMutations($catch['variable']['value']);\n }\n if (isset($catch['statements'])) {\n $this->passStatementBlock($catch['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "59f8177995833e65667177ed64c654190eae318eded512017c9f03d889d8314d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/StaticPropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 87, + "startColumn": 9, + "charOffset": 2896, + "charLength": 885, + "snippet": { + "text": "$this->checkClassHasProperty(\n $classDefinition,\n $property,\n $expression\n );\n\n /** @var Property $propertyDefinition */\n $propertyDefinition = $classDefinition->getProperty($property);\n $this->checkAccessNonStaticProperty(\n $propertyDefinition,\n $classDefinition,\n $property,\n $expression\n );\n\n if ($propertyDefinition->isPrivate()) {\n if ($classDefinition != $compilationContext->classDefinition) {\n throw new CompilerException(\n \"Cannot access private static property '\"\n . $classDefinition->getCompleteName()\n . '::'\n . $property\n . \"' out of its declaring context\",\n $expression\n );\n }\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 87, + "startColumn": 1, + "charOffset": 2888, + "charLength": 893, + "snippet": { + "text": " $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $expression\n );\n\n /** @var Property $propertyDefinition */\n $propertyDefinition = $classDefinition->getProperty($property);\n $this->checkAccessNonStaticProperty(\n $propertyDefinition,\n $classDefinition,\n $property,\n $expression\n );\n\n if ($propertyDefinition->isPrivate()) {\n if ($classDefinition != $compilationContext->classDefinition) {\n throw new CompilerException(\n \"Cannot access private static property '\"\n . $classDefinition->getCompleteName()\n . '::'\n . $property\n . \"' out of its declaring context\",\n $expression\n );\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 86, + "startColumn": 9, + "charOffset": 2844, + "charLength": 882, + "snippet": { + "text": "$this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement\n );\n\n /** @var Property $propertyDefinition */\n $propertyDefinition = $classDefinition->getProperty($property);\n $this->checkAccessNonStaticProperty(\n $propertyDefinition,\n $classDefinition,\n $property,\n $statement\n );\n\n if ($propertyDefinition->isPrivate()) {\n if ($classDefinition != $compilationContext->classDefinition) {\n throw new CompilerException(\n \"Cannot access private static property '\"\n . $classDefinition->getCompleteName()\n . '::'\n . $property\n . \"' out of its declaring context\",\n $statement\n );\n }\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 2836, + "charLength": 890, + "snippet": { + "text": " $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement\n );\n\n /** @var Property $propertyDefinition */\n $propertyDefinition = $classDefinition->getProperty($property);\n $this->checkAccessNonStaticProperty(\n $propertyDefinition,\n $classDefinition,\n $property,\n $statement\n );\n\n if ($propertyDefinition->isPrivate()) {\n if ($classDefinition != $compilationContext->classDefinition) {\n throw new CompilerException(\n \"Cannot access private static property '\"\n . $classDefinition->getCompleteName()\n . '::'\n . $property\n . \"' out of its declaring context\",\n $statement\n );\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5c21bca61e28d82bdfbc8e8ef8177eee843e4be65186c4eb4e73f045d9aac021" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 69, + "startColumn": 9, + "charOffset": 1736, + "charLength": 1308, + "snippet": { + "text": "if ('this' == $symbolVariable->getRealName()) {\n $classDefinition = $compilationContext->classDefinition;\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement\n );\n } else {\n /*\n * If we know the class related to a variable we could check if the property\n * is defined on that class\n */\n if ($symbolVariable->hasAnyDynamicType('object')) {\n $classType = current($symbolVariable->getClassTypes());\n $compiler = $compilationContext->compiler;\n\n if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n if (!$classDefinition) {\n throw new CompilerException(\n 'Cannot locate class definition for class: ' . $classType,\n $statement\n );\n }\n\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement,\n $classType\n );\n }\n }\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 69, + "startColumn": 1, + "charOffset": 1728, + "charLength": 1316, + "snippet": { + "text": " if ('this' == $symbolVariable->getRealName()) {\n $classDefinition = $compilationContext->classDefinition;\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement\n );\n } else {\n /*\n * If we know the class related to a variable we could check if the property\n * is defined on that class\n */\n if ($symbolVariable->hasAnyDynamicType('object')) {\n $classType = current($symbolVariable->getClassTypes());\n $compiler = $compilationContext->compiler;\n\n if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n if (!$classDefinition) {\n throw new CompilerException(\n 'Cannot locate class definition for class: ' . $classType,\n $statement\n );\n }\n\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement,\n $classType\n );\n }\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndexAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 120, + "startColumn": 9, + "charOffset": 3582, + "charLength": 1309, + "snippet": { + "text": "if ('this' == $symbolVariable->getRealName()) {\n $classDefinition = $compilationContext->classDefinition;\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement\n );\n } else {\n /**\n * If we know the class related to a variable we could check if the property\n * is defined on that class\n */\n if ($symbolVariable->hasAnyDynamicType('object')) {\n $classType = current($symbolVariable->getClassTypes());\n $compiler = $compilationContext->compiler;\n\n if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n if (!$classDefinition) {\n throw new CompilerException(\n 'Cannot locate class definition for class: ' . $classType,\n $statement\n );\n }\n\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement,\n $classType\n );\n }\n }\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 120, + "startColumn": 1, + "charOffset": 3574, + "charLength": 1317, + "snippet": { + "text": " if ('this' == $symbolVariable->getRealName()) {\n $classDefinition = $compilationContext->classDefinition;\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement\n );\n } else {\n /**\n * If we know the class related to a variable we could check if the property\n * is defined on that class\n */\n if ($symbolVariable->hasAnyDynamicType('object')) {\n $classType = current($symbolVariable->getClassTypes());\n $compiler = $compilationContext->compiler;\n\n if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n if (!$classDefinition) {\n throw new CompilerException(\n 'Cannot locate class definition for class: ' . $classType,\n $statement\n );\n }\n\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement,\n $classType\n );\n }\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyDecr.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 84, + "startColumn": 9, + "charOffset": 2257, + "charLength": 1308, + "snippet": { + "text": "if ('this' == $symbolVariable->getRealName()) {\n $classDefinition = $compilationContext->classDefinition;\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement\n );\n } else {\n /*\n * If we know the class related to a variable we could check if the property\n * is defined on that class\n */\n if ($symbolVariable->hasAnyDynamicType('object')) {\n $classType = current($symbolVariable->getClassTypes());\n $compiler = $compilationContext->compiler;\n\n if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n if (!$classDefinition) {\n throw new CompilerException(\n 'Cannot locate class definition for class: ' . $classType,\n $statement\n );\n }\n\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement,\n $classType\n );\n }\n }\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 84, + "startColumn": 1, + "charOffset": 2249, + "charLength": 1316, + "snippet": { + "text": " if ('this' == $symbolVariable->getRealName()) {\n $classDefinition = $compilationContext->classDefinition;\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement\n );\n } else {\n /*\n * If we know the class related to a variable we could check if the property\n * is defined on that class\n */\n if ($symbolVariable->hasAnyDynamicType('object')) {\n $classType = current($symbolVariable->getClassTypes());\n $compiler = $compilationContext->compiler;\n\n if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n if (!$classDefinition) {\n throw new CompilerException(\n 'Cannot locate class definition for class: ' . $classType,\n $statement\n );\n }\n\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement,\n $classType\n );\n }\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5d53dd48ab9c75067d8b728476c9f845850bb812b1cb8753fcd37c8cbbed9fb2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Detectors/WriteDetector.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 380, + "startColumn": 21, + "charOffset": 12413, + "charLength": 775, + "snippet": { + "text": "if ('array-access' == $statement['expr']['type']) {\n if ('variable' == $statement['expr']['left']['type']) {\n $this->increaseMutations($statement['expr']['left']['value']);\n }\n } else {\n if ('list' == $statement['expr']['type']) {\n if ('array-access' == $statement['expr']['left']['type']) {\n if ('variable' == $statement['expr']['left']['left']['type']) {\n $this->increaseMutations($statement['expr']['left']['left']['value']);\n }\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 380, + "startColumn": 1, + "charOffset": 12393, + "charLength": 795, + "snippet": { + "text": " if ('array-access' == $statement['expr']['type']) {\n if ('variable' == $statement['expr']['left']['type']) {\n $this->increaseMutations($statement['expr']['left']['value']);\n }\n } else {\n if ('list' == $statement['expr']['type']) {\n if ('array-access' == $statement['expr']['left']['type']) {\n if ('variable' == $statement['expr']['left']['left']['type']) {\n $this->increaseMutations($statement['expr']['left']['left']['value']);\n }\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/MutateGathererPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 374, + "startColumn": 21, + "charOffset": 11437, + "charLength": 775, + "snippet": { + "text": "if ('array-access' == $statement['expr']['type']) {\n if ('variable' == $statement['expr']['left']['type']) {\n $this->increaseMutations($statement['expr']['left']['value']);\n }\n } else {\n if ('list' == $statement['expr']['type']) {\n if ('array-access' == $statement['expr']['left']['type']) {\n if ('variable' == $statement['expr']['left']['left']['type']) {\n $this->increaseMutations($statement['expr']['left']['left']['value']);\n }\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 374, + "startColumn": 1, + "charOffset": 11417, + "charLength": 795, + "snippet": { + "text": " if ('array-access' == $statement['expr']['type']) {\n if ('variable' == $statement['expr']['left']['type']) {\n $this->increaseMutations($statement['expr']['left']['value']);\n }\n } else {\n if ('list' == $statement['expr']['type']) {\n if ('array-access' == $statement['expr']['left']['type']) {\n if ('variable' == $statement['expr']['left']['left']['type']) {\n $this->increaseMutations($statement['expr']['left']['left']['value']);\n }\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "64956060aed098c22282964b7ee84928eaf8ceefeaa3c451961a56f4ca1d623c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 771, + "startColumn": 17, + "charOffset": 35545, + "charLength": 1122, + "snippet": { + "text": "if ($isExpecting) {\n if ('return_value' == $symbolVariable->getName()) {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 1, $paramCount);\n $codePrinter->output(\n $macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 2, $paramCount);\n $codePrinter->output(\n $macro . '(' . $symbolCode . ', ' . $variableCode . ', ' . $method->getInternalName(\n ) . $paramsStr . ');'\n );\n }\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 0, $paramCount);\n $codePrinter->output(\n $macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 771, + "startColumn": 1, + "charOffset": 35529, + "charLength": 1138, + "snippet": { + "text": " if ($isExpecting) {\n if ('return_value' == $symbolVariable->getName()) {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 1, $paramCount);\n $codePrinter->output(\n $macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 2, $paramCount);\n $codePrinter->output(\n $macro . '(' . $symbolCode . ', ' . $variableCode . ', ' . $method->getInternalName(\n ) . $paramsStr . ');'\n );\n }\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 0, $paramCount);\n $codePrinter->output(\n $macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 439, + "startColumn": 13, + "charOffset": 16948, + "charLength": 904, + "snippet": { + "text": "if ($isExpecting) {\n if ('return_value' == $symbolVariable->getName()) {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 1, $paramCount);\n $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');');\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount);\n $codePrinter->output(\n $macro . '(' . $symbol . ', ' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n }\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 0, $paramCount);\n $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');');\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 439, + "startColumn": 1, + "charOffset": 16936, + "charLength": 916, + "snippet": { + "text": " if ($isExpecting) {\n if ('return_value' == $symbolVariable->getName()) {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 1, $paramCount);\n $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');');\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount);\n $codePrinter->output(\n $macro . '(' . $symbol . ', ' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n }\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 0, $paramCount);\n $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');');\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 536, + "startColumn": 13, + "charOffset": 20776, + "charLength": 904, + "snippet": { + "text": "if ($isExpecting) {\n if ('return_value' == $symbolVariable->getName()) {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 1, $paramCount);\n $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');');\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount);\n $codePrinter->output(\n $macro . '(' . $symbol . ', ' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n }\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 0, $paramCount);\n $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');');\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 536, + "startColumn": 1, + "charOffset": 20764, + "charLength": 916, + "snippet": { + "text": " if ($isExpecting) {\n if ('return_value' == $symbolVariable->getName()) {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 1, $paramCount);\n $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');');\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount);\n $codePrinter->output(\n $macro . '(' . $symbol . ', ' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n }\n } else {\n $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 0, $paramCount);\n $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');');\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "67c8450c4612f8a204bc1aa2ac110f5f5c99ad6f17b647691f2798c9b7cedced" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/BasenameOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 9, + "charOffset": 1029, + "charLength": 671, + "snippet": { + "text": "if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (1 != count($expression['parameters'])) {\n return false;\n }\n\n $context->headersManager->add('kernel/file');\n\n /*\n * Process the expected symbol to be returned\n */\n $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable(true, $context);\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 1021, + "charLength": 679, + "snippet": { + "text": " if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (1 != count($expression['parameters'])) {\n return false;\n }\n\n $context->headersManager->add('kernel/file');\n\n /*\n * Process the expected symbol to be returned\n */\n $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable(true, $context);\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FileGetContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 9, + "charOffset": 981, + "charLength": 670, + "snippet": { + "text": "if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (1 != count($expression['parameters'])) {\n return false;\n }\n\n $context->headersManager->add('kernel/file');\n\n /*\n * Process the expected symbol to be returned\n */\n $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable(true, $context);\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 973, + "charLength": 678, + "snippet": { + "text": " if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (1 != count($expression['parameters'])) {\n return false;\n }\n\n $context->headersManager->add('kernel/file');\n\n /*\n * Process the expected symbol to be returned\n */\n $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable(true, $context);\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7baef90fb27fefb6a5ceaac52951a800f10fee8fe6ecd9d946e9b40b4c1b141e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 395, + "startColumn": 9, + "charOffset": 15081, + "charLength": 685, + "snippet": { + "text": "$compilationContext->symbolTable->mustGrownStack(true);\n\n if ($mustInit) {\n $symbolVariable->setMustInitNull(true);\n $symbolVariable->trackVariant($compilationContext);\n }\n\n /**\n * Check if the method call can have an inline cache.\n */\n $methodCache = $compilationContext->cacheManager->getStaticMethodCache();\n $cachePointer = $methodCache->get($compilationContext, $method ?? null);\n\n $params = [];\n if (isset($expression['parameters']) && count($expression['parameters'])) {\n $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression);\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 395, + "startColumn": 1, + "charOffset": 15073, + "charLength": 693, + "snippet": { + "text": " $compilationContext->symbolTable->mustGrownStack(true);\n\n if ($mustInit) {\n $symbolVariable->setMustInitNull(true);\n $symbolVariable->trackVariant($compilationContext);\n }\n\n /**\n * Check if the method call can have an inline cache.\n */\n $methodCache = $compilationContext->cacheManager->getStaticMethodCache();\n $cachePointer = $methodCache->get($compilationContext, $method ?? null);\n\n $params = [];\n if (isset($expression['parameters']) && count($expression['parameters'])) {\n $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 773, + "startColumn": 9, + "charOffset": 30750, + "charLength": 685, + "snippet": { + "text": "$compilationContext->symbolTable->mustGrownStack(true);\n\n if ($mustInit) {\n $symbolVariable->setMustInitNull(true);\n $symbolVariable->trackVariant($compilationContext);\n }\n\n /**\n * Check if the method call can have an inline cache.\n */\n $methodCache = $compilationContext->cacheManager->getStaticMethodCache();\n $cachePointer = $methodCache->get($compilationContext, $method ?? null);\n\n $params = [];\n if (isset($expression['parameters']) && count($expression['parameters'])) {\n $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression);\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 773, + "startColumn": 1, + "charOffset": 30742, + "charLength": 693, + "snippet": { + "text": " $compilationContext->symbolTable->mustGrownStack(true);\n\n if ($mustInit) {\n $symbolVariable->setMustInitNull(true);\n $symbolVariable->trackVariant($compilationContext);\n }\n\n /**\n * Check if the method call can have an inline cache.\n */\n $methodCache = $compilationContext->cacheManager->getStaticMethodCache();\n $cachePointer = $methodCache->get($compilationContext, $method ?? null);\n\n $params = [];\n if (isset($expression['parameters']) && count($expression['parameters'])) {\n $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7eaca14c21fabab6e49ad89b5c646e4ac6a54a5027cf168a3998bd74edf98200" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FilePutContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 9, + "charOffset": 981, + "charLength": 582, + "snippet": { + "text": "if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (2 != count($expression['parameters'])) {\n return false;\n }\n\n $context->headersManager->add('kernel/file');\n\n /*\n * Process the expected symbol to be returned\n */\n $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable();\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 973, + "charLength": 590, + "snippet": { + "text": " if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (2 != count($expression['parameters'])) {\n return false;\n }\n\n $context->headersManager->add('kernel/file');\n\n /*\n * Process the expected symbol to be returned\n */\n $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable();\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FwriteOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 9, + "charOffset": 952, + "charLength": 582, + "snippet": { + "text": "if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (2 != count($expression['parameters'])) {\n return false;\n }\n\n $context->headersManager->add('kernel/file');\n\n /*\n * Process the expected symbol to be returned\n */\n $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable();\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 944, + "charLength": 590, + "snippet": { + "text": " if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (2 != count($expression['parameters'])) {\n return false;\n }\n\n $context->headersManager->add('kernel/file');\n\n /*\n * Process the expected symbol to be returned\n */\n $call->processExpectedReturn($context);\n\n $symbolVariable = $call->getSymbolVariable();\n $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "85c329c4716072967778fb33b25cf012514ce0ed7d1994738b7a6d4e5857125c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Cache/MethodCache.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 83, + "startColumn": 21, + "charOffset": 2736, + "charLength": 612, + "snippet": { + "text": "if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n } else {\n $classDefinition = $compiler->getInternalClassDefinition($classType);\n }\n\n if (!$classDefinition) {\n continue;\n }\n\n if ($classDefinition->hasMethod($methodName) && !$classDefinition->isInterface()) {\n ++$numberPoly;\n $method = $classDefinition->getMethod($methodName);\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 83, + "startColumn": 1, + "charOffset": 2716, + "charLength": 632, + "snippet": { + "text": " if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n } else {\n $classDefinition = $compiler->getInternalClassDefinition($classType);\n }\n\n if (!$classDefinition) {\n continue;\n }\n\n if ($classDefinition->hasMethod($methodName) && !$classDefinition->isInterface()) {\n ++$numberPoly;\n $method = $classDefinition->getMethod($methodName);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 887, + "startColumn": 21, + "charOffset": 40050, + "charLength": 612, + "snippet": { + "text": "if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n } else {\n $classDefinition = $compiler->getInternalClassDefinition($classType);\n }\n\n if (!$classDefinition) {\n continue;\n }\n\n if ($classDefinition->hasMethod($methodName) && !$classDefinition->isInterface()) {\n ++$numberPoly;\n $method = $classDefinition->getMethod($methodName);\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 887, + "startColumn": 1, + "charOffset": 40030, + "charLength": 632, + "snippet": { + "text": " if ($compiler->isClass($classType)) {\n $classDefinition = $compiler->getClassDefinition($classType);\n } else {\n $classDefinition = $compiler->getInternalClassDefinition($classType);\n }\n\n if (!$classDefinition) {\n continue;\n }\n\n if ($classDefinition->hasMethod($methodName) && !$classDefinition->isInterface()) {\n ++$numberPoly;\n $method = $classDefinition->getMethod($methodName);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9cab9644f64be61eb8884d0a33c31ffccfb1652c73b693fd1db4574ad576062f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/DivOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 569, + "startColumn": 41, + "charOffset": 26904, + "charLength": 1005, + "snippet": { + "text": "$op2 = $compilationContext->backend->getVariableCode($variableRight);\n\n $expected = $this->getExpected($compilationContext, $expression);\n $expectedCode = $compilationContext->backend->getVariableCode($expected);\n $compilationContext->codePrinter->output(\n $this->zvalOperator . '(' . $expectedCode . ', ' . $op1 . ', ' . $op2 . ');'\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n return new CompiledExpression(\n 'variable',\n $expected->getName(),\n $expression\n );" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 569, + "startColumn": 1, + "charOffset": 26864, + "charLength": 1045, + "snippet": { + "text": " $op2 = $compilationContext->backend->getVariableCode($variableRight);\n\n $expected = $this->getExpected($compilationContext, $expression);\n $expectedCode = $compilationContext->backend->getVariableCode($expected);\n $compilationContext->codePrinter->output(\n $this->zvalOperator . '(' . $expectedCode . ', ' . $op1 . ', ' . $op2 . ');'\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n return new CompiledExpression(\n 'variable',\n $expected->getName(),\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ModOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 531, + "startColumn": 41, + "charOffset": 25577, + "charLength": 991, + "snippet": { + "text": "$op2 = $compilationContext->backend->getVariableCode($variableRight);\n\n $expected = $this->getExpected($compilationContext, $expression);\n $symbol = $compilationContext->backend->getVariableCode($expected);\n $compilationContext->codePrinter->output(\n $this->zvalOperator . '(' . $symbol . ', ' . $op1 . ', ' . $op2 . ');'\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n return new CompiledExpression(\n 'variable',\n $expected->getName(),\n $expression\n );" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 531, + "startColumn": 1, + "charOffset": 25537, + "charLength": 1031, + "snippet": { + "text": " $op2 = $compilationContext->backend->getVariableCode($variableRight);\n\n $expected = $this->getExpected($compilationContext, $expression);\n $symbol = $compilationContext->backend->getVariableCode($expected);\n $compilationContext->codePrinter->output(\n $this->zvalOperator . '(' . $symbol . ', ' . $op1 . ', ' . $op2 . ');'\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n return new CompiledExpression(\n 'variable',\n $expected->getName(),\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 632, + "startColumn": 41, + "charOffset": 29639, + "charLength": 837, + "snippet": { + "text": "$op2 = $compilationContext->backend->getVariableCode($variableRight);\n\n $expected = $this->getExpected($compilationContext, $expression);\n $expectedSymbol = $compilationContext->backend->getVariableCode($expected);\n $compilationContext->codePrinter->output(\n $this->zvalOperator . '(' . $expectedSymbol . ', ' . $op1 . ', ' . $op2 . ');'\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n return new CompiledExpression('variable', $expected->getName(), $expression);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 632, + "startColumn": 1, + "charOffset": 29599, + "charLength": 877, + "snippet": { + "text": " $op2 = $compilationContext->backend->getVariableCode($variableRight);\n\n $expected = $this->getExpected($compilationContext, $expression);\n $expectedSymbol = $compilationContext->backend->getVariableCode($expected);\n $compilationContext->codePrinter->output(\n $this->zvalOperator . '(' . $expectedSymbol . ', ' . $op1 . ', ' . $op2 . ');'\n );\n\n $this->checkVariableTemporal($variableLeft);\n $this->checkVariableTemporal($variableRight);\n\n return new CompiledExpression('variable', $expected->getName(), $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bf58bb02b18139be9e5b207856cfed4e939d732ddce6aefa7e7d1db8fdfc00a6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/FetchOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 140, + "startColumn": 17, + "charOffset": 5338, + "charLength": 1460, + "snippet": { + "text": "$exprVariable = new Expression($expression['right']['left']);\n $exprVariable->setReadOnly(true);\n $exprVariable->setNoisy(false);\n\n $exprCompiledVariable = $exprVariable->compile($compilationContext);\n if ('variable' != $exprCompiledVariable->getType()) {\n throw new CompilerException(\n 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as object',\n $expression['right']['left']\n );\n }\n\n $evalVariable = $compilationContext->symbolTable->getVariableForRead(\n $exprCompiledVariable->getCode(),\n $compilationContext,\n $expression['right']['left']\n );\n if ('variable' != $evalVariable->getType()) {\n throw new CompilerException(\n 'Variable type: ' . $variable->getType() . ' cannot be used as object',\n $expression['right']['left']\n );\n }\n\n if ($evalVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) {\n $compilationContext->logger->warning(\n 'Possible attempt to use non object in fetch operator',\n ['non-valid-fetch', $expression['right']]\n );\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 140, + "startColumn": 1, + "charOffset": 5322, + "charLength": 1476, + "snippet": { + "text": " $exprVariable = new Expression($expression['right']['left']);\n $exprVariable->setReadOnly(true);\n $exprVariable->setNoisy(false);\n\n $exprCompiledVariable = $exprVariable->compile($compilationContext);\n if ('variable' != $exprCompiledVariable->getType()) {\n throw new CompilerException(\n 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as object',\n $expression['right']['left']\n );\n }\n\n $evalVariable = $compilationContext->symbolTable->getVariableForRead(\n $exprCompiledVariable->getCode(),\n $compilationContext,\n $expression['right']['left']\n );\n if ('variable' != $evalVariable->getType()) {\n throw new CompilerException(\n 'Variable type: ' . $variable->getType() . ' cannot be used as object',\n $expression['right']['left']\n );\n }\n\n if ($evalVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) {\n $compilationContext->logger->warning(\n 'Possible attempt to use non object in fetch operator',\n ['non-valid-fetch', $expression['right']]\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/FetchOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 184, + "startColumn": 17, + "charOffset": 7434, + "charLength": 1464, + "snippet": { + "text": "$exprVariable = new Expression($expression['right']['left']);\n $exprVariable->setReadOnly(true);\n $exprVariable->setNoisy(false);\n\n $exprCompiledVariable = $exprVariable->compile($compilationContext);\n if ('variable' != $exprCompiledVariable->getType()) {\n throw new CompilerException(\n 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as object',\n $expression['right']['left']\n );\n }\n\n $evalVariable = $compilationContext->symbolTable->getVariableForRead(\n $exprCompiledVariable->getCode(),\n $compilationContext,\n $expression['right']['left']\n );\n if ('variable' != $evalVariable->getType()) {\n throw new CompilerException(\n 'Variable type: ' . $evalVariable->getType() . ' cannot be used as object',\n $expression['right']['left']\n );\n }\n\n if ($evalVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) {\n $compilationContext->logger->warning(\n 'Possible attempt to use non object in fetch operator',\n ['non-valid-fetch', $expression['right']]\n );\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 184, + "startColumn": 1, + "charOffset": 7418, + "charLength": 1480, + "snippet": { + "text": " $exprVariable = new Expression($expression['right']['left']);\n $exprVariable->setReadOnly(true);\n $exprVariable->setNoisy(false);\n\n $exprCompiledVariable = $exprVariable->compile($compilationContext);\n if ('variable' != $exprCompiledVariable->getType()) {\n throw new CompilerException(\n 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as object',\n $expression['right']['left']\n );\n }\n\n $evalVariable = $compilationContext->symbolTable->getVariableForRead(\n $exprCompiledVariable->getCode(),\n $compilationContext,\n $expression['right']['left']\n );\n if ('variable' != $evalVariable->getType()) {\n throw new CompilerException(\n 'Variable type: ' . $evalVariable->getType() . ' cannot be used as object',\n $expression['right']['left']\n );\n }\n\n if ($evalVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) {\n $compilationContext->logger->warning(\n 'Possible attempt to use non object in fetch operator',\n ['non-valid-fetch', $expression['right']]\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c9c24624894c7675f0279343b835e8d2274f8825e0c7d4aeb017a875fee6088d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Detectors/WriteDetector.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 298, + "startColumn": 21, + "charOffset": 9112, + "charLength": 657, + "snippet": { + "text": "if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 298, + "startColumn": 1, + "charOffset": 9092, + "charLength": 677, + "snippet": { + "text": " if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/CallGathererPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 315, + "startColumn": 21, + "charOffset": 9204, + "charLength": 657, + "snippet": { + "text": "if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 315, + "startColumn": 1, + "charOffset": 9184, + "charLength": 677, + "snippet": { + "text": " if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/LocalContextPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 432, + "startColumn": 21, + "charOffset": 14042, + "charLength": 657, + "snippet": { + "text": "if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 432, + "startColumn": 1, + "charOffset": 14022, + "charLength": 677, + "snippet": { + "text": " if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/MutateGathererPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 292, + "startColumn": 21, + "charOffset": 8136, + "charLength": 657, + "snippet": { + "text": "if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 292, + "startColumn": 1, + "charOffset": 8116, + "charLength": 677, + "snippet": { + "text": " if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/StaticTypeInference.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 479, + "startColumn": 21, + "charOffset": 14374, + "charLength": 657, + "snippet": { + "text": "if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 479, + "startColumn": 1, + "charOffset": 14354, + "charLength": 677, + "snippet": { + "text": " if (isset($statement['expr'])) {\n $this->passExpression($statement['expr']);\n }\n if (isset($statement['clauses'])) {\n foreach ($statement['clauses'] as $clause) {\n if (isset($clause['expr'])) {\n $this->passExpression($clause['expr']);\n }\n if (isset($clause['statements'])) {\n $this->passStatementBlock($clause['statements']);\n }\n }\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d3c0ba88b555b2af173ec2fc25f08731fe2a3a1540e93da5d993834601224b8b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 716, + "startColumn": 9, + "charOffset": 25793, + "charLength": 1054, + "snippet": { + "text": "if ($this->globalsManager->isSuperGlobal($name)) {\n if (!$this->hasVariable($name)) {\n /**\n * TODO:, injecting globals, initialize to null and check first?\n */\n $superVar = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch());\n $superVar->setIsInitialized(true, $compilationContext);\n $superVar->setDynamicTypes('array');\n $superVar->increaseMutates();\n $superVar->increaseUses();\n $superVar->setIsExternal(true);\n $superVar->setUsed(true, $statement);\n $this->addRawVariable($superVar);\n\n return $superVar;\n }\n }\n\n if (!$this->hasVariable($name)) {\n throw new CompilerException(\"Cannot mutate variable '\" . $name . \"' because it wasn't defined\", $statement);\n }\n\n $variable = $this->getVariable($name);\n $variable->increaseUses();\n $variable->increaseMutates();" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 716, + "startColumn": 1, + "charOffset": 25785, + "charLength": 1062, + "snippet": { + "text": " if ($this->globalsManager->isSuperGlobal($name)) {\n if (!$this->hasVariable($name)) {\n /**\n * TODO:, injecting globals, initialize to null and check first?\n */\n $superVar = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch());\n $superVar->setIsInitialized(true, $compilationContext);\n $superVar->setDynamicTypes('array');\n $superVar->increaseMutates();\n $superVar->increaseUses();\n $superVar->setIsExternal(true);\n $superVar->setUsed(true, $statement);\n $this->addRawVariable($superVar);\n\n return $superVar;\n }\n }\n\n if (!$this->hasVariable($name)) {\n throw new CompilerException(\"Cannot mutate variable '\" . $name . \"' because it wasn't defined\", $statement);\n }\n\n $variable = $this->getVariable($name);\n $variable->increaseUses();\n $variable->increaseMutates();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 769, + "startColumn": 9, + "charOffset": 27740, + "charLength": 1054, + "snippet": { + "text": "if ($this->globalsManager->isSuperGlobal($name)) {\n if (!$this->hasVariable($name)) {\n /**\n * TODO:, injecting globals, initialize to null and check first?\n */\n $superVar = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch());\n $superVar->setIsInitialized(true, $compilationContext);\n $superVar->setDynamicTypes('array');\n $superVar->increaseMutates();\n $superVar->increaseUses();\n $superVar->setIsExternal(true);\n $superVar->setUsed(true, $statement);\n $this->addRawVariable($superVar);\n\n return $superVar;\n }\n }\n\n if (!$this->hasVariable($name)) {\n throw new CompilerException(\"Cannot mutate variable '\" . $name . \"' because it wasn't defined\", $statement);\n }\n\n $variable = $this->getVariable($name);\n $variable->increaseUses();\n $variable->increaseMutates();" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 769, + "startColumn": 1, + "charOffset": 27732, + "charLength": 1062, + "snippet": { + "text": " if ($this->globalsManager->isSuperGlobal($name)) {\n if (!$this->hasVariable($name)) {\n /**\n * TODO:, injecting globals, initialize to null and check first?\n */\n $superVar = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch());\n $superVar->setIsInitialized(true, $compilationContext);\n $superVar->setDynamicTypes('array');\n $superVar->increaseMutates();\n $superVar->increaseUses();\n $superVar->setIsExternal(true);\n $superVar->setUsed(true, $statement);\n $this->addRawVariable($superVar);\n\n return $superVar;\n }\n }\n\n if (!$this->hasVariable($name)) {\n throw new CompilerException(\"Cannot mutate variable '\" . $name . \"' because it wasn't defined\", $statement);\n }\n\n $variable = $this->getVariable($name);\n $variable->increaseUses();\n $variable->increaseMutates();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "da50221b5e3ab440623dc84a9c425167aa37e1739d51d042ca747fe3a80cb844" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MemstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 9, + "charOffset": 904, + "charLength": 392, + "snippet": { + "text": "if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (2 != count($expression['parameters'])) {\n return false;\n }\n\n if ('string' == $expression['parameters'][1]['parameter']['type']) {\n $str = Name::addSlashes($expression['parameters'][1]['parameter']['value']);\n unset($expression['parameters'][1]);\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 41, + "startColumn": 1, + "charOffset": 896, + "charLength": 400, + "snippet": { + "text": " if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (2 != count($expression['parameters'])) {\n return false;\n }\n\n if ('string' == $expression['parameters'][1]['parameter']['type']) {\n $str = Name::addSlashes($expression['parameters'][1]['parameter']['value']);\n unset($expression['parameters'][1]);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MethodExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 9, + "charOffset": 879, + "charLength": 392, + "snippet": { + "text": "if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (2 != count($expression['parameters'])) {\n return false;\n }\n\n if ('string' == $expression['parameters'][1]['parameter']['type']) {\n $str = Name::addSlashes($expression['parameters'][1]['parameter']['value']);\n unset($expression['parameters'][1]);\n }" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 871, + "charLength": 400, + "snippet": { + "text": " if (!isset($expression['parameters'])) {\n return false;\n }\n\n if (2 != count($expression['parameters'])) {\n return false;\n }\n\n if ('string' == $expression['parameters'][1]['parameter']['type']) {\n $str = Name::addSlashes($expression['parameters'][1]['parameter']['value']);\n unset($expression['parameters'][1]);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e1dc5f4694fcbd691dc96a462008cbdf13f317264d1ba5f846c6407a43296598" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarDumpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 13, + "charOffset": 1314, + "charLength": 1830, + "snippet": { + "text": "if (!$variable || !$variable->isVariable()) {\n /*\n * Complex expressions require a temporary variable\n */\n $type = match ($resolvedParam->getType()) {\n Types::T_ARRAY => 'array',\n default => 'variable',\n };\n\n $variable = $context->symbolTable->addTemp($type, $context);\n $variable->initVariant($context);\n\n $statement = new LetStatement([\n 'type' => 'let',\n 'assignments' => [\n [\n 'assign-type' => $type,\n 'variable' => $variable->getName(),\n 'operator' => 'assign',\n 'expr' => [\n 'type' => $resolvedParam->getType(),\n 'value' => $resolvedParam->getCode(),\n 'file' => $expression['file'],\n 'line' => $expression['line'],\n 'char' => $expression['char'],\n ],\n 'file' => $expression['file'],\n 'line' => $expression['line'],\n 'char' => $expression['char'],\n ],\n ],\n ]);\n $statement->compile($context);\n } else {\n /**\n * This mark the variable as used.\n */\n $variable = $context->symbolTable->getVariableForRead($resolvedParam->getCode(), $context, $expression);\n }\n\n $symbol = $context->backend->getVariableCode($variable);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 48, + "startColumn": 13, + "charOffset": 1314, + "charLength": 1830, + "snippet": { + "text": "if (!$variable || !$variable->isVariable()) {\n /*\n * Complex expressions require a temporary variable\n */\n $type = match ($resolvedParam->getType()) {\n Types::T_ARRAY => 'array',\n default => 'variable',\n };\n\n $variable = $context->symbolTable->addTemp($type, $context);\n $variable->initVariant($context);\n\n $statement = new LetStatement([\n 'type' => 'let',\n 'assignments' => [\n [\n 'assign-type' => $type,\n 'variable' => $variable->getName(),\n 'operator' => 'assign',\n 'expr' => [\n 'type' => $resolvedParam->getType(),\n 'value' => $resolvedParam->getCode(),\n 'file' => $expression['file'],\n 'line' => $expression['line'],\n 'char' => $expression['char'],\n ],\n 'file' => $expression['file'],\n 'line' => $expression['line'],\n 'char' => $expression['char'],\n ],\n ],\n ]);\n $statement->compile($context);\n } else {\n /**\n * This mark the variable as used.\n */\n $variable = $context->symbolTable->getVariableForRead($resolvedParam->getCode(), $context, $expression);\n }\n\n $symbol = $context->backend->getVariableCode($variable);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarExportOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 9, + "charOffset": 1540, + "charLength": 1701, + "snippet": { + "text": "if (!$symbolVariable || !$symbolVariable->isVariable()) {\n /*\n * Complex expressions require a temporary variable\n */\n $type = match ($resolvedParam->getType()) {\n Types::T_ARRAY => 'array',\n default => 'variable',\n };\n\n $variable = $context->symbolTable->addTemp($type, $context);\n $variable->initVariant($context);\n\n $statement = new LetStatement([\n 'type' => 'let',\n 'assignments' => [\n [\n 'assign-type' => $type,\n 'variable' => $variable->getName(),\n 'operator' => 'assign',\n 'expr' => [\n 'type' => $resolvedParam->getType(),\n 'value' => $resolvedParam->getCode(),\n 'file' => $expression['file'],\n 'line' => $expression['line'],\n 'char' => $expression['char'],\n ],\n 'file' => $expression['file'],\n 'line' => $expression['line'],\n 'char' => $expression['char'],\n ],\n ],\n ]);\n $statement->compile($context);\n } else {\n /**\n * This mark the variable as used.\n */\n $variable = $context->symbolTable->getVariableForRead($resolvedParam->getCode(), $context, $expression);\n }\n $variableSymbol = $context->backend->getVariableCode($variable);" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1532, + "charLength": 1709, + "snippet": { + "text": " if (!$symbolVariable || !$symbolVariable->isVariable()) {\n /*\n * Complex expressions require a temporary variable\n */\n $type = match ($resolvedParam->getType()) {\n Types::T_ARRAY => 'array',\n default => 'variable',\n };\n\n $variable = $context->symbolTable->addTemp($type, $context);\n $variable->initVariant($context);\n\n $statement = new LetStatement([\n 'type' => 'let',\n 'assignments' => [\n [\n 'assign-type' => $type,\n 'variable' => $variable->getName(),\n 'operator' => 'assign',\n 'expr' => [\n 'type' => $resolvedParam->getType(),\n 'value' => $resolvedParam->getCode(),\n 'file' => $expression['file'],\n 'line' => $expression['line'],\n 'char' => $expression['char'],\n ],\n 'file' => $expression['file'],\n 'line' => $expression['line'],\n 'char' => $expression['char'],\n ],\n ],\n ]);\n $statement->compile($context);\n } else {\n /**\n * This mark the variable as used.\n */\n $variable = $context->symbolTable->getVariableForRead($resolvedParam->getCode(), $context, $expression);\n }\n $variableSymbol = $context->backend->getVariableCode($variable);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e6a0470cdbc98183bc192f660a183f47ea4753958aedbbc234bfaef753b1ee67" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "DuplicatedCode", + "kind": "fail", + "level": "note", + "message": { + "text": "Duplicated code", + "markdown": "Duplicated code" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/CallGathererPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 193, + "startColumn": 17, + "charOffset": 5356, + "charLength": 422, + "snippet": { + "text": "if (FunctionCall::CALL_NORMAL == $expression['call-type']) {\n $name = $expression['name'];\n if (!isset($this->functionCalls[$name])) {\n $this->functionCalls[$name] = 1;\n } else {\n ++$this->functionCalls[$name];\n }\n }\n $this->passCall($expression);\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 193, + "startColumn": 1, + "charOffset": 5340, + "charLength": 438, + "snippet": { + "text": " if (FunctionCall::CALL_NORMAL == $expression['call-type']) {\n $name = $expression['name'];\n if (!isset($this->functionCalls[$name])) {\n $this->functionCalls[$name] = 1;\n } else {\n ++$this->functionCalls[$name];\n }\n }\n $this->passCall($expression);\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + }, + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/CallGathererPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 365, + "startColumn": 21, + "charOffset": 11110, + "charLength": 440, + "snippet": { + "text": "if (FunctionCall::CALL_NORMAL == $expr['call-type']) {\n $name = $expr['name'];\n if (!isset($this->functionCalls[$name])) {\n $this->functionCalls[$name] = 1;\n } else {\n ++$this->functionCalls[$name];\n }\n }\n $this->passCall($expr);\n break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 365, + "startColumn": 1, + "charOffset": 11090, + "charLength": 460, + "snippet": { + "text": " if (FunctionCall::CALL_NORMAL == $expr['call-type']) {\n $name = $expr['name'];\n if (!isset($this->functionCalls[$name])) {\n $this->functionCalls[$name] = 1;\n } else {\n ++$this->functionCalls[$name];\n }\n }\n $this->passCall($expr);\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e9b4ab84d6b7c06820c9badc665723934eda3726bf3903df3ce982bdeda45766" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpComposerExtensionStubsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "'ext-gmp' is specified in 'require-dev' section but used outside of tests", + "markdown": "'ext-gmp' is specified in 'require-dev' section but used outside of tests" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArray.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 14, + "charOffset": 663, + "charLength": 10, + "snippet": { + "text": "gmp_strval" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 592, + "charLength": 87, + "snippet": { + "text": "use function function_exists;\nuse function gmp_nextprime;\nuse function gmp_strval;\n\n/**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "049a05b823beab8478b118c172ba7e072274fbf8d0add5c2c4052cd23cc7d7f7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpComposerExtensionStubsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "'ext-gmp' is specified in 'require-dev' section but used outside of tests", + "markdown": "'ext-gmp' is specified in 'require-dev' section but used outside of tests" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArray.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 14, + "charOffset": 635, + "charLength": 13, + "snippet": { + "text": "gmp_nextprime" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 572, + "charLength": 103, + "snippet": { + "text": "use function count;\nuse function function_exists;\nuse function gmp_nextprime;\nuse function gmp_strval;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c0a927182a2b26135263ba90831205fc01910ea5673dfb4fba8ab3fc77776294" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpComposerExtensionStubsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "'ext-gmp' is specified in 'require-dev' section but used outside of tests", + "markdown": "'ext-gmp' is specified in 'require-dev' section but used outside of tests" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArray.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 106, + "startColumn": 33, + "charOffset": 3179, + "charLength": 10, + "snippet": { + "text": "gmp_strval" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 104, + "startColumn": 1, + "charOffset": 3026, + "charLength": 208, + "snippet": { + "text": " $arrayLength = count($expression['left']);\n if ($arrayLength >= 33 && function_exists('gmp_nextprime')) {\n $arrayLength = (int)gmp_strval(gmp_nextprime($arrayLength - 1));\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d6a9bc5e729aab418ad24e473e922ebface7003fdb28b36d83a89b1951120d36" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because 'in_array($className, ['self', 'static'])' is already 'false' at this point", + "markdown": "Condition is always 'true' because 'in_array($className, \\['self', 'static'\\])' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 67, + "startColumn": 21, + "charOffset": 2025, + "charLength": 22, + "snippet": { + "text": "'parent' == $className" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 65, + "startColumn": 1, + "charOffset": 1911, + "charLength": 292, + "snippet": { + "text": " $classDefinition = $compilationContext->classDefinition;\n } else {\n if ('parent' == $className) {\n $classDefinition = $compilationContext->classDefinition;\n $extendsClass = $classDefinition->getExtendsClass();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0dad8a1568e70ddfa502ca49d6d3dc64303009190234ca4be4a4f2b5985e6b2d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '1 != count($expression['parameters'])' is already 'false' at this point", + "markdown": "Condition is always 'true' because '1 != count($expression\\['parameters'\\])' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrtokOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 50, + "startColumn": 13, + "charOffset": 1138, + "charLength": 37, + "snippet": { + "text": "1 == count($expression['parameters'])" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 48, + "startColumn": 1, + "charOffset": 1115, + "charLength": 146, + "snippet": { + "text": " }\n\n if (1 == count($expression['parameters'])) {\n return new CompiledExpression('bool', 'false', $expression);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0f24f8a2cb526e35900b262beaba75e0332358debfb0bfcee5f6c4d87d933131" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '$statementsBlock' is evaluated at this point", + "markdown": "Condition is always 'true' because '$statementsBlock' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Property.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 420, + "startColumn": 17, + "charOffset": 12920, + "charLength": 16, + "snippet": { + "text": "$statementsBlock" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 418, + "startColumn": 1, + "charOffset": 12801, + "charLength": 272, + "snippet": { + "text": " if ($constructMethod) {\n $statementsBlock = $constructMethod->getStatementsBlock();\n if ($statementsBlock) {\n $statements = $statementsBlock->getStatements();\n $letStatement = $this->getLetStatement()->build();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1c660a7fdbfe2c48138daf1d50a7d4eede4bf57ad8fdd7cea2b37936d09fee1e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '$returnClassTypes' is evaluated at this point", + "markdown": "Condition is always 'true' because '$returnClassTypes' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 520, + "startColumn": 25, + "charOffset": 23587, + "charLength": 26, + "snippet": { + "text": "null !== $returnClassTypes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 518, + "startColumn": 1, + "charOffset": 23490, + "charLength": 269, + "snippet": { + "text": " $returnClassTypes = $method->getReturnClassTypes();\n\n if (null !== $returnClassTypes) {\n $symbolVariable->setDynamicTypes('object');\n foreach ($returnClassTypes as &$returnClassType) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "38401ffe61bd8d3a4893709612172af4b998b1ad498b81626a96741a8a5ee4b6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '$interfaces' is evaluated at this point", + "markdown": "Condition is always 'true' because '$interfaces' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Definition/Definition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 507, + "startColumn": 13, + "charOffset": 15428, + "charLength": 21, + "snippet": { + "text": "is_array($interfaces)" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 505, + "startColumn": 1, + "charOffset": 15362, + "charLength": 140, + "snippet": { + "text": " $compiler = $compilationContext->compiler;\n\n if (is_array($interfaces)) {\n $codePrinter->outputBlankLine(true);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "388429471940f618787be53d9cfebb607abe02909473f435a943948b11b4bf8e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'false' because ''string' !== $expr['right']['type']' is already 'false' at this point", + "markdown": "Condition is always 'false' because ''string' !== $expr\\['right'\\]\\['type'\\]' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 880, + "startColumn": 13, + "charOffset": 39362, + "charLength": 35, + "snippet": { + "text": "'string' !== $expr['right']['type']" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 878, + "startColumn": 1, + "charOffset": 39232, + "charLength": 296, + "snippet": { + "text": " $variableVariable = $compilationContext->symbolTable->getVariableForRead($code, $compilationContext, $expr);\n\n if ('string' !== $expr['right']['type']) {\n throw new CompilerException('Right expression of typeof operator must be \"string\" type', $expr['right']);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3977286db4a6066e7fd4d14ab1d48b4638e21a50731ebc2d013c1d4d6f5d0211" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '($file = $this->getFile())' is already 'true' at this point", + "markdown": "Condition is always 'true' because '($file = $this-\\>getFile())' is already 'true' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 33, + "startColumn": 75, + "charOffset": 642, + "charLength": 14, + "snippet": { + "text": "null !== $file" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 31, + "startColumn": 1, + "charOffset": 526, + "charLength": 185, + "snippet": { + "text": " $expression = $this->preBuild();\n\n if (!isset($expression['file']) && (($file = $this->getFile()) && null !== $file)) {\n $expression['file'] = $file;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4284633246736641dcf1c9fb2de1013d73e76a7a19e66f6950d2a7bc4950e35f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because ''string' == $type' is already 'false' at this point", + "markdown": "Condition is always 'true' because ''string' == $type' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 910, + "startColumn": 42, + "charOffset": 31749, + "charLength": 15, + "snippet": { + "text": "'char' == $type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 908, + "startColumn": 1, + "charOffset": 31656, + "charLength": 196, + "snippet": { + "text": " case 'string':\n case 'char':\n if ('string' == $type || 'char' == $type) {\n $value = '\"' . Name::addSlashes($value) . '\"';\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5ed3aa85975cc6cf3edb2d91e6d68fa04647682fcf8caaa245cb4bedd60325ea" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'false' because ''variable' !== $symbolVariable->getType()' is already 'false' at this point", + "markdown": "Condition is always 'false' because ''variable' !== $symbolVariable-\\>getType()' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectDynamicStringProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 78, + "startColumn": 13, + "charOffset": 2183, + "charLength": 40, + "snippet": { + "text": "'variable' != $symbolVariable->getType()" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 76, + "startColumn": 1, + "charOffset": 2160, + "charLength": 161, + "snippet": { + "text": " }\n\n if ('variable' != $symbolVariable->getType()) {\n throw CompilerException::cannotUseVariableTypeAs(\n $symbolVariable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "671ec86619a2aa5c5df6fbb886b6293daf3e2c508cd20cf6b4e8a652ea5fb312" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because 'CompilationContext $compilationContext' is evaluated at this point", + "markdown": "Condition is always 'true' because 'CompilationContext $compilationContext' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 857, + "startColumn": 31, + "charOffset": 30669, + "charLength": 19, + "snippet": { + "text": "$compilationContext" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 855, + "startColumn": 1, + "charOffset": 30541, + "charLength": 266, + "snippet": { + "text": " public function markTemporalVariablesIdle(CompilationContext $compilationContext): void\n {\n $compilationContext = $compilationContext ?: $this->compilationContext;\n $branchId = $compilationContext->branchManager->getCurrentBranchId();\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6d317f849f5d879c3a0d12f67ea77df90183287fc37478e578935050cfdb906b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable is always 'true' when reached", + "markdown": "Variable is always 'true' when reached" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 218, + "startColumn": 13, + "charOffset": 7258, + "charLength": 13, + "snippet": { + "text": "$duplicateKey" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 216, + "startColumn": 1, + "charOffset": 7115, + "charLength": 215, + "snippet": { + "text": " isset($this->statement['key']) ? $keyVariable : null,\n isset($this->statement['value']) ? $variable : null,\n $duplicateKey,\n $duplicateHash,\n $this->statement," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7394fb56f9409b60f33e7558f21543ab162557eb1078e8d500d4b33c9c04b249" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '$optimized' is evaluated at this point", + "markdown": "Condition is always 'true' because '$optimized' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ConcatOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 13, + "charOffset": 1374, + "charLength": 20, + "snippet": { + "text": "is_array($optimized)" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1252, + "charLength": 262, + "snippet": { + "text": " */\n $optimized = $this->_getOptimizedConcat($expression, $compilationContext, $isFullString);\n if (is_array($optimized)) {\n if (!$isFullString) {\n $expected = $this->getExpectedComplexLiteral($compilationContext);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "77863d2ddf259e8d9d2050e9476c36cd5863c97703b9e573c1326f9f568c9d5b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'false' because 'string $url' is evaluated at this point", + "markdown": "Condition is always 'false' because 'string $url' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 139, + "startColumn": 19, + "charOffset": 3389, + "charLength": 26, + "snippet": { + "text": "$url instanceof Definition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 137, + "startColumn": 1, + "charOffset": 3328, + "charLength": 202, + "snippet": { + "text": " return $url;\n }\n } elseif ($url instanceof Definition) {\n return $this->url(Documentation::classUrl($url));\n } elseif ($url instanceof CompilerFile) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "79d9951aa4c024f9d8130d757c11687fb492b15d6f47dd4fb1c500985970d5ee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because 'isset($expression['parameters'])' is already 'true' at this point", + "markdown": "Condition is always 'true' because 'isset($expression\\['parameters'\\])' is already 'true' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 590, + "startColumn": 68, + "charOffset": 26199, + "charLength": 32, + "snippet": { + "text": "isset($expression['parameters'])" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 588, + "startColumn": 1, + "charOffset": 25998, + "charLength": 385, + "snippet": { + "text": " // We check here if a correct parameter type is passed to the called method\n if (self::CALL_NORMAL == $type) {\n if (isset($method) && $method instanceof Method && isset($expression['parameters'])) {\n $resolvedTypes = $this->getResolvedTypes();\n $resolvedDynamicTypes = $this->getResolvedDynamicTypes();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7a52360a65c3cd25bf00bc8faedde0ca4697d18c5ca8cd21b0c35337d31be469" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '!$pattern' is already 'false' at this point", + "markdown": "Condition is always 'true' because '!$pattern' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2244, + "startColumn": 37, + "charOffset": 74244, + "charLength": 8, + "snippet": { + "text": "$pattern" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 2242, + "startColumn": 1, + "charOffset": 74072, + "charLength": 377, + "snippet": { + "text": " $this->recursiveProcess($pathName, $dest . DIRECTORY_SEPARATOR . $fileName, $pattern, $callback);\n }\n } elseif (!$pattern || ($pattern && 1 === preg_match($pattern, $fileName))) {\n $path = $dest . DIRECTORY_SEPARATOR . $fileName;\n $success = $success && call_user_func($callback, $pathName, $path);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "864f8e68dcc0aea431f21286a8c86ee02d0cfe38da9e6775a12adad119d03426" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because 'Method $method' is evaluated at this point", + "markdown": "Condition is always 'true' because 'Method $method' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 784, + "startColumn": 64, + "charOffset": 31192, + "charLength": 7, + "snippet": { + "text": "$method" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 782, + "startColumn": 1, + "charOffset": 31034, + "charLength": 198, + "snippet": { + "text": " */\n $methodCache = $compilationContext->cacheManager->getStaticMethodCache();\n $cachePointer = $methodCache->get($compilationContext, $method ?? null);\n\n $params = [];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8c9d01ea1fc4796b0d89558906772b01b1df3a359a05c1b276f7e0c79891bcb5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'false' because '!$symbolVariable->isVariable()' is already 'false' at this point", + "markdown": "Condition is always 'false' because '!$symbolVariable-\\>isVariable()' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectDynamicProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 80, + "startColumn": 13, + "charOffset": 2326, + "charLength": 30, + "snippet": { + "text": "!$symbolVariable->isVariable()" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 78, + "startColumn": 1, + "charOffset": 2303, + "charLength": 151, + "snippet": { + "text": " }\n\n if (!$symbolVariable->isVariable()) {\n throw CompilerException::cannotUseVariableTypeAs(\n $symbolVariable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "94d561c5c6762611b0ca8923dea691d95ecb35765da25041aa6b575803e32f9e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'false' because '!$symbolVariable->isVariable()' is already 'false' at this point", + "markdown": "Condition is always 'false' because '!$symbolVariable-\\>isVariable()' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 78, + "startColumn": 13, + "charOffset": 2020, + "charLength": 30, + "snippet": { + "text": "!$symbolVariable->isVariable()" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 76, + "startColumn": 1, + "charOffset": 1997, + "charLength": 176, + "snippet": { + "text": " }\n\n if (!$symbolVariable->isVariable()) {\n throw new Exception(\n \"Cannot use variable type: {$symbolVariable->getType()} as an object\"," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a10062e73e26e436a8ba0d5f60b4f5c922f9bc01969a3f9890528f0638c62473" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '($line = $this->getLine())' is already 'true' at this point", + "markdown": "Condition is always 'true' because '($line = $this-\\>getLine())' is already 'true' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 75, + "charOffset": 787, + "charLength": 14, + "snippet": { + "text": "null !== $line" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 702, + "charLength": 154, + "snippet": { + "text": " }\n\n if (!isset($expression['line']) && (($line = $this->getLine()) && null !== $line)) {\n $expression['line'] = $line;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a1aa7ff735f189adb49b5ef022b368baa6bd7fc951fa027adc53bdb4a346eaf9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because 'string $url' is evaluated at this point", + "markdown": "Condition is always 'true' because 'string $url' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 133, + "startColumn": 13, + "charOffset": 3168, + "charLength": 15, + "snippet": { + "text": "is_string($url)" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 131, + "startColumn": 1, + "charOffset": 3105, + "charLength": 181, + "snippet": { + "text": " public function url(string $url): string\n {\n if (is_string($url)) {\n if ('/' == $url[0]) {\n return $this->getPathToRoot() . ltrim($url, '/');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a30521646e25186b820c1c400e05b20589e14a2b4336f4e4f44b8ae2be54c276" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '$returnTypes' is evaluated at this point", + "markdown": "Condition is always 'true' because '$returnTypes' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 529, + "startColumn": 25, + "charOffset": 24069, + "charLength": 21, + "snippet": { + "text": "null !== $returnTypes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 527, + "startColumn": 1, + "charOffset": 23982, + "charLength": 261, + "snippet": { + "text": "\n $returnTypes = $method->getReturnTypes();\n if (null !== $returnTypes) {\n foreach ($returnTypes as $dataType => $returnType) {\n $symbolVariable->setDynamicTypes($dataType);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a8b7e1097ee9f41758488e08a5489857c9a70baa81d62ae57f5ff33b930e3d2b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '($char = $this->getChar())' is already 'true' at this point", + "markdown": "Condition is always 'true' because '($char = $this-\\>getChar())' is already 'true' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 75, + "charOffset": 932, + "charLength": 14, + "snippet": { + "text": "null !== $char" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 847, + "charLength": 154, + "snippet": { + "text": " }\n\n if (!isset($expression['char']) && (($char = $this->getChar()) && null !== $char)) {\n $expression['char'] = $char;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ad48c9361966c66aa5138ab7a732eadd559adddf3e7129f3882241bb27024b59" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because '$this->compiler' is evaluated at this point", + "markdown": "Condition is always 'true' because '$this-\\>compiler' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Definition/Definition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 891, + "startColumn": 70, + "charOffset": 29502, + "charLength": 15, + "snippet": { + "text": "$this->compiler" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 889, + "startColumn": 1, + "charOffset": 29358, + "charLength": 276, + "snippet": { + "text": " public function getExtendsClassDefinition(): ?AbstractDefinition\n {\n if (!$this->extendsClassDefinition && $this->extendsClass && $this->compiler) {\n $this->setExtendsClassDefinition($this->compiler->getClassDefinition($this->extendsClass));\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b2f20b7f6b9de44a36ca535e5554d0d531b56f1306003820e6c1690ece805748" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'false' because '$url instanceof Definition' is already 'false' at this point", + "markdown": "Condition is always 'false' because '$url instanceof Definition' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 141, + "startColumn": 19, + "charOffset": 3499, + "charLength": 28, + "snippet": { + "text": "$url instanceof CompilerFile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 139, + "startColumn": 1, + "charOffset": 3371, + "charLength": 253, + "snippet": { + "text": " } elseif ($url instanceof Definition) {\n return $this->url(Documentation::classUrl($url));\n } elseif ($url instanceof CompilerFile) {\n return $this->url(Documentation::classUrl($url->getClassDefinition()));\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b9e35e67ac63309e6941d527fde15595bec11bddc081629c8e5c892ab511e4eb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'false' because '$classInterfaceDefinition' is evaluated at this point", + "markdown": "Condition is always 'false' because '$classInterfaceDefinition' is evaluated at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 220, + "startColumn": 41, + "charOffset": 7957, + "charLength": 26, + "snippet": { + "text": "!$classInterfaceDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 218, + "startColumn": 1, + "charOffset": 7736, + "charLength": 428, + "snippet": { + "text": " if (!$classInterfaceDefinition) {\n $classInterfaceDefinition = $compiler->getInternalClassDefinition($interface);\n if (!$classInterfaceDefinition) {\n throw new CompilerException(\n \"Couldn't locate internal or external interface: \" . $interface," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bdaa8eeb0313b38bc02f51e80e24dd19bb78e745a2ba1239fd4402fa653dbae7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable already equals the assigned value", + "markdown": "Variable already equals the assigned value" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 208, + "startColumn": 25, + "charOffset": 6949, + "charLength": 20, + "snippet": { + "text": "$duplicateKey = true" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 206, + "startColumn": 1, + "charOffset": 6746, + "charLength": 264, + "snippet": { + "text": " $detector->setDetectionFlags(WriteDetector::DETECT_ALL);\n if ($detector->detect($keyVariable->getName(), $this->statement['statements'])) {\n $duplicateKey = true;\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bfbafd065bedcb62fdefe936f341c366d9868c57fa861205057e1c8b0bb5ddc1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'true' because 'is_string($url)' is already 'true' at this point", + "markdown": "Condition is always 'true' because 'is_string($url)' is already 'true' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 136, + "startColumn": 23, + "charOffset": 3309, + "charLength": 15, + "snippet": { + "text": "is_string($url)" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 134, + "startColumn": 1, + "charOffset": 3187, + "charLength": 183, + "snippet": { + "text": " if ('/' == $url[0]) {\n return $this->getPathToRoot() . ltrim($url, '/');\n } elseif (is_string($url)) {\n return $url;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c86cfd8ad97a38eaa1bcf974efc06d210d0f2262cac82c820632261a03ba22a5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'false' because '!$symbolVariable->isInitialized()' is already 'false' at this point", + "markdown": "Condition is always 'false' because '!$symbolVariable-\\>isInitialized()' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 67, + "startColumn": 13, + "charOffset": 1683, + "charLength": 33, + "snippet": { + "text": "!$symbolVariable->isInitialized()" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 65, + "startColumn": 1, + "charOffset": 1600, + "charLength": 177, + "snippet": { + "text": " $className = $context->classDefinition->getCompleteName();\n\n if (!$symbolVariable->isInitialized()) {\n throw new Exception(\n sprintf(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d0d335f73984a0d633455a281e445a0127d5b381ae5a79d1cb364d6f6b5a6b9e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionAlreadyCheckedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is always 'false' because '$interface || $class' is already 'false' at this point", + "markdown": "Condition is always 'false' because '$interface \\|\\| $class' is already 'false' at this point" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 336, + "startColumn": 25, + "charOffset": 10781, + "charLength": 10, + "snippet": { + "text": "$interface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 334, + "startColumn": 1, + "charOffset": 10693, + "charLength": 249, + "snippet": { + "text": " case 'class':\n case 'interface':\n if ($interface || $class) {\n throw new CompilerException('More than one class defined in the same file', $topStatement);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "df38aaded1e7868c6165c4ecc93d46d3c36431685112a72b02c4dd6276bbc507" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionCheckedByNextConditionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is unnecessary because it is checked by 'empty($resolvedParams[0])'", + "markdown": "Condition is unnecessary because it is checked by 'empty($resolvedParams\\[0\\])'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GlobalsSetOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 72, + "startColumn": 17, + "charOffset": 2156, + "charLength": 26, + "snippet": { + "text": "!isset($resolvedParams[0])" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 70, + "startColumn": 1, + "charOffset": 2023, + "charLength": 354, + "snippet": { + "text": " $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n if (!isset($resolvedParams[0]) || empty($resolvedParams[0]) || !is_string($resolvedParams[0])) {\n throw new CompilerException(\n \"Unable to reslove value for '{$globalName}' global variable.\"," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1f82d5cc19e4d793a204a7f33ca3c060f6bd639fa29c63662d11b8efcc790032" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpConditionCheckedByNextConditionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Condition is unnecessary because it is checked by '$expr instanceof self'", + "markdown": "Condition is unnecessary because it is checked by '$expr instanceof self'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 160, + "startColumn": 13, + "charOffset": 2965, + "charLength": 16, + "snippet": { + "text": "is_object($expr)" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 158, + "startColumn": 1, + "charOffset": 2942, + "charLength": 112, + "snippet": { + "text": " }\n\n if (is_object($expr) && $expr instanceof self) {\n return $expr->build();\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "40d0b747a1f8e7c33d39dd31021acb642bcd03ec2203fdc91eb625ec985aab8c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDeprecationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method 'recursiveProcess' is deprecated", + "markdown": "Method 'recursiveProcess' is deprecated" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1968, + "startColumn": 30, + "charOffset": 66115, + "charLength": 16, + "snippet": { + "text": "recursiveProcess" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1966, + "startColumn": 1, + "charOffset": 66016, + "charLength": 172, + "snippet": { + "text": " $sourceKernelPath = $this->backend->getInternalKernelPath();\n\n $configured = $this->recursiveProcess(\n $sourceKernelPath,\n $kernelPath," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1cd442023a7c37ae8ea06e3282909b227ef672858b9cf12d67b5e4648d3f9e9b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDeprecationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method 'recursiveProcess' is deprecated", + "markdown": "Method 'recursiveProcess' is deprecated" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2242, + "startColumn": 28, + "charOffset": 74099, + "charLength": 16, + "snippet": { + "text": "recursiveProcess" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 2240, + "startColumn": 1, + "charOffset": 73966, + "charLength": 331, + "snippet": { + "text": " mkdir($dest . DIRECTORY_SEPARATOR . $fileName, 0755, true);\n }\n $this->recursiveProcess($pathName, $dest . DIRECTORY_SEPARATOR . $fileName, $pattern, $callback);\n }\n } elseif (!$pattern || ($pattern && 1 === preg_match($pattern, $fileName))) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "252ada7d3408a1cb2ec19b7bd7460107465f978bcb5e33294d36ab0e8db809ca" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDeprecationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method 'renderPhalconCompatible' is deprecated", + "markdown": "Method 'renderPhalconCompatible' is deprecated" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Code/ArgInfoDefinition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 20, + "charOffset": 1247, + "charLength": 23, + "snippet": { + "text": "renderPhalconCompatible" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1187, + "charLength": 140, + "snippet": { + "text": " public function render(): void\n {\n if ($this->renderPhalconCompatible()) {\n $this->codePrinter->outputBlankLine();\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4c1775a966d925e1d6e9b5220d7813211525ab3d1fb9816301abbdc84bad3eeb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDeprecationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method 'getParserManager' is deprecated", + "markdown": "Method 'getParserManager' is deprecated" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 484, + "startColumn": 34, + "charOffset": 15856, + "charLength": 16, + "snippet": { + "text": "getParserManager" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 482, + "startColumn": 1, + "charOffset": 15766, + "charLength": 263, + "snippet": { + "text": "\n if (!$this->filesystem->exists($compilePath)) {\n $parser = $compiler->getParserManager()->getParser();\n $ir = $parser->parse($zepRealPath);\n $this->filesystem->write($compilePath, json_encode($ir, JSON_PRETTY_PRINT));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4deb1c011c79042e9c0c3fd7702c7d962b7a6ed5ae004484fd1c28d80d283808" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDeprecationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method 'recursiveDeletePath' is deprecated", + "markdown": "Method 'recursiveDeletePath' is deprecated" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1977, + "startColumn": 20, + "charOffset": 66379, + "charLength": 19, + "snippet": { + "text": "recursiveDeletePath" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1975, + "startColumn": 1, + "charOffset": 66267, + "charLength": 197, + "snippet": { + "text": " if (!$configured) {\n $this->logger->info('Cleaning old kernel files...');\n $this->recursiveDeletePath($kernelPath, '@^.*\\.[lcho]$@');\n\n @mkdir($kernelPath);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8e50c6ad69f00cc80ac7379ee300a83c5093403a38a385cc96bba12ec6128aa4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDeprecationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method 'removeMemoryStackReferences' is deprecated", + "markdown": "Method 'removeMemoryStackReferences' is deprecated" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Method/Method.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1413, + "startColumn": 24, + "charOffset": 54430, + "charLength": 27, + "snippet": { + "text": "removeMemoryStackReferences" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1411, + "startColumn": 1, + "charOffset": 54310, + "charLength": 202, + "snippet": { + "text": " * Remove macros that grow/restore the memory frame stack if it wasn't used.\n */\n $code = $this->removeMemoryStackReferences($symbolTable, $codePrinter->getOutput());\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c51843a3eb4468bc75886e47e9da55264883570ae0afa8173462d5d565abd79b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDeprecationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method 'recursiveProcess' is deprecated", + "markdown": "Method 'recursiveProcess' is deprecated" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1982, + "startColumn": 20, + "charOffset": 66549, + "charLength": 16, + "snippet": { + "text": "recursiveProcess" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1980, + "startColumn": 1, + "charOffset": 66465, + "charLength": 160, + "snippet": { + "text": "\n $this->logger->info('Copying new kernel files...');\n $this->recursiveProcess($sourceKernelPath, $kernelPath, '@^.*\\.[ch]$@');\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f77d88b86ea86baf1a1b13e74d6cdf790f7f51437c255b0139c8e1a5c64398ac" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 193, + "startColumn": 8, + "charOffset": 5325, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 191, + "startColumn": 1, + "charOffset": 5277, + "charLength": 176, + "snippet": { + "text": " * @return CompiledExpression\n *\n * @throws CompilerException\n */\n protected function _callDynamic(array $expression, CompilationContext $compilationContext)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0729faf7e3ba9ca0bb81e58ad4778e6d18551d990711e94c73f3a94bfb525274" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/DoublevalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 824, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 765, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "08be9382087826f6a83d44d2dd0fff88d28f577fac85fe2b8c2a006d76961d3d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateArrayOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 844, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 790, + "charLength": 176, + "snippet": { + "text": " * @return CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0a42d921798473de00cf4fe5330ed68dd35609e492864d3b07075247d8d8bf32" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FloorOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 812, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 753, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0a7b12367aebdebab3c312b61ae1c479e014460c3ebeea0a405e944e57a6cc16" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MergeAppendOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 831, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 772, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0d2bf055a22460901a267507d7d1cc36dbe451b957b31da263bc219dd3b3163d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FunctionExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 6, + "charOffset": 777, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 720, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0ec1d61b106fcfc86bec53ef32d62b98c2395376b158b5ca63143d2f3688a9fd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/TernaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 6, + "charOffset": 746, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 700, + "charLength": 155, + "snippet": { + "text": " *\n * @return CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext): CompiledExpression\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0ec389123446d0c9d366ec94c022ad8f3b25596ab0a21ee0c99e7f691d96a645" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ClassExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 831, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 772, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "151777ee715691003478056d8bd0ad8242746bac565d1e8a95fb6d1a253bd8f7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FeofOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 6, + "charOffset": 760, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 703, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "155b09349935b1d65a82920a0b32c53bfdc5aaad275988e2cc6174b37824df49" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonEncodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 592, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 534, + "charLength": 145, + "snippet": { + "text": "class JsonEncodeOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1d0a82b384c2800c8b9370d4c5ded6460afb89d69ea65f7b8c2ed4fc2948abea" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 661, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 616, + "charLength": 146, + "snippet": { + "text": " protected bool $literalOnly = true;\n\n /**\n * @param array $expression\n * @param CompilationContext $compilationContext" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1d89b784899130af7d3ede3ddb245ca925b5789c4a5eded64bdfe42a690dbf97" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/DivOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 5, + "charOffset": 667, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 609, + "charLength": 121, + "snippet": { + "text": " protected string $zvalOperator = 'div_function';\n\n /**\n * Compiles the arithmetical division operation.\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "20ff1cf69dcf3a7a714c98b74368ed325e61344fdc7623064eccd6f001bdfdb6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FileGetContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 844, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 785, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2289e9fefcb246fd500222db8a9c61f5218cb6d70b832c495f98da621a919f49" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 114, + "startColumn": 8, + "charOffset": 3330, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 112, + "startColumn": 1, + "charOffset": 3283, + "charLength": 122, + "snippet": { + "text": " *\n * @throws CompilerException\n * @throws Exception\n */\n protected function _assignArrayIndexMultiple(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "22b43d80fb0d6cc07d2d92dea4db3efb3481139fe3f5732f11234e664d6cae18" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsScalarOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 6, + "charOffset": 833, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 776, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "24c26d75109d7d5c3689420009befeadd90646f798dc423e6c0bd1ae626a607f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/HashEqualsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 828, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 769, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2578aaf42ba132e23d9b5187f6466afed7ddd316469c25284bd3b9a1709fa588" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 438, + "startColumn": 8, + "charOffset": 14121, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 436, + "startColumn": 1, + "charOffset": 14054, + "charLength": 129, + "snippet": { + "text": " * @param FunctionDefinition $functionDefinition\n *\n * @throws Exception\n */\n public function compileFunction(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2b674659d839e1704dc895709c1901e6798e9ac6cbc004118b6486c0b4fa9974" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/RequireStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 32, + "startColumn": 8, + "charOffset": 652, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 30, + "startColumn": 1, + "charOffset": 585, + "charLength": 174, + "snippet": { + "text": " * @param CompilationContext $compilationContext\n *\n * @throws CompilerException\n */\n public function compile(CompilationContext $compilationContext): void" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2c91cdf21f442ff07641ae6c1007c9a0e915950f335a3758c6922d0d3f6b0107" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/RangeExclusiveOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 8, + "charOffset": 775, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 727, + "charLength": 180, + "snippet": { + "text": " * @return CompiledExpression\n *\n * @throws Exception\n */\n public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "32bbf36676d21c46a81859683337144956cb300b5ac1b072c8d43ed97d530786" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/FetchOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 8, + "charOffset": 828, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 780, + "charLength": 180, + "snippet": { + "text": " * @return CompiledExpression\n *\n * @throws Exception\n */\n public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "32d5962766eef7e286113895c8849523b0fa16dc711fb239d88d5faf2db4a7a3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/RangeInclusiveOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 8, + "charOffset": 753, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 705, + "charLength": 180, + "snippet": { + "text": " * @return CompiledExpression\n *\n * @throws Exception\n */\n public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "35f079cbd44f3b0d014f8928cc30251c9987a57469e465d9521f45f4da08aa05" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarDumpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 622, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 567, + "charLength": 142, + "snippet": { + "text": "class VarDumpOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "38eebf89a49cf9302f98cd35e75df7764ff0e4f89f805fbc1ed3a51d97596330" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MemstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 6, + "charOffset": 798, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 741, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3fb84a983617529c01bcae73fb5b7a74e33119338e860d50e7ab095aee973f04" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ShortTernaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 32, + "startColumn": 5, + "charOffset": 738, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 30, + "startColumn": 1, + "charOffset": 680, + "charLength": 101, + "snippet": { + "text": "class ShortTernaryOperator extends AbstractOperator\n{\n /**\n * Compile ternary operator.\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "410d89eafd6614fc9b8da4d11597cff4bed106052d6b66fc5d2660872dd3ca97" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/EmptyOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 8, + "charOffset": 740, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 692, + "charLength": 180, + "snippet": { + "text": " * @return CompiledExpression\n *\n * @throws Exception\n */\n public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4167d5d8cbef870d66d7efc87a548a41978d1acbc4a1e149ed9fa1f797c83eec" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/InterfaceExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 843, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 784, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "43fb4ab17aeb03db83a7fa98e26c891fcbafa583bfe89f1a83265379b006ca53" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsScalarOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 32, + "startColumn": 5, + "charOffset": 646, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 30, + "startColumn": 1, + "charOffset": 590, + "charLength": 143, + "snippet": { + "text": "class IsScalarOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "452d2982440e7bf80ccf1418dd851d02ee2ef885d6bb01d0a893385210aba44d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarDumpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 6, + "charOffset": 809, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 752, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "49e34c13eaca0e57522e4694bdd94843b0a8d1301acebcf8c085d195fea52cf6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 822, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 763, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4a4634fa7563353babf5c312546b63f02b09c54971537b525a536ee0276db557" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 133, + "startColumn": 6, + "charOffset": 4396, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 131, + "startColumn": 1, + "charOffset": 4294, + "charLength": 189, + "snippet": { + "text": " * @param CompilationContext $compilationContext\n * @param array $statement\n */\n protected function _assignStaticPropertyArrayMultipleIndex(\n $classEntry," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4bfc75d2aed1377b5f6e41ac9207ae8ef240c650300c74b6c9984927aca2b60d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/EvalExpression.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 84, + "startColumn": 8, + "charOffset": 1774, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 82, + "startColumn": 1, + "charOffset": 1733, + "charLength": 145, + "snippet": { + "text": " * @return bool|string\n *\n * @throws Exception\n */\n public function optimize($exprRaw, CompilationContext $compilationContext)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4eccae0b3b6ea0d10e3930574f6a1265dbaa593e28fddfa0aab21c1e0a19487c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ImplodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 8, + "charOffset": 811, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 752, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4fefbc043632539b11dc05def349b173ff2063341ada8cae2c7ba0cdfb68ba87" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CeilOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 809, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 750, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4fff0b619641159030c1dd0492d20b74f5004e1aaeb66c67d9d4676b33d75635" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 8, + "charOffset": 987, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 929, + "charLength": 119, + "snippet": { + "text": " * @param array $statement\n *\n * @throws CompilerException\n */\n public function assign(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "552baba5ed3760578d7c00685a48538ade20e1f57bbfd1ea0b238db00a0aaff6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/UniquePathKeyOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 838, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 779, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5a30aa6e632aa480dec197d6ac06b3e1c4cdf0482c40cd973b9189762bff7cbf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/TernaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 5, + "charOffset": 558, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 505, + "charLength": 96, + "snippet": { + "text": "class TernaryOperator extends AbstractOperator\n{\n /**\n * Compile ternary operator.\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5b0286bbbdfba46a254ed0989823ed3107d3057e75077c110b216179e21dd6d4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CountOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 6, + "charOffset": 763, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 706, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5b071f820049b16f9b24a28bff8561496c9060f347b2da5f47f51ee6c089549b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FilePutContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 844, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 785, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5f306534d0c4104810eb4bdbf177661218ebfb6f1e4b957059e1f1735915ff1e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CountOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 576, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 523, + "charLength": 140, + "snippet": { + "text": "class CountOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "613e1306b9ea08cb55d9504aff40f01f698120dcca762f3bef863f25cb4d5bf7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/WhileStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 6, + "charOffset": 568, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 502, + "charLength": 148, + "snippet": { + "text": " /**\n * @param CompilationContext $compilationContext\n */\n public function compile(CompilationContext $compilationContext): void\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "665de0a1d8e6686eaf25921881f4799d98e668fc72b86a5d638e46f198359aad" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ShortTernaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 6, + "charOffset": 926, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 880, + "charLength": 155, + "snippet": { + "text": " *\n * @return CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext): CompiledExpression\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "69ea4a228976e4da17d3d7d3b8b22b3b8ef43ed73b9b58eaed9608ae923c52ab" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrposOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 815, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 756, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6ab95cf40b98d90d588e3a1cb89fc016df718f8fac6ebe7e865e65a4972fdaf7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/LdexpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 8, + "charOffset": 851, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 792, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6b5ea4c36081ba59df9a101808e9a791e8ebd125b99b4a9b3dbd323bc4b9e9da" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 6, + "charOffset": 1020, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 974, + "charLength": 135, + "snippet": { + "text": " *\n * @return CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6da1587f194bf4702c5f8f228d5640acf55c13a63019042eaaabb1fa57bd859f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 5, + "charOffset": 810, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 753, + "charLength": 122, + "snippet": { + "text": " protected bool $readOnly = false;\n\n /**\n * Resolves the access to a property in an object.\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "70a81cd040f59ce3689c975096eb83872325a00eaf21634934ee1ca8c26e3613" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsNumericOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 6, + "charOffset": 776, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 719, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "746330f2a4301c2c233574971f2f475000f325aac7927a030cb904931b65d0f1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsNumericOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 589, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 532, + "charLength": 144, + "snippet": { + "text": "class IsNumericOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "74943ca86c8041736e65cc2e1c38186534ade1c3b9e0806e81c65025cda86f58" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ModOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 6, + "charOffset": 857, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 754, + "charLength": 192, + "snippet": { + "text": " * @param array $expression\n * @param CompilationContext $compilationContext\n */\n public function compile($expression, CompilationContext $compilationContext)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "754dbc94363d38f45c87f45fb4f82a086627150b12e8a0473d48aa4f48f03591" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ModOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 691, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 633, + "charLength": 120, + "snippet": { + "text": " protected string $zvalOperator = 'mod_function';\n\n /**\n * Compiles the arithmetical modulus operation.\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "75e62e374d3fea75847d5d59ee4329e98c649b2008784617b53b36c9a4e584f9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Call.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 615, + "startColumn": 8, + "charOffset": 25943, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 613, + "startColumn": 1, + "charOffset": 25888, + "charLength": 125, + "snippet": { + "text": " * @return CompiledExpression[]|null\n *\n * @throws Exception\n */\n public function getResolvedParamsAsExpr(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7795aa14cc67fb22c77232cf37ddb672f6671a321b25c2d4ef3056c09c74c12a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateInstanceOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 8, + "charOffset": 980, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 926, + "charLength": 176, + "snippet": { + "text": " * @return CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "77e7fcc78f890e79f71c88470caf6d04eaa97faa898a53ac057b964824346b27" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 5, + "charOffset": 777, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 728, + "charLength": 114, + "snippet": { + "text": " protected bool $readOnly = false;\n\n /**\n * Resolves the access to a property in an object.\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7848d1ee31f2b2f1baf758c90eb6b9880e3e930a55965fa8b06cfae9272a4f98" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ArrayKeysOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 8, + "charOffset": 865, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 811, + "charLength": 168, + "snippet": { + "text": " *\n * @return false|CompiledExpression\n * @throws Exception\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "78eddea99c8607b2c1bc8adcba0d8844a91b04c41603bc4e0afa06a2c64b1566" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonEncodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 6, + "charOffset": 779, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 722, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "78fdc2bd331f66bf252225d8a78e4cbb9775b417c404b963031f0f72a3a68e21" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonDecodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 6, + "charOffset": 779, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 722, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7bd113c27b96482b549fea34d5c759c841e973aa1f8fd56ba0e513de3fa44305" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsCallableOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 592, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 534, + "charLength": 145, + "snippet": { + "text": "class IsCallableOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7d043e1920c7324655c646fef7401b05b294cbff4ca05c3bedf11ca093fab6c2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 125, + "startColumn": 5, + "charOffset": 4080, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 123, + "startColumn": 1, + "charOffset": 4069, + "charLength": 89, + "snippet": { + "text": " }\n\n /**\n * Compiles x::y[a][b][] = {expr} (multiple offset assignment).\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7e5915bbda776cedf36100ef03f93269aba3469237526a450983a4040590025f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/EndsWithOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 6, + "charOffset": 886, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 829, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "849f87c1fc8c53757a7589e2cdcdb35179ced2fccfa27c8aea00672a72d40294" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrlenOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 6, + "charOffset": 766, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 709, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "86f64ea5971058a044c4bfe4ad0b0caefc78fcd320bc4d18e6efca115e3811f9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MethodExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 5, + "charOffset": 586, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 526, + "charLength": 147, + "snippet": { + "text": "class MethodExistsOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8a05bcc7fdf620fe0f2e8f0c562a8bf463acac9eb305126bba682cd13f0c9310" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarExportOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 859, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 805, + "charLength": 176, + "snippet": { + "text": " * @return CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8e31c33859b2a8bb0159c6ecb1f1a22cb11176c0439ade9d0ba42425a8df34cc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 827, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 768, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8e4abed6f377b6b948fd7da2596466bf5d625d377494a29fcea8556932ebeab6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsCallableOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 6, + "charOffset": 779, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 722, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "91875889ace43a7c6102b9ca830fd1188701951c7ccc24097cfbf7ac40c72229" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/RoundOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 8, + "charOffset": 895, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 836, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "93dd438c9226517b4aa6342c27a64a026c102216c114b7294728bcd9b4cbd8f2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CompareMtimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 834, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 775, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "942d34097e5ab85fd529a4894e3193dc80be9898e08959dc68ceeee94535b13a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CamelizeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 43, + "startColumn": 8, + "charOffset": 998, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 41, + "startColumn": 1, + "charOffset": 939, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9508e8ab1403447d365c6cbbf1eeaa59844ac787cc477b42dae48d22923a7d70" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrReplaceOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 828, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 769, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "95d455bf20538a918287d681dfa61a4cb2f1d286d89e3ce782d28d7888db5104" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/EndsWithOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 33, + "startColumn": 5, + "charOffset": 699, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 31, + "startColumn": 1, + "charOffset": 631, + "charLength": 155, + "snippet": { + "text": " protected string $zephirMethodStr = 'zephir_end_with_str';\n\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9925bb90e9278460756e22b943d5d48532b174a113389547dd8760ad21bad4d2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MicrotimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 824, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 765, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9acecb4cb59756e4dd9289876e3be135d9ff34ca74e44399d296c53ca678bba7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IntvalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 815, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 756, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9f25355b26a69f4ce215c3e76d2531db80bc549c94b66c52366a837b02fee8db" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 182, + "startColumn": 8, + "charOffset": 5418, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 180, + "startColumn": 1, + "charOffset": 5360, + "charLength": 139, + "snippet": { + "text": " * @param array $statement\n *\n * @throws CompilerException\n */\n protected function _assignArrayIndexSingle(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a3d5302be73057b5458f2ed360040494865679a5d827846b46af50fa7c993cb0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndexAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 5, + "charOffset": 2394, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 2383, + "charLength": 77, + "snippet": { + "text": " }\n\n /**\n * Compiles foo[y][x][] = {expr} (multiple offset).\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a591fc97230359389b2c6ee12057c8eb3bb84cf9bb42bdc4a3bb7695d4886090" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MethodExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 6, + "charOffset": 773, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 716, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a5d51c514f033852d17bc84c80fa6ef01ff9fa87271d65e521b1107b4a9da0c6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 6, + "charOffset": 987, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 941, + "charLength": 135, + "snippet": { + "text": " *\n * @return CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a9121c4123dbc4029225c1bfa38edecc6e2fc9cf4c1477e0680e9dd03bac15e0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 8, + "charOffset": 724, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 665, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ab051579427f1ae6fa70bab9b5efa42d4725413fa5bf71c44463e6e5979057d7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 99, + "startColumn": 8, + "charOffset": 2671, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 97, + "startColumn": 1, + "charOffset": 2613, + "charLength": 149, + "snippet": { + "text": " * @param array $statement\n *\n * @throws CompilerException\n */\n protected function _assignPropertyArrayMultipleIndex(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ab34bf5d86c1359b1cf834425fb44e648fd8d444251b53940a27ee3b9570224e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonDecodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 592, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 534, + "charLength": 145, + "snippet": { + "text": "class JsonDecodeOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b05ec121bb0cc36ba2c8adaaaeb6528f6a301f2df0248b6162811d63d7996552" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/NewInstanceTypeOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 8, + "charOffset": 928, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 880, + "charLength": 188, + "snippet": { + "text": " * @return CompiledExpression\n *\n * @throws CompilerException\n */\n public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b198fdb31f56e1500be8729167e732d5c0fdddacfc1bee148a1e7703dbed1bef" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/WhileStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 5, + "charOffset": 506, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 453, + "charLength": 117, + "snippet": { + "text": "class WhileStatement extends StatementAbstract\n{\n /**\n * @param CompilationContext $compilationContext\n */" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b1c4035aab3e3c49e7717873656fa6a6b8d3f920751cabe0a9d677b1ffccb9f4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 269, + "startColumn": 8, + "charOffset": 8819, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 267, + "startColumn": 1, + "charOffset": 8760, + "charLength": 178, + "snippet": { + "text": " * @param StringsManager $stringsManager\n *\n * @throws CompilerException\n */\n public function compile(Compiler $compiler, StringsManager $stringsManager): void" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b20a587e166cab8421c16abc8f9ec7a146a3f24f3cc066c627d57c5e6858dfe0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FuncGetArgOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 8, + "charOffset": 878, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 830, + "charLength": 170, + "snippet": { + "text": " * @return CompiledExpression\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b2e28dbc13bca7c5c7c1fc67e3a4de547d2e96f34260bbd34122fdb18b5ddbcf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 6, + "charOffset": 814, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 763, + "charLength": 140, + "snippet": { + "text": " *\n * @return bool|CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b3485b61e0f089369249d238fe7f53cd66bc5bf66e732ab1ab334eb6bab08787" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 164, + "startColumn": 8, + "charOffset": 4739, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 162, + "startColumn": 1, + "charOffset": 4681, + "charLength": 147, + "snippet": { + "text": " * @param array $statement\n *\n * @throws CompilerException\n */\n protected function _assignPropertyArraySingleIndex(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b6597ab24907d211ebc16c2757f6783661c4b4e6e00352dc8056144e24c3f227" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GettypeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 818, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 759, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b8e0503490d3d691afa3567a2788efe29466543bb279805852e9f439645c971d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 8, + "charOffset": 2330, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 2263, + "charLength": 174, + "snippet": { + "text": " * @param CompilationContext $compilationContext\n *\n * @throws CompilerException\n */\n public function compile(CompilationContext $compilationContext): void" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "babd7d1e708fd90c20363e845fa1b0ee2d346ba2c2e947bed1306e4dbd297f1b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 853, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 794, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bcfa8ba7b0bb94bb7d68ddae627792c6db8c729dad9af997ec1a62af99b0e094" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FwriteOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 815, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 756, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bd456dbfe27e9f0673e5494c663b0fe493c21c056c37404ca735b159c35c3bac" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CallUserFuncOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 6, + "charOffset": 864, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 807, + "charLength": 154, + "snippet": { + "text": " *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bdd5044c7e77a82722f44e219a397899c064edd0c4d70d8deccc4b8646cac562" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 8, + "charOffset": 1069, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 1030, + "charLength": 153, + "snippet": { + "text": " *\n * @throws Exception\n * @throws CompilerException\n */\n public function compile($expression, CompilationContext $compilationContext)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "be944aafd945c7177f3a6571a3dbefd62c10e1154ed2cb46f1034793a512cb0e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndexAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 6, + "charOffset": 950, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 846, + "charLength": 153, + "snippet": { + "text": " * @param CompilationContext $compilationContext ,\n * @param array $statement\n */\n public function assign(\n $variable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c09c334911d28dd3a6795d8c067c496ec6d87c93c18bd6fe784224f60f4afaaa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/SubstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 815, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 756, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c2e049fcb53d8326127592b24646ec05c6166a7e676e8f5c78ef0013c11e75d0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/UniqueKeyOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 8, + "charOffset": 936, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 877, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c54c0a4bcd5fb38b6d68851aa7e7246e74bdcf77cc552f60df594ab9523f3f74" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/CloneOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 8, + "charOffset": 729, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 681, + "charLength": 180, + "snippet": { + "text": " * @return CompiledExpression\n *\n * @throws Exception\n */\n public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c69f77cb6a23efa42523838fe0d5da6023d30232477642ff7e2b8fc47de1f0ea" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ExplodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 8, + "charOffset": 811, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 752, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c85d46f44778287d830391c25e84173d45a1a39b8baff5baaf064694e2238291" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StripslashesOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 8, + "charOffset": 894, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 835, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c8e455bbce53806151f1617470af1450a02fe184c9909e29e484c96cbd8a4019" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndexAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 89, + "startColumn": 6, + "charOffset": 2702, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 87, + "startColumn": 1, + "charOffset": 2600, + "charLength": 173, + "snippet": { + "text": " * @param CompilationContext $compilationContext\n * @param array $statement\n */\n protected function _assignArrayIndexMultiple(\n $variable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cf0ea9a9a26d5edeccd6c2b95e1d2d98f4e5420ef06b20af1590ea59846f475e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FunctionExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 5, + "charOffset": 590, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 528, + "charLength": 149, + "snippet": { + "text": "class FunctionExistsOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cf4218eadb02daccbfc27f2d27050a537349789f8ce0ad351a5870e77059b57a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FcloseOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 815, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 756, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d3b6412fe7b09bb6932bcaa37ae4f847aa6ec6df677fd6b57bf6db031263796b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ExitOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 8, + "charOffset": 788, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 729, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d4d6c437f366560de52940176be34302ab4d2682a50ccfcbe5b7c9d033cdb80c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FileExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 828, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 769, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "da690c1e838e345dc244be8fa6e5b33513e13b881909ccdef1afe0a676f93dfd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CallUserFuncOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 33, + "startColumn": 5, + "charOffset": 677, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 31, + "startColumn": 1, + "charOffset": 608, + "charLength": 156, + "snippet": { + "text": " protected string $zephirMethod = 'ZEPHIR_CALL_USER_FUNC';\n\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dc9633acebee7dd1ac2a0c1cc35229c61c9d1ebcf102a6a2126c95c071512891" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndexAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 32, + "startColumn": 5, + "charOffset": 663, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 30, + "startColumn": 1, + "charOffset": 601, + "charLength": 105, + "snippet": { + "text": "class ObjectPropertyArrayIndexAppend extends ArrayIndex\n{\n /**\n * Compiles x->y[z][] = foo.\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dd52710c8cfb0ce0021610c70a49182bb020120cab5828597c85ed00c0524612" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrtoupperOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 8, + "charOffset": 938, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 879, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dfdf80844768595f6332a9c1f04efabae935764efce488a28d0b207f961f7a7f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FeofOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 573, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 521, + "charLength": 139, + "snippet": { + "text": "class FeofOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e2d645f6a68ee1d1430330a06494ba4ead2b128ce518bb82c9f70d98fd5be64e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 8, + "charOffset": 947, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 908, + "charLength": 106, + "snippet": { + "text": " *\n * @throws Exception\n * @throws CompilerException\n */\n public function assignStatic(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e691fc2efbfc5077e8a4a47e4539ccbab4a2b736e592f3354feb0abca1a57482" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MemstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 32, + "startColumn": 5, + "charOffset": 611, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 30, + "startColumn": 1, + "charOffset": 557, + "charLength": 141, + "snippet": { + "text": "class MemstrOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e7e3af4064012626a7a267808cd274d6f3ea3a88d63f324a57007b4a24a0f9f9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrlenOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 579, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 525, + "charLength": 141, + "snippet": { + "text": "class StrlenOptimizer extends OptimizerAbstract\n{\n /**\n * @param array $expression\n * @param Call $call" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ecd36f83ae67502e65dc7ed856ac167a8006bace9681293a528ca8e359eab0b5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/DivOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 6, + "charOffset": 834, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 731, + "charLength": 192, + "snippet": { + "text": " * @param array $expression\n * @param CompilationContext $compilationContext\n */\n public function compile($expression, CompilationContext $compilationContext)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ed6dfbfb46b5da34c966dfba4932537e0eb6dd968247b6b83cd7da108c97e51a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetNsClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 8, + "charOffset": 829, + "charLength": 25, + "snippet": { + "text": "@throws CompilerException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 770, + "charLength": 181, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f097aed876fc384f2e3b7e6cb24a9145dc3c3e044f011f8b3ea1f243c4fa0774" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocMissingThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment doesn't contain all the necessary @throws tags", + "markdown": "PHPDoc comment doesn't contain all the necessary @throws tags" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 69, + "startColumn": 8, + "charOffset": 1874, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 67, + "startColumn": 1, + "charOffset": 1815, + "charLength": 170, + "snippet": { + "text": " * @param StringsManager $stringsManager\n *\n * @throws Exception\n */\n public function compile(Compiler $compiler, StringsManager $stringsManager): void" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f5de5700120fb964fa8258b7d9625ff84d7feed29b35f601ac75f5f4b713ccc7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocRedundantThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Exception 'Exception' is never thrown in the function", + "markdown": "Exception 'Exception' is never thrown in the function" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 167, + "startColumn": 8, + "charOffset": 5465, + "charLength": 17, + "snippet": { + "text": "@throws Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 165, + "startColumn": 1, + "charOffset": 5402, + "charLength": 133, + "snippet": { + "text": " * @return array\n * @throws ReflectionException\n * @throws Exception\n */\n protected function getOffsetExpressions(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8cae4b2f170cdbb58e9c2d21f8b7ab61e4a3786b8d0fb8f8607651e6846b8299" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocRedundantThrowsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Exception 'ReflectionException' is never thrown in the function", + "markdown": "Exception 'ReflectionException' is never thrown in the function" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 166, + "startColumn": 8, + "charOffset": 5430, + "charLength": 27, + "snippet": { + "text": "@throws ReflectionException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 164, + "startColumn": 1, + "charOffset": 5395, + "charLength": 95, + "snippet": { + "text": " *\n * @return array\n * @throws ReflectionException\n * @throws Exception\n */" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ffeda0a31f6608a880573535303fc8819c2eaafaabb9414ecfcbc16725142845" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Exception/CompilerException.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 213, + "startColumn": 5, + "charOffset": 6387, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 211, + "startColumn": 1, + "charOffset": 6376, + "charLength": 50, + "snippet": { + "text": " }\n\n /**\n * Unknown variable type\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "356cac0c743a4c04f6697c414c5b8f3d5b3c7c455ad0f4d2bd8640adfa30fc51" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ModOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 6, + "charOffset": 857, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 754, + "charLength": 192, + "snippet": { + "text": " * @param array $expression\n * @param CompilationContext $compilationContext\n */\n public function compile($expression, CompilationContext $compilationContext)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "66f9dac515774a836c162f3bfda22533fd0e9bca3a42a36c02e4dd1dfc645d0d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/DivOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 5, + "charOffset": 667, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 609, + "charLength": 121, + "snippet": { + "text": " protected string $zvalOperator = 'div_function';\n\n /**\n * Compiles the arithmetical division operation.\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "68b4ae5cc7a3825964347f35fe6db41dc3a6acdc017b9f499efdf521fc523342" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Exception/CompilerException.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 221, + "startColumn": 6, + "charOffset": 6599, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 219, + "startColumn": 1, + "charOffset": 6567, + "charLength": 102, + "snippet": { + "text": " *\n * @return self\n */\n public static function unknownType(\n Variable $variable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6916e5e4749eec88b764a269f65ba6bc033bbd7e855f8d52c0b70d55689b841d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Exception/CompilerException.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 121, + "startColumn": 5, + "charOffset": 3618, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 119, + "startColumn": 1, + "charOffset": 3607, + "charLength": 77, + "snippet": { + "text": " }\n\n /**\n * Cannot use non-initialized variable as an object\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "70df175e6050d888732f315c861f4d98ca22c3e5e484b620afc5a65820196758" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Traits/VariablesTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 6, + "charOffset": 783, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 751, + "charLength": 125, + "snippet": { + "text": " *\n * @return void\n */\n protected function checkAccessNonStaticProperty(\n Property $propertyDefinition," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7adfc6a419c1edb72e7eb38cbd8b1c05f14b7814aea74a5d0e33f6a1321e8952" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Exception/CompilerException.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 97, + "startColumn": 5, + "charOffset": 2841, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 95, + "startColumn": 1, + "charOffset": 2830, + "charLength": 77, + "snippet": { + "text": " }\n\n /**\n * Cannot use non-initialized variable as an object\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7b08b28e1eb5632b72412c84c0f4ff1a176bcb1fb44847cd47b5d2b75b1ed973" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Exception/CompilerException.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 105, + "startColumn": 6, + "charOffset": 3205, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 103, + "startColumn": 1, + "charOffset": 3173, + "charLength": 111, + "snippet": { + "text": " *\n * @return self\n */\n public static function cannotUseValueTypeAs(\n Variable $variable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "81cb85713162c6cc7ca9984efe5588cbdde6d931e4f457c43e63a8bfb4bfef03" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Traits/VariablesTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 5, + "charOffset": 1321, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1310, + "charLength": 65, + "snippet": { + "text": " }\n\n /**\n * Check whether a class has a property\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9e44a57ea707b9c90613710e5e98b0437068b1a284279929b0cb88c69fb6826b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/DivOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 6, + "charOffset": 834, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 731, + "charLength": 192, + "snippet": { + "text": " * @param array $expression\n * @param CompilationContext $compilationContext\n */\n public function compile($expression, CompilationContext $compilationContext)\n {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bc38337eac18bdc5f681c29d4626408d1a0bc657e9ccc861e5a44293b9a6b459" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Traits/VariablesTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 62, + "startColumn": 6, + "charOffset": 1521, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 60, + "startColumn": 1, + "charOffset": 1489, + "charLength": 117, + "snippet": { + "text": " *\n * @return void\n */\n protected function checkClassHasProperty(\n Definition $classDefinition," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d223107813814fa20508df5c2ac3b8d46d61a12caf41bac2b63d986b51cd0a0b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Traits/VariablesTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 5, + "charOffset": 583, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 556, + "charLength": 81, + "snippet": { + "text": "trait VariablesTrait\n{\n /**\n * Check whether a class has a property\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f14e54f22520b9e08469fee7ce9f7a7f11f0d1627d06e19ac00c709e2a6198c4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Exception/CompilerException.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 129, + "startColumn": 6, + "charOffset": 3982, + "charLength": 2, + "snippet": { + "text": "*/" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 127, + "startColumn": 1, + "charOffset": 3950, + "charLength": 114, + "snippet": { + "text": " *\n * @return self\n */\n public static function cannotUseVariableTypeAs(\n Variable $variable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fa5be3008d990174d4a80f07e9e80f171b6cf9b9c63c54309bb7bf96bb6b58d3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDocSignatureIsNotCompleteInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "PHPDoc comment signature is not complete", + "markdown": "PHPDoc comment signature is not complete" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ModOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 5, + "charOffset": 691, + "charLength": 3, + "snippet": { + "text": "/**" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 633, + "charLength": 120, + "snippet": { + "text": " protected string $zvalOperator = 'mod_function';\n\n /**\n * Compiles the arithmetical modulus operation.\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "feada92f0fa24ed4e4eede3671d7f71cc2875e2e2d2a4cfd0de634e6fedefe19" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDuplicateCaseInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Duplicate case expression", + "markdown": "Duplicate case expression" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/CallGathererPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 218, + "startColumn": 18, + "charOffset": 6144, + "charLength": 15, + "snippet": { + "text": "'short-ternary'" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 216, + "startColumn": 1, + "charOffset": 6072, + "charLength": 142, + "snippet": { + "text": " case 'cast':\n case 'type-hint':\n case 'short-ternary':\n case 'ternary':\n case 'fetch':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ef6baacb97f6814bf81b0253261e0c80704401ba6f89c317c91639e9cc236f9d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDynamicFieldDeclarationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Property declared dynamically", + "markdown": "Property declared dynamically" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 16, + "charOffset": 1831, + "charLength": 6, + "snippet": { + "text": "logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 1735, + "charLength": 217, + "snippet": { + "text": " $this->config = $config;\n $this->classes = $classes;\n $this->logger = new NullLogger();\n $this->templatesPath = $templatesPath;\n $this->options = $options;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0b24fd7f1df119e66d06e0ad936cf119eb9e8b32de2a1a767f417c867cd4babd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDynamicFieldDeclarationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Property declared dynamically", + "markdown": "Property declared dynamically" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 128, + "startColumn": 16, + "charOffset": 2970, + "charLength": 6, + "snippet": { + "text": "logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 126, + "startColumn": 1, + "charOffset": 2908, + "charLength": 182, + "snippet": { + "text": " ) {\n $this->config = $config;\n $this->logger = new NullLogger();\n $this->aliasManager = $aliasManager;\n $this->filesystem = $filesystem;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "10489014c0519162625c4a9a5f8710793146d5f931ba9386a8c5fd556a1bd493" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDynamicFieldDeclarationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Property declared dynamically", + "markdown": "Property declared dynamically" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 16, + "charOffset": 1692, + "charLength": 6, + "snippet": { + "text": "logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1592, + "charLength": 142, + "snippet": { + "text": " $this->config = $config;\n $this->context = $context;\n $this->logger = new NullLogger();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "135bf489d5a732fa637446d6d402318807c6aae2a609cd9576fcaf26fd894787" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpDynamicFieldDeclarationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Property declared dynamically", + "markdown": "Property declared dynamically" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 150, + "startColumn": 16, + "charOffset": 3985, + "charLength": 6, + "snippet": { + "text": "logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 148, + "startColumn": 1, + "charOffset": 3904, + "charLength": 233, + "snippet": { + "text": " private CompilerFileFactory $compilerFileFactory,\n ) {\n $this->logger = new NullLogger();\n $this->stringManager = new StringsManager();\n $this->fcallManager = $this->backend->getFcallManager();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2def1e80fc569a15a11c1bae2933df1b643a648058043ff3fa72a147f6587979" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpElementIsNotAvailableInCurrentPhpVersionInspection", + "kind": "fail", + "level": "error", + "message": { + "text": "'ReturnTypeWillChange' is available starting with 8.1 PHP version", + "markdown": "'ReturnTypeWillChange' is available starting with 8.1 PHP version" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 5, + "charOffset": 316, + "charLength": 20, + "snippet": { + "text": "ReturnTypeWillChange" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 273, + "charLength": 96, + "snippet": { + "text": "use ArrayAccess;\nuse JsonSerializable;\nuse ReturnTypeWillChange;\n\nuse function array_key_exists;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4784c30899df298a1c80ac8a4013c87998109e10a00d21af559493908eda78c1" + }, + "properties": { + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpFieldAssignmentTypeMismatchInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Incompatible types: Expected property of type 'null|\\Psr\\Log\\LoggerInterface', '\\Psr\\Log\\NullLogger' provided", + "markdown": "Incompatible types: Expected property of type 'null\\|\\\\Psr\\\\Log\\\\LoggerInterface', '\\\\Psr\\\\Log\\\\NullLogger' provided" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 86, + "startColumn": 9, + "charOffset": 2490, + "charLength": 51, + "snippet": { + "text": "$compilationContext->logger = $this->logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 84, + "startColumn": 1, + "charOffset": 2364, + "charLength": 307, + "snippet": { + "text": " $compilationContext->compiler = $compiler;\n $compilationContext->config = $this->config;\n $compilationContext->logger = $this->logger;\n $compilationContext->stringsManager = $stringsManager;\n $compilationContext->backend = $compiler->backend;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3482c1c96b22cd5d3ab73165abc00558e35a7b1389ba142d9c9fec718b9f721c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpFieldAssignmentTypeMismatchInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Incompatible types: Expected property of type 'null|\\Psr\\Log\\LoggerInterface', '\\Psr\\Log\\NullLogger' provided", + "markdown": "Incompatible types: Expected property of type 'null\\|\\\\Psr\\\\Log\\\\LoggerInterface', '\\\\Psr\\\\Log\\\\NullLogger' provided" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 559, + "startColumn": 9, + "charOffset": 17673, + "charLength": 49, + "snippet": { + "text": "$compilationContext->logger = $this->logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 557, + "startColumn": 1, + "charOffset": 17551, + "charLength": 301, + "snippet": { + "text": " $compilationContext->compiler = $compiler;\n $compilationContext->config = $this->config;\n $compilationContext->logger = $this->logger;\n $compilationContext->aliasManager = $this->aliasManager;\n $compilationContext->backend = $compiler->backend;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3c801b1258708406a35bb54c83c2abf8478874359ef78163cf8cd8550373cbf3" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpFieldAssignmentTypeMismatchInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Incompatible types: Expected property of type 'null|\\Psr\\Log\\LoggerInterface', '\\Psr\\Log\\NullLogger' provided", + "markdown": "Incompatible types: Expected property of type 'null\\|\\\\Psr\\\\Log\\\\LoggerInterface', '\\\\Psr\\\\Log\\\\NullLogger' provided" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 302, + "startColumn": 9, + "charOffset": 9782, + "charLength": 43, + "snippet": { + "text": "$compilationContext->logger = $this->logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 300, + "startColumn": 1, + "charOffset": 9706, + "charLength": 133, + "snippet": { + "text": " * Set global logger in the compilation context\n */\n $compilationContext->logger = $this->logger;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "78fab1fb4e843c1012d2a9c3b7f8b110038d6083f9dcee7079bdcd4f5853e3dd" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpInconsistentReturnPointsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Missing 'return' statement", + "markdown": "Missing 'return' statement" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/Types.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 137, + "startColumn": 13, + "charOffset": 4454, + "charLength": 1, + "snippet": { + "text": "}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 135, + "startColumn": 1, + "charOffset": 4391, + "charLength": 148, + "snippet": { + "text": " return $ret;\n }\n });\n\n return implode('|', array_values($withoutNullable)) . $nullableType;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2ba9229198309302708c17e883a74e1a37b0da912e599b77d2c53d2abf7e3261" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpInconsistentReturnPointsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Missing 'return' statement", + "markdown": "Missing 'return' statement" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/StaticTypeInference.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 409, + "startColumn": 5, + "charOffset": 11915, + "charLength": 1, + "snippet": { + "text": "}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 407, + "startColumn": 1, + "charOffset": 11878, + "charLength": 100, + "snippet": { + "text": " break;\n }\n }\n\n public function passLetStatement(array $statement): void" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aad6e68c300ce6c780632ccbc9e9fdc7cf111db7931dffecf0a6754db061236d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpInconsistentReturnPointsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Missing 'return' statement", + "markdown": "Missing 'return' statement" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArrayAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 96, + "startColumn": 5, + "charOffset": 2865, + "charLength": 1, + "snippet": { + "text": "}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 94, + "startColumn": 1, + "charOffset": 2748, + "charLength": 127, + "snippet": { + "text": " return $this->accessStringOffset($expression, $variableVariable, $compilationContext);\n }\n }\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e1901231a4c64bb2e4d855415a9fee984a5739a4bd8ff3832d1f8ad419068bc2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpInconsistentReturnPointsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Missing 'return' statement", + "markdown": "Missing 'return' statement" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PowOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 5, + "charOffset": 1165, + "charLength": 1, + "snippet": { + "text": "}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1125, + "charLength": 50, + "snippet": { + "text": " return false;\n }\n }\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f3be7324978e7a00d1e3ff6d7891edb43c2b4325e45cf7ea1530f336b1e2c42d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpLoopCanBeReplacedWithStdFunctionCallsInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Loop can be replaced with 'array_key_exists()'", + "markdown": "Loop can be replaced with 'array_key_exists()'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Definition/Definition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1150, + "startColumn": 9, + "charOffset": 36123, + "charLength": 7, + "snippet": { + "text": "foreach" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1148, + "startColumn": 1, + "charOffset": 36057, + "charLength": 187, + "snippet": { + "text": " {\n $methodNameLower = strtolower($methodName);\n foreach ($this->methods as $name => $method) {\n if ($methodNameLower === $name) {\n return true;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5a30fd7ae1aaf3691894df797a0dce73e5bc391f316640990e497c67717fa9d9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMatchExpressionWithOnlyDefaultArmInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "'match' expression has only default arm and should be simplified", + "markdown": "'match' expression has only default arm and should be simplified" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 307, + "startColumn": 23, + "charOffset": 12666, + "charLength": 5, + "snippet": { + "text": "match" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 305, + "startColumn": 1, + "charOffset": 12616, + "charLength": 201, + "snippet": { + "text": "\n case 'string':\n throw match ($right->getType()) {\n default => new CompilerException(\n 'Operation is not supported between strings'," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1c3bd63b16c83ccab3498f4b0c4ec366d7ea23d046186c86f4623ff47b8f6157" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMatchExpressionWithOnlyDefaultArmInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "'match' expression has only default arm and should be simplified", + "markdown": "'match' expression has only default arm and should be simplified" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 255, + "startColumn": 23, + "charOffset": 10359, + "charLength": 5, + "snippet": { + "text": "match" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 253, + "startColumn": 1, + "charOffset": 10309, + "charLength": 201, + "snippet": { + "text": "\n case 'string':\n throw match ($right->getType()) {\n default => new CompilerException(\n 'Operation is not supported between strings'," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8ccc4f3164834ed845e6e2b37ae5ca836f1137e9233af57a36d2dfd69b9145e1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMatchExpressionWithOnlyDefaultArmInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "'match' expression has only default arm and should be simplified", + "markdown": "'match' expression has only default arm and should be simplified" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/DivOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 208, + "startColumn": 23, + "charOffset": 8304, + "charLength": 5, + "snippet": { + "text": "match" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 206, + "startColumn": 1, + "charOffset": 8229, + "charLength": 239, + "snippet": { + "text": " case 'string':\n case 'array':\n throw match ($right->getType()) {\n default => new CompilerException(\n 'Operation is not supported between ' . $right->getType()," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ce9a24ef7c229f016e4e166ca90184a19defefb40b1ded3090ff835a0cf2012f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 2 parameters, but the method signature uses 1 parameters", + "markdown": "Method call is provided 2 parameters, but the method signature uses 1 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 316, + "startColumn": 45, + "charOffset": 13516, + "charLength": 19, + "snippet": { + "text": "$compilationContext" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 314, + "startColumn": 1, + "charOffset": 13308, + "charLength": 271, + "snippet": { + "text": " $variableRight = $compilationContext->backend->getVariableCode(\n $variableRight,\n $compilationContext\n );\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0d359cf74b12bbb4a6191ce4c16c5916bb501a66a4425c7ddb386998ced182c5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 3 parameters, but the method signature uses 2 parameters", + "markdown": "Method call is provided 3 parameters, but the method signature uses 2 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArrayAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 210, + "startColumn": 21, + "charOffset": 7075, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 208, + "startColumn": 1, + "charOffset": 6982, + "charLength": 137, + "snippet": { + "text": " 'variable',\n $compilationContext,\n $expression\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "10b759aba2fe16119af10fb03c5dd9ecf4c9e8c3e5e98cae10291764c0843702" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 3 parameters, but the method signature uses 2 parameters", + "markdown": "Method call is provided 3 parameters, but the method signature uses 2 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 580, + "startColumn": 83, + "charOffset": 19533, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 578, + "startColumn": 1, + "charOffset": 19328, + "charLength": 262, + "snippet": { + "text": " ): void {\n [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext);\n $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true);\n\n $compilationContext->codePrinter->output(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "149639fea32545ca0fea129bc555a487c00ff9abca1eb3cc525f91c13568c173" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 3 parameters, but the method signature uses 2 parameters", + "markdown": "Method call is provided 3 parameters, but the method signature uses 2 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 603, + "startColumn": 83, + "charOffset": 20328, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 601, + "startColumn": 1, + "charOffset": 20123, + "charLength": 289, + "snippet": { + "text": " ): void {\n [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext);\n $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true);\n\n $offsetStr = $offsetItems ? ', ' . implode(', ', $offsetItems) : '';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "37dab5aa4807d5c695f4c322a4a6e7d9bc86f5bda2d46a7e33bc60993ec7b5fa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 3 parameters, but the method signature uses 2 parameters", + "markdown": "Method call is provided 3 parameters, but the method signature uses 2 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArrayAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 202, + "startColumn": 29, + "charOffset": 6774, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 200, + "startColumn": 1, + "charOffset": 6657, + "charLength": 177, + "snippet": { + "text": " 'variable',\n $compilationContext,\n $expression\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "457cd8470aecc47e98e125f2c6b3837f43d57c905e031f1ff7096d3e55237690" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 2 parameters, but the method signature uses 1 parameters", + "markdown": "Method call is provided 2 parameters, but the method signature uses 1 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 375, + "startColumn": 45, + "charOffset": 16674, + "charLength": 19, + "snippet": { + "text": "$compilationContext" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 373, + "startColumn": 1, + "charOffset": 16466, + "charLength": 271, + "snippet": { + "text": " $variableRight = $compilationContext->backend->getVariableCode(\n $variableRight,\n $compilationContext\n );\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "493dd0c3b795bd668269d392c78227103b2aab5c738370b291362376c8cfe2fe" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 2 parameters, but the method signature uses 1 parameters", + "markdown": "Method call is provided 2 parameters, but the method signature uses 1 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 227, + "startColumn": 37, + "charOffset": 9262, + "charLength": 19, + "snippet": { + "text": "$compilationContext" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 225, + "startColumn": 1, + "charOffset": 9078, + "charLength": 239, + "snippet": { + "text": " $variableRight = $compilationContext->backend->getVariableCode(\n $variableRight,\n $compilationContext\n );\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7e3153334b7636040c742d7afe0e303dbb49ef98e8b1e88c58272682b12032fa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 3 parameters, but the method signature uses 2 parameters", + "markdown": "Method call is provided 3 parameters, but the method signature uses 2 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1848, + "startColumn": 67, + "charOffset": 64213, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1846, + "startColumn": 1, + "charOffset": 64111, + "charLength": 170, + "snippet": { + "text": " $flags = null\n ): void {\n $value = $this->resolveValue($value, $compilationContext, true);\n if (!isset($flags)) {\n $flags = 'PH_COPY';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "93e9980a81ee1de197e550f28dab30e4bad36c7ab415c88c81220a810ab1e0fa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 2 parameters, but the method signature uses 1 parameters", + "markdown": "Method call is provided 2 parameters, but the method signature uses 1 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 99, + "startColumn": 57, + "charOffset": 2379, + "charLength": 6, + "snippet": { + "text": "$class" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 97, + "startColumn": 1, + "charOffset": 2262, + "charLength": 179, + "snippet": { + "text": "\n // class source file (source/ns1/n2/class.html)\n $sfile = new File\\SourceFile($this->config, $class);\n $this->theme->drawFile($sfile);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bc7d7f87feed53f8ef3de3f8df04e301ec68b0bf77756ea65f9f7a0a6f72fa9b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 2 parameters, but the method signature uses 1 parameters", + "markdown": "Method call is provided 2 parameters, but the method signature uses 1 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 453, + "startColumn": 45, + "charOffset": 20743, + "charLength": 19, + "snippet": { + "text": "$compilationContext" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 451, + "startColumn": 1, + "charOffset": 20535, + "charLength": 271, + "snippet": { + "text": " $variableRight = $compilationContext->backend->getVariableCode(\n $variableRight,\n $compilationContext\n );\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dac7045a453c0ba2fd8d1ca8ce0ce19dd4f7c3936ca7364cf84fdc09854a59ae" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMethodParametersCountMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Method call is provided 3 parameters, but the method signature uses 2 parameters", + "markdown": "Method call is provided 3 parameters, but the method signature uses 2 parameters" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 515, + "startColumn": 78, + "charOffset": 16942, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 513, + "startColumn": 1, + "charOffset": 16755, + "charLength": 297, + "snippet": { + "text": " [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext);\n\n $symbol = $this->resolveValue($symbolVariable, $compilationContext, true);\n $varCode = $this->getVariableCode($variable);\n $compilationContext->codePrinter->output(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e2ff953b7652a7fe5a7e3f7effae742aa3b0019871fa6c6c2314e2a23fccf06d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingBreakStatementInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing 'break' statement", + "markdown": "Missing 'break' statement" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1319, + "startColumn": 17, + "charOffset": 46965, + "charLength": 4, + "snippet": { + "text": "case" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1317, + "startColumn": 1, + "charOffset": 46921, + "charLength": 168, + "snippet": { + "text": " break;\n\n case 'char':\n $defaultValue = (string)$defaultValue;\n if (strlen($defaultValue) > 4) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d784dd488e6aa9a45848982f3938ee41f78386f8e7332d6b62c6eafd358ac963" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 15, + "charOffset": 1106, + "charLength": 9, + "snippet": { + "text": "$themeDir" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1034, + "charLength": 115, + "snippet": { + "text": " protected $projectConfig;\n protected $themeConfig;\n protected $themeDir;\n protected $themeInfos = [];\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "01e9ccefcac0a4a632908803401bd8be45b8a8e73ff242c906cb96f164aed299" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 15, + "charOffset": 904, + "charLength": 14, + "snippet": { + "text": "$documentation" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 856, + "charLength": 89, + "snippet": { + "text": " * @var Documentation\n */\n protected $documentation;\n /**\n * @var Theme" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "036c6d37ecf8dba9c88e3dc5f761a2b40ca223a97ac66148205284ea5270c1bd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/RawExpression.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 13, + "charOffset": 405, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 347, + "charLength": 79, + "snippet": { + "text": "class RawExpression extends AbstractBuilder\n{\n private $expression;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "03e10424d253aeaae50549f57045ef681fcf6fe13a3c207a292b5da788c72785" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 15, + "charOffset": 475, + "charLength": 14, + "snippet": { + "text": "$annotationLen" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 432, + "charLength": 124, + "snippet": { + "text": "{\n protected $annotation;\n protected $annotationLen;\n protected $annotationNameOpen;\n protected $annotationOpen;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "067c86e77bfe864be933089a6f5b94bbfca7e6818425ffb088c983a4c9c7e695" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 13, + "charOffset": 820, + "charLength": 10, + "snippet": { + "text": "$arguments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 721, + "charLength": 152, + "snippet": { + "text": " */\n public const TYPE_CALL_DYNAMIC_STRING = FunctionCall::CALL_DYNAMIC_STRING;\n private $arguments;\n private $name;\n private $typeCall;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0db75629ba1c6c7cb5e7fd2236f41a91b46b37d7334d6a17dd8ef1e80ed55be2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 15, + "charOffset": 1022, + "charLength": 10, + "snippet": { + "text": "$outputDir" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 954, + "charLength": 137, + "snippet": { + "text": " protected $extendedTheme;\n protected $options;\n protected $outputDir;\n protected $projectConfig;\n protected $themeConfig;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "109ebcd025640481cf98a2326287f4f06531e6c40f863edf5d309601fc026ad0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsPhpVersionOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 31, + "startColumn": 15, + "charOffset": 626, + "charLength": 13, + "snippet": { + "text": "$allowedTypes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 29, + "startColumn": 1, + "charOffset": 556, + "charLength": 141, + "snippet": { + "text": "class IsPhpVersionOptimizer extends OptimizerAbstract\n{\n protected $allowedTypes = [\n 'string' => true,\n 'int' => true," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "10c80259abc3a0760ff062209e58851cc1dae2ccabb5663d32bb0213bcc4deee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 13, + "charOffset": 668, + "charLength": 11, + "snippet": { + "text": "$statements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 620, + "charLength": 69, + "snippet": { + "text": " * @var StatementsBlock\n */\n private $statements;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "121abe82c95b6deeed4bf8934ebdeb7b4e6af2e5ab616bc0807b916528e1fc7a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 28, + "startColumn": 15, + "charOffset": 505, + "charLength": 19, + "snippet": { + "text": "$annotationNameOpen" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 26, + "startColumn": 1, + "charOffset": 434, + "charLength": 150, + "snippet": { + "text": " protected $annotation;\n protected $annotationLen;\n protected $annotationNameOpen;\n protected $annotationOpen;\n protected $commentOpen;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1519e3218cede19eac00556f4b57914245911bf5f5ff98197a3e6a032c9b38da" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Call.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 15, + "charOffset": 1018, + "charLength": 11, + "snippet": { + "text": "$reflection" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 973, + "charLength": 83, + "snippet": { + "text": " * @var mixed|null\n */\n protected $reflection;\n /**\n * @var array" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "15eaddd1f710992def9dfb321caff215e3d552b264b67219eec7690b3945cc5d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 15, + "charOffset": 1107, + "charLength": 7, + "snippet": { + "text": "$config" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 1046, + "charLength": 115, + "snippet": { + "text": " protected $classes;\n /** @var Config */\n protected $config;\n /** @var array */\n protected $options;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "17da5ac400201382822ebb4e14343fd8b3062d504fabb6e554ae7dcf06496243" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 15, + "charOffset": 571, + "charLength": 12, + "snippet": { + "text": "$commentOpen" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 491, + "charLength": 117, + "snippet": { + "text": " protected $annotationNameOpen;\n protected $annotationOpen;\n protected $commentOpen;\n\n // Parsing helpers" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "17dfd732afc8d64ecabae8955bb75645ce6eb55869bdb9130e43dfc677976ed3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 15, + "charOffset": 765, + "charLength": 12, + "snippet": { + "text": "$currentLine" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 690, + "charLength": 151, + "snippet": { + "text": " protected $currentChar;\n protected $currentCharIndex;\n protected $currentLine;\n protected $descriptionOpen;\n protected $descriptionStr;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "18d0dce815811edd8f36e2adcf8db60cd98f0ed9dbc5dffa95725cf1dab513c0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/NamespaceAccessor.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 26, + "startColumn": 15, + "charOffset": 447, + "charLength": 8, + "snippet": { + "text": "$classes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 24, + "startColumn": 1, + "charOffset": 398, + "charLength": 89, + "snippet": { + "text": " * @var CompilerFile[]\n */\n protected $classes;\n protected $namespaceTree;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1b1d9829eac89ed0e7d4be0224b19e8e6d3a1aa0d191a538b9ad14a95cac6bf6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 15, + "charOffset": 1005, + "charLength": 8, + "snippet": { + "text": "$baseUrl" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 964, + "charLength": 105, + "snippet": { + "text": " use LoggerAwareTrait;\n\n protected $baseUrl;\n /** @var CompilerFile[] */\n protected $classes;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "24a82ba924bcc993fd614e9cdc16d04f7c34497d58a7db40e8fe20cb2f1b8a1d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 23, + "startColumn": 13, + "charOffset": 461, + "charLength": 10, + "snippet": { + "text": "$arguments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 21, + "startColumn": 1, + "charOffset": 395, + "charLength": 133, + "snippet": { + "text": "class CallStaticStatement extends AbstractStatement\n{\n private $arguments;\n private $class;\n private $dynamicClass = false;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "26e4e8b7d248c4ad932f079d966be91cf4ff2fbb839cb3e5dc3b3be83b1a3f03" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 15, + "charOffset": 1152, + "charLength": 8, + "snippet": { + "text": "$options" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1093, + "charLength": 122, + "snippet": { + "text": " protected $config;\n /** @var array */\n protected $options;\n protected $outputDirectory;\n /** @var Theme */" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2873aed1b653ce03932fb4a162d342e4fa10cce488e64d2d2fc922a08ce8d7da" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 13, + "charOffset": 577, + "charLength": 7, + "snippet": { + "text": "$method" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 493, + "charLength": 101, + "snippet": { + "text": " private $dynamicClass = false;\n private $dynamicMethod = false;\n private $method;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "28c4ac9f516bf1c3de4e38311990ae9914bb2e510a7e273a72ed51d8aae466f3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/File/Sitemap.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 24, + "startColumn": 15, + "charOffset": 441, + "charLength": 8, + "snippet": { + "text": "$baseUrl" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 22, + "startColumn": 1, + "charOffset": 386, + "charLength": 115, + "snippet": { + "text": "class Sitemap implements FileInterface\n{\n protected $baseUrl;\n protected $classes;\n protected $namespaces;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2a4fca2ac8ddf31a51a4999a36f1c21653e6e0cdeeb69e2172d8a8b587000be3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 15, + "charOffset": 998, + "charLength": 8, + "snippet": { + "text": "$options" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 946, + "charLength": 117, + "snippet": { + "text": " */\n protected $extendedTheme;\n protected $options;\n protected $outputDir;\n protected $projectConfig;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2cc7ecd765c95fc75c4690714aa8248ea4fd8012e546f825c596370d16bf0190" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Closure.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 22, + "charOffset": 969, + "charLength": 3, + "snippet": { + "text": "$id" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 914, + "charLength": 88, + "snippet": { + "text": " * Unique closure ID.\n */\n protected static $id = 0;\n /**\n * @var bool" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "30d8173cb443078024c66f3b5076188a731b422511e650d0f2783cdc9bfbc69f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 22, + "charOffset": 1489, + "charLength": 11, + "snippet": { + "text": "$optimizers" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1370, + "charLength": 155, + "snippet": { + "text": " protected static $functionReflection = [];\n protected static $optimizerDirectories = [];\n protected static $optimizers = [];\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3180eee5d8bf1c893cc8e1f7df660f7abd28bac0ebcd84321698c09e223ef119" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 33, + "startColumn": 15, + "charOffset": 623, + "charLength": 28, + "snippet": { + "text": "$currentAnnotationContentStr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 31, + "startColumn": 1, + "charOffset": 585, + "charLength": 132, + "snippet": { + "text": "\n // Parsing helpers\n protected $currentAnnotationContentStr;\n protected $currentAnnotationStr;\n protected $currentChar;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "323be222a34905c646d39557f842301dbe07c9973682712c160b1670acc02f36" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 15, + "charOffset": 1396, + "charLength": 14, + "snippet": { + "text": "$lastStatement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1351, + "charLength": 90, + "snippet": { + "text": " * @var array|null\n */\n protected $lastStatement;\n protected $loop = false;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "343c2c3add19e52823831936a1ce32f3b9ac392461b3a82060d2d6dc36134c5a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 15, + "charOffset": 704, + "charLength": 12, + "snippet": { + "text": "$currentChar" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 609, + "charLength": 169, + "snippet": { + "text": " protected $currentAnnotationContentStr;\n protected $currentAnnotationStr;\n protected $currentChar;\n protected $currentCharIndex;\n protected $currentLine;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "365669eaa4d9dff9c1cba5f47c632c82afa8c95820a655aaaab94161bc8fcd5c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 15, + "charOffset": 1060, + "charLength": 8, + "snippet": { + "text": "$classes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 991, + "charLength": 124, + "snippet": { + "text": " protected $baseUrl;\n /** @var CompilerFile[] */\n protected $classes;\n /** @var Config */\n protected $config;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "39418d498ca2ef1d29b4ee9cf6793467f99ff40a3a04366836d95eb58f637ae6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 15, + "charOffset": 540, + "charLength": 15, + "snippet": { + "text": "$annotationOpen" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 461, + "charLength": 124, + "snippet": { + "text": " protected $annotationLen;\n protected $annotationNameOpen;\n protected $annotationOpen;\n protected $commentOpen;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "40564e6f1827fff06e3b1a6733a1136b73334b8995f72c76dd30647bb896f5c3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 15, + "charOffset": 1078, + "charLength": 12, + "snippet": { + "text": "$themeConfig" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1008, + "charLength": 140, + "snippet": { + "text": " protected $outputDir;\n protected $projectConfig;\n protected $themeConfig;\n protected $themeDir;\n protected $themeInfos = [];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4a7974ec394f87f0f906d1607a2295f3d6453c7fd274d9d53a7888d3ad61d13b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 50, + "startColumn": 15, + "charOffset": 1327, + "charLength": 6, + "snippet": { + "text": "$debug" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 48, + "startColumn": 1, + "charOffset": 1289, + "charLength": 84, + "snippet": { + "text": "class StatementsBlock\n{\n protected $debug = false;\n /**\n * @var array|null" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4bb417e95dd275e087e253401f65b18903be4194966b6e3e8787ee15948e7220" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 26, + "startColumn": 15, + "charOffset": 448, + "charLength": 11, + "snippet": { + "text": "$annotation" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 24, + "startColumn": 1, + "charOffset": 411, + "charLength": 114, + "snippet": { + "text": "class DocblockParser\n{\n protected $annotation;\n protected $annotationLen;\n protected $annotationNameOpen;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4c893954771fbabc3e636cdc5f5cfe4a7eedaf1e72393f5fed4426152bb4cc45" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 26, + "startColumn": 13, + "charOffset": 541, + "charLength": 14, + "snippet": { + "text": "$dynamicMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 24, + "startColumn": 1, + "charOffset": 473, + "charLength": 113, + "snippet": { + "text": " private $class;\n private $dynamicClass = false;\n private $dynamicMethod = false;\n private $method;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4fcfb4aaa2b07bb16a3366fb121104a6f4a3c70b109484ccdf73a065e4a68945" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Annotation/See.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 26, + "startColumn": 15, + "charOffset": 490, + "charLength": 9, + "snippet": { + "text": "$resource" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 24, + "startColumn": 1, + "charOffset": 445, + "charLength": 77, + "snippet": { + "text": "class See extends Annotation\n{\n protected $resource;\n protected $text;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5c031693f9521f3d6fa86a333be7779759a1e39d2891858319e48eab5f28f82b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 120, + "startColumn": 13, + "charOffset": 2720, + "charLength": 16, + "snippet": { + "text": "$rightExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 118, + "startColumn": 1, + "charOffset": 2656, + "charLength": 90, + "snippet": { + "text": " private $leftExpression;\n private $operator;\n private $rightExpression;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5cedc55e32c30238636627d7149088e989db4dca41dce94b42d2527b115852b9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/UnaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 64, + "startColumn": 13, + "charOffset": 1380, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 62, + "startColumn": 1, + "charOffset": 1299, + "charLength": 117, + "snippet": { + "text": " // y = typeof a\n public const OPERATOR_UNLIKELY = 'unlikely';\n private $expression;\n private $operator;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5e016096ca3417660430ca575294f38c48f03fac7339c50d030f1e77d7020c1c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 15, + "charOffset": 736, + "charLength": 13, + "snippet": { + "text": "$themeOptions" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 684, + "charLength": 75, + "snippet": { + "text": " */\n protected $projectConfig;\n protected $themeOptions;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "605fb11e95a14c62838b1747b99ec56cd687434c5000596e0115f1084f0a752d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 15, + "charOffset": 913, + "charLength": 12, + "snippet": { + "text": "$docblockObj" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 870, + "charLength": 112, + "snippet": { + "text": " * @var Docblock\n */\n protected $docblockObj;\n protected $ignoreSpaces;\n protected $ignoreStar;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "61f7fdfcebfa2e787a2620c85a49b93072ee6e398c73ae741a6f9cbfa3b534eb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 24, + "startColumn": 13, + "charOffset": 485, + "charLength": 6, + "snippet": { + "text": "$class" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 22, + "startColumn": 1, + "charOffset": 447, + "charLength": 117, + "snippet": { + "text": "{\n private $arguments;\n private $class;\n private $dynamicClass = false;\n private $dynamicMethod = false;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "628304c0975d914ea550044e9c5d92aa475b806ef92afc1393d420a4d5ba238f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/File/Sitemap.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 15, + "charOffset": 465, + "charLength": 8, + "snippet": { + "text": "$classes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 425, + "charLength": 98, + "snippet": { + "text": "{\n protected $baseUrl;\n protected $classes;\n protected $namespaces;\n private $baseDir;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "656f83b6f21ab9693f7953f39396220bbdc079044fe4a66073ae977b19b2dae0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 119, + "startColumn": 13, + "charOffset": 2697, + "charLength": 9, + "snippet": { + "text": "$operator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 117, + "startColumn": 1, + "charOffset": 2605, + "charLength": 133, + "snippet": { + "text": " public const OPERATOR_TYPE_HINT = 'type-hint';\n private $leftExpression;\n private $operator;\n private $rightExpression;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "67f382d312bd9c1a45c835f178f8c7dc2b6f9591e48434eee44ab8f7430ab0d5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 23, + "startColumn": 13, + "charOffset": 428, + "charLength": 5, + "snippet": { + "text": "$file" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 21, + "startColumn": 1, + "charOffset": 395, + "charLength": 59, + "snippet": { + "text": "{\n private $char;\n private $file;\n private $line;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "69613d2409c40dda4faba51599fc10a2b73d1460a3db3d2eb3de792a46d4433a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/UnaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 65, + "startColumn": 13, + "charOffset": 1405, + "charLength": 9, + "snippet": { + "text": "$operator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 63, + "startColumn": 1, + "charOffset": 1319, + "charLength": 105, + "snippet": { + "text": " public const OPERATOR_UNLIKELY = 'unlikely';\n private $expression;\n private $operator;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6b196a9b7224805da5613f3a017e14a60ee8615567a3fdc85c43e00a346a72c0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 24, + "startColumn": 13, + "charOffset": 447, + "charLength": 5, + "snippet": { + "text": "$line" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 22, + "startColumn": 1, + "charOffset": 397, + "charLength": 65, + "snippet": { + "text": " private $char;\n private $file;\n private $line;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6f941e44a19b92de98b4509e5a941f5f4c46098ea049cd10fe57765ffe261b12" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 13, + "charOffset": 425, + "charLength": 12, + "snippet": { + "text": "$assignments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 366, + "charLength": 81, + "snippet": { + "text": "class LetStatement extends AbstractStatement\n{\n private $assignments;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "72dd547bbb1bd1f2290a2c11aa2244ca131cc82d13b258bd92b4c101e5a320dc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 118, + "startColumn": 13, + "charOffset": 2668, + "charLength": 15, + "snippet": { + "text": "$leftExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 116, + "startColumn": 1, + "charOffset": 2587, + "charLength": 150, + "snippet": { + "text": " // x [{expr}]\n public const OPERATOR_TYPE_HINT = 'type-hint';\n private $leftExpression;\n private $operator;\n private $rightExpression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "79f1f158eb19175cf569ed13ba196744cbef9121740a5521b63337a34b8685ad" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/RawStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 13, + "charOffset": 396, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 358, + "charLength": 59, + "snippet": { + "text": " * @var array\n */\n private $expression;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7f5a7fbffd272befed999f441a6f0c80733c628e073cfcdfc4daa8e120e70530" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 56, + "startColumn": 15, + "charOffset": 1176, + "charLength": 16, + "snippet": { + "text": "$outputDirectory" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 54, + "startColumn": 1, + "charOffset": 1116, + "charLength": 121, + "snippet": { + "text": " /** @var array */\n protected $options;\n protected $outputDirectory;\n /** @var Theme */\n protected $theme;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8c7a10fd1bd27da65affa1d2099c0d53d0e8ef50aa8c915f03df86c516951a1f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/NamespaceAccessor.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 15, + "charOffset": 471, + "charLength": 14, + "snippet": { + "text": "$namespaceTree" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 425, + "charLength": 70, + "snippet": { + "text": " */\n protected $classes;\n protected $namespaceTree;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8e3106e7f74d1e384e95d99f5484d3ce40f962ee99381baf37e6f6e9ef26698a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 13, + "charOffset": 505, + "charLength": 13, + "snippet": { + "text": "$dynamicClass" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 449, + "charLength": 136, + "snippet": { + "text": " private $arguments;\n private $class;\n private $dynamicClass = false;\n private $dynamicMethod = false;\n private $method;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "90030a9a72aaad6cc4631306a29ed014e3338c5a4a54ffd5b8ae132024a2ce59" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 15, + "charOffset": 706, + "charLength": 14, + "snippet": { + "text": "$projectConfig" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 665, + "charLength": 86, + "snippet": { + "text": " * @var Config\n */\n protected $projectConfig;\n protected $themeOptions;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9259e400a52eeb7637cb6cbcf3a761ce17bc0e27634d61780ce0f8c4ca44653a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 57, + "startColumn": 15, + "charOffset": 1456, + "charLength": 15, + "snippet": { + "text": "$mutateGatherer" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 55, + "startColumn": 1, + "charOffset": 1412, + "charLength": 102, + "snippet": { + "text": " protected $loop = false;\n\n protected $mutateGatherer;\n protected ?bool $unreachable = null;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "928994a1e5197c47ec15523478cef06bb8833d01a2b6b2d1f8a7936d19ef41d1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/BuilderFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 24, + "startColumn": 15, + "charOffset": 529, + "charLength": 17, + "snippet": { + "text": "$operatorsFactory" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 22, + "startColumn": 1, + "charOffset": 450, + "charLength": 165, + "snippet": { + "text": " protected static $instance;\n /** @var OperatorsFactory */\n protected $operatorsFactory;\n /** @var StatementsFactory */\n protected $statementsFactory;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "92cd9cfcaaa39d59e8351f7040bee9cf7c3d889ce22cabdd8033f04ed39b04f7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 15, + "charOffset": 667, + "charLength": 21, + "snippet": { + "text": "$currentAnnotationStr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 586, + "charLength": 164, + "snippet": { + "text": " // Parsing helpers\n protected $currentAnnotationContentStr;\n protected $currentAnnotationStr;\n protected $currentChar;\n protected $currentCharIndex;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9e191846f10237cd55897559247a9f93f641c8ae515b0bd2b66d19b8bd4c6d5a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 26, + "startColumn": 13, + "charOffset": 527, + "charLength": 10, + "snippet": { + "text": "$condition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 24, + "startColumn": 1, + "charOffset": 478, + "charLength": 96, + "snippet": { + "text": " * @var AbstractOperator\n */\n private $condition;\n /**\n * @var StatementsBlock" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a0bf55b55cd9f73b1d6038e123ebf0b3d326348d0858702ccd1518aba6cdb930" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 59, + "startColumn": 22, + "charOffset": 1391, + "charLength": 19, + "snippet": { + "text": "$functionReflection" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 57, + "startColumn": 1, + "charOffset": 1328, + "charLength": 188, + "snippet": { + "text": " */\n public const CALL_NORMAL = 1;\n protected static $functionReflection = [];\n protected static $optimizerDirectories = [];\n protected static $optimizers = [];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a3cc682a5f3a0f122628655176e67cb3a652b4dccbff41d5ee95d89eca9b2baf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 15, + "charOffset": 732, + "charLength": 17, + "snippet": { + "text": "$currentCharIndex" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 653, + "charLength": 157, + "snippet": { + "text": " protected $currentAnnotationStr;\n protected $currentChar;\n protected $currentCharIndex;\n protected $currentLine;\n protected $descriptionOpen;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a513c1b20fd6c673e32e0efa2bc0c84af424c7f98adb46b2fa837d0297ad7c16" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Builder/Operators/UnaryOperatorBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 15, + "charOffset": 545, + "charLength": 15, + "snippet": { + "text": "$leftExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 505, + "charLength": 85, + "snippet": { + "text": " * @var mixed\n */\n protected $leftExpression;\n /**\n * Operator name" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a640882970aae883975722cb0602ea78ab5f9b2055b273755c74796cf1a80f50" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 15, + "charOffset": 825, + "charLength": 15, + "snippet": { + "text": "$descriptionStr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 751, + "charLength": 110, + "snippet": { + "text": " protected $currentLine;\n protected $descriptionOpen;\n protected $descriptionStr;\n\n // parsed data" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a94f3bcf7da8ceebd8edb48504a880f81d62f4a8a1708768ef2f1088d33e613a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/NamespaceAccessor.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 22, + "startColumn": 15, + "charOffset": 376, + "charLength": 12, + "snippet": { + "text": "$byNamespace" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 20, + "startColumn": 1, + "charOffset": 336, + "charLength": 88, + "snippet": { + "text": "class NamespaceAccessor\n{\n protected $byNamespace;\n /**\n * @var CompilerFile[]" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b0c952872a59bcd8922027c5b1ba4bc8e834f43ce7d968aab5400c1dd4f03547" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 15, + "charOffset": 997, + "charLength": 12, + "snippet": { + "text": "$summaryOpen" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 927, + "charLength": 111, + "snippet": { + "text": " protected $ignoreSpaces;\n protected $ignoreStar;\n protected $summaryOpen;\n protected $summaryStr;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b27585686bd5499eb12fb57f7e5573bc1722fa4f0fc0f1df60e34487e3654e94" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallMethodStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 13, + "charOffset": 432, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 362, + "charLength": 89, + "snippet": { + "text": "class CallMethodStatement extends CallFunctionStatement\n{\n private $variable;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b296a2aa8a36c928e595aad9a51b14dd8c450bbf3a49c64034ed4391b37290e8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/File/Sitemap.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 13, + "charOffset": 514, + "charLength": 8, + "snippet": { + "text": "$baseDir" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 451, + "charLength": 153, + "snippet": { + "text": " protected $classes;\n protected $namespaces;\n private $baseDir;\n\n public function __construct($baseDir, $baseUrl, $classList, $namespaceList)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b458e195fde0c6600243eddc6c3a823e0006c3186261a1950b4c9fad202c8788" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/BuilderFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 26, + "startColumn": 15, + "charOffset": 596, + "charLength": 18, + "snippet": { + "text": "$statementsFactory" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 24, + "startColumn": 1, + "charOffset": 515, + "charLength": 109, + "snippet": { + "text": " protected $operatorsFactory;\n /** @var StatementsFactory */\n protected $statementsFactory;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b546ae9b8461a57fb5c0760ea65b4be1b85e0fbfa6b18253ebae18f830b0c854" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Annotation/Link.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 15, + "charOffset": 572, + "charLength": 4, + "snippet": { + "text": "$uri" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 505, + "charLength": 107, + "snippet": { + "text": " protected $linkText;\n /** @var string|null */\n protected $uri;\n\n public function getLinkText()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b72b8de0494474f0fe820f7aee650369054d52c8852a1ed98040743e8f52eb83" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Annotation/See.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 15, + "charOffset": 515, + "charLength": 5, + "snippet": { + "text": "$text" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 474, + "charLength": 90, + "snippet": { + "text": "{\n protected $resource;\n protected $text;\n\n public function getResource(): string" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b9b4508eb4b135199f22a7f25447093216292cdc79a5c1b33ff2c14055e04c2a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 56, + "startColumn": 15, + "charOffset": 1131, + "charLength": 11, + "snippet": { + "text": "$themeInfos" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 54, + "startColumn": 1, + "charOffset": 1064, + "charLength": 193, + "snippet": { + "text": " protected $themeConfig;\n protected $themeDir;\n protected $themeInfos = [];\n\n public function __construct($themeDir, $outputDir, $themeConfig, $config, Documentation $documentation)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ba66b03e7823047ff1a4542cd62cfb02d7589d31c0e26f37f0dea00efd3270a4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 13, + "charOffset": 863, + "charLength": 9, + "snippet": { + "text": "$typeCall" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 808, + "charLength": 74, + "snippet": { + "text": " private $arguments;\n private $name;\n private $typeCall;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bdf4cc3462479b286e7532487bde004d235cf1aa6d76da0b800b0f00f22318a8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 13, + "charOffset": 844, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 729, + "charLength": 145, + "snippet": { + "text": " public const TYPE_CALL_DYNAMIC_STRING = FunctionCall::CALL_DYNAMIC_STRING;\n private $arguments;\n private $name;\n private $typeCall;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c2f92a885119a5949eea0713b10c74f9e723b697c083952ca92ccdd0f9b49d45" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 22, + "startColumn": 13, + "charOffset": 409, + "charLength": 5, + "snippet": { + "text": "$char" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 20, + "startColumn": 1, + "charOffset": 364, + "charLength": 89, + "snippet": { + "text": "abstract class AbstractBuilder\n{\n private $char;\n private $file;\n private $line;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c62b1416d9c63489375d3cd77a40d318473702af75573d8de6689a7812eeb2d5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Annotation/Link.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 15, + "charOffset": 519, + "charLength": 9, + "snippet": { + "text": "$linkText" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 475, + "charLength": 102, + "snippet": { + "text": "{\n /** @var string|null */\n protected $linkText;\n /** @var string|null */\n protected $uri;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c799dc64db24b362fe2e6289c9d50fa0024604784c540a6350a52bd155cdb536" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 15, + "charOffset": 1426, + "charLength": 5, + "snippet": { + "text": "$loop" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1374, + "charLength": 98, + "snippet": { + "text": " */\n protected $lastStatement;\n protected $loop = false;\n\n protected $mutateGatherer;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ca0aef65b573f04dc0897734d66bad25611f561eca59264988aee04bef7442e0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 15, + "charOffset": 793, + "charLength": 16, + "snippet": { + "text": "$descriptionOpen" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 718, + "charLength": 124, + "snippet": { + "text": " protected $currentCharIndex;\n protected $currentLine;\n protected $descriptionOpen;\n protected $descriptionStr;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d0bbf2c37cf9982c2fbd022e4a6000bbc3610d706cbd2d0c7cd6cd68a7e3541f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 62, + "startColumn": 13, + "charOffset": 1313, + "charLength": 14, + "snippet": { + "text": "$templatesPath" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 60, + "startColumn": 1, + "charOffset": 1272, + "charLength": 65, + "snippet": { + "text": "\n /** @var string|null */\n private $templatesPath;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d1b1ce7c1ed4188858f26e042c769035e4e6731ef4526b3ec7a5c12fae4ee96f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 23, + "startColumn": 13, + "charOffset": 475, + "charLength": 11, + "snippet": { + "text": "$statements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 21, + "startColumn": 1, + "charOffset": 415, + "charLength": 81, + "snippet": { + "text": "class StatementsBlock extends AbstractBuilder\n{\n private $statements;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d3acc483aa50da34ef29bf149c6c1465078e89309d4a1132c4bb9a9e883e6442" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Branch.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 13, + "charOffset": 1092, + "charLength": 9, + "snippet": { + "text": "$uniqueId" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 1054, + "charLength": 57, + "snippet": { + "text": " * @var mixed\n */\n private $uniqueId;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d4068559c9ab3a501c849ff1a50c4ef6d301b55596e8498412a7a0e2dcc516e6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 15, + "charOffset": 1230, + "charLength": 6, + "snippet": { + "text": "$theme" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1162, + "charLength": 110, + "snippet": { + "text": " protected $outputDirectory;\n /** @var Theme */\n protected $theme;\n protected $themesDirectories;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d5ae7f178277814bd0b9e331e895fd520535a60445a8e4295cb47e2000af9f07" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 22, + "charOffset": 1440, + "charLength": 21, + "snippet": { + "text": "$optimizerDirectories" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1336, + "charLength": 181, + "snippet": { + "text": " public const CALL_NORMAL = 1;\n protected static $functionReflection = [];\n protected static $optimizerDirectories = [];\n protected static $optimizers = [];\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d82d4154517e5f304e1c5cdeaca8e01a1d5f428235dee0cc507cb992b18a15ed" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 15, + "charOffset": 1048, + "charLength": 14, + "snippet": { + "text": "$projectConfig" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 984, + "charLength": 132, + "snippet": { + "text": " protected $options;\n protected $outputDir;\n protected $projectConfig;\n protected $themeConfig;\n protected $themeDir;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "db33400cd9805b489290de2ed55975cc1764d1f76c4bf8ea11964a350d25483e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 113, + "startColumn": 13, + "charOffset": 2567, + "charLength": 13, + "snippet": { + "text": "$originalNode" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 111, + "startColumn": 1, + "charOffset": 2529, + "charLength": 61, + "snippet": { + "text": " * @var mixed\n */\n private $originalNode;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dd49ff01bc0dbe39738c61146f4a0560a4db9a1434b7cbea81d4f230ab16008b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 15, + "charOffset": 970, + "charLength": 11, + "snippet": { + "text": "$ignoreStar" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 899, + "charLength": 138, + "snippet": { + "text": " protected $docblockObj;\n protected $ignoreSpaces;\n protected $ignoreStar;\n protected $summaryOpen;\n protected $summaryStr;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ddfd7fca5848361b49cdd2017e2de45e3957ba2b6de8470617831613c56cc91e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/BuilderFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 22, + "startColumn": 22, + "charOffset": 471, + "charLength": 9, + "snippet": { + "text": "$instance" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 20, + "startColumn": 1, + "charOffset": 427, + "charLength": 120, + "snippet": { + "text": "{\n /** @var self */\n protected static $instance;\n /** @var OperatorsFactory */\n protected $operatorsFactory;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e165f2ca7b20dd848f306a3b1f87e6906aab10ba3c480ce0f62d2fd1c5c1f843" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/RawOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 13, + "charOffset": 393, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 355, + "charLength": 59, + "snippet": { + "text": " * @var array\n */\n private $expression;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e2fa628b3dae52857c50d49e64cac99a1a515359a4217db87eb4e735ba128285" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 50, + "startColumn": 15, + "charOffset": 968, + "charLength": 14, + "snippet": { + "text": "$extendedTheme" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 48, + "startColumn": 1, + "charOffset": 928, + "charLength": 105, + "snippet": { + "text": " * @var Theme\n */\n protected $extendedTheme;\n protected $options;\n protected $outputDir;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e6d707df636c74f08d28f6c6f2662a9e061d0b31b87e0feaea46fde921381996" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 15, + "charOffset": 1025, + "charLength": 11, + "snippet": { + "text": "$summaryStr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 956, + "charLength": 90, + "snippet": { + "text": " protected $ignoreStar;\n protected $summaryOpen;\n protected $summaryStr;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e77dde5e5cf1be3274eb2db8468e644c478c0bd4fb7029a3eecde7c2b277ae5e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 13, + "charOffset": 595, + "charLength": 15, + "snippet": { + "text": "$elseStatements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 547, + "charLength": 100, + "snippet": { + "text": " * @var StatementsBlock\n */\n private $elseStatements;\n /**\n * @var StatementsBlock" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ea0e98b59b8aa13674c4b85135927875556a5df67d8a1bcc4fbfb32823f8eaf6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 59, + "startColumn": 15, + "charOffset": 1252, + "charLength": 18, + "snippet": { + "text": "$themesDirectories" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 57, + "startColumn": 1, + "charOffset": 1194, + "charLength": 106, + "snippet": { + "text": " /** @var Theme */\n protected $theme;\n protected $themesDirectories;\n\n /** @var string|null */" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ea73c80cd7d3cd02c33e108aaae4029d7c8663cc8ee7a2dda9eb65c1d9b2e5f3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/File/Sitemap.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 26, + "startColumn": 15, + "charOffset": 489, + "charLength": 11, + "snippet": { + "text": "$namespaces" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 24, + "startColumn": 1, + "charOffset": 427, + "charLength": 97, + "snippet": { + "text": " protected $baseUrl;\n protected $classes;\n protected $namespaces;\n private $baseDir;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f38a56d0ff8e9d9e5c0d71efbcce32f755b228027486e27589f3cd93fd7774b9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingFieldTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing property's type declaration", + "markdown": "Missing property's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 15, + "charOffset": 941, + "charLength": 13, + "snippet": { + "text": "$ignoreSpaces" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 891, + "charLength": 119, + "snippet": { + "text": " */\n protected $docblockObj;\n protected $ignoreSpaces;\n protected $ignoreStar;\n protected $summaryOpen;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f4726b0748eac37e56058574367a7f5b344b913631fc017cf455c0984fb4c39f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 295, + "startColumn": 33, + "charOffset": 10432, + "charLength": 9, + "snippet": { + "text": "$readOnly" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 293, + "startColumn": 1, + "charOffset": 10363, + "charLength": 128, + "snippet": { + "text": " * @param bool $readOnly\n */\n public function setReadOnly($readOnly): void\n {\n $this->readOnly = $readOnly;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "010205f938b7300cce4ef8252270c347179210edf32d221de11de6d1a2449a2a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 256, + "startColumn": 50, + "charOffset": 7483, + "charLength": 5, + "snippet": { + "text": "$type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 254, + "startColumn": 1, + "charOffset": 7402, + "charLength": 184, + "snippet": { + "text": " * @return Variable\n */\n public function getTempLocalVariableForWrite($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'stack');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "01601dc4c6f6e8f83e67eb5c8a8327cdc283dc2e38c5f3bb6e8c4db4dd20e465" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 592, + "startColumn": 9, + "charOffset": 23338, + "charLength": 9, + "snippet": { + "text": "$mustInit" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 590, + "startColumn": 1, + "charOffset": 23278, + "charLength": 139, + "snippet": { + "text": " array $expression,\n $symbolVariable,\n $mustInit,\n $isExpecting,\n CompilationContext $compilationContext" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "06880f6f82dbced3bd8d470ba1758ffb78b1559386b3eeb208b4da9c25d74381" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ArrayKeysOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 80, + "startColumn": 50, + "charOffset": 2153, + "charLength": 15, + "snippet": { + "text": "$resolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 78, + "startColumn": 1, + "charOffset": 2074, + "charLength": 133, + "snippet": { + "text": " * @return string\n */\n protected function getOutput(string $symbol, $resolvedParams): string\n {\n return sprintf(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "081a3380d3605b7163347c26a6bead4f7e44513e3b70865b7ab93e9cfd0b0431" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1062, + "startColumn": 9, + "charOffset": 36720, + "charLength": 9, + "snippet": { + "text": "$readOnly" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1060, + "startColumn": 1, + "charOffset": 36667, + "charLength": 113, + "snippet": { + "text": " $classDefinition,\n $property,\n $readOnly,\n CompilationContext $context\n ): void {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "098903c5ae72382d3616f47a6224c5a6847a75fcbf513380fc3efd0e5919c499" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 130, + "startColumn": 38, + "charOffset": 2396, + "charLength": 14, + "snippet": { + "text": "$dynamicMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 128, + "startColumn": 1, + "charOffset": 2316, + "charLength": 148, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setDynamicMethod($dynamicMethod)\n {\n $this->dynamicMethod = $dynamicMethod;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0a9c6dacbc04b61dc14557e81d47bb5cc0b56babfe810c04229959606e8cdf9f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 160, + "startColumn": 41, + "charOffset": 4197, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 158, + "startColumn": 1, + "charOffset": 4122, + "charLength": 130, + "snippet": { + "text": " * @return string|null\n */\n public function findThemePathByName($name)\n {\n // check the theme from the config" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0fc3b0f0ec85f09204bc32f048a49bacf301733366072940fd1bdfde8bc33ea8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 103, + "startColumn": 61, + "charOffset": 3018, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 101, + "startColumn": 1, + "charOffset": 2916, + "charLength": 159, + "snippet": { + "text": " * @return CompiledExpression\n */\n protected function passNativeFCall($compiledExpression, $expression)\n {\n return new CompiledExpression(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "13a427b2c129551ac16ab440fc32ecaaa7f55b0b5574507b8ce33372340d6335" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyDecr.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 9, + "charOffset": 1098, + "charLength": 10, + "snippet": { + "text": "$statement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 1002, + "charLength": 201, + "snippet": { + "text": " ZephirVariable $symbolVariable,\n CompilationContext $compilationContext,\n $statement\n ): void {\n $this->checkVariableInitialized($variable, $symbolVariable, $statement);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "14f0fd11aeab1a14c9cb5d9ff2734ac4550b3888b608ce907d8058a5ca000a98" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/StaticTypeInference.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 72, + "startColumn": 34, + "charOffset": 2039, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 70, + "startColumn": 1, + "charOffset": 1971, + "charLength": 147, + "snippet": { + "text": " * @param string $type\n */\n public function markVariable($variable, $type): void\n {\n if (isset($this->variables[$variable])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "167d6e7552a92b57478687b1092c41b31a83d7eecaafc167fcaa2725806e4633" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 157, + "startColumn": 30, + "charOffset": 5245, + "charLength": 6, + "snippet": { + "text": "$noisy" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 155, + "startColumn": 1, + "charOffset": 5182, + "charLength": 113, + "snippet": { + "text": " * @param bool $noisy\n */\n public function setNoisy($noisy): void\n {\n $this->noisy = $noisy;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "182c2e88895c58ed3449d9aa426e7105c55246d96bd0abd181adedffb240c563" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 118, + "startColumn": 37, + "charOffset": 2171, + "charLength": 13, + "snippet": { + "text": "$dynamicClass" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 116, + "startColumn": 1, + "charOffset": 2092, + "charLength": 144, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setDynamicClass($dynamicClass)\n {\n $this->dynamicClass = $dynamicClass;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "191010113798046afc6129406ce46f189b55e2df8197349a4d40d26c86df1fe1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyDecr.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 9, + "charOffset": 991, + "charLength": 9, + "snippet": { + "text": "$property" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 936, + "charLength": 153, + "snippet": { + "text": " public function assign(\n $variable,\n $property,\n ZephirVariable $symbolVariable,\n CompilationContext $compilationContext," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1a24c219e15033a5e2d1915fa24527a14f342e73e1ce1f2d44a449518aca3e11" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyDecr.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 9, + "charOffset": 972, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 928, + "charLength": 113, + "snippet": { + "text": " */\n public function assign(\n $variable,\n $property,\n ZephirVariable $symbolVariable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1bbcbcdf73cb2a7a9ce883c733c8a0315ecc0e0a3f96bc25149ef017b6ef8cf6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 284, + "startColumn": 41, + "charOffset": 7988, + "charLength": 12, + "snippet": { + "text": "$themeConfig" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 282, + "startColumn": 1, + "charOffset": 7909, + "charLength": 179, + "snippet": { + "text": " * @throws ConfigException\n */\n private function findThemeDirectory($themeConfig, $path = null)\n {\n // check if there are additional theme paths in the config" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1c3215c2de8eb95d951c27faebdfd0bc2a29f95399a1d0add907c0ca559a8546" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 103, + "startColumn": 36, + "charOffset": 2747, + "charLength": 13, + "snippet": { + "text": "$functionName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 101, + "startColumn": 1, + "charOffset": 2684, + "charLength": 158, + "snippet": { + "text": " * @return bool\n */\n public function functionExists($functionName, CompilationContext $context)\n {\n if (function_exists($functionName)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1d3d1974d87df8b8bde051817095d1be37f1ff68e0c4450f921fb02c6557f268" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 528, + "startColumn": 35, + "charOffset": 17940, + "charLength": 9, + "snippet": { + "text": "$funcName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 526, + "startColumn": 1, + "charOffset": 17865, + "charLength": 161, + "snippet": { + "text": " * @throws CompilerException\n */\n protected function isReadOnly($funcName, array $expression)\n {\n if ($this->isBuiltInFunction($funcName)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1e1fa19a339705930bab294a5e738821d5dc44e8a53e1f0d089747b7286c9e01" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 29, + "charOffset": 1131, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 1062, + "charLength": 205, + "snippet": { + "text": " * @throws CompilerException\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n $this->checkLeft($expression, CompilerException::class, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1e318d31fdbe01d87079a7c560d9d618f847839687d22efdea2521f164c5dd7f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 29, + "charOffset": 1018, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 948, + "charLength": 167, + "snippet": { + "text": " * @return CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n $propertyAccess = $expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1ee970923e679d8f4bcfdbb63e34887049bed6a7d8d07d1eb2a396daa72c596b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 328, + "startColumn": 83, + "charOffset": 10032, + "charLength": 26, + "snippet": { + "text": "$initNonReferenced = false" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 326, + "startColumn": 1, + "charOffset": 9918, + "charLength": 215, + "snippet": { + "text": " * @return Variable\n */\n public function getTempNonTrackedVariable($type, CompilationContext $context, $initNonReferenced = false)\n {\n $variable = $this->reuseTempVariable($type, 'non-tracked');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "266080839ec895910186e3ad9742e104e8e06879ec52705ae982f3d26b108808" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 186, + "startColumn": 33, + "charOffset": 4141, + "charLength": 9, + "snippet": { + "text": "$operator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 184, + "startColumn": 1, + "charOffset": 4071, + "charLength": 123, + "snippet": { + "text": " * @return BinaryOperator\n */\n public function setOperator($operator)\n {\n $this->operator = $operator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "272424e5228c43e079224805e3bf36a9c070a78bad62988985a0f1b0c9472b36" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 520, + "startColumn": 40, + "charOffset": 16352, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 518, + "startColumn": 1, + "charOffset": 16272, + "charLength": 176, + "snippet": { + "text": " * @throws CompilerException\n */\n public function getVariableForRead($name, CompilationContext $compilationContext = null, array $statement = null)\n {\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2798e86199d71d87c2658b2c3adfcd276d996aa9c96143cff74c49afb47a9573" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 187, + "startColumn": 41, + "charOffset": 6318, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 185, + "startColumn": 1, + "charOffset": 6244, + "charLength": 120, + "snippet": { + "text": " * @return Annotation\n */\n private function __createAnnotation($name, $string)\n {\n switch ($name) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "280ec4b46237326b885b4620e290b70f8ff8cf939080b149c584ccde9a14632a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 94, + "startColumn": 34, + "charOffset": 1768, + "charLength": 10, + "snippet": { + "text": "$arguments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 92, + "startColumn": 1, + "charOffset": 1692, + "charLength": 132, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setArguments($arguments)\n {\n $this->arguments = $arguments;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2c84d719c7c980b39897889d381572c0b8d7a6f4cb3d7e7d3fefcd22cd02f37e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 482, + "startColumn": 9, + "charOffset": 18784, + "charLength": 15, + "snippet": { + "text": "$symbolVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 480, + "startColumn": 1, + "charOffset": 18728, + "charLength": 113, + "snippet": { + "text": " $methodName,\n array $expression,\n $symbolVariable,\n $mustInit,\n $isExpecting," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2e62cb26dd96fdbc83a8949246b7b71348357ac80c82c5b8a1edf9f139030ee9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/StaticTypeInference.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 72, + "startColumn": 45, + "charOffset": 2050, + "charLength": 5, + "snippet": { + "text": "$type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 70, + "startColumn": 1, + "charOffset": 1971, + "charLength": 147, + "snippet": { + "text": " * @param string $type\n */\n public function markVariable($variable, $type): void\n {\n if (isset($this->variables[$variable])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2f9f21cd9022c32d38e0eff372f99bedf2825a2322e88d5b0e9b3b6833e95b7e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler/FileInterface.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 35, + "charOffset": 1097, + "charLength": 9, + "snippet": { + "text": "$external" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1026, + "charLength": 85, + "snippet": { + "text": " * @param bool $external\n */\n public function setIsExternal($external);\n}\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3210ab16c41543357c90d13a5f260705a9c6fb50061c321f95639e618c6b2bfb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 661, + "startColumn": 33, + "charOffset": 22822, + "charLength": 9, + "snippet": { + "text": "$funcName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 659, + "startColumn": 1, + "charOffset": 22757, + "charLength": 180, + "snippet": { + "text": " * @throws Exception\n */\n protected function optimize($funcName, array $expression, Call $call, CompilationContext $compilationContext)\n {\n $optimizer = false;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "34b95845b8c1ad299c510578ef29d3e8df445604bc5d50f98983779db4ffd64d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallMethodStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 33, + "startColumn": 9, + "charOffset": 717, + "charLength": 30, + "snippet": { + "text": "$type = self::TYPE_CALL_DIRECT" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 31, + "startColumn": 1, + "charOffset": 653, + "charLength": 158, + "snippet": { + "text": " $name = null,\n array $parameters = null,\n $type = self::TYPE_CALL_DIRECT\n ) {\n parent::__construct($name, $parameters, $type);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3aaf1d7e6e42b19c07e4e8531f6123a9007224254ac7a4836082f8129e161b7e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 126, + "startColumn": 34, + "charOffset": 2324, + "charLength": 5, + "snippet": { + "text": "$file" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 124, + "startColumn": 1, + "charOffset": 2262, + "charLength": 126, + "snippet": { + "text": " * @return $this\n */\n public function setParseInfo($file, $line, $char = null)\n {\n $this->setFile($file);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3b46a446fd9068d24e5ba1bb6fe39561d1cee9eb1a29d2d2eeec268668d30443" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 925, + "startColumn": 9, + "charOffset": 32915, + "charLength": 9, + "snippet": { + "text": "$location" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 923, + "startColumn": 1, + "charOffset": 32847, + "charLength": 160, + "snippet": { + "text": " protected function registerTempVariable(\n $type,\n $location,\n Variable $variable,\n CompilationContext $compilationContext = null" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3ca35a77a1bf7605bac863189aa0adcfeff33f00829c2c1f862f19d55cfe6e2b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 103, + "startColumn": 40, + "charOffset": 2997, + "charLength": 19, + "snippet": { + "text": "$compiledExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 101, + "startColumn": 1, + "charOffset": 2916, + "charLength": 159, + "snippet": { + "text": " * @return CompiledExpression\n */\n protected function passNativeFCall($compiledExpression, $expression)\n {\n return new CompiledExpression(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3d403a95a664b4f710ad34106637a7a63b35bf1255f24b8ace8ac658c7a01857" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 256, + "startColumn": 42, + "charOffset": 6978, + "charLength": 10, + "snippet": { + "text": "$outputDir" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 254, + "startColumn": 1, + "charOffset": 6902, + "charLength": 183, + "snippet": { + "text": " * @return string|null\n */\n private function findOutputDirectory($outputDir)\n {\n $outputDir = str_replace('%version%', $this->config->get('version'), $outputDir);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4025222629e79f4c8b510d8464059ffccc69826540fe80c710d9a8a14684042f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/NamespaceAccessor.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 32, + "startColumn": 33, + "charOffset": 572, + "charLength": 6, + "snippet": { + "text": "$files" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 30, + "startColumn": 1, + "charOffset": 496, + "charLength": 122, + "snippet": { + "text": " * @param CompilerFile[] $files\n */\n public function __construct($files)\n {\n $this->classes = $files;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "417fa132d2dad0952ba7bdf8841f5f0d7f44e416a9d7aa57d8323099660f69e5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 261, + "startColumn": 34, + "charOffset": 8087, + "charLength": 7, + "snippet": { + "text": "$offset" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 259, + "startColumn": 1, + "charOffset": 8026, + "charLength": 177, + "snippet": { + "text": " * @return bool\n */\n public function offsetExists($offset): bool\n {\n return isset($this->container[$offset]) || array_key_exists($offset, $this->container);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "43533acd2969d0342376898e2e226ff792c48dd91333e000d4140d03e5f3d767" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 603, + "startColumn": 9, + "charOffset": 20460, + "charLength": 11, + "snippet": { + "text": "$parameters" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 601, + "startColumn": 1, + "charOffset": 20394, + "charLength": 148, + "snippet": { + "text": " protected function markReferences(\n $funcName,\n $parameters,\n CompilationContext $compilationContext,\n &$references," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "45d4130585277d545bc6f66941a637657de94307e68e133afc1936d15a15679c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 480, + "startColumn": 9, + "charOffset": 18736, + "charLength": 11, + "snippet": { + "text": "$methodName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 478, + "startColumn": 1, + "charOffset": 18682, + "charLength": 118, + "snippet": { + "text": " */\n protected function callFromClass(\n $methodName,\n array $expression,\n $symbolVariable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "46de1619e542bc62c485984b065298cd6de32197ca6036456a81e3580946b6af" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 9, + "charOffset": 1043, + "charLength": 9, + "snippet": { + "text": "$property" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 981, + "charLength": 162, + "snippet": { + "text": " public function assignStatic(\n $className,\n $property,\n CompiledExpression $resolvedExpr,\n CompilationContext $compilationContext," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "47ace55285e4fc23ff25a3e27d3a5f88df8a1df0fc5453f4e1ec5824bb7d8669" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 593, + "startColumn": 9, + "charOffset": 23357, + "charLength": 12, + "snippet": { + "text": "$isExpecting" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 591, + "startColumn": 1, + "charOffset": 23305, + "charLength": 126, + "snippet": { + "text": " $symbolVariable,\n $mustInit,\n $isExpecting,\n CompilationContext $compilationContext\n ): void {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4b085eee09f3f9c5069d5899103b58af6e34c39f6886b3030c54f5f4e7bc0e14" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 220, + "startColumn": 59, + "charOffset": 6268, + "charLength": 5, + "snippet": { + "text": "$type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 218, + "startColumn": 1, + "charOffset": 6178, + "charLength": 200, + "snippet": { + "text": " * @return Variable\n */\n public function getTempComplexLiteralVariableForWrite($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'heap-literal');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4b6ca582eae029eb91bfa10c3585595d032c79000a3d0bfff1b02d54d43a022e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 106, + "startColumn": 30, + "charOffset": 1969, + "charLength": 6, + "snippet": { + "text": "$class" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 104, + "startColumn": 1, + "charOffset": 1897, + "charLength": 116, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setClass($class)\n {\n $this->class = $class;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4d1124daf314aa3307a76168c577e222de366873045c5f54cbf07c233d518723" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2150, + "startColumn": 42, + "charOffset": 71396, + "charLength": 5, + "snippet": { + "text": "$path" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 2148, + "startColumn": 1, + "charOffset": 71340, + "charLength": 157, + "snippet": { + "text": " *\n */\n private function recursiveDeletePath($path, $mask): void\n {\n if (!file_exists($path) || !is_dir($path) || !is_readable($path)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4dcdabf4b822a3120dbc1ca6b3636ba324a931a07707ce79cccb4eee4b51b43a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/ArrayType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 93, + "startColumn": 26, + "charOffset": 2980, + "charLength": 7, + "snippet": { + "text": "$caller" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 91, + "startColumn": 1, + "charOffset": 2922, + "charLength": 211, + "snippet": { + "text": " * @throws Exception\n */\n public function join($caller, CompilationContext $compilationContext, Call $call, array $expression)\n {\n $functionCall = BuilderFactory::getInstance()->statements()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "52f7961dab4e86c8b2d7e066bd4b901f742e21ef538cc3445cda695260944c9a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 29, + "charOffset": 1051, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 981, + "charLength": 167, + "snippet": { + "text": " * @return CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n $propertyAccess = $expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "53f2c4f8a25f012fa74fcc266f3c3dcad49f677303e544c8d88a7227061e79b4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 733, + "startColumn": 104, + "charOffset": 24268, + "charLength": 9, + "snippet": { + "text": "$docblock" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 731, + "startColumn": 1, + "charOffset": 24114, + "charLength": 254, + "snippet": { + "text": " * @param array $docblock\n */\n public function preCompileClass(CompilationContext $compilationContext, $namespace, $topStatement, $docblock): void\n {\n $classDefinition = new Definition($namespace, $topStatement['name']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "55873ca8852efbe61545446e50dfaa527269fd88b577184abfdeed32d52d16d1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 35, + "charOffset": 772, + "charLength": 11, + "snippet": { + "text": "$assignment" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 709, + "charLength": 125, + "snippet": { + "text": " * @return $this\n */\n public function addAssignment($assignment)\n {\n $this->assignments[] = $assignment;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "55b1cf02c639b8c1029d06915e7c57bda65c87c89467287651d436a730e955b4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 9, + "charOffset": 984, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 940, + "charLength": 136, + "snippet": { + "text": " */\n public function assign(\n $variable,\n ZephirVariable $symbolVariable,\n CompiledExpression $resolvedExpr," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5622ec99bb8f73ae4ac626ac90e5592b574461832bff2e4f981d6d981f5be49e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/HeadersManager.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 65, + "startColumn": 32, + "charOffset": 1178, + "charLength": 13, + "snippet": { + "text": "$position = 0" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 63, + "startColumn": 1, + "charOffset": 1099, + "charLength": 138, + "snippet": { + "text": " * @throws InvalidArgumentException\n */\n public function add($path, $position = 0): void\n {\n if (!is_string($path)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "577f4e7c9c2129e0ee2e9ec69920211c6f48d219c7b60890c1f9ec3d43403682" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Property.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 249, + "startColumn": 80, + "charOffset": 6716, + "charLength": 5, + "snippet": { + "text": "$type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 247, + "startColumn": 1, + "charOffset": 6596, + "charLength": 203, + "snippet": { + "text": " * @throws CompilerException\n */\n protected function declareProperty(CompilationContext $compilationContext, $type, $value): void\n {\n $codePrinter = $compilationContext->codePrinter;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5a04dfe9aac8ae7bca911827cb8df41a7626e649a0b8c8a01db95da54ea7a50e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 34, + "charOffset": 1241, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 1163, + "charLength": 228, + "snippet": { + "text": " * @return CallFunctionStatement\n */\n public function functionCall($name, $parameters = null, $type = CallFunctionStatement::TYPE_CALL_DIRECT)\n {\n return new CallFunctionStatement($name, $parameters, $type);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5b1aa6173acadad0481003eb02178e6dadc2204a909b8cf0037172cb92b926e3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 241, + "startColumn": 31, + "charOffset": 7631, + "charLength": 17, + "snippet": { + "text": "$namespace = null" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 239, + "startColumn": 1, + "charOffset": 7567, + "charLength": 190, + "snippet": { + "text": " * @return mixed|null\n */\n public function get($key, $namespace = null)\n {\n return null !== $namespace ? $this->offsetGet([$namespace => $key]) : $this->offsetGet($key);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5b8f8128669e547907606b124b0a16ca5cd407da93a64fb9b7c60b05ee8df8ee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 135, + "startColumn": 9, + "charOffset": 4471, + "charLength": 11, + "snippet": { + "text": "$classEntry" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 133, + "startColumn": 1, + "charOffset": 4391, + "charLength": 160, + "snippet": { + "text": " */\n protected function _assignStaticPropertyArrayMultipleIndex(\n $classEntry,\n string $property,\n CompiledExpression $resolvedExpr," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5cfdbc6c16a47e68eb5f86a4f890960187aaab4afda84521fdeab5d54e42f2e7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 284, + "startColumn": 55, + "charOffset": 8002, + "charLength": 12, + "snippet": { + "text": "$path = null" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 282, + "startColumn": 1, + "charOffset": 7909, + "charLength": 179, + "snippet": { + "text": " * @throws ConfigException\n */\n private function findThemeDirectory($themeConfig, $path = null)\n {\n // check if there are additional theme paths in the config" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5d7a3d686993cc70666a9a1a009f6314b304fc46f6b3607e7ae366eceb5422b7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1923, + "startColumn": 67, + "charOffset": 67135, + "charLength": 6, + "snippet": { + "text": "$value" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1921, + "startColumn": 1, + "charOffset": 67041, + "charLength": 198, + "snippet": { + "text": " * @return void\n */\n public function updateProperty(Variable $variable, $property, $value, CompilationContext $context): void\n {\n $value = $this->resolveValue($value, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "601a764f9cd6dd49d07ad735689529aadff5bccd17f3455da2f4559c3489a47f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ExportSymbol.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 9, + "charOffset": 1095, + "charLength": 17, + "snippet": { + "text": "$statement = null" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 983, + "charLength": 200, + "snippet": { + "text": " CompiledExpression $resolvedExpr = null,\n CompilationContext $compilationContext = null,\n $statement = null\n ): void {\n $codePrinter = $compilationContext->codePrinter;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "60389c9f2ab5291020e5f4a8a64507dc298963fb290b020d6f9c60022398bd1c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 328, + "startColumn": 33, + "charOffset": 9726, + "charLength": 7, + "snippet": { + "text": "$offset" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 326, + "startColumn": 1, + "charOffset": 9658, + "charLength": 130, + "snippet": { + "text": " */\n #[ReturnTypeWillChange]\n public function offsetUnset($offset): void\n {\n unset($this->container[$offset]);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "60d8a7503b8a41debb14cf6e9397f0b2ee2ac941d45ae5270c0a83218135a539" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 451, + "startColumn": 88, + "charOffset": 13954, + "charLength": 12, + "snippet": { + "text": "$init = true" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 449, + "startColumn": 1, + "charOffset": 13835, + "charLength": 209, + "snippet": { + "text": " * @return Variable\n */\n public function getTempVariableForWrite(string $type, CompilationContext $context, $init = true): Variable\n {\n $variable = $this->reuseTempVariable($type, 'heap');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "62a1cdaf793ff92f18be7eba59bb97169095ff63be491a201a324c33c929aa62" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 109, + "startColumn": 38, + "charOffset": 2588, + "charLength": 14, + "snippet": { + "text": "$projectConfig" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 107, + "startColumn": 1, + "charOffset": 2508, + "charLength": 154, + "snippet": { + "text": " * @param array $projectConfig\n */\n public function setProjectConfig($projectConfig): void\n {\n $this->projectConfig = $projectConfig;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6351972e5f72e0f37fe829036ed7112674737f2eb0ca0108a0093796a89fe476" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 924, + "startColumn": 9, + "charOffset": 32900, + "charLength": 5, + "snippet": { + "text": "$type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 922, + "startColumn": 1, + "charOffset": 32839, + "charLength": 114, + "snippet": { + "text": " */\n protected function registerTempVariable(\n $type,\n $location,\n Variable $variable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "63ec5eb0263bd40ab2e44fb3038b75efd4e2175df90e33d970e5f8ba6425e9f2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/UnlikelyOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 43, + "startColumn": 29, + "charOffset": 1020, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 41, + "startColumn": 1, + "charOffset": 949, + "charLength": 192, + "snippet": { + "text": " * @throws ReflectionException\n */\n public function compile($expression, CompilationContext $compilationContext): CompiledExpression\n {\n if (!isset($expression['left'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6c608f3473df452e0d9efe5ac036eca02df35cb9c9fd4c14ed6abdde62609454" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 102, + "startColumn": 9, + "charOffset": 2771, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 100, + "startColumn": 1, + "charOffset": 2697, + "charLength": 166, + "snippet": { + "text": " */\n protected function _assignPropertyArrayMultipleIndex(\n $variable,\n ZephirVariable $symbolVariable,\n CompiledExpression $resolvedExpr," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6ea415f2060ec497f246118471b18e2c9be01572ba5acdb52180622a08bdb394" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 29, + "charOffset": 845, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 770, + "charLength": 211, + "snippet": { + "text": " * @return bool|CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n $this->checkLeft($expression, CompilerException::class, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6f1738291272087c4a9f0a284c80c98dd3efe30bb077b6dd32ba177b5bb6aed2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 340, + "startColumn": 31, + "charOffset": 9972, + "charLength": 6, + "snippet": { + "text": "$value" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 338, + "startColumn": 1, + "charOffset": 9903, + "charLength": 218, + "snippet": { + "text": " * @param mixed $namespace\n */\n public function set($key, $value, $namespace = null): void\n {\n null !== $namespace ? $this->offsetSet([$namespace => $key], $value) : $this->offsetSet($key, $value);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "74af00528def1405417e3286a1ece2eab14ab0c02acd828f84be888b3e19e76d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 9, + "charOffset": 1206, + "charLength": 10, + "snippet": { + "text": "$statement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 1108, + "charLength": 133, + "snippet": { + "text": " CompiledExpression $resolvedExpr,\n CompilationContext $compilationContext,\n $statement\n ): void {\n /*" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7904180e15d03eec25b81c281bb23bb1fc11facbe5c7297f17e9066c42889d3d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 591, + "startColumn": 9, + "charOffset": 23313, + "charLength": 15, + "snippet": { + "text": "$symbolVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 589, + "startColumn": 1, + "charOffset": 23250, + "charLength": 120, + "snippet": { + "text": " string $methodName,\n array $expression,\n $symbolVariable,\n $mustInit,\n $isExpecting," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7ced52839d36050cadc089ddf1ab7ff7bf2344ba26501683b562154aae10861c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 119, + "startColumn": 37, + "charOffset": 2836, + "charLength": 13, + "snippet": { + "text": "$themeOptions" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 117, + "startColumn": 1, + "charOffset": 2758, + "charLength": 149, + "snippet": { + "text": " * @param array $themeOptions\n */\n public function setThemeOptions($themeOptions): void\n {\n $this->themeOptions = $themeOptions;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7d3d923030d16f4f662bc478597587b5b2aee799d22e4248cccde67a0eada85f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 761, + "startColumn": 9, + "charOffset": 30377, + "charLength": 9, + "snippet": { + "text": "$mustInit" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 759, + "startColumn": 1, + "charOffset": 30317, + "charLength": 129, + "snippet": { + "text": " array $expression,\n $symbolVariable,\n $mustInit,\n $isExpecting,\n Definition $classDefinition," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8033f32b6ee5c900f04e1d331f7468a52d9e12916aa0cf2686f23649906abbfe" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 340, + "startColumn": 25, + "charOffset": 9966, + "charLength": 4, + "snippet": { + "text": "$key" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 338, + "startColumn": 1, + "charOffset": 9903, + "charLength": 218, + "snippet": { + "text": " * @param mixed $namespace\n */\n public function set($key, $value, $namespace = null): void\n {\n null !== $namespace ? $this->offsetSet([$namespace => $key], $value) : $this->offsetSet($key, $value);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "80cf6474e3e81c385638b18b1e86908ea338b0ae5e610d7e9b6c7f2b69a1c32d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2150, + "startColumn": 49, + "charOffset": 71403, + "charLength": 5, + "snippet": { + "text": "$mask" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 2148, + "startColumn": 1, + "charOffset": 71340, + "charLength": 157, + "snippet": { + "text": " *\n */\n private function recursiveDeletePath($path, $mask): void\n {\n if (!file_exists($path) || !is_dir($path) || !is_readable($path)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "80f6c605fee9789319d44dce2113911b0b0552d2c2dd7674faf57ed7fecfb6a2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 760, + "startColumn": 9, + "charOffset": 30352, + "charLength": 15, + "snippet": { + "text": "$symbolVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 758, + "startColumn": 1, + "charOffset": 30289, + "charLength": 120, + "snippet": { + "text": " string $methodName,\n array $expression,\n $symbolVariable,\n $mustInit,\n $isExpecting," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8234a6d6fdcb8f4463df9e080a073ba1835b896e7e196312cc2f87f6adff1314" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 75, + "startColumn": 65, + "charOffset": 1671, + "charLength": 14, + "snippet": { + "text": "$templatesPath" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 73, + "startColumn": 1, + "charOffset": 1574, + "charLength": 159, + "snippet": { + "text": " * @throws Exception\n */\n public function __construct(array $classes, Config $config, $templatesPath, array $options)\n {\n ksort($classes);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "84af102510cac3c3a4a94ccfabb9e0f437601777375fe3b33526a7bc279ddb75" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 117, + "startColumn": 9, + "charOffset": 3414, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 115, + "startColumn": 1, + "charOffset": 3348, + "charLength": 158, + "snippet": { + "text": " */\n protected function _assignArrayIndexMultiple(\n $variable,\n ZephirVariable $symbolVariable,\n CompiledExpression $resolvedExpr," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "87b8531cf3947b4964b0774a450c9eecf6eaf8666db830dcbd25cd2783821c5a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 418, + "startColumn": 56, + "charOffset": 12848, + "charLength": 5, + "snippet": { + "text": "$type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 416, + "startColumn": 1, + "charOffset": 12761, + "charLength": 200, + "snippet": { + "text": " * @return Variable\n */\n public function getTempVariableForObserveOrNullify($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'observe-nullify');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8a64169fc673197168be28dbd1607996d38f241374aa8bd99c456aca5b5a1226" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 764, + "startColumn": 41, + "charOffset": 27587, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 762, + "startColumn": 1, + "charOffset": 27506, + "charLength": 169, + "snippet": { + "text": " * @throws CompilerException\n */\n public function getVariableForWrite($name, CompilationContext $compilationContext, array $statement = null)\n {\n /*" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8d1b6ad454009798a29c43d04314543f72b1c9a9f3ec9a9f25b75697c2a1c7a5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 295, + "startColumn": 60, + "charOffset": 8879, + "charLength": 5, + "snippet": { + "text": "$type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 293, + "startColumn": 1, + "charOffset": 8788, + "charLength": 214, + "snippet": { + "text": " * @return Variable\n */\n public function getTempNonTrackedUninitializedVariable($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'non-tracked-uninitialized');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "92071d3c3ff158f0917394dcc1cb493fca2bf4265ea6c9e9ee34dd382efa2ff9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/OperatorsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 138, + "startColumn": 27, + "charOffset": 3807, + "charLength": 16, + "snippet": { + "text": "$operator = null" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 136, + "startColumn": 1, + "charOffset": 3744, + "charLength": 180, + "snippet": { + "text": " * @return UnaryOperator\n */\n public function unary($operator = null, AbstractBuilder $expression = null)\n {\n return new UnaryOperator($operator, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "934aebc95e15548a7d474778271696432640125175c3844ebc04dc231f3a6349" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 301, + "startColumn": 40, + "charOffset": 9143, + "charLength": 6, + "snippet": { + "text": "$value" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 299, + "startColumn": 1, + "charOffset": 9068, + "charLength": 128, + "snippet": { + "text": " */\n #[ReturnTypeWillChange]\n public function offsetSet($offset, $value): void\n {\n if (!is_array($offset)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "93a2c26703dc636050d99e8868b43720cea779253d3053544f03caa7a7ea0d54" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 188, + "startColumn": 9, + "charOffset": 5638, + "charLength": 10, + "snippet": { + "text": "$statement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 186, + "startColumn": 1, + "charOffset": 5540, + "charLength": 189, + "snippet": { + "text": " CompiledExpression $resolvedExpr,\n CompilationContext $compilationContext,\n $statement\n ): void {\n $expression = new Expression($statement['index-expr'][0]);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "961f0e8c9bbf2d6b63b43e1d10c832bb5b6ab4c7f28b056e0e666a9096ca92e3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 167, + "startColumn": 9, + "charOffset": 4837, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 165, + "startColumn": 1, + "charOffset": 4765, + "charLength": 164, + "snippet": { + "text": " */\n protected function _assignPropertyArraySingleIndex(\n $variable,\n ZephirVariable $symbolVariable,\n CompiledExpression $resolvedExpr," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "96c90c41a9a0fbf8efe613441c27dcab4584d60330bdd4c6d3c4d20f742a4931" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/CharType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 27, + "charOffset": 1009, + "charLength": 7, + "snippet": { + "text": "$caller" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 950, + "charLength": 199, + "snippet": { + "text": " * @throws Exception\n */\n public function toHex($caller, CompilationContext $compilationContext, Call $call, array $expression)\n {\n $exprBuilder = BuilderFactory::getInstance();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "96edf37a43d7ece73cebf48d5df8569885328ef7316993f81c476835ef777343" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 249, + "startColumn": 45, + "charOffset": 7168, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 247, + "startColumn": 1, + "charOffset": 7095, + "charLength": 121, + "snippet": { + "text": " * @return array\n */\n public function getThemeInfoExtendAware($name)\n {\n if ($this->extendedTheme) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "97b6558525d30bf369a6291f95e8d83db55eb94983105fdd578205b3d9b01f4e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 112, + "startColumn": 29, + "charOffset": 2094, + "charLength": 5, + "snippet": { + "text": "$line" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 110, + "startColumn": 1, + "charOffset": 2027, + "charLength": 108, + "snippet": { + "text": " * @return AbstractBuilder\n */\n public function setLine($line)\n {\n $this->line = $line;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "986355ece56f493ae0b8c3b647b714914a2d398aa5e90e3939e87af785900459" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 733, + "startColumn": 89, + "charOffset": 24253, + "charLength": 13, + "snippet": { + "text": "$topStatement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 731, + "startColumn": 1, + "charOffset": 24114, + "charLength": 254, + "snippet": { + "text": " * @param array $docblock\n */\n public function preCompileClass(CompilationContext $compilationContext, $namespace, $topStatement, $docblock): void\n {\n $classDefinition = new Definition($namespace, $topStatement['name']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "98dd7b784c581d2c0c4596fd576352d5efacd107f697156b1e8f404726690df1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 605, + "startColumn": 9, + "charOffset": 20529, + "charLength": 12, + "snippet": { + "text": "&$references" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 603, + "startColumn": 1, + "charOffset": 20452, + "charLength": 124, + "snippet": { + "text": " $parameters,\n CompilationContext $compilationContext,\n &$references,\n $expression\n ): void {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9ab5a8b6d84f239503cedcfde734b74095e3a1a0305406258684ebe8fadb4e13" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/StaticTypeInference.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 36, + "charOffset": 1442, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 1379, + "charLength": 129, + "snippet": { + "text": " * @return bool\n */\n public function getInferedType($variable)\n {\n if (isset($this->variables[$variable])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9bcba5c530b7b4ddda4d6057ac48981996c4becd9c964edf8d8840260a2014c2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1923, + "startColumn": 56, + "charOffset": 67124, + "charLength": 9, + "snippet": { + "text": "$property" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1921, + "startColumn": 1, + "charOffset": 67041, + "charLength": 198, + "snippet": { + "text": " * @return void\n */\n public function updateProperty(Variable $variable, $property, $value, CompilationContext $context): void\n {\n $value = $this->resolveValue($value, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a54f33eef5bb6a939732cdf6ae4dff162385eeb9eac0ade14cd2fe060b996dcd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 340, + "startColumn": 39, + "charOffset": 9980, + "charLength": 17, + "snippet": { + "text": "$namespace = null" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 338, + "startColumn": 1, + "charOffset": 9903, + "charLength": 218, + "snippet": { + "text": " * @param mixed $namespace\n */\n public function set($key, $value, $namespace = null): void\n {\n null !== $namespace ? $this->offsetSet([$namespace => $key], $value) : $this->offsetSet($key, $value);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a6c77f32c4d22edc330e4112341c064b0d2ebcdfa81e56754829a56d03410dd7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 68, + "startColumn": 44, + "charOffset": 1677, + "charLength": 10, + "snippet": { + "text": "$directory" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 66, + "startColumn": 1, + "charOffset": 1594, + "charLength": 158, + "snippet": { + "text": " * @param string $directory\n */\n public static function addOptimizerDir($directory): void\n {\n self::$optimizerDirectories[] = $directory;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a741d9a732dfbc7031adbb8bdd06473f8b552a38c9cd67198d41db5b7653e83f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 233, + "startColumn": 34, + "charOffset": 6784, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 231, + "startColumn": 1, + "charOffset": 6717, + "charLength": 126, + "snippet": { + "text": " * @return mixed|null\n */\n public function getThemeInfo($name)\n {\n if (isset($this->themeInfos[$name])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a757ea2cd09c25056bf43f06902795ff221ba7220c0aae90187f642a936e25bd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/StaticTypeInference.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 178, + "startColumn": 54, + "charOffset": 5137, + "charLength": 5, + "snippet": { + "text": "$type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 176, + "startColumn": 1, + "charOffset": 5049, + "charLength": 151, + "snippet": { + "text": " * @param string $type\n */\n public function markVariableIfUnknown($variable, $type): void\n {\n $this->variables[$variable] = $type;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a9a0e632ba3d9ae862bf56ea67a8d5baeeffbfd84939cb24aa25102afe8ea5d8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/AbstractType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 64, + "startColumn": 9, + "charOffset": 1434, + "charLength": 7, + "snippet": { + "text": "$caller" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 62, + "startColumn": 1, + "charOffset": 1371, + "charLength": 139, + "snippet": { + "text": " public function invokeMethod(\n $methodName,\n $caller,\n CompilationContext $compilationContext,\n Call $call," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aa119720db24186a5e982009a4d77cde0a874f2883b0f1601cea41d5a27c4c42" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1013, + "startColumn": 9, + "charOffset": 35179, + "charLength": 9, + "snippet": { + "text": "$readOnly" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1011, + "startColumn": 1, + "charOffset": 35116, + "charLength": 123, + "snippet": { + "text": " Variable $variableVariable,\n $property,\n $readOnly,\n CompilationContext $context\n ): void {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aa27c3b17cf8df657501fd2d6f2025f3f21ff9ecbcfb950b48ce636a6c657758" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 274, + "startColumn": 31, + "charOffset": 8401, + "charLength": 7, + "snippet": { + "text": "$offset" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 272, + "startColumn": 1, + "charOffset": 8335, + "charLength": 114, + "snippet": { + "text": " */\n #[ReturnTypeWillChange]\n public function offsetGet($offset)\n {\n if (!is_array($offset)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aa66b79b3619599926fb8c84677a4c3e24d43c9a00cd072ef193c2efeb2b0db2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 128, + "startColumn": 33, + "charOffset": 2401, + "charLength": 9, + "snippet": { + "text": "$typeCall" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 126, + "startColumn": 1, + "charOffset": 2340, + "charLength": 114, + "snippet": { + "text": " * @return $this\n */\n public function setTypeCall($typeCall)\n {\n $this->typeCall = $typeCall;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aa72a1bacd00510068fbdf530ab02b79a71fd0d8d317fd1479f70a0009056471" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/AssignVariableOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 109, + "startColumn": 33, + "charOffset": 2206, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 107, + "startColumn": 1, + "charOffset": 2145, + "charLength": 114, + "snippet": { + "text": " * @return $this\n */\n public function setVariable($variable)\n {\n $this->variable = $variable;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b0977eada3ad90da20f9bccb7aa39f4c9c3461c9b5940ab5d59516fad77d9186" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 116, + "startColumn": 29, + "charOffset": 2225, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 114, + "startColumn": 1, + "charOffset": 2168, + "charLength": 98, + "snippet": { + "text": " * @return $this\n */\n public function setName($name)\n {\n $this->name = $name;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b26f10d22de70445fd892f5b10dad57328bbd47f4ed3db555d209ac75260a940" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/HeadersManager.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 65, + "startColumn": 25, + "charOffset": 1171, + "charLength": 5, + "snippet": { + "text": "$path" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 63, + "startColumn": 1, + "charOffset": 1099, + "charLength": 138, + "snippet": { + "text": " * @throws InvalidArgumentException\n */\n public function add($path, $position = 0): void\n {\n if (!is_string($path)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b501ec6b37905313bda017c4adba54f4e5974fed36d0324ab06483b68339a35d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 93, + "startColumn": 26, + "charOffset": 2334, + "charLength": 6, + "snippet": { + "text": "$value" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 91, + "startColumn": 1, + "charOffset": 2273, + "charLength": 102, + "snippet": { + "text": " * @return RawStatement\n */\n public function rawC($value)\n {\n return $this->raw([" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b5d8f62d029e3f67774e58cba525302b8c3fa2e040da9a0f7b9900912ed27cdc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 301, + "startColumn": 31, + "charOffset": 9134, + "charLength": 7, + "snippet": { + "text": "$offset" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 299, + "startColumn": 1, + "charOffset": 9068, + "charLength": 128, + "snippet": { + "text": " */\n #[ReturnTypeWillChange]\n public function offsetSet($offset, $value): void\n {\n if (!is_array($offset)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ba6fb7353fd80da802d852bb2f9d9b8fc26044a47f534ee746b93be3b90f47eb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2224, + "startColumn": 69, + "charOffset": 73376, + "charLength": 18, + "snippet": { + "text": "$callback = 'copy'" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 2222, + "startColumn": 1, + "charOffset": 73293, + "charLength": 134, + "snippet": { + "text": " *\n */\n private function recursiveProcess($src, $dest, $pattern = null, $callback = 'copy')\n {\n $success = true;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bdd993864287c6af7f0bf7c38ca4f6952808f760bc6ceced8329218055e0e6d6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2224, + "startColumn": 52, + "charOffset": 73359, + "charLength": 15, + "snippet": { + "text": "$pattern = null" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 2222, + "startColumn": 1, + "charOffset": 73293, + "charLength": 134, + "snippet": { + "text": " *\n */\n private function recursiveProcess($src, $dest, $pattern = null, $callback = 'copy')\n {\n $success = true;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c3432fd418e9cfc237f252b752843e1e4e10f1081e07572c6519e16975edd6a7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 136, + "startColumn": 34, + "charOffset": 3705, + "charLength": 9, + "snippet": { + "text": "$funcName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 134, + "startColumn": 1, + "charOffset": 3625, + "charLength": 107, + "snippet": { + "text": " * @return ReflectionFunction|null\n */\n public function getReflector($funcName)\n {\n /*" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c37d2a9491a1c358345de84bd0fe60bd127a26c1688ec68c08ac1c4b226a1f34" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ConcatOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 133, + "startColumn": 9, + "charOffset": 4686, + "charLength": 14, + "snippet": { + "text": "&$isFullString" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 131, + "startColumn": 1, + "charOffset": 4603, + "charLength": 149, + "snippet": { + "text": " array $expression,\n CompilationContext $compilationContext,\n &$isFullString\n ): array {\n $originalExpr = $expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c49815b55f756cfd9b78b6f08352b2cd5e64fa438bea3b245b4451a5ba3710ea" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 29, + "charOffset": 1732, + "charLength": 5, + "snippet": { + "text": "$char" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 1665, + "charLength": 108, + "snippet": { + "text": " * @return AbstractBuilder\n */\n public function setChar($char)\n {\n $this->char = $char;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c58df3e83b03284fc3ff8e85ef175500d92d4b08397e0c3f4317c0abb86618a1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 484, + "startColumn": 9, + "charOffset": 18828, + "charLength": 12, + "snippet": { + "text": "$isExpecting" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 482, + "startColumn": 1, + "charOffset": 18776, + "charLength": 150, + "snippet": { + "text": " $symbolVariable,\n $mustInit,\n $isExpecting,\n Definition $classDefinition,\n CompilationContext $compilationContext," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c6c28f766280335cf8e44be5c1a7879a8b2f7f1ed069ffd8dc3f7a33a242befb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/AbstractType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 9, + "charOffset": 1413, + "charLength": 11, + "snippet": { + "text": "$methodName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1363, + "charLength": 127, + "snippet": { + "text": " */\n public function invokeMethod(\n $methodName,\n $caller,\n CompilationContext $compilationContext," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c6c81de57e0a424a51024b6e071069aeb9e6e730bb131c11a2aaf5172b5122a8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 846, + "startColumn": 41, + "charOffset": 28273, + "charLength": 10, + "snippet": { + "text": "$namespace" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 844, + "startColumn": 1, + "charOffset": 28194, + "charLength": 206, + "snippet": { + "text": " * @param array $docblock\n */\n public function preCompileInterface($namespace, $topStatement, $docblock): void\n {\n $classDefinition = new Definition($namespace, $topStatement['name']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c7b631fb9a789358fc8eaa972238f00a7f44aa2beb838342e700485c7fcd2a06" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 41, + "charOffset": 1248, + "charLength": 18, + "snippet": { + "text": "$parameters = null" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 1163, + "charLength": 228, + "snippet": { + "text": " * @return CallFunctionStatement\n */\n public function functionCall($name, $parameters = null, $type = CallFunctionStatement::TYPE_CALL_DIRECT)\n {\n return new CallFunctionStatement($name, $parameters, $type);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c809a0944d22a4f6b4a06a7bb5e33e316db0737fafbb5818f8efc74918daee7e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 241, + "startColumn": 25, + "charOffset": 7625, + "charLength": 4, + "snippet": { + "text": "$key" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 239, + "startColumn": 1, + "charOffset": 7567, + "charLength": 190, + "snippet": { + "text": " * @return mixed|null\n */\n public function get($key, $namespace = null)\n {\n return null !== $namespace ? $this->offsetGet([$namespace => $key]) : $this->offsetGet($key);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c89f788a28630f881bfcc8b573b0a2b0fbe01f736092c4ecaae659e9e9a911aa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 762, + "startColumn": 9, + "charOffset": 30396, + "charLength": 12, + "snippet": { + "text": "$isExpecting" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 760, + "startColumn": 1, + "charOffset": 30344, + "charLength": 150, + "snippet": { + "text": " $symbolVariable,\n $mustInit,\n $isExpecting,\n Definition $classDefinition,\n CompilationContext $compilationContext," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c96592670d4b91f7dbaf7d2051dd32c0ad8ae98c5268abe69c1395858949d3b4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 121, + "startColumn": 9, + "charOffset": 3563, + "charLength": 10, + "snippet": { + "text": "$statement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 119, + "startColumn": 1, + "charOffset": 3465, + "charLength": 149, + "snippet": { + "text": " CompiledExpression $resolvedExpr,\n CompilationContext $compilationContext,\n $statement\n ): void {\n $offsetExprs = [];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "caf3fb3e2d5c16fc6b22cf6a3d4e44de1bffe044950656cada420ff223f6f6b6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 846, + "startColumn": 53, + "charOffset": 28285, + "charLength": 13, + "snippet": { + "text": "$topStatement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 844, + "startColumn": 1, + "charOffset": 28194, + "charLength": 206, + "snippet": { + "text": " * @param array $docblock\n */\n public function preCompileInterface($namespace, $topStatement, $docblock): void\n {\n $classDefinition = new Definition($namespace, $topStatement['name']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cbd8389bfdbff24dcaef49faa41f78b6786b6ba39b9fb7d1a395ecc8e376aea8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 146, + "startColumn": 37, + "charOffset": 4929, + "charLength": 10, + "snippet": { + "text": "$expecting" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 144, + "startColumn": 1, + "charOffset": 4838, + "charLength": 197, + "snippet": { + "text": " * @param Variable|null $expectingVariable\n */\n public function setExpectReturn($expecting, Variable $expectingVariable = null): void\n {\n $this->expecting = $expecting;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ccbe4bda924b8a97aea525ee6bb903776f155e28aafa0e9efbe7e00108d21b3d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 427, + "startColumn": 76, + "charOffset": 13838, + "charLength": 13, + "snippet": { + "text": "$topStatement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 425, + "startColumn": 1, + "charOffset": 13708, + "charLength": 242, + "snippet": { + "text": " * @param array $topStatement\n */\n public function compileComment(CompilationContext $compilationContext, $topStatement): void\n {\n $compilationContext->codePrinter->output('/' . $topStatement['value'] . '/');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ce3786f253706f8fe10703df6f88910d3a942c1f9874d7bff3ec3dbff709087e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 68, + "startColumn": 35, + "charOffset": 1256, + "charLength": 11, + "snippet": { + "text": "$statements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 66, + "startColumn": 1, + "charOffset": 1193, + "charLength": 122, + "snippet": { + "text": " * @return $this\n */\n public function setStatements($statements)\n {\n $this->statements = $statements;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d144f8cfcc08605d59724df7acc6ec48faab2c3eef55b59fabaac6eb7b6b7204" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 167, + "startColumn": 33, + "charOffset": 5455, + "charLength": 9, + "snippet": { + "text": "$readOnly" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 165, + "startColumn": 1, + "charOffset": 5386, + "charLength": 128, + "snippet": { + "text": " * @param bool $readOnly\n */\n public function setReadOnly($readOnly): void\n {\n $this->readOnly = $readOnly;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d162c3f42ff4ca8abd71135d4b82f2e5fe78d2d9cd5f9d8964142e3c516ca6f8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 126, + "startColumn": 41, + "charOffset": 2331, + "charLength": 5, + "snippet": { + "text": "$line" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 124, + "startColumn": 1, + "charOffset": 2262, + "charLength": 126, + "snippet": { + "text": " * @return $this\n */\n public function setParseInfo($file, $line, $char = null)\n {\n $this->setFile($file);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d1911ed8a5144c8381cd358a0f4affe3125d6bcce69f5d2128769d19ff10139a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1060, + "startColumn": 9, + "charOffset": 36675, + "charLength": 16, + "snippet": { + "text": "$classDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1058, + "startColumn": 1, + "charOffset": 36592, + "charLength": 138, + "snippet": { + "text": " public function fetchStaticProperty(\n Variable $symbolVariable,\n $classDefinition,\n $property,\n $readOnly," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d5bb2e6bbb9cfe6c26a7d8eef7d6661536e20a6e43f7eb90db672a3bf5a7ef58" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/StaticTypeInference.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 178, + "startColumn": 43, + "charOffset": 5126, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 176, + "startColumn": 1, + "charOffset": 5049, + "charLength": 151, + "snippet": { + "text": " * @param string $type\n */\n public function markVariableIfUnknown($variable, $type): void\n {\n $this->variables[$variable] = $type;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d73ba907f0ce357cc00d632e289d6504b5b727d7936f74ba948085a2e97a2c61" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 385, + "startColumn": 47, + "charOffset": 11758, + "charLength": 5, + "snippet": { + "text": "$type" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 383, + "startColumn": 1, + "charOffset": 11680, + "charLength": 183, + "snippet": { + "text": " * @return Variable\n */\n public function getTempVariableForObserve($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'observe');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "de1090bff7306282e9d15ceed1a1ef20e74cbf113af20ae4fa7e380d6c6f0ef7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 100, + "startColumn": 29, + "charOffset": 1913, + "charLength": 5, + "snippet": { + "text": "$file" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 98, + "startColumn": 1, + "charOffset": 1846, + "charLength": 108, + "snippet": { + "text": " * @return AbstractBuilder\n */\n public function setFile($file)\n {\n $this->file = $file;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "df05420dcc7eae3bd1e1a15d705d9255d2c79022117b01bad6b64b9147eaf587" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ExportSymbol.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 9, + "charOffset": 925, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 881, + "charLength": 150, + "snippet": { + "text": " */\n public function assign(\n $variable,\n ZephirVariable $symbolVariable = null,\n CompiledExpression $resolvedExpr = null," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dfa94a4a8428f7d0788db77640c1c902d9c1f11ab721168633fcfb96afc815a2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 649, + "startColumn": 52, + "charOffset": 21612, + "charLength": 5, + "snippet": { + "text": "$code" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 647, + "startColumn": 1, + "charOffset": 21511, + "charLength": 202, + "snippet": { + "text": " * @param CompilationContext $context\n */\n public function assignZval(Variable $variable, $code, CompilationContext $context): void\n {\n $code = $this->resolveValue($code, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e187343889a1a58bc7d513907a22a99f3772d998fe2c9051a6d63e782197df5a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 142, + "startColumn": 31, + "charOffset": 2611, + "charLength": 7, + "snippet": { + "text": "$method" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 140, + "startColumn": 1, + "charOffset": 2538, + "charLength": 120, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setMethod($method)\n {\n $this->method = $method;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e1fbeda17c735a9c738d40fdd63163d8a530939f7ad4d83fc866e9f7e2eab2a9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 733, + "startColumn": 77, + "charOffset": 24241, + "charLength": 10, + "snippet": { + "text": "$namespace" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 731, + "startColumn": 1, + "charOffset": 24114, + "charLength": 254, + "snippet": { + "text": " * @param array $docblock\n */\n public function preCompileClass(CompilationContext $compilationContext, $namespace, $topStatement, $docblock): void\n {\n $classDefinition = new Definition($namespace, $topStatement['name']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e2836b3b4b5b0fe7887be606c7b56e34fcdd0b8cb798bec8752a34a9546c4b34" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 61, + "charOffset": 1268, + "charLength": 47, + "snippet": { + "text": "$type = CallFunctionStatement::TYPE_CALL_DIRECT" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 1163, + "charLength": 228, + "snippet": { + "text": " * @return CallFunctionStatement\n */\n public function functionCall($name, $parameters = null, $type = CallFunctionStatement::TYPE_CALL_DIRECT)\n {\n return new CallFunctionStatement($name, $parameters, $type);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e2c73a099a8c96f23f67fd748aff48006d2d67731e2760931969cf386e6ffbe2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 9, + "charOffset": 1057, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1013, + "charLength": 136, + "snippet": { + "text": " */\n public function assign(\n $variable,\n ZephirVariable $symbolVariable,\n CompiledExpression $resolvedExpr," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e5fc4fea2f81deff1e20b99cab5468db07cbd3decad16dc1e9922bea56d99af8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 602, + "startColumn": 9, + "charOffset": 20441, + "charLength": 9, + "snippet": { + "text": "$funcName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 600, + "startColumn": 1, + "charOffset": 20386, + "charLength": 134, + "snippet": { + "text": " */\n protected function markReferences(\n $funcName,\n $parameters,\n CompilationContext $compilationContext," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e65da6b24f0358b17beb6e424d4acc03e6b0a39dd35b4367f912782816582d81" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 483, + "startColumn": 9, + "charOffset": 18809, + "charLength": 9, + "snippet": { + "text": "$mustInit" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 481, + "startColumn": 1, + "charOffset": 18749, + "charLength": 129, + "snippet": { + "text": " array $expression,\n $symbolVariable,\n $mustInit,\n $isExpecting,\n Definition $classDefinition," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e7f9c2c4e588c6c59165a41973b6a2de95fa3ded1f2f266713b50baf84a08dd1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 668, + "startColumn": 9, + "charOffset": 26511, + "charLength": 15, + "snippet": { + "text": "$symbolVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 666, + "startColumn": 1, + "charOffset": 26418, + "charLength": 160, + "snippet": { + "text": " protected function callFromDynamicClassDynamicMethod(\n array $expression,\n $symbolVariable,\n bool $mustInit,\n bool $isExpecting," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e86715129b1c3bd7fad9ae9a49b9a8a983fc43ea2c75c0ddeebdddfa256b2e46" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 846, + "startColumn": 68, + "charOffset": 28300, + "charLength": 9, + "snippet": { + "text": "$docblock" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 844, + "startColumn": 1, + "charOffset": 28194, + "charLength": 206, + "snippet": { + "text": " * @param array $docblock\n */\n public function preCompileInterface($namespace, $topStatement, $docblock): void\n {\n $classDefinition = new Definition($namespace, $topStatement['name']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e90123451c5b0e81d7c0eb43645870b5571cafac1508b7c29bcc2d15599b9ad8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ListCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 32, + "startColumn": 48, + "charOffset": 639, + "charLength": 17, + "snippet": { + "text": "$mergeArgs = true" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 30, + "startColumn": 1, + "charOffset": 554, + "charLength": 171, + "snippet": { + "text": " * @param bool $mergeArgs\n */\n public function mergeApplicationDefinition($mergeArgs = true): void\n {\n parent::mergeApplicationDefinition($mergeArgs);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ed911ec734bb3aaba5004564f7b69f6b1016593d05e0393c9e04f715bd353492" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 36, + "charOffset": 1099, + "charLength": 12, + "snippet": { + "text": "$assignments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1035, + "charLength": 126, + "snippet": { + "text": " * @return $this\n */\n public function setAssignments($assignments)\n {\n $this->assignments = $assignments;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ee1a16411b707a227193cf3f4f9faa959d0e172b9e3647d3e5d71d029b6f1dbd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1012, + "startColumn": 9, + "charOffset": 35160, + "charLength": 9, + "snippet": { + "text": "$property" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1010, + "startColumn": 1, + "charOffset": 35082, + "charLength": 143, + "snippet": { + "text": " Variable $symbolVariable,\n Variable $variableVariable,\n $property,\n $readOnly,\n CompilationContext $context" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ef5456d38604963a79422bef21c4a0465b29506c41faf3bc59342541d581bd8c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 606, + "startColumn": 9, + "charOffset": 20551, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 604, + "startColumn": 1, + "charOffset": 20473, + "charLength": 154, + "snippet": { + "text": " CompilationContext $compilationContext,\n &$references,\n $expression\n ): void {\n if ($this->isBuiltInFunction($funcName)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ef859b923d5936a905125786823cba2d1cf8ccf4295dbcba10fa951440aca88f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 337, + "startColumn": 56, + "charOffset": 9919, + "charLength": 15, + "snippet": { + "text": "$options = null" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 335, + "startColumn": 1, + "charOffset": 9831, + "charLength": 141, + "snippet": { + "text": " * @throws Exception\n */\n private function prepareThemeOptions($themeConfig, $options = null)\n {\n $parsedOptions = null;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "efbf59af0e821cc1cb44bc54003f53a4ece790840400df9d9f2d026cd62a32d0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 337, + "startColumn": 42, + "charOffset": 9905, + "charLength": 12, + "snippet": { + "text": "$themeConfig" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 335, + "startColumn": 1, + "charOffset": 9831, + "charLength": 141, + "snippet": { + "text": " * @throws Exception\n */\n private function prepareThemeOptions($themeConfig, $options = null)\n {\n $parsedOptions = null;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f355d516e448c0ea8dfdafb4c7e8990817401e01595f52b4907ef2af0b70960f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 187, + "startColumn": 48, + "charOffset": 6325, + "charLength": 7, + "snippet": { + "text": "$string" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 185, + "startColumn": 1, + "charOffset": 6244, + "charLength": 120, + "snippet": { + "text": " * @return Annotation\n */\n private function __createAnnotation($name, $string)\n {\n switch ($name) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f3ba096c0555fc6ba1894e2822b9eed75052fdd91a6d6e1d087ffa3f12fd31b4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 9, + "charOffset": 1023, + "charLength": 10, + "snippet": { + "text": "$className" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 973, + "charLength": 122, + "snippet": { + "text": " */\n public function assignStatic(\n $className,\n $property,\n CompiledExpression $resolvedExpr," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f3fe0383d9aa85f6db83370cdd3f471cbd17200c3f9caa9fcfea2a41f60413b0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 629, + "startColumn": 9, + "charOffset": 21085, + "charLength": 6, + "snippet": { + "text": "$value" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 627, + "startColumn": 1, + "charOffset": 21015, + "charLength": 150, + "snippet": { + "text": " public function assignString(\n Variable $variable,\n $value,\n CompilationContext $context,\n bool $useCodePrinter = true" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f4578d3a57f3f0721177dd2c295909530859b7eb56ddf31a817f5f09f021f587" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParamTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing parameter's type declaration", + "markdown": "Missing parameter's type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Cache/MethodCache.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 201, + "startColumn": 39, + "charOffset": 7139, + "charLength": 23, + "snippet": { + "text": "$classDefinition = null" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 199, + "startColumn": 1, + "charOffset": 7073, + "charLength": 156, + "snippet": { + "text": " * @return bool\n */\n private function isClassCacheable($classDefinition = null): bool\n {\n if ($classDefinition instanceof Definition) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f8e9daa180ed915ae87b224465e7ba926a5463b9b2836b88be347e92bdd18488" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingParentConstructorInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Missing parent constructor call", + "markdown": "Missing parent constructor call" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionDefinition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 21, + "charOffset": 563, + "charLength": 11, + "snippet": { + "text": "__construct" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 506, + "charLength": 136, + "snippet": { + "text": " private bool $isGlobal = false;\n\n public function __construct(\n private string $namespace,\n protected string $name," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "27793a1c4a39d77b77d249d2e3a4f3f94d3fb91bcc8b2c8c8f31aac015f6c6cf" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 21, + "charOffset": 1821, + "charLength": 12, + "snippet": { + "text": "setCondition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 1772, + "charLength": 135, + "snippet": { + "text": " * @return $this\n */\n public function setCondition(AbstractOperator $condition)\n {\n $this->condition = $condition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "003f5c475408944ad613a952cc6593933a602eedbaf55e01ed9abcbe5d0a53a7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 94, + "startColumn": 21, + "charOffset": 1854, + "charLength": 11, + "snippet": { + "text": "getTypeCall" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 92, + "startColumn": 1, + "charOffset": 1807, + "charLength": 98, + "snippet": { + "text": " * @return int\n */\n public function getTypeCall()\n {\n return $this->typeCall;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0068fe52bb48a5a2a880dce97044faab85565c3e8eeb6a1d19ed19d1cceffa11" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 21, + "charOffset": 1117, + "charLength": 12, + "snippet": { + "text": "getArguments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1068, + "charLength": 102, + "snippet": { + "text": " * @return mixed\n */\n public function getArguments()\n {\n return $this->arguments;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "00cfdb0980b6f57975182228a4c33df4677b321a74a03d9eb9ba14d7959eed3c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 78, + "startColumn": 24, + "charOffset": 1406, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 76, + "startColumn": 1, + "charOffset": 1354, + "charLength": 107, + "snippet": { + "text": " * @return array\n */\n protected function preBuild()\n {\n return $this->getStatements();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0104e3d5e86c2a4c5582b6f45fddf8943fb1c81759ac414942ad8a171e3f98ae" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 128, + "startColumn": 21, + "charOffset": 2389, + "charLength": 11, + "snippet": { + "text": "setTypeCall" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 126, + "startColumn": 1, + "charOffset": 2340, + "charLength": 114, + "snippet": { + "text": " * @return $this\n */\n public function setTypeCall($typeCall)\n {\n $this->typeCall = $typeCall;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "014ae50816e6dd3cee23ba52f03087358f344ecda45cfc27f1385b4f64668b9e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 100, + "startColumn": 21, + "charOffset": 2048, + "charLength": 17, + "snippet": { + "text": "setElseStatements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 98, + "startColumn": 1, + "charOffset": 1999, + "charLength": 154, + "snippet": { + "text": " * @return $this\n */\n public function setElseStatements(StatementsBlock $elseStatements)\n {\n $this->elseStatements = $elseStatements;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "01c39ad614420a7dcf6fd8b76ec4135d4c9a56f0241bd908e3852f469ab608a9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/RawStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 684, + "charLength": 13, + "snippet": { + "text": "getExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 635, + "charLength": 104, + "snippet": { + "text": " * @return array\n */\n public function getExpression()\n {\n return $this->expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "028c454f5b485d4179193816890ab17d4a2aa4defbb6c23d72352304a4f309c9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/UcfirstOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 21, + "charOffset": 890, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 837, + "charLength": 176, + "snippet": { + "text": " * @throws Exception\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0525860df493df8c51738baafe0f9f67d44dea996a48a19b2ad27b5753357588" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/RawStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 21, + "charOffset": 843, + "charLength": 13, + "snippet": { + "text": "setExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 794, + "charLength": 128, + "snippet": { + "text": " * @return $this\n */\n public function setExpression(array $expression)\n {\n $this->expression = $expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "054d65c87f65b61d9e16cc78d4bfb5d3a2c5f1abb60df6fc95afb3e7fdafae75" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FcloseOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 869, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 808, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "057f042ffd874e69b00bf0ffc85d185ac1ceba99664df1e38ea39e66f88158ed" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsArrayOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 24, + "charOffset": 514, + "charLength": 7, + "snippet": { + "text": "getType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 434, + "charLength": 122, + "snippet": { + "text": "class IsArrayOptimizer extends IsTypeOptimizerAbstract\n{\n protected function getType()\n {\n return 'IS_ARRAY';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "05f8679aaf0231ee69f7d123ff7f2c23e72ef3133bce3675357217723de31902" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/OperatorsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 113, + "startColumn": 21, + "charOffset": 3235, + "charLength": 4, + "snippet": { + "text": "hint" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 111, + "startColumn": 1, + "charOffset": 3180, + "charLength": 129, + "snippet": { + "text": " * @return RawOperator\n */\n public function hint($type, AbstractBuilder $expression)\n {\n return $this->raw([" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "066c4cc045a9e061aadaed99e789158cbb2479ef0f0e48cffc7b6295971a5234" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 174, + "startColumn": 21, + "charOffset": 3889, + "charLength": 17, + "snippet": { + "text": "setLeftExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 172, + "startColumn": 1, + "charOffset": 3831, + "charLength": 163, + "snippet": { + "text": " * @return BinaryOperator\n */\n public function setLeftExpression(AbstractBuilder $leftExpression)\n {\n $this->leftExpression = $leftExpression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "06e2ccdc5ea59bcc5c5768dc057dde764b900c2e265c36dd5db212c0ef5d6d6c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 21, + "charOffset": 785, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 712, + "charLength": 195, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n $call->processExpectedReturn($context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "080db03f65fe9ef6aa3ad645634d6ae0181036b0e3f78a762b1d12ab72ff8fb9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/InterfaceExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 897, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 836, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "08d8f4bff4cf373c2624f440d563d71a9a3f4aa240ae126ba5f9763d93c55ed9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/UnaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 115, + "startColumn": 21, + "charOffset": 2355, + "charLength": 11, + "snippet": { + "text": "setOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 113, + "startColumn": 1, + "charOffset": 2306, + "charLength": 114, + "snippet": { + "text": " * @return $this\n */\n public function setOperator($operator)\n {\n $this->operator = $operator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "09f01186c2e0383001bb0b29e8daf5b42471af34383fe5d12c7f8ef7b7abc630" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 274, + "startColumn": 21, + "charOffset": 8391, + "charLength": 9, + "snippet": { + "text": "offsetGet" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 272, + "startColumn": 1, + "charOffset": 8335, + "charLength": 114, + "snippet": { + "text": " */\n #[ReturnTypeWillChange]\n public function offsetGet($offset)\n {\n if (!is_array($offset)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0a5422b26f129f74d754cf3dada2a15feb22a6ec4b92ee342bae89caa56e9788" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/FileSystemInterface.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 114, + "startColumn": 21, + "charOffset": 2380, + "charLength": 11, + "snippet": { + "text": "requireFile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 112, + "startColumn": 1, + "charOffset": 2331, + "charLength": 84, + "snippet": { + "text": " * @return mixed\n */\n public function requireFile(string $path);\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0b040d516b39137d4a3219575ec22cdff4dae64f1089941a82b60ca65205b102" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CamelizeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 21, + "charOffset": 1052, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 991, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0b0d06a19011bf64e6ae4e34e2ec422c262a643aa158e04c8a6d1bde57de4853" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 232, + "startColumn": 22, + "charOffset": 7733, + "charLength": 13, + "snippet": { + "text": "nextCharacter" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 230, + "startColumn": 1, + "charOffset": 7656, + "charLength": 133, + "snippet": { + "text": " * @return string the new current character\n */\n private function nextCharacter()\n {\n ++$this->currentCharIndex;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0bb9a806e6b6764f07f71746f3ed0c552f15552581ac3232e11e1a77b8d9e360" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrReplaceOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 882, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 821, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0e45a953884d2fd0806da5eab090ab70d3c770ef975cdfb90cf808431db63659" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FileExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 882, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 821, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0f47eb9bb9df756c1990bc6aae462d6841cbbfd2aa4ed76c23a469b558488557" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/AssignVariableOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 87, + "startColumn": 21, + "charOffset": 1846, + "charLength": 11, + "snippet": { + "text": "getVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 85, + "startColumn": 1, + "charOffset": 1796, + "charLength": 101, + "snippet": { + "text": " * @return string\n */\n public function getVariable()\n {\n return $this->variable;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0fd69886b36e9a67b472edb56dcc5972273861d51939db934e389e3675825dc9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/OptimizerAbstract.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 33, + "startColumn": 30, + "charOffset": 678, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 31, + "startColumn": 1, + "charOffset": 620, + "charLength": 136, + "snippet": { + "text": " * @return mixed\n */\n abstract public function optimize(array $expression, Call $call, CompilationContext $context);\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "10652cb8887e6a8b10d0f8959a584ce837ddafa1a82de1fa8f572ff48971eeac" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Annotation/Link.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 31, + "startColumn": 21, + "charOffset": 599, + "charLength": 11, + "snippet": { + "text": "getLinkText" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 29, + "startColumn": 1, + "charOffset": 558, + "charLength": 97, + "snippet": { + "text": " protected $uri;\n\n public function getLinkText()\n {\n if (!$this->contentParsed) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "10fd06e95bba11654b345f1623cfc505873aebd28785baaa4e54b74d1abbcab7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Property.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 346, + "startColumn": 24, + "charOffset": 9701, + "charLength": 15, + "snippet": { + "text": "getLetStatement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 344, + "startColumn": 1, + "charOffset": 9671, + "charLength": 107, + "snippet": { + "text": " }\n\n protected function getLetStatement()\n {\n $exprBuilder = BuilderFactory::getInstance();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "11db90c66cec3c63598d1edd9c9e7396c236b5d2a2fe336a988dfb0318fbaea1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetCalledClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 895, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 834, + "charLength": 183, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "121d2d036d6105e0202266a8c8e6890c4220e1734d1142cc268285df412fd0b5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FuncGetArgsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 21, + "charOffset": 865, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 804, + "charLength": 146, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n /*" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "13ebdf9e585828c1c92f23d20597343aa78ce18ca3134bc8920a2e1b17941525" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 21, + "charOffset": 1083, + "charLength": 13, + "snippet": { + "text": "getStatements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1034, + "charLength": 104, + "snippet": { + "text": " * @return array\n */\n public function getStatements()\n {\n return $this->statements;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "141dd98c38a0203657a5354bb2b9e6e289e1f29a3a1f50f17a401f81d3820a0e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 78, + "startColumn": 21, + "charOffset": 1575, + "charLength": 7, + "snippet": { + "text": "getLine" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 76, + "startColumn": 1, + "charOffset": 1525, + "charLength": 93, + "snippet": { + "text": " * @return string\n */\n public function getLine()\n {\n return $this->line;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "14cac5cabc9a19ead9b03b70fc6f3e3cc35699fd51b06865c39ccbdff88f22c7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 50, + "startColumn": 21, + "charOffset": 955, + "charLength": 5, + "snippet": { + "text": "build" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 48, + "startColumn": 1, + "charOffset": 906, + "charLength": 112, + "snippet": { + "text": " * @return array\n */\n public function build()\n {\n return $this->resolve($this->preBuild());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "156a7a9bbdbed77eecc8760d2e96d0cf3d1ee8ad0f873c89fdd8a9321ffb1be9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArray.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 21, + "charOffset": 1217, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1164, + "charLength": 137, + "snippet": { + "text": " * @throws Exception\n */\n public function compile(array $expression, CompilationContext $compilationContext)\n {\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "165323488362cc7b8735a6ac9a8289fe725ae2a577b68ebbb86cb82dff051e15" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Constants.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 94, + "startColumn": 21, + "charOffset": 2155, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 92, + "startColumn": 1, + "charOffset": 2094, + "charLength": 168, + "snippet": { + "text": " * @throws CompilerException\n */\n public function compile(array $expression, CompilationContext $compilationContext)\n {\n $isPhpConstant = false;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "184d95afb2244d67d898520bf574cca8feadbd8492db31ab82fe381f1d46cd8e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 186, + "startColumn": 21, + "charOffset": 4129, + "charLength": 11, + "snippet": { + "text": "setOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 184, + "startColumn": 1, + "charOffset": 4071, + "charLength": 123, + "snippet": { + "text": " * @return BinaryOperator\n */\n public function setOperator($operator)\n {\n $this->operator = $operator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1adf4aa4913472785ba24a6a63fd43dc5103515246e4c7d7f83527c6fef58994" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/AssignVariableOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 119, + "startColumn": 24, + "charOffset": 2350, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 117, + "startColumn": 1, + "charOffset": 2298, + "charLength": 85, + "snippet": { + "text": " * {@inheritdoc}\n */\n protected function preBuild()\n {\n return [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1d144d193b91e156e37a85401bf64550ea47543e1c0bc68ba8bd77a0b3fb5b56" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/NamespaceAccessor.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 83, + "startColumn": 21, + "charOffset": 1932, + "charLength": 14, + "snippet": { + "text": "getByNamespace" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 81, + "startColumn": 1, + "charOffset": 1871, + "charLength": 118, + "snippet": { + "text": " * @return NamespaceHelper[]\n */\n public function getByNamespace()\n {\n return $this->byNamespace;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1d686b8331b7d933ad319170c7ccddea54ee2d9f07bff80063f40d94d82a3e4a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MicrotimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 878, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 817, + "charLength": 201, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n /* microtime has one optional parameter (get_as_float) */" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1f6460f2825bd0105cc79ec7b8bd8c3112a9a2713b35e549f5ad7ce35e8fe350" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 184, + "startColumn": 21, + "charOffset": 4759, + "charLength": 18, + "snippet": { + "text": "getOutputDirectory" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 182, + "startColumn": 1, + "charOffset": 4709, + "charLength": 115, + "snippet": { + "text": " * @return string\n */\n public function getOutputDirectory()\n {\n return $this->outputDirectory;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "20227e56d23b1e5b752b63c0ddd6f67b00103dcfcf35dd45f5df7c9353daeb27" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IntvalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 869, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 808, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "22d7e09afff701bbc429440eaf69bfc73a3230c6f521e5974e0f239bcb682fb3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsCallableOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 21, + "charOffset": 802, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 729, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "233b21ef558a472e53a05cf6c34ffeac71ed2e97fc7b15a0f6565fc1abe64d97" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseNotOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 21, + "charOffset": 797, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 744, + "charLength": 197, + "snippet": { + "text": " * @throws Exception\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n $this->checkLeft($expression, CompilerException::class, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "239ac758d40092a00dd357889810186c2a94bbc5a63f5a3663cc3ca154ca71d9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 148, + "startColumn": 24, + "charOffset": 2695, + "charLength": 7, + "snippet": { + "text": "resolve" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 146, + "startColumn": 1, + "charOffset": 2643, + "charLength": 103, + "snippet": { + "text": " * @return array\n */\n protected function resolve($expr)\n {\n if (is_array($expr)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "255b4980b47f57f692947496126942289ce4b03e8d98ff1fc1494c19a3406827" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PregMatchOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 122, + "startColumn": 22, + "charOffset": 3639, + "charLength": 13, + "snippet": { + "text": "createMatches" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 120, + "startColumn": 1, + "charOffset": 3586, + "charLength": 171, + "snippet": { + "text": " * @return Variable\n */\n private function createMatches(array $expression, CompilationContext $context)\n {\n if (isset($expression['parameters'][2])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "263091743dd0bfcf3a85448477477c8580871a34c9c3d87c8401c2684e21bb6e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 68, + "startColumn": 21, + "charOffset": 1345, + "charLength": 9, + "snippet": { + "text": "getMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 66, + "startColumn": 1, + "charOffset": 1296, + "charLength": 96, + "snippet": { + "text": " * @return mixed\n */\n public function getMethod()\n {\n return $this->method;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "263d1f7055c00a9492c9e9de0854f17137c7aa0b684f78ec1b09a1bfcd0359e7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonEncodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 21, + "charOffset": 802, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 729, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2688dfce9a2df2dd993ac5f04ccc62bc2ad8b9808889f9706698fc2956a27268" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 283, + "startColumn": 24, + "charOffset": 8822, + "charLength": 21, + "snippet": { + "text": "_getResolvedArrayItem" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 281, + "startColumn": 1, + "charOffset": 8758, + "charLength": 209, + "snippet": { + "text": " * @throws CompilerException\n */\n protected function _getResolvedArrayItem(CompiledExpression $resolvedExpr, CompilationContext $compilationContext)\n {\n switch ($resolvedExpr->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "26caa32fd18199c0d22e0b9188e033e982ab1ddc3dd82ee0e15940e886720672" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 269, + "startColumn": 21, + "charOffset": 7590, + "charLength": 12, + "snippet": { + "text": "getThemePath" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 267, + "startColumn": 1, + "charOffset": 7540, + "charLength": 140, + "snippet": { + "text": " * @return string\n */\n public function getThemePath($path)\n {\n $path = pathinfo($this->themeDir . '/' . $path);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2822a300578f57b1f0b02ea0bb8af5fc16b0579ac3a330c1f246ca4dc5801a0a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 195, + "startColumn": 24, + "charOffset": 5382, + "charLength": 12, + "snippet": { + "text": "_callDynamic" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 193, + "startColumn": 1, + "charOffset": 5318, + "charLength": 215, + "snippet": { + "text": " * @throws CompilerException\n */\n protected function _callDynamic(array $expression, CompilationContext $compilationContext)\n {\n $variable = $compilationContext->symbolTable->getVariableForRead(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "28f9c7e9409adffe20f8affb630388712d450b16dcbc03b1f37827512330b04a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsBoolOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 24, + "charOffset": 511, + "charLength": 7, + "snippet": { + "text": "getType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 432, + "charLength": 120, + "snippet": { + "text": "class IsBoolOptimizer extends IsTypeOptimizerAbstract\n{\n protected function getType()\n {\n return 'IS_BOOL';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2a21c750056102ddf4cb6a18c7c7d9b54511f95757e020807cae086d998c5f8d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 100, + "startColumn": 21, + "charOffset": 1905, + "charLength": 7, + "snippet": { + "text": "setFile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 98, + "startColumn": 1, + "charOffset": 1846, + "charLength": 108, + "snippet": { + "text": " * @return AbstractBuilder\n */\n public function setFile($file)\n {\n $this->file = $file;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2a9a6d690b9d12453b5bfe6ae93cf2f9e14649d41390bb5a6e75746d45369bf2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 557, + "startColumn": 21, + "charOffset": 18604, + "charLength": 10, + "snippet": { + "text": "assignLong" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 555, + "startColumn": 1, + "charOffset": 18577, + "charLength": 243, + "snippet": { + "text": " }\n\n public function assignLong(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true)\n {\n return $this->assignHelper('ZVAL_LONG', $this->getVariableCode($variable), $value, $context, $useCodePrinter);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2b3fe5c314447fcd45801f50ca39ba385cae5c0d645e29ac7b9b9912576be28e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 70, + "startColumn": 21, + "charOffset": 1466, + "charLength": 7, + "snippet": { + "text": "getFile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 68, + "startColumn": 1, + "charOffset": 1416, + "charLength": 93, + "snippet": { + "text": " * @return string\n */\n public function getFile()\n {\n return $this->file;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2b7248cd23f7d92c49ccb31a5858fd89581c68f6bcd1954a811c980086094b9d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsObjectOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 24, + "charOffset": 516, + "charLength": 7, + "snippet": { + "text": "getType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 435, + "charLength": 124, + "snippet": { + "text": "class IsObjectOptimizer extends IsTypeOptimizerAbstract\n{\n protected function getType()\n {\n return 'IS_OBJECT';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2c1a5d5e715aa464ad5b012015b4cad315bd3916cb05d09afac899c647c29ccb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ModOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 880, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 799, + "charLength": 232, + "snippet": { + "text": " * @param CompilationContext $compilationContext\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n [$left, $right] = $this->preCompileChecks($expression, $compilationContext);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2c6f4e76984cc94ed4a945921cd4e6fa5a6a6d19df85ed2fc92c2509d69b0e07" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 778, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 717, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2dc18b997aed4a5fb1206948b525c13a02894afe4ff349e4b84950c5e3b09132" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 152, + "startColumn": 24, + "charOffset": 2749, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 150, + "startColumn": 1, + "charOffset": 2697, + "charLength": 118, + "snippet": { + "text": " * @return array\n */\n protected function preBuild()\n {\n if ($arguments = $this->getArguments()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3000431440eea23ca4f1407df11393730286414a1ec2dca7a73a1328aa9a52d2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 62, + "startColumn": 21, + "charOffset": 1357, + "charLength": 7, + "snippet": { + "text": "getChar" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 60, + "startColumn": 1, + "charOffset": 1310, + "charLength": 90, + "snippet": { + "text": " * @return int\n */\n public function getChar()\n {\n return $this->char;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "302c737329faa09bb1060d45c724aa8f62289265f0007e9a871ed610d55f56ab" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 83, + "startColumn": 21, + "charOffset": 2148, + "charLength": 3, + "snippet": { + "text": "raw" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 81, + "startColumn": 1, + "charOffset": 2092, + "charLength": 130, + "snippet": { + "text": " * @return RawStatement\n */\n public function raw(array $expression)\n {\n return new RawStatement($expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "310719fb5704853d54fa0c52f59bd254c56090fc1e064e2253e52331cab664d1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 24, + "charOffset": 1092, + "charLength": 7, + "snippet": { + "text": "execute" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 1062, + "charLength": 152, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $command = $this->getApplication()->find('clean');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "32792ebcda1aa16f68a4c880e6ff25c9775f9ddb6ae2107d9d6b6ce2f3c9e4ed" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 383, + "startColumn": 21, + "charOffset": 11726, + "charLength": 16, + "snippet": { + "text": "arrayIssetFetch2" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 381, + "startColumn": 1, + "charOffset": 11699, + "charLength": 93, + "snippet": { + "text": " }\n\n public function arrayIssetFetch2(\n Variable $target,\n Variable $var," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "34b3c68f7a15f1dd99e5fcd1736db10b6d171ca403223ea0684904b5a5eb53df" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 76, + "startColumn": 21, + "charOffset": 1456, + "charLength": 14, + "snippet": { + "text": "isDynamicClass" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 74, + "startColumn": 1, + "charOffset": 1408, + "charLength": 106, + "snippet": { + "text": " * @return bool\n */\n public function isDynamicClass()\n {\n return $this->dynamicClass;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3647a6f6724d56a924ff93d3b76539b1e0798cb348237a250516f44cc4cdbc5e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarExportOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 913, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 852, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "394fc6bfa85c930140f1f46679579b1b1000968b9e32e2fddb2a786ff1e200a1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrposOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 869, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 808, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3b90838456965a3356a2894bedb738e249e124c7a2963108044420a24992660a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FuncNumArgsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 21, + "charOffset": 785, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 712, + "charLength": 225, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n return new CompiledExpression('int', 'ZEND_NUM_ARGS()', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3c0b9c19ecc90cb8dfe7284b0cf198cc5fb3199738ae56bbacea45d01bd2e329" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsStringOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 24, + "charOffset": 517, + "charLength": 7, + "snippet": { + "text": "getType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 436, + "charLength": 124, + "snippet": { + "text": "class IsStringOptimizer extends IsTypeOptimizerAbstract\n{\n protected function getType()\n {\n return 'IS_STRING';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3cf4ae55a9391b7f385b52ec9b881f82507236bd5a4abe95c8f0b81c81ef4d20" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/HashEqualsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 882, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 821, + "charLength": 225, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters']) || 2 != count($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3d655bdf9fc4a6c99c80ca45782e57fd1267cdb353d2b5400687b611e88f5fa5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 21, + "charOffset": 1235, + "charLength": 8, + "snippet": { + "text": "getClass" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1186, + "charLength": 94, + "snippet": { + "text": " * @return mixed\n */\n public function getClass()\n {\n return $this->class;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3dfa01b99e86fa6c996fa4d5cee155da13d1071767e1a4fedc8b2f8208c288bc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 106, + "startColumn": 21, + "charOffset": 2572, + "charLength": 7, + "snippet": { + "text": "returnX" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 104, + "startColumn": 1, + "charOffset": 2516, + "charLength": 126, + "snippet": { + "text": " * @return RawStatement\n */\n public function returnX(AbstractBuilder $expression)\n {\n return $this->raw([" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3fc51c1e23a99fe2cc0270dd31c3ad383446cc355ae2f2694be3c6e86a36bfc1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MemstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 21, + "charOffset": 821, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 748, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "43a04c15aaf8519c948e1bf84f33cb48f57dde8e5424e81346cce4771fee8a8b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 418, + "startColumn": 21, + "charOffset": 12813, + "charLength": 34, + "snippet": { + "text": "getTempVariableForObserveOrNullify" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 416, + "startColumn": 1, + "charOffset": 12761, + "charLength": 200, + "snippet": { + "text": " * @return Variable\n */\n public function getTempVariableForObserveOrNullify($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'observe-nullify');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "46ce3890f6b9b8ce87e98754bed78323298eada5c385287b7f771d053db789c8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 187, + "startColumn": 22, + "charOffset": 6299, + "charLength": 18, + "snippet": { + "text": "__createAnnotation" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 185, + "startColumn": 1, + "charOffset": 6244, + "charLength": 120, + "snippet": { + "text": " * @return Annotation\n */\n private function __createAnnotation($name, $string)\n {\n switch ($name) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "474772b34c6bf7ecfe79d3be82f0342bf36e1b2fe178cfc3333c05131d358348" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 156, + "startColumn": 21, + "charOffset": 3571, + "charLength": 11, + "snippet": { + "text": "getOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 154, + "startColumn": 1, + "charOffset": 3521, + "charLength": 101, + "snippet": { + "text": " * @return string\n */\n public function getOperator()\n {\n return $this->operator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4751cb803a19a35ed4ff73bd9fd8ea48ba387fd21884c9ad52c171d5c01e14fb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/RawOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 21, + "charOffset": 840, + "charLength": 13, + "snippet": { + "text": "setExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 791, + "charLength": 128, + "snippet": { + "text": " * @return $this\n */\n public function setExpression(array $expression)\n {\n $this->expression = $expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "47a5ab6c8cd6a943b1fbd9a38fa4c3cd9014bead4117b5646a08c0ae8e4e5e49" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 116, + "startColumn": 21, + "charOffset": 2217, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 114, + "startColumn": 1, + "charOffset": 2168, + "charLength": 98, + "snippet": { + "text": " * @return $this\n */\n public function setName($name)\n {\n $this->name = $name;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "47ab42187432f94bb58f41397609408713a9a72b03045fc07d5fbc49a41178d1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Docblock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 134, + "startColumn": 21, + "charOffset": 2772, + "charLength": 14, + "snippet": { + "text": "setAnnotations" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 132, + "startColumn": 1, + "charOffset": 2704, + "charLength": 151, + "snippet": { + "text": " * @param Annotation[] $annotations\n */\n public function setAnnotations(array $annotations)\n {\n $this->annotations = $annotations;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4859809284fed5b0690bc5781298bbaad5e2a8cba78843b8a21017e5ea4a4dec" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/OperatorsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 84, + "startColumn": 21, + "charOffset": 2499, + "charLength": 6, + "snippet": { + "text": "binary" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 82, + "startColumn": 1, + "charOffset": 2441, + "charLength": 139, + "snippet": { + "text": " * @return BinaryOperator\n */\n public function binary(\n $operator = null,\n AbstractBuilder $leftExpression = null," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "48deec0c7d21595adfb94617837fa82a625ff961515211fa6dc7c11084b23827" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrtoupperOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 43, + "startColumn": 21, + "charOffset": 992, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 41, + "startColumn": 1, + "charOffset": 931, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "48e6eb6d4e251d4181328e50c7b21bfc7bceedcaa25a903e39700080489032bc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/AbstractType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 62, + "startColumn": 21, + "charOffset": 1391, + "charLength": 12, + "snippet": { + "text": "invokeMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 60, + "startColumn": 1, + "charOffset": 1328, + "charLength": 114, + "snippet": { + "text": " * @throws ReflectionException\n */\n public function invokeMethod(\n $methodName,\n $caller," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4a12cf5547eb529db168264143cea6e00d9f422f965397bffda30a189fb11bf8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 86, + "startColumn": 21, + "charOffset": 2392, + "charLength": 24, + "snippet": { + "text": "buildJsonClassDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 84, + "startColumn": 1, + "charOffset": 2365, + "charLength": 113, + "snippet": { + "text": " }\n\n public function buildJsonClassDefinition($classList, NamespaceAccessor $nsA)\n {\n $output = [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4a798317b1184de5de865027fd643b7bdecaede09b64392b2603ee958dccd510" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/BuilderFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 57, + "startColumn": 21, + "charOffset": 1167, + "charLength": 9, + "snippet": { + "text": "operators" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 55, + "startColumn": 1, + "charOffset": 1107, + "charLength": 117, + "snippet": { + "text": " * @return OperatorsFactory\n */\n public function operators()\n {\n if (!$this->operatorsFactory) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4b6eee92f6821c0e85c87795165b1f0849cfc28fcea25cd4808fe4d804167997" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ArrayKeysOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 21, + "charOffset": 911, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 858, + "charLength": 176, + "snippet": { + "text": " * @throws Exception\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4cb37de7dd94bdcbbb17d48cddf427a7cbb821b253a54438208538ef8e020a34" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 21, + "charOffset": 1084, + "charLength": 14, + "snippet": { + "text": "setAssignments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1035, + "charLength": 126, + "snippet": { + "text": " * @return $this\n */\n public function setAssignments($assignments)\n {\n $this->assignments = $assignments;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4ce830b96f626db6d1b854e2bec13671bcd4c607e07e1d0372dde5183c0404c1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 205, + "startColumn": 21, + "charOffset": 5899, + "charLength": 10, + "snippet": { + "text": "arrayFetch" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 203, + "startColumn": 1, + "charOffset": 5872, + "charLength": 84, + "snippet": { + "text": " }\n\n public function arrayFetch(\n Variable $var,\n Variable $src," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4d434b7939ae089d97e3c4b62cb07a15f0ee3132c28b2f611b44489b3bca08e9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/DoublevalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 878, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 817, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4f1dc8d9b020b5fb86c5f5cb7a147eb7ff66ebd7219b889435c4721a77ef7496" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/UniqueKeyOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 21, + "charOffset": 990, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 929, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4f437beadae59abc70b9988fb65cb97bd6c8609a977d85ef16dca5822a61977a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 355, + "startColumn": 21, + "charOffset": 10832, + "charLength": 15, + "snippet": { + "text": "arrayIssetFetch" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 353, + "startColumn": 1, + "charOffset": 10805, + "charLength": 92, + "snippet": { + "text": " }\n\n public function arrayIssetFetch(\n Variable $target,\n Variable $var," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "51e324fd0ee75a8475977b30ba11814a019c1088b6acbdc4b96e58ba2588a4ec" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Config.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 241, + "startColumn": 21, + "charOffset": 7621, + "charLength": 3, + "snippet": { + "text": "get" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 239, + "startColumn": 1, + "charOffset": 7567, + "charLength": 190, + "snippet": { + "text": " * @return mixed|null\n */\n public function get($key, $namespace = null)\n {\n return null !== $namespace ? $this->offsetGet([$namespace => $key]) : $this->offsetGet($key);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "52f5d65d210eb163cc7f514b70e880d915de9d17e2f8e15fda2f124ef2395af0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 164, + "startColumn": 21, + "charOffset": 3697, + "charLength": 18, + "snippet": { + "text": "getRightExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 162, + "startColumn": 1, + "charOffset": 3638, + "charLength": 124, + "snippet": { + "text": " * @return AbstractBuilder\n */\n public function getRightExpression()\n {\n return $this->rightExpression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "53447de9ca13a0e5cd47374ae21106c8a53872f04bfb48259f7add54eb746f34" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1758, + "startColumn": 21, + "charOffset": 61036, + "charLength": 13, + "snippet": { + "text": "propertyIsset" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1756, + "startColumn": 1, + "charOffset": 61009, + "charLength": 106, + "snippet": { + "text": " }\n\n public function propertyIsset(Variable $var, $key)\n {\n return new CompiledExpression(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "539ba9bee1c694eebe49d9b29f904d652d8e6f284a480ce2b991af5776b36521" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonDecodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 21, + "charOffset": 802, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 729, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "54cc0d0237076f38c08859e7a702bba32929ec93c4cf75f36e903c6f7beda831" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 160, + "startColumn": 21, + "charOffset": 4177, + "charLength": 19, + "snippet": { + "text": "findThemePathByName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 158, + "startColumn": 1, + "charOffset": 4122, + "charLength": 130, + "snippet": { + "text": " * @return string|null\n */\n public function findThemePathByName($name)\n {\n // check the theme from the config" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5675abe5f8ef60bc8ffe47516b724c5e1095a9e747c8505cf8416b46dde66d94" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/RawExpression.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 56, + "startColumn": 24, + "charOffset": 980, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 54, + "startColumn": 1, + "charOffset": 928, + "charLength": 107, + "snippet": { + "text": " * @return array\n */\n protected function preBuild()\n {\n return $this->getExpression();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "58d76f4b8f333b0c31b13249e5ea4cb4b7c07ca4bc2bfd172e70c55bbbc34f92" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 84, + "startColumn": 21, + "charOffset": 1578, + "charLength": 15, + "snippet": { + "text": "isDynamicMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 82, + "startColumn": 1, + "charOffset": 1530, + "charLength": 108, + "snippet": { + "text": " * @return bool\n */\n public function isDynamicMethod()\n {\n return $this->dynamicMethod;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "59f637bbd435c252c72be4823c409203e327991278c3cb40e95d3c76ba6700cb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 21, + "charOffset": 972, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 919, + "charLength": 204, + "snippet": { + "text": " * @throws Exception\n */\n public function compile(array $expression, CompilationContext $compilationContext)\n {\n $conditions = $this->optimizeTypeOf($expression, $compilationContext);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5cd82a0d04478ede172e12655eecdfb66958e48bfb3e90cb08d2c359f5608711" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2224, + "startColumn": 22, + "charOffset": 73329, + "charLength": 16, + "snippet": { + "text": "recursiveProcess" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 2222, + "startColumn": 1, + "charOffset": 73293, + "charLength": 134, + "snippet": { + "text": " *\n */\n private function recursiveProcess($src, $dest, $pattern = null, $callback = 'copy')\n {\n $success = true;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5cf1446625e2181803710e5dabb1d61eb388af340cc678c8200e45559c18ba00" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/EvalExpression.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 86, + "startColumn": 21, + "charOffset": 1820, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 84, + "startColumn": 1, + "charOffset": 1767, + "charLength": 190, + "snippet": { + "text": " * @throws Exception\n */\n public function optimize($exprRaw, CompilationContext $compilationContext)\n {\n $conditions = $this->optimizeNot($exprRaw, $compilationContext);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5dd23809fb0c377ea0a558e4c70ed1b122893501a6fd2e20c5e7e617d7d5d546" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/RawStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 56, + "startColumn": 24, + "charOffset": 1013, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 54, + "startColumn": 1, + "charOffset": 961, + "charLength": 107, + "snippet": { + "text": " * @return array\n */\n protected function preBuild()\n {\n return $this->getExpression();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5f61c73d0ec8d19d797acba0a235d57c16e3e519e82e74b67120c53742dde259" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 73, + "startColumn": 21, + "charOffset": 1538, + "charLength": 5, + "snippet": { + "text": "parse" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 71, + "startColumn": 1, + "charOffset": 1466, + "charLength": 130, + "snippet": { + "text": " * @return Docblock the parsed docblock\n */\n public function parse()\n {\n $this->docblockObj = new Docblock();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6029db17da907fd897b30467a832094dcb6280b442c3ba52a4231c38a2d2af41" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 376, + "startColumn": 21, + "charOffset": 13018, + "charLength": 20, + "snippet": { + "text": "getLastStatementType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 374, + "startColumn": 1, + "charOffset": 12968, + "charLength": 123, + "snippet": { + "text": " * @return string\n */\n public function getLastStatementType()\n {\n return $this->lastStatement['type'];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "61c60f9318a1b6b0f31941b728c1ba0a83296e6eecb202136cf31409bd76d12b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/OperatorsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 127, + "startColumn": 21, + "charOffset": 3556, + "charLength": 3, + "snippet": { + "text": "raw" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 125, + "startColumn": 1, + "charOffset": 3501, + "charLength": 128, + "snippet": { + "text": " * @return RawOperator\n */\n public function raw(array $expression)\n {\n return new RawOperator($expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6229401d3545cb59e0a3baffc262bba00e3c7effbd89f27568629353ab432176" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/EvalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 21, + "charOffset": 913, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 860, + "charLength": 216, + "snippet": { + "text": " * @throws Exception\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters']) || count($expression['parameters']) > 1) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "639feb165c9dff46696e774ab199e03b0f6329f31b76b5d859bfc401c6556883" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 118, + "startColumn": 21, + "charOffset": 2155, + "charLength": 15, + "snippet": { + "text": "setDynamicClass" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 116, + "startColumn": 1, + "charOffset": 2092, + "charLength": 144, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setDynamicClass($dynamicClass)\n {\n $this->dynamicClass = $dynamicClass;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "652505d6c6d769b815adbbacfb4c60353760ea7fb101deb61ab83c638a190298" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsNullOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 24, + "charOffset": 511, + "charLength": 7, + "snippet": { + "text": "getType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 432, + "charLength": 120, + "snippet": { + "text": "class IsNullOptimizer extends IsTypeOptimizerAbstract\n{\n protected function getType()\n {\n return 'IS_NULL';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6577a10fc1e510761a529f25bb21714826fabe283702e1dca8b0e09bd1a26a15" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 136, + "startColumn": 21, + "charOffset": 3692, + "charLength": 12, + "snippet": { + "text": "getReflector" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 134, + "startColumn": 1, + "charOffset": 3625, + "charLength": 107, + "snippet": { + "text": " * @return ReflectionFunction|null\n */\n public function getReflector($funcName)\n {\n /*" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "66977e1b7dafc8b659dde75f435141a60a5aebbdda5cc7299ad3a9c911f6a283" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/RoundOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 21, + "charOffset": 949, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 888, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "66d6fd3c6bd7fab4a68a6ecaf1ee52d02f2a8a4d4a9eae863352741c0ff634ea" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FloorOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 866, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 805, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6765f54c430a4086232f6bed437e2ec4b30f50eac8cbdcbe870c0644479239f9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 104, + "startColumn": 21, + "charOffset": 2013, + "charLength": 12, + "snippet": { + "text": "setArguments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 102, + "startColumn": 1, + "charOffset": 1964, + "charLength": 131, + "snippet": { + "text": " * @return $this\n */\n public function setArguments(array $arguments = null)\n {\n $this->arguments = $arguments;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "68f7a07dbab24d26438d72d7613f0c890849dca2cf2fa0712b087f40376ba8bc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/OperatorsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 138, + "startColumn": 21, + "charOffset": 3801, + "charLength": 5, + "snippet": { + "text": "unary" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 136, + "startColumn": 1, + "charOffset": 3744, + "charLength": 180, + "snippet": { + "text": " * @return UnaryOperator\n */\n public function unary($operator = null, AbstractBuilder $expression = null)\n {\n return new UnaryOperator($operator, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6919deaf626532cbbc1115b4eeccc4774c2facea366d65cc14c542f5d4dbcbc7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 141, + "startColumn": 28, + "charOffset": 3750, + "charLength": 8, + "snippet": { + "text": "classUrl" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 139, + "startColumn": 1, + "charOffset": 3716, + "charLength": 73, + "snippet": { + "text": " }\n\n public static function classUrl($c)\n {\n $cname = $c;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6936abec9f12d09b4863a303471f4d9356b8d17bb2f9d7c5ddc3543109d6ad5f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ExitOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 21, + "charOffset": 842, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 781, + "charLength": 223, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (isset($expression['parameters']) && count($expression['parameters']) > 1) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6ba4176f58135c508a1073f98c0feb4949a50e10b5e6d456cf876b0ee59c660a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 126, + "startColumn": 21, + "charOffset": 2311, + "charLength": 12, + "snippet": { + "text": "setParseInfo" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 124, + "startColumn": 1, + "charOffset": 2262, + "charLength": 126, + "snippet": { + "text": " * @return $this\n */\n public function setParseInfo($file, $line, $char = null)\n {\n $this->setFile($file);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6bd93bf1d068579b84306f6fe26741fcb9a0488a807eb0bb814f544c2442a8bb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 528, + "startColumn": 24, + "charOffset": 17929, + "charLength": 10, + "snippet": { + "text": "isReadOnly" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 526, + "startColumn": 1, + "charOffset": 17865, + "charLength": 161, + "snippet": { + "text": " * @throws CompilerException\n */\n protected function isReadOnly($funcName, array $expression)\n {\n if ($this->isBuiltInFunction($funcName)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6c3391eee607158934c019f8cbb00fa823d8374d31e38396c04ec1613c216f3a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 216, + "startColumn": 21, + "charOffset": 6301, + "charLength": 13, + "snippet": { + "text": "getOutputPath" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 214, + "startColumn": 1, + "charOffset": 6274, + "charLength": 119, + "snippet": { + "text": " }\n\n public function getOutputPath($path)\n {\n $path = pathinfo($this->outputDir . '/' . $path);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6c344630d15988e8d6739f46849914fbefbe1b97897ae8ce68cc2aa0e153cf05" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 562, + "startColumn": 21, + "charOffset": 18848, + "charLength": 10, + "snippet": { + "text": "assignNull" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 560, + "startColumn": 1, + "charOffset": 18821, + "charLength": 191, + "snippet": { + "text": " }\n\n public function assignNull(Variable $variable, CompilationContext $context, $useCodePrinter = true)\n {\n $output = 'ZVAL_NULL(' . $this->getVariableCode($variable) . ');';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6c59f4dc6609af76efd60bcff28597b3a97f7128bde3af4b11ee9a68a6541177" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 130, + "startColumn": 21, + "charOffset": 2379, + "charLength": 16, + "snippet": { + "text": "setDynamicMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 128, + "startColumn": 1, + "charOffset": 2316, + "charLength": 148, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setDynamicMethod($dynamicMethod)\n {\n $this->dynamicMethod = $dynamicMethod;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6cc98b03da5b65e519ab787606a73f2b2859b9e20b4a325a56040e185725a01a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 21, + "charOffset": 1252, + "charLength": 3, + "snippet": { + "text": "get" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1152, + "charLength": 142, + "snippet": { + "text": " * Use {@link \\Zephir\\Builder\\AbstractBuilder::build()}\n */\n public function get()\n {\n return $this->build();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6ccea83951a04c5629de574335052ec757cda7c63a9289a7ff7c9b4bfe4d8d09" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FuncGetArgOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 21, + "charOffset": 932, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 871, + "charLength": 225, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters']) || 1 != count($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6e02ff6bf1ee6f75db938d2c6c2fb821bf51971abd1377018b90d22a7e589442" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/BuilderFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 31, + "startColumn": 28, + "charOffset": 680, + "charLength": 11, + "snippet": { + "text": "getInstance" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 29, + "startColumn": 1, + "charOffset": 625, + "charLength": 108, + "snippet": { + "text": " * @return self\n */\n public static function getInstance()\n {\n if (!static::$instance) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6f22c20056916eaf78fe75c207a2e192938915227619eb1295058ec3bf233e3a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/BuilderFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 79, + "startColumn": 21, + "charOffset": 1594, + "charLength": 10, + "snippet": { + "text": "statements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 77, + "startColumn": 1, + "charOffset": 1533, + "charLength": 120, + "snippet": { + "text": " * @return StatementsFactory\n */\n public function statements()\n {\n if (!$this->statementsFactory) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6f5806a59dfaaffac0b23201ff54c6a064dd5d51e359cc45bdc1ad579db9463f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/DivOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 21, + "charOffset": 857, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 776, + "charLength": 232, + "snippet": { + "text": " * @param CompilationContext $compilationContext\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n [$left, $right] = $this->preCompileChecks($expression, $compilationContext);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6f7ffadd12e1ba9c58f8a54531a67d7972d3b57e93b21d39f7264983c7d4cc69" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 21, + "charOffset": 512, + "charLength": 5, + "snippet": { + "text": "build" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 463, + "charLength": 103, + "snippet": { + "text": " * @return array\n */\n public function build()\n {\n $expression = $this->preBuild();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "710242919e613e5048536434242f64cd3c41db3cc5a4a14cd96d1012b12792ed" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/ArrayType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 93, + "startColumn": 21, + "charOffset": 2975, + "charLength": 4, + "snippet": { + "text": "join" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 91, + "startColumn": 1, + "charOffset": 2922, + "charLength": 211, + "snippet": { + "text": " * @throws Exception\n */\n public function join($caller, CompilationContext $compilationContext, Call $call, array $expression)\n {\n $functionCall = BuilderFactory::getInstance()->statements()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "74e3efc69c647aee3bf2e6d0309a01c1d321ae42a3f901f29b10e101923b3e75" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 148, + "startColumn": 21, + "charOffset": 3442, + "charLength": 17, + "snippet": { + "text": "getLeftExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 146, + "startColumn": 1, + "charOffset": 3383, + "charLength": 122, + "snippet": { + "text": " * @return AbstractBuilder\n */\n public function getLeftExpression()\n {\n return $this->leftExpression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "759ac709b93bb685cd80d0e23a1a880dcc53560d26743a45456c09e01c3ba4d9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 366, + "startColumn": 21, + "charOffset": 12828, + "charLength": 16, + "snippet": { + "text": "getLastStatement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 364, + "startColumn": 1, + "charOffset": 12774, + "charLength": 115, + "snippet": { + "text": " * @return array|null\n */\n public function getLastStatement()\n {\n return $this->lastStatement;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "75e296bd7cffccfde2b81be5c66a97697d560c0ab57eec19e97b170fe3eaabba" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 70, + "startColumn": 21, + "charOffset": 1514, + "charLength": 17, + "snippet": { + "text": "getElseStatements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 68, + "startColumn": 1, + "charOffset": 1455, + "charLength": 122, + "snippet": { + "text": " * @return StatementsBlock\n */\n public function getElseStatements()\n {\n return $this->elseStatements;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "782326024d540694c188d99e849e83c15d57cfc20d1b4e3d7b332f4cafd0440c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 165, + "startColumn": 21, + "charOffset": 4580, + "charLength": 17, + "snippet": { + "text": "isBuiltInFunction" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 163, + "startColumn": 1, + "charOffset": 4532, + "charLength": 132, + "snippet": { + "text": " * @return bool\n */\n public function isBuiltInFunction(string $functionName)\n {\n return match ($functionName) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "790852c9ad70a0f1f36ce64ee1b571b934570e5fffe028c9bd620e8ea87ed976" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsResourceOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 24, + "charOffset": 519, + "charLength": 7, + "snippet": { + "text": "getType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 436, + "charLength": 128, + "snippet": { + "text": "class IsResourceOptimizer extends IsTypeOptimizerAbstract\n{\n protected function getType()\n {\n return 'IS_RESOURCE';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7ae6de722b2655456381309c36d92c1da9bd41bff08e8eaf255cc3887f20f47b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 21, + "charOffset": 1010, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 948, + "charLength": 167, + "snippet": { + "text": " * @return CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n $propertyAccess = $expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7c03ae8d1770d36c332ae069022e18c9cc0a12c707baf9df7e19c086f921922a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrtokOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 875, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 814, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7ef086a5bef63651769ffaa6030ae75af04fcf3ffc3fb3956be16846838535dd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 73, + "startColumn": 21, + "charOffset": 1954, + "charLength": 3, + "snippet": { + "text": "let" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 71, + "startColumn": 1, + "charOffset": 1898, + "charLength": 139, + "snippet": { + "text": " * @return LetStatement\n */\n public function let(array $assignments = null)\n {\n return new LetStatement($assignments);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8173c13403e746c5bf643be2beb0529bce8e31f28d6828b20850f4129231acfd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StripslashesOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 21, + "charOffset": 948, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 887, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "81a63fb28d37b08432a75d2fb5259183fffd9178a74034dff62b5c72f56c4888" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/AssignVariableOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 71, + "startColumn": 21, + "charOffset": 1608, + "charLength": 13, + "snippet": { + "text": "getExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 69, + "startColumn": 1, + "charOffset": 1559, + "charLength": 104, + "snippet": { + "text": " * @return mixed\n */\n public function getExpression()\n {\n return $this->expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "81c17ba23c15f00417c371ba2d671188bd15dbf31f46e6c87233853e1880b841" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Branch.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 21, + "charOffset": 1773, + "charLength": 11, + "snippet": { + "text": "getUniqueId" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 1724, + "charLength": 100, + "snippet": { + "text": " * @return mixed\n */\n public function getUniqueId()\n {\n return $this->uniqueId;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "81c905dd5aba2b1767cb4d08624630db15d432a9420b369beb6d2d1004c44b55" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 103, + "startColumn": 21, + "charOffset": 2732, + "charLength": 14, + "snippet": { + "text": "functionExists" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 101, + "startColumn": 1, + "charOffset": 2684, + "charLength": 158, + "snippet": { + "text": " * @return bool\n */\n public function functionExists($functionName, CompilationContext $context)\n {\n if (function_exists($functionName)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "81da348bf0244c6d428a7401b183628094b9cc354e9f8af5bdb325979cf97143" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 21, + "charOffset": 922, + "charLength": 14, + "snippet": { + "text": "getAssignments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 873, + "charLength": 106, + "snippet": { + "text": " * @return mixed\n */\n public function getAssignments()\n {\n return $this->assignments;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "820e7fdebd9bfe972e4b985bb27c3c3ce9efbd58f8ff15781eab5ca6b03d774c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArray.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 467, + "startColumn": 21, + "charOffset": 20558, + "charLength": 13, + "snippet": { + "text": "getArrayValue" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 465, + "startColumn": 1, + "charOffset": 20491, + "charLength": 170, + "snippet": { + "text": " * @return GlobalConstant|Variable\n */\n public function getArrayValue(\n CompiledExpression $exprCompiled,\n CompilationContext $compilationContext" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "824c666f44ec8fe716c6db9b728abfc3220d0e90b68713c8d9323e991e7edc63" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 256, + "startColumn": 22, + "charOffset": 6958, + "charLength": 19, + "snippet": { + "text": "findOutputDirectory" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 254, + "startColumn": 1, + "charOffset": 6902, + "charLength": 183, + "snippet": { + "text": " * @return string|null\n */\n private function findOutputDirectory($outputDir)\n {\n $outputDir = str_replace('%version%', $this->config->get('version'), $outputDir);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "833262b4281172f267832618372329040885b5101f3f10d975259396203b6257" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 21, + "charOffset": 1228, + "charLength": 12, + "snippet": { + "text": "functionCall" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 1163, + "charLength": 228, + "snippet": { + "text": " * @return CallFunctionStatement\n */\n public function functionCall($name, $parameters = null, $type = CallFunctionStatement::TYPE_CALL_DIRECT)\n {\n return new CallFunctionStatement($name, $parameters, $type);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8396535ba3d84550e8629448c90890295d0775574cfc11ca3d33ad9703018c28" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 814, + "startColumn": 21, + "charOffset": 29366, + "charLength": 12, + "snippet": { + "text": "getVariables" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 812, + "startColumn": 1, + "charOffset": 29312, + "charLength": 93, + "snippet": { + "text": " * @return Variable[]\n */\n public function getVariables()\n {\n $ret = [];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "85694a8758c1407887ad82e5a962fe281e195e78752b31e147c0129a93b09167" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/RawOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 681, + "charLength": 13, + "snippet": { + "text": "getExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 632, + "charLength": 104, + "snippet": { + "text": " * @return array\n */\n public function getExpression()\n {\n return $this->expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "868d7ee90c07adf900146734502598d54d9280a917a7a19d9f3bcc0a0abda220" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 86, + "startColumn": 21, + "charOffset": 1748, + "charLength": 7, + "snippet": { + "text": "getName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 84, + "startColumn": 1, + "charOffset": 1698, + "charLength": 93, + "snippet": { + "text": " * @return string\n */\n public function getName()\n {\n return $this->name;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "87c7bba195b4bc563e9fb108e1802b45de77ec7a64d27ba7b649501aa3cebfb2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/UnaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 125, + "startColumn": 24, + "charOffset": 2511, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 123, + "startColumn": 1, + "charOffset": 2459, + "charLength": 85, + "snippet": { + "text": " * {@inheritdoc}\n */\n protected function preBuild()\n {\n return [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "884e56c170756262b68799c5a98cd51c0204d6f849f2e684c53e21b465e72779" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 988, + "startColumn": 21, + "charOffset": 34407, + "charLength": 11, + "snippet": { + "text": "fetchGlobal" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 986, + "startColumn": 1, + "charOffset": 34380, + "charLength": 170, + "snippet": { + "text": " }\n\n public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true)\n {\n $name = $globalVar->getName();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "88a228f2f6efa6455f6d9591424b5b86244542a6fe65e37ab4e483c5ad98bdb9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PregMatchOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 178, + "startColumn": 22, + "charOffset": 5505, + "charLength": 16, + "snippet": { + "text": "processOptionals" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 176, + "startColumn": 1, + "charOffset": 5443, + "charLength": 169, + "snippet": { + "text": " * @throws CompilerException\n */\n private function processOptionals(array &$expression, Call $call, CompilationContext $context)\n {\n $flags = null;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "898fc6ee15025a7f4cef5be4a3a6e660cdf3d8f53da95939b75b6ed2a15969c5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 290, + "startColumn": 21, + "charOffset": 8107, + "charLength": 24, + "snippet": { + "text": "getThemePathExtendsAware" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 288, + "startColumn": 1, + "charOffset": 8057, + "charLength": 134, + "snippet": { + "text": " * @return string\n */\n public function getThemePathExtendsAware($path)\n {\n $newPath = $this->getThemePath($path);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8a173f16fb4c985681f231d480ad61e837cc673cfe64aec502e0b1a941226ff6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/RawExpression.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 681, + "charLength": 13, + "snippet": { + "text": "getExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 632, + "charLength": 104, + "snippet": { + "text": " * @return mixed\n */\n public function getExpression()\n {\n return $this->expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8b13f5fd26540079d3d4655c2a4c5e9537f33f11e2ee359faacd0875e0bd000a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/BuilderFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 71, + "startColumn": 21, + "charOffset": 1448, + "charLength": 3, + "snippet": { + "text": "raw" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 69, + "startColumn": 1, + "charOffset": 1391, + "charLength": 126, + "snippet": { + "text": " * @return RawExpression\n */\n public function raw($expression)\n {\n return new RawExpression($expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8ba780c085cd33f128fc2542529cb3cfc8a20ff272edd57822bbbcad39a23e32" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler/FileInterface.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 723, + "charLength": 10, + "snippet": { + "text": "isExternal" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 675, + "charLength": 70, + "snippet": { + "text": " * @return bool\n */\n public function isExternal();\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8c4318b5dcaf16d450a025b80e4237704a8937228fe49f2439794ef641021d78" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 103, + "startColumn": 24, + "charOffset": 2981, + "charLength": 15, + "snippet": { + "text": "passNativeFCall" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 101, + "startColumn": 1, + "charOffset": 2916, + "charLength": 159, + "snippet": { + "text": " * @return CompiledExpression\n */\n protected function passNativeFCall($compiledExpression, $expression)\n {\n return new CompiledExpression(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8cab31eb7ff7b43d498ff43c18c0310ed412cf8fa159b72159447acd55e10e60" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/CharType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 21, + "charOffset": 1003, + "charLength": 5, + "snippet": { + "text": "toHex" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 950, + "charLength": 199, + "snippet": { + "text": " * @throws Exception\n */\n public function toHex($caller, CompilationContext $compilationContext, Call $call, array $expression)\n {\n $exprBuilder = BuilderFactory::getInstance();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8e26dffac5fc5cc8aa61de1178eb2582bb8560131759497f14cf95e3a9932d93" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/EndsWithOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 909, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 836, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8f38a08265575a81c7932741a7169dfad4022670017d9ca51f6fdeef9f302deb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/UnaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 85, + "startColumn": 21, + "charOffset": 1862, + "charLength": 13, + "snippet": { + "text": "getExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 83, + "startColumn": 1, + "charOffset": 1813, + "charLength": 104, + "snippet": { + "text": " * @return mixed\n */\n public function getExpression()\n {\n return $this->expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8f6f77ee6d44ed616ff84c007435068394d1b7689a95b395ab658b4e09579fbf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 24, + "charOffset": 1412, + "charLength": 7, + "snippet": { + "text": "execute" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1382, + "charLength": 140, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9288b345c1eaa266c562ac9609a747c7199c39e34e62d9f5fa23ae7d5bea643e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 112, + "startColumn": 21, + "charOffset": 2290, + "charLength": 13, + "snippet": { + "text": "setStatements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 110, + "startColumn": 1, + "charOffset": 2241, + "charLength": 138, + "snippet": { + "text": " * @return $this\n */\n public function setStatements(StatementsBlock $statements)\n {\n $this->statements = $statements;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "93040d3063c40a93ef880be02ea0057f6129a6d1c46ad213dd0cb688cd5a9b65" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallMethodStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 21, + "charOffset": 960, + "charLength": 11, + "snippet": { + "text": "getVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 911, + "charLength": 100, + "snippet": { + "text": " * @return mixed\n */\n public function getVariable()\n {\n return $this->variable;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "931757c5ed624420189d1055fb860a3c1f3e7c1b0a9b3afc701e2f933242bd31" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 189, + "startColumn": 28, + "charOffset": 4859, + "charLength": 12, + "snippet": { + "text": "namespaceUrl" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 187, + "startColumn": 1, + "charOffset": 4825, + "charLength": 127, + "snippet": { + "text": " }\n\n public static function namespaceUrl($ns)\n {\n return '/namespace/' . str_replace('\\\\', '/', $ns) . '.html';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "936f939c6e46f86209986096e086c6afb764015b268225a3d9d4651ec5e1367c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/AssignVariableOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 79, + "startColumn": 21, + "charOffset": 1729, + "charLength": 11, + "snippet": { + "text": "getOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 77, + "startColumn": 1, + "charOffset": 1679, + "charLength": 101, + "snippet": { + "text": " * @return string\n */\n public function getOperator()\n {\n return $this->operator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "95c5702345586ed19701f0a87ab85a2fd019112db154c2bca8f952184d5f5e46" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 62, + "startColumn": 21, + "charOffset": 1386, + "charLength": 12, + "snippet": { + "text": "getCondition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 60, + "startColumn": 1, + "charOffset": 1326, + "charLength": 113, + "snippet": { + "text": " * @return AbstractOperator\n */\n public function getCondition()\n {\n return $this->condition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9671ee8a4785ea9ba2eb256f43453c3814f706dafc3868d093d5bcf50d10dd15" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 83, + "startColumn": 21, + "charOffset": 2014, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 81, + "startColumn": 1, + "charOffset": 1943, + "charLength": 177, + "snippet": { + "text": " * @throws CompilerException|Exception\n */\n public function compile(Expression $expr, CompilationContext $compilationContext)\n {\n $this->expression = $expr;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "97b3f49931aa46c911921129878fcae3870d584c5a2c9c8e34ab5c8401fd67fa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 837, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 770, + "charLength": 211, + "snippet": { + "text": " * @return bool|CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n $this->checkLeft($expression, CompilerException::class, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "97f92e2324b830bae8e64c546244884d7b3e8db32a6bf0eced661d523ad8b888" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 106, + "startColumn": 21, + "charOffset": 1960, + "charLength": 8, + "snippet": { + "text": "setClass" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 104, + "startColumn": 1, + "charOffset": 1897, + "charLength": 116, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setClass($class)\n {\n $this->class = $class;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "98194bc6672c61ca51e03e617aa2381a2a3e3c664efeaa611ad374c96f3891b4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsNumericOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 21, + "charOffset": 799, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 726, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "998526f7dfc4ef94f43402e703bdb699920813cbda5d516e9eb58d46934efa24" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CallUserFuncOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 887, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 814, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9a254c6562e3cca59ef64bc3dbb7987645733fe43acf6cdc3e545c64c26c602f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/UnaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 93, + "startColumn": 21, + "charOffset": 1982, + "charLength": 11, + "snippet": { + "text": "getOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 91, + "startColumn": 1, + "charOffset": 1933, + "charLength": 100, + "snippet": { + "text": " * @return mixed\n */\n public function getOperator()\n {\n return $this->operator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9a29aa1693ae3e4f63ceeda884dec717e094ccf3c3692512bc24fd099c372558" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 303, + "startColumn": 21, + "charOffset": 8978, + "charLength": 11, + "snippet": { + "text": "arrayIsset2" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 301, + "startColumn": 1, + "charOffset": 8951, + "charLength": 168, + "snippet": { + "text": " }\n\n public function arrayIsset2(Variable $var, $resolvedExpr, $expression, CompilationContext $context)\n {\n if (!($resolvedExpr instanceof Variable)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9a4742640b6ae4586e04f51ff030d0e1a77933e18b2c9e89270296bcddb21937" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArrayAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 21, + "charOffset": 1026, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 963, + "charLength": 141, + "snippet": { + "text": " * @throws ReflectionException\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9ac10f7b2613cb625084a99a17877fa05aedc1828fc3451c77c9ca933ad830a3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/UnaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 103, + "startColumn": 21, + "charOffset": 2147, + "charLength": 13, + "snippet": { + "text": "setExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 101, + "startColumn": 1, + "charOffset": 2098, + "charLength": 138, + "snippet": { + "text": " * @return $this\n */\n public function setExpression(AbstractBuilder $expression)\n {\n $this->expression = $expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9b1ed4203e8fa8675d3215fa01a0d1e7a5a07329ee6100318012c658139a2115" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 157, + "startColumn": 21, + "charOffset": 4777, + "charLength": 15, + "snippet": { + "text": "getCompiledFile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 155, + "startColumn": 1, + "charOffset": 4727, + "charLength": 109, + "snippet": { + "text": " * @return string\n */\n public function getCompiledFile()\n {\n return $this->compiledFile;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9bc1a03cd69d96b96f8c754c507bc243b75b957c7d692345723a5a5a5f39cdbf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 21, + "charOffset": 1043, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 981, + "charLength": 167, + "snippet": { + "text": " * @return CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n $propertyAccess = $expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9bf4d25e85d8ffd66d46caec86ce0e3d8079de89a40de8af0c6a4fa6a3595a83" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 68, + "startColumn": 24, + "charOffset": 1252, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 66, + "startColumn": 1, + "charOffset": 1200, + "charLength": 85, + "snippet": { + "text": " * {@inheritdoc}\n */\n protected function preBuild()\n {\n return [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9d080a6a9c6dc40c0f8149632fa0e5ff8e4b7457e6a90a09062af9e1c98bfa6a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 21, + "charOffset": 1616, + "charLength": 3, + "snippet": { + "text": "ifX" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1561, + "charLength": 147, + "snippet": { + "text": " * @return IfStatement\n */\n public function ifX(\n AbstractOperator $condition = null,\n StatementsBlock $statements = null," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9d2b43b27fa26f7aded1e55fc93bbef1ddc7b9a41969221212fc8b8458612942" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/UniquePathKeyOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 892, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 831, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9e585d056afd800ba4e71d51e7f7521c2dc1ea7428e2d21340b83853b444f3ab" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 68, + "startColumn": 21, + "charOffset": 1242, + "charLength": 13, + "snippet": { + "text": "setStatements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 66, + "startColumn": 1, + "charOffset": 1193, + "charLength": 122, + "snippet": { + "text": " * @return $this\n */\n public function setStatements($statements)\n {\n $this->statements = $statements;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9fc04144de1b98ea95d9bd655083baf42fbf82f8de7c9cfd9cf1f5e6f8467e3c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallMethodStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 21, + "charOffset": 1107, + "charLength": 11, + "snippet": { + "text": "setVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1058, + "charLength": 114, + "snippet": { + "text": " * @return $this\n */\n public function setVariable($variable)\n {\n $this->variable = $variable;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a10c67a62f89b99ed4205f0608bff01988cb5b6ce1b7e48c3e0d84b09ebb1a64" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 208, + "startColumn": 24, + "charOffset": 4545, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 206, + "startColumn": 1, + "charOffset": 4493, + "charLength": 85, + "snippet": { + "text": " * {@inheritdoc}\n */\n protected function preBuild()\n {\n return [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a665b08f663beb1405dce4de4f61687722b2828f74215412929730ac59648941" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CeilOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 863, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 802, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a7193b56815af596f973f62e5495996cef8f83ea27292e9e97b91885c3a35960" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/BasenameOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 43, + "startColumn": 21, + "charOffset": 946, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 41, + "startColumn": 1, + "charOffset": 893, + "charLength": 176, + "snippet": { + "text": " * @throws Exception\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a7792cefd7f608d2ad13be109d01832ef429d08c055afb195f7ab14916baf99e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 69, + "startColumn": 21, + "charOffset": 1465, + "charLength": 5, + "snippet": { + "text": "parse" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 67, + "startColumn": 1, + "charOffset": 1438, + "charLength": 91, + "snippet": { + "text": " }\n\n public function parse()\n {\n foreach ($this->data as $name => $value) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a896733ed1940c2a5d57546f0ae013798353ab497002b850feea1fc60d09a99f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 284, + "startColumn": 22, + "charOffset": 7969, + "charLength": 18, + "snippet": { + "text": "findThemeDirectory" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 282, + "startColumn": 1, + "charOffset": 7909, + "charLength": 179, + "snippet": { + "text": " * @throws ConfigException\n */\n private function findThemeDirectory($themeConfig, $path = null)\n {\n // check if there are additional theme paths in the config" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a8ff7bdbb81a48b044d41e6cf22af8876b13d0be047b65f5c6d122f52a52877b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1651, + "startColumn": 21, + "charOffset": 57439, + "charLength": 10, + "snippet": { + "text": "initObject" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1649, + "startColumn": 1, + "charOffset": 57412, + "charLength": 182, + "snippet": { + "text": " }\n\n public function initObject(Variable $variable, $ce, CompilationContext $context, $useCodePrinter = true)\n {\n $variableAccess = $this->getVariableCode($variable);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a93064f5cea6f6dc892012df80e3edaaf0820228c5302bbdf688075363bb79a7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/EvalExpression.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 43, + "startColumn": 21, + "charOffset": 974, + "charLength": 15, + "snippet": { + "text": "getEvalVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 41, + "startColumn": 1, + "charOffset": 922, + "charLength": 117, + "snippet": { + "text": " * @return Variable\n */\n public function getEvalVariable()\n {\n return end($this->usedVariables);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aa922f6de259fd78a53fcdd82736af8f0e1290d959042df06e9954b845b50a94" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Annotation/Link.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 761, + "charLength": 6, + "snippet": { + "text": "getUri" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 734, + "charLength": 78, + "snippet": { + "text": " }\n\n public function getUri()\n {\n if (!$this->contentParsed) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aba0d69b7755f5c6bb599e7727932cd56c83f0501e79c23f2e0152bebeb00c96" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 955, + "charLength": 5, + "snippet": { + "text": "block" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 896, + "charLength": 145, + "snippet": { + "text": " * @return StatementsBlock\n */\n public function block(array $statements = null)\n {\n return new StatementsBlock($statements);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b292de7f326eda3df5897771bae63017a5be2c2d5d045031030cf1f659f4ef79" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateInstanceOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 43, + "startColumn": 21, + "charOffset": 1034, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 41, + "startColumn": 1, + "charOffset": 973, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b2ec91b1920ef7f1c9ba4268b611fe93ad489a285cb7c5171b17a9a6ab7b3bbd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 24, + "charOffset": 2459, + "charLength": 7, + "snippet": { + "text": "execute" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 2429, + "charLength": 123, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $options = array_merge(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b30e3c8cf62d61e72d3a8efdba6ad6e40866ae400f7fa7e3cf4d1c14824fe0ac" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 487, + "startColumn": 21, + "charOffset": 15099, + "charLength": 11, + "snippet": { + "text": "getVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 485, + "startColumn": 1, + "charOffset": 15042, + "charLength": 196, + "snippet": { + "text": " * @return bool|Variable\n */\n public function getVariable($name, CompilationContext $compilationContext = null)\n {\n /* Check if the variable already is referencing a branch */" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b3af69a66b80ebe52dda96f8219577b8784038632deb526d4f2e97c294050a93" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 711, + "startColumn": 21, + "charOffset": 25611, + "charLength": 20, + "snippet": { + "text": "getVariableForUpdate" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 709, + "startColumn": 1, + "charOffset": 25559, + "charLength": 169, + "snippet": { + "text": " * @return Variable\n */\n public function getVariableForUpdate(string $name, CompilationContext $compilationContext, array $statement = null)\n {\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b3ba31da7b01169dd129572ee45499259f250c4875ce82667f6d6acfed9af9c9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 142, + "startColumn": 21, + "charOffset": 2601, + "charLength": 9, + "snippet": { + "text": "setMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 140, + "startColumn": 1, + "charOffset": 2538, + "charLength": 120, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setMethod($method)\n {\n $this->method = $method;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b3eff7cf0dcbbdf59a25004a2af5612f7fdc815bc70479623f1652959b65ddaa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 122, + "startColumn": 24, + "charOffset": 2470, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 120, + "startColumn": 1, + "charOffset": 2418, + "charLength": 92, + "snippet": { + "text": " * {@inheritdoc}\n */\n protected function preBuild()\n {\n $expression = [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b4cf7486afaf79b4ff708b9501fe427cf4df6145f0063d7681fa6ee89a990c9d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/TimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 21, + "charOffset": 842, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 781, + "charLength": 183, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b54977ed933d166eed9c1af61167c517359d93685f974f462e346ea6a70b540a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallMethodStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 65, + "startColumn": 24, + "charOffset": 1263, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 63, + "startColumn": 1, + "charOffset": 1211, + "charLength": 122, + "snippet": { + "text": " * @return array\n */\n protected function preBuild()\n {\n $expression = parent::preBuild();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b610c53f82fc7a227131149d24c87f73d9c0b2a66715e9c5216fd00e92382822" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 24, + "charOffset": 1714, + "charLength": 7, + "snippet": { + "text": "execute" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1684, + "charLength": 140, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b6b29b50c9fad361a4783304e5dc089bcafe5c0acc935064b01c01abcfc67b01" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FilePutContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 898, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 837, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b9d52792e6d4e536691e84c9b4fc5c659a53a7d2e4a2619e7af7ad4705929209" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/StaticTypeInference.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 21, + "charOffset": 1427, + "charLength": 14, + "snippet": { + "text": "getInferedType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 1379, + "charLength": 129, + "snippet": { + "text": " * @return bool\n */\n public function getInferedType($variable)\n {\n if (isset($this->variables[$variable])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "badba27b16eabdd328f9c00d34637e9ce0ef09701b19d663cfda134e91ad30eb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 748, + "startColumn": 21, + "charOffset": 35710, + "charLength": 23, + "snippet": { + "text": "optimizeConstantFolding" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 746, + "startColumn": 1, + "charOffset": 35643, + "charLength": 250, + "snippet": { + "text": " * @return bool|CompiledExpression\n */\n public function optimizeConstantFolding(array $expression, CompilationContext $compilationContext)\n {\n if ('int' != $expression['left']['type'] && 'double' != $expression['left']['type']) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bbbf105d6fec01b1281c41486d798d5f543f78a16dae32d90ccccb09991e8aae" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/OperatorsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 98, + "startColumn": 21, + "charOffset": 2873, + "charLength": 4, + "snippet": { + "text": "cast" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 96, + "startColumn": 1, + "charOffset": 2818, + "charLength": 129, + "snippet": { + "text": " * @return RawOperator\n */\n public function cast($type, AbstractBuilder $expression)\n {\n return $this->raw([" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bc8c568a1bb1c189e2e3abedbd33c973d8cf4dc100b63e299c9fdffaed45c177" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsScalarOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 21, + "charOffset": 856, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 783, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bdf512a34dd2969714c7b6fd15695e0489fe750cf7c8c696d086e6d0084f5535" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 21, + "charOffset": 758, + "charLength": 13, + "snippet": { + "text": "addAssignment" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 709, + "charLength": 125, + "snippet": { + "text": " * @return $this\n */\n public function addAssignment($assignment)\n {\n $this->assignments[] = $assignment;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bfa378fb7174e434bbc189d900fc9bce0effa6cf0eab253bc47698f10a5aefb3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetNsClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 883, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 822, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bfe441f603e6bc473bfaf03e30dc0e2ad736f1891c5bf1aa19ddc5690cdbe251" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/LdexpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 21, + "charOffset": 905, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 844, + "charLength": 225, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters']) || 2 != count($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c113111365b45eead3f6511c075dc8b1a85cfe9fa3b5d273b6f8149238719fcc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 21, + "charOffset": 1724, + "charLength": 7, + "snippet": { + "text": "setChar" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 1665, + "charLength": 108, + "snippet": { + "text": " * @return AbstractBuilder\n */\n public function setChar($char)\n {\n $this->char = $char;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c1ae96651d3af153b4ea5456429a79534822aeb358e2418f2dac7bf22b45afea" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 337, + "startColumn": 22, + "charOffset": 9885, + "charLength": 19, + "snippet": { + "text": "prepareThemeOptions" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 335, + "startColumn": 1, + "charOffset": 9831, + "charLength": 141, + "snippet": { + "text": " * @throws Exception\n */\n private function prepareThemeOptions($themeConfig, $options = null)\n {\n $parsedOptions = null;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c1d33cd80b489c8742e160d84ee88a52dbfa6c7a9bf79c96b1aca8f2d2bc2899" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/RawExpression.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 21, + "charOffset": 828, + "charLength": 13, + "snippet": { + "text": "setExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 779, + "charLength": 110, + "snippet": { + "text": " * @return $this\n */\n public function setExpression($expr)\n {\n $this->expression = $expr;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c1eb77e5f74faeeb23921fd33770de8f2ce099c7b0bf4b199750cf67927fedb2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 21, + "charOffset": 946, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 885, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c331bdef14583bb61db5c8bb3352715d6f6f7434cdf4ba8e774092619cf2a16e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 21, + "charOffset": 858, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 805, + "charLength": 176, + "snippet": { + "text": " * @throws Exception\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c38c176bc5079abf734bc177ac85c790a49054b0365f863c5af6ed35a59de0c2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 876, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 815, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c39728174a6de1cad53bc6767e48283733688f9eaa16f3399a17d22d12661877" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FunctionExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 800, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 727, + "charLength": 238, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters']) || 1 !== count($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c510c02aa7bcaa0d0b340fa119a77e482fe46288176cbb7294cc9f25c3992ad6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 82, + "startColumn": 21, + "charOffset": 1757, + "charLength": 7, + "snippet": { + "text": "partial" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 80, + "startColumn": 1, + "charOffset": 1730, + "charLength": 120, + "snippet": { + "text": " }\n\n public function partial(string $fileName, array $data = [])\n {\n $newLevel = $this->nestedLevel + 1;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c70bc23e37276ebde6177bb611c51cf0ae43712b8afca14fc31a05c8fe1c66f3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/AssignVariableOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 109, + "startColumn": 21, + "charOffset": 2194, + "charLength": 11, + "snippet": { + "text": "setVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 107, + "startColumn": 1, + "charOffset": 2145, + "charLength": 114, + "snippet": { + "text": " * @return $this\n */\n public function setVariable($variable)\n {\n $this->variable = $variable;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c85219fb9c34dac9addd1595705695eabf587053ea9d765ca1892692d98d456c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 284, + "startColumn": 21, + "charOffset": 8317, + "charLength": 10, + "snippet": { + "text": "arrayIsset" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 282, + "startColumn": 1, + "charOffset": 8290, + "charLength": 167, + "snippet": { + "text": " }\n\n public function arrayIsset(Variable $var, $resolvedExpr, $expression, CompilationContext $context)\n {\n if (!($resolvedExpr instanceof Variable)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c90b898e5b5bb06d364b070c4b17f3a72beecbf1117a781c95995d21bc2fc65d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 141, + "startColumn": 33, + "charOffset": 2595, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 139, + "startColumn": 1, + "charOffset": 2534, + "charLength": 81, + "snippet": { + "text": " * @return array\n */\n abstract protected function preBuild();\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c978ff3383d6b888765b51a9f074ee2efcf85a0a613ba691dbf779368d4656a9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/BuilderFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 21, + "charOffset": 955, + "charLength": 7, + "snippet": { + "text": "literal" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 898, + "charLength": 120, + "snippet": { + "text": " * @return RawExpression\n */\n public function literal($type, $value = null)\n {\n return $this->raw([" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ca24379e85ffe4c6cbca36e1017e170b7a4e24240e89be3ab174de78f77f27f8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 661, + "startColumn": 24, + "charOffset": 22813, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 659, + "startColumn": 1, + "charOffset": 22757, + "charLength": 180, + "snippet": { + "text": " * @throws Exception\n */\n protected function optimize($funcName, array $expression, Call $call, CompilationContext $compilationContext)\n {\n $optimizer = false;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cf24aec99507df22fec73681dca50cfe6fd7710fafc5f522e8a71d792999ebd2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 385, + "startColumn": 21, + "charOffset": 11732, + "charLength": 25, + "snippet": { + "text": "getTempVariableForObserve" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 383, + "startColumn": 1, + "charOffset": 11680, + "charLength": 183, + "snippet": { + "text": " * @return Variable\n */\n public function getTempVariableForObserve($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'observe');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cfe476f8f257e4e3ad064ef4828e41b51fe6244107c1d8fa12c49a4f32c7a42d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 59, + "startColumn": 24, + "charOffset": 1519, + "charLength": 7, + "snippet": { + "text": "execute" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 57, + "startColumn": 1, + "charOffset": 1489, + "charLength": 140, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d0012b3999cc7ae35cc98f2d15bcca22001b36977d2fae512b8a209d195502a6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Docblock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 142, + "startColumn": 21, + "charOffset": 2933, + "charLength": 14, + "snippet": { + "text": "setDescription" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 140, + "startColumn": 1, + "charOffset": 2871, + "charLength": 146, + "snippet": { + "text": " * @param string $description\n */\n public function setDescription(string $description)\n {\n $this->description = $description;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d111848e1983cae1d7c9c860a333cb10623ca385666475296b56ba79078af6ab" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 888, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 827, + "charLength": 183, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d1c670cf84416ea987569e0982171b30128981ed2192929281825e26a74c8ab7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 21, + "charOffset": 1123, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 1062, + "charLength": 205, + "snippet": { + "text": " * @throws CompilerException\n */\n public function compile($expression, CompilationContext $compilationContext)\n {\n $this->checkLeft($expression, CompilerException::class, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d2369ae88d24c58c0a41372cc334b15b54bd731e69e98dd12db252e6a1b3f845" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ImplodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 21, + "charOffset": 865, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 804, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d2983985b3e2d74872da94fc562673bb1326bef0b498808c1e8d47651f89238c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 328, + "startColumn": 21, + "charOffset": 9970, + "charLength": 25, + "snippet": { + "text": "getTempNonTrackedVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 326, + "startColumn": 1, + "charOffset": 9918, + "charLength": 215, + "snippet": { + "text": " * @return Variable\n */\n public function getTempNonTrackedVariable($type, CompilationContext $context, $initNonReferenced = false)\n {\n $variable = $this->reuseTempVariable($type, 'non-tracked');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d44d4b30201089396193d9a2169e04d973eb2919b6823d93c4c6858233748db1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ClassExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 885, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 824, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d45d94681daa73dc4c9db194923f7d4bd74709c5bafaa0405f95822a75429833" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 552, + "startColumn": 21, + "charOffset": 18356, + "charLength": 12, + "snippet": { + "text": "assignDouble" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 550, + "startColumn": 1, + "charOffset": 18329, + "charLength": 247, + "snippet": { + "text": " }\n\n public function assignDouble(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true)\n {\n return $this->assignHelper('ZVAL_DOUBLE', $this->getVariableCode($variable), $value, $context, $useCodePrinter);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d480a1c3202a67c4f7e53c3b81554842d8b701086c937983b86aeef87949bfae" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/BuilderFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 93, + "startColumn": 21, + "charOffset": 1874, + "charLength": 8, + "snippet": { + "text": "variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 91, + "startColumn": 1, + "charOffset": 1817, + "charLength": 106, + "snippet": { + "text": " * @return RawExpression\n */\n public function variable($name)\n {\n return $this->raw([" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d7130b4c73699a211a459eed5f898502b6de80939fe879f862a3fdd0155424ee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 520, + "startColumn": 21, + "charOffset": 16333, + "charLength": 18, + "snippet": { + "text": "getVariableForRead" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 518, + "startColumn": 1, + "charOffset": 16272, + "charLength": 176, + "snippet": { + "text": " * @throws CompilerException\n */\n public function getVariableForRead($name, CompilationContext $compilationContext = null, array $statement = null)\n {\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d8718d945d68e6aea6710b63e3328ec2c7c33c953a63282686bc500a03af4ec4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/AddslashesOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 21, + "charOffset": 843, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 790, + "charLength": 176, + "snippet": { + "text": " * @throws Exception\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "daa0016724d662f69763f2df55ac64e28ede950a750d3c1a9efe49bc17e989f3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PowOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 21, + "charOffset": 911, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 850, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "daa2bc761c2c4bc4700d90df91d35c324ca0a44d90530e84935f3f35d648245a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/AssignVariableOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 97, + "startColumn": 21, + "charOffset": 1995, + "charLength": 13, + "snippet": { + "text": "setExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 95, + "startColumn": 1, + "charOffset": 1946, + "charLength": 122, + "snippet": { + "text": " * @return $this\n */\n public function setExpression($expression)\n {\n $this->expression = $expression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dbbf85e118b4a3f176554fe2f3a5158ad4fbce9cbe7025592d1cd502450f7648" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/BinaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 198, + "startColumn": 21, + "charOffset": 4345, + "charLength": 18, + "snippet": { + "text": "setRightExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 196, + "startColumn": 1, + "charOffset": 4287, + "charLength": 167, + "snippet": { + "text": " * @return BinaryOperator\n */\n public function setRightExpression(AbstractBuilder $rightExpression)\n {\n $this->rightExpression = $rightExpression;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dd499f6a68aaa140b40b635d560b86910d9d6f196c0a2b18973de0b0ea548e4c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 24, + "charOffset": 1205, + "charLength": 7, + "snippet": { + "text": "execute" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1175, + "charLength": 142, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n if (!$this->filesystem->isInitialized()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dd724f99eae553cd5712b259b9d381150416ab1701a3687fe22ad42b4c05c783" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 881, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 820, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dd8013f2aa00969fc7f4148cedeeb624e79003eb43b5c3b6dc0b0b39bc6533cc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CompareMtimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 888, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 827, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "de38ffca15cce2a94e7aed9356b74f5fbea629c66732cfbb6373d2949c3924de" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 764, + "startColumn": 21, + "charOffset": 27567, + "charLength": 19, + "snippet": { + "text": "getVariableForWrite" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 762, + "startColumn": 1, + "charOffset": 27506, + "charLength": 169, + "snippet": { + "text": " * @throws CompilerException\n */\n public function getVariableForWrite($name, CompilationContext $compilationContext, array $statement = null)\n {\n /*" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "deecca77504e420fc79b3a2fa5d14e1b0673df658ca63fb6abb4ab9d4ef880a9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FileGetContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 898, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 837, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "df03ecc7952b7829d810b5b4299a2fe8dbc6b76bd7bb44387d5fc9f2eb23dd61" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 295, + "startColumn": 21, + "charOffset": 8840, + "charLength": 38, + "snippet": { + "text": "getTempNonTrackedUninitializedVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 293, + "startColumn": 1, + "charOffset": 8788, + "charLength": 214, + "snippet": { + "text": " * @return Variable\n */\n public function getTempNonTrackedUninitializedVariable($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'non-tracked-uninitialized');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "df320d262a045e51ba4a3a7938a7c0fc8061f33c0d6d5855a1bcb2d845f55472" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MergeAppendOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 885, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 824, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e1116614aae14d2eb9850620db76df8a16c742c67f22566b4ff97bc04abb30bf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrlenOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 21, + "charOffset": 789, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 716, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e222e6031e96386388e7c6a7caaa85133b6e3be8d214419c5d893eb4cbf07632" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 256, + "startColumn": 21, + "charOffset": 7454, + "charLength": 28, + "snippet": { + "text": "getTempLocalVariableForWrite" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 254, + "startColumn": 1, + "charOffset": 7402, + "charLength": 184, + "snippet": { + "text": " * @return Variable\n */\n public function getTempLocalVariableForWrite($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'stack');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e43fea052dc829da102058d34fc9ffb41053f12ad925be6b8a4d906bdf7579cb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/SymbolTable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 220, + "startColumn": 21, + "charOffset": 6230, + "charLength": 37, + "snippet": { + "text": "getTempComplexLiteralVariableForWrite" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 218, + "startColumn": 1, + "charOffset": 6178, + "charLength": 200, + "snippet": { + "text": " * @return Variable\n */\n public function getTempComplexLiteralVariableForWrite($type, CompilationContext $context)\n {\n $variable = $this->reuseTempVariable($type, 'heap-literal');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e4bda14d7fca8fe3c4aa2b07947fa5e698414879337a1f16c5797bfa3449ba55" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PregMatchOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 21, + "charOffset": 1039, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 978, + "charLength": 224, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters']) || count($expression['parameters']) < 2) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e535b24810f6f1fc1692b1046b556507d995b854a980db2d2d286753f5ca08d0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 68, + "startColumn": 21, + "charOffset": 1473, + "charLength": 11, + "snippet": { + "text": "addArgument" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 66, + "startColumn": 1, + "charOffset": 1424, + "charLength": 117, + "snippet": { + "text": " * @return $this\n */\n public function addArgument($argument)\n {\n $this->arguments[] = $argument;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e7e05eff656f2aac1f5e524a334b1ed89899e1121e47f96fea7fd408e567d0e3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 547, + "startColumn": 21, + "charOffset": 18112, + "charLength": 10, + "snippet": { + "text": "assignBool" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 545, + "startColumn": 1, + "charOffset": 18085, + "charLength": 243, + "snippet": { + "text": " }\n\n public function assignBool(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true)\n {\n return $this->assignHelper('ZVAL_BOOL', $this->getVariableCode($variable), $value, $context, $useCodePrinter);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e863046a7392d11e22547f0e33eea5ae73b79cc59352e298c32fdd32a0806e3e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/AbstractBuilder.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 112, + "startColumn": 21, + "charOffset": 2086, + "charLength": 7, + "snippet": { + "text": "setLine" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 110, + "startColumn": 1, + "charOffset": 2027, + "charLength": 108, + "snippet": { + "text": " * @return AbstractBuilder\n */\n public function setLine($line)\n {\n $this->line = $line;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eb4c110c726bb757c2014edb7817c05246bc1262b35f058643c73e8d291bb407" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallStaticStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 94, + "startColumn": 21, + "charOffset": 1755, + "charLength": 12, + "snippet": { + "text": "setArguments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 92, + "startColumn": 1, + "charOffset": 1692, + "charLength": 132, + "snippet": { + "text": " * @return CallStaticStatement\n */\n public function setArguments($arguments)\n {\n $this->arguments = $arguments;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eb5ef6c2a175de8aa08b6db93d527f2c52a460d72e93792e6f4b9bc7a863f744" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/IfStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 78, + "startColumn": 21, + "charOffset": 1652, + "charLength": 13, + "snippet": { + "text": "getStatements" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 76, + "startColumn": 1, + "charOffset": 1593, + "charLength": 114, + "snippet": { + "text": " * @return StatementsBlock\n */\n public function getStatements()\n {\n return $this->statements;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ec204bb3a16b01d24c9a6a1240157e2305f3f7685dfae36eb644c2f57355bd09" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GettypeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 872, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 811, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ec66ddfa7a3dede39c130220d874e083981ce298dd3d79bfd34560aef05d4139" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/SubstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 869, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 808, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ecef55813a671a5519049d777c82668028b85948ee611fe72ddc62fef6342d68" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CountOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 21, + "charOffset": 786, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 713, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ed4852735e243aa15172300e4ff8b79fd021a793ce2dbf2db36cbb03f9c2b914" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 78, + "startColumn": 21, + "charOffset": 1629, + "charLength": 12, + "snippet": { + "text": "getArguments" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 76, + "startColumn": 1, + "charOffset": 1580, + "charLength": 102, + "snippet": { + "text": " * @return array\n */\n public function getArguments()\n {\n return $this->arguments;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f04b49646be7c3b7f87513110f41c83a98fa68bd624d652d04fc294a1016fa0c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FwriteOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 869, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 808, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f07191fd879669c182ca4d328a49abf5bbdf6312ab7ca85b0ba030cbf69792f8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 194, + "startColumn": 28, + "charOffset": 4987, + "charLength": 9, + "snippet": { + "text": "sourceUrl" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 192, + "startColumn": 1, + "charOffset": 4953, + "charLength": 149, + "snippet": { + "text": " }\n\n public static function sourceUrl(Definition $c)\n {\n return '/source/' . str_replace('\\\\', '/', $c->getCompleteName()) . '.html';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f0bf9fc55e6658e81750458f29bd60a288006b122394238d4b1660c189d47b60" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateArrayOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 898, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 837, + "charLength": 183, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f20bb612a9f07c2fa9a3dadfb09fcfafadaeac56b12686c88d181ff52e807b17" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 907, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 846, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f50c141c69bf0ae5d0ab5a2837f35e3927c425b76aed2a36ab922173286a60ae" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Factory/StatementsFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 93, + "startColumn": 21, + "charOffset": 2329, + "charLength": 4, + "snippet": { + "text": "rawC" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 91, + "startColumn": 1, + "charOffset": 2273, + "charLength": 102, + "snippet": { + "text": " * @return RawStatement\n */\n public function rawC($value)\n {\n return $this->raw([" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f5682dfb48244e007917c5c99693d138b666e272bed8b2aaf97fbb305edd6c59" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FeofOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 21, + "charOffset": 783, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 710, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f681df20709c3c3fae391e3878848278167c9e99bc12c61fa9d367877720984f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsIntOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 24, + "charOffset": 508, + "charLength": 7, + "snippet": { + "text": "getType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 430, + "charLength": 119, + "snippet": { + "text": "class IsIntOptimizer extends IsTypeOptimizerAbstract\n{\n protected function getType()\n {\n return 'IS_LONG';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f6d1170a89254445cb6476f81b3fda5378561274ae071a4404ed0f4ed58dca91" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/StatementsBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 21, + "charOffset": 795, + "charLength": 12, + "snippet": { + "text": "addStatement" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 746, + "charLength": 121, + "snippet": { + "text": " * @return $this\n */\n public function addStatement($statement)\n {\n $this->statements[] = $statement;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f84a7e6c7d55319bf98ecd34af3836f50c561adc45952e88054d0e71cd1e2e87" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 233, + "startColumn": 21, + "charOffset": 6771, + "charLength": 12, + "snippet": { + "text": "getThemeInfo" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 231, + "startColumn": 1, + "charOffset": 6717, + "charLength": 126, + "snippet": { + "text": " * @return mixed|null\n */\n public function getThemeInfo($name)\n {\n if (isset($this->themeInfos[$name])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f8640a960385d343ae07a9e921ab6ae7598e5b34839cdb3fca30284a451b9a32" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 21, + "charOffset": 1337, + "charLength": 17, + "snippet": { + "text": "getParsedDocblock" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1265, + "charLength": 132, + "snippet": { + "text": " * @return Docblock the parsed docblock\n */\n public function getParsedDocblock()\n {\n return $this->docblockObj;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f8713d1b6bb9ff1f24d793338cfaaf82e8234e840d848c9e86ce18e551b9437b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 499, + "startColumn": 21, + "charOffset": 16251, + "charLength": 18, + "snippet": { + "text": "getClassDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 497, + "startColumn": 1, + "charOffset": 16197, + "charLength": 150, + "snippet": { + "text": " * @return Definition\n */\n public function getClassDefinition()\n {\n $this->classDefinition->setAliasManager($this->aliasManager);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f87672c7b9f90e2a8889febaeb4e3477cd51ee4f0839b9127d9a392f5cf6589a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarDumpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 21, + "charOffset": 832, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 759, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f9392c5736a4252f450e8bcb2f1f46b6d39b628de779ef080d6de4c5952db52e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MethodExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 21, + "charOffset": 796, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 723, + "charLength": 196, + "snippet": { + "text": " * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f9fefae79ae0463c83e77401585c29db989a38f24bd631f7f4912c8c6566baf4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsPhpVersionOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 21, + "charOffset": 1044, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 982, + "charLength": 185, + "snippet": { + "text": " * @return CompiledExpression\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fb9b97c3e253b31871b733c685abb3635d6f81f64d5a22a91405b0108669df2e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1828, + "startColumn": 21, + "charOffset": 63450, + "charLength": 12, + "snippet": { + "text": "returnString" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1826, + "startColumn": 1, + "charOffset": 63423, + "charLength": 197, + "snippet": { + "text": " }\n\n public function returnString($value, CompilationContext $context, $useCodePrinter = true)\n {\n return $this->returnHelper('RETURN_MM_STRING', $value, $context, $useCodePrinter);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fcb0e74b0870daba17122f220e8c5e222433cc87cff0247478df1575c4fc5cbc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 336, + "startColumn": 24, + "charOffset": 10597, + "charLength": 11, + "snippet": { + "text": "_callNormal" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 334, + "startColumn": 1, + "charOffset": 10523, + "charLength": 203, + "snippet": { + "text": " * @throws Exception|CompilerException\n */\n protected function _callNormal(array $expression, CompilationContext $compilationContext)\n {\n $funcName = strtolower($expression['name']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fdadea27d641867e6c7ec2059c31c201b04dd4a95740eeb299707e8fd86bdf25" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Statements/CallFunctionStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 138, + "startColumn": 24, + "charOffset": 2545, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 136, + "startColumn": 1, + "charOffset": 2493, + "charLength": 118, + "snippet": { + "text": " * @return array\n */\n protected function preBuild()\n {\n if ($arguments = $this->getArguments()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fe3045f6c12c0728d017855e3913d0108c87460c88f4555efa6399fb61117bc3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ExplodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 21, + "charOffset": 865, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 804, + "charLength": 184, + "snippet": { + "text": " * @throws CompilerException\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fe3e8abd0f5be17509ded36f52424692fef4777df238025ad9341df9622e1ab0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 249, + "startColumn": 21, + "charOffset": 7144, + "charLength": 23, + "snippet": { + "text": "getThemeInfoExtendAware" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 247, + "startColumn": 1, + "charOffset": 7095, + "charLength": 121, + "snippet": { + "text": " * @return array\n */\n public function getThemeInfoExtendAware($name)\n {\n if ($this->extendedTheme) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fe6e671f75f047951198bd67e3bf4688022d19a759ee00adcc94ef05e81e6eee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler/FileInterface.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 21, + "charOffset": 563, + "charLength": 18, + "snippet": { + "text": "getClassDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 509, + "charLength": 84, + "snippet": { + "text": " * @return Definition\n */\n public function getClassDefinition();\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fe8e5782714fd3d3fdbf28e2e37bf9706cbec96388337673538d295d632491b7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMissingReturnTypeInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Missing function's return type declaration", + "markdown": "Missing function's return type declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/RawOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 56, + "startColumn": 24, + "charOffset": 1010, + "charLength": 8, + "snippet": { + "text": "preBuild" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 54, + "startColumn": 1, + "charOffset": 958, + "charLength": 107, + "snippet": { + "text": " * @return array\n */\n protected function preBuild()\n {\n return $this->getExpression();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ff3574ad2040ec791324ae8efbe25d868b2aff6db6581119f318955e32d927b9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpMixedReturnTypeCanBeReducedInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Type can be narrowed to 'CompiledExpression|bool'", + "markdown": "Type can be narrowed to 'CompiledExpression\\|bool'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 66, + "startColumn": 88, + "charOffset": 1531, + "charLength": 5, + "snippet": { + "text": "mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 64, + "startColumn": 1, + "charOffset": 1401, + "charLength": 187, + "snippet": { + "text": " * @throws ReflectionException\n */\n public function compile(Expression $expr, CompilationContext $compilationContext): mixed\n {\n $expression = $expr->getExpression();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "83f1a7556b63e7d0e542532aaf5ef3605c8d890998e844a6c46fc7d233f34c47" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpNonStrictObjectEqualityInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Non-strict object equality comparison", + "markdown": "Non-strict object equality comparison" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Cache/MethodCache.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 147, + "startColumn": 56, + "charOffset": 5442, + "charLength": 2, + "snippet": { + "text": "==" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 145, + "startColumn": 1, + "charOffset": 5289, + "charLength": 272, + "snippet": { + "text": " $staticCacheable = !$method->getClassDefinition()->isInterface() &&\n (\n $compilationContext->currentMethod == $method ||\n $method->getClassDefinition()->isFinal() ||\n $method->isFinal() ||" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7278ff3dd417a2af9efcef330d2b5883bb286a6d828029265a23bc33e1bed2e6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpNotInstalledPackagesInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Packages are not installed", + "markdown": "Packages are not installed" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "composer.json", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 23, + "startColumn": 5, + "charOffset": 629, + "charLength": 9, + "snippet": { + "text": "\"require\"" + }, + "sourceLanguage": "JSON" + }, + "contextRegion": { + "startLine": 21, + "startColumn": 1, + "charOffset": 608, + "charLength": 83, + "snippet": { + "text": " }\n ],\n \"require\": {\n \"php\": \">=8.0\",\n \"ext-ctype\": \"*\"," + }, + "sourceLanguage": "JSON" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "574d956496a7f3d13d1e88038e2d2332c7f8d6ac18b2c2b7017646da31c6e53b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "JSON" + ] + } + }, + { + "ruleId": "PhpNotInstalledPackagesInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Packages are not installed", + "markdown": "Packages are not installed" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "composer.json", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 5, + "charOffset": 969, + "charLength": 13, + "snippet": { + "text": "\"require-dev\"" + }, + "sourceLanguage": "JSON" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 915, + "charLength": 118, + "snippet": { + "text": " \"symfony/event-dispatcher\": \"^5.3\"\n },\n \"require-dev\": {\n \"ext-gmp\": \"*\",\n \"ext-pdo\": \"*\"," + }, + "sourceLanguage": "JSON" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d43f95314a8e0ddb2d554d109da414e7c5955f1d244884709a3c244bdbd00c1f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "JSON" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$file' type is not compatible with declaration", + "markdown": "Parameter '$file' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 819, + "startColumn": 65, + "charOffset": 28237, + "charLength": 5, + "snippet": { + "text": "$file" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 817, + "startColumn": 1, + "charOffset": 28098, + "charLength": 257, + "snippet": { + "text": " foreach ($this->compiledFiles as $file) {\n if ($file) {\n $fileH = str_replace('.c', '.zep.h', $file);\n $include = '#include \"' . $fileH . '\"';\n $includeHeaders[] = $include;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "299f4f4aa8538cdf39b04e502e0b401166c04f1decb2efc8420a403529dc75f7" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$logger' type is not compatible with declaration", + "markdown": "Parameter '$logger' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 109, + "startColumn": 69, + "charOffset": 2954, + "charLength": 7, + "snippet": { + "text": "$logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 107, + "startColumn": 1, + "charOffset": 2855, + "charLength": 187, + "snippet": { + "text": " $consoleStdOutHandler,\n]);\n$compilerFactory = new Compiler\\CompilerFileFactory($config, $disk, $logger);\n$backend = new Backend($config, $rootPath.'/kernel', $rootPath.'/templates');\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3bf26e80486614d559b649fc747bfa398d55313500683ee73ada93b302caf886" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$expression' type is not compatible with declaration", + "markdown": "Parameter '$expression' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/NewInstanceTypeOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 83, + "startColumn": 59, + "charOffset": 2405, + "charLength": 11, + "snippet": { + "text": "$expression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 81, + "startColumn": 1, + "charOffset": 2252, + "charLength": 201, + "snippet": { + "text": " return $expression->compile($compilationContext);\n } catch (Exception $e) {\n throw new CompilerException($e->getMessage(), $expression, $e->getCode(), $e);\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3c6a8e78f46eb54e9022dee66b733b02069b5cec0cf5ce9d32612c2664f846e5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$this->config' type is not compatible with declaration", + "markdown": "Parameter '$this-\\>config' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 99, + "startColumn": 42, + "charOffset": 2364, + "charLength": 13, + "snippet": { + "text": "$this->config" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 97, + "startColumn": 1, + "charOffset": 2262, + "charLength": 179, + "snippet": { + "text": "\n // class source file (source/ns1/n2/class.html)\n $sfile = new File\\SourceFile($this->config, $class);\n $this->theme->drawFile($sfile);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "632fbc378ba47dd4fd640823893b3901fc60d3461e6c9461c4973db2a971858e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$logger' type is not compatible with declaration", + "markdown": "Parameter '$logger' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 125, + "startColumn": 54, + "charOffset": 3703, + "charLength": 7, + "snippet": { + "text": "$logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 123, + "startColumn": 1, + "charOffset": 3556, + "charLength": 254, + "snippet": { + "text": "$application->add(new FullCleanCommand());\n$application->add(new GenerateCommand($compiler));\n$application->add(new InitCommand($backend, $config, $logger));\n$application->add(new InstallCommand($compiler, $config));\n$application->add(new ListCommand());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bdce38ccece735be8a59e6ffc771fffe601b495a211177f993a1888688c4bf6a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$this->projectConfig' type is not compatible with declaration", + "markdown": "Parameter '$this-\\>projectConfig' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 89, + "startColumn": 37, + "charOffset": 2102, + "charLength": 20, + "snippet": { + "text": "$this->projectConfig" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 87, + "startColumn": 1, + "charOffset": 1951, + "charLength": 209, + "snippet": { + "text": " $template->setPathToRoot($this->getPathToRoot());\n $template->setThemeOptions($this->themeOptions);\n $template->setProjectConfig($this->projectConfig);\n\n return $template->parse();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c08ddbbd8e158a925394aefdfbfbdcaff4666840e13ce69f4f77d6d3dc06b2ae" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$variable' type is not compatible with declaration", + "markdown": "Parameter '$variable' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 944, + "startColumn": 87, + "charOffset": 32920, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 942, + "startColumn": 1, + "charOffset": 32770, + "charLength": 273, + "snippet": { + "text": " */\n foreach ($variables as $variable) {\n $nextCode = $this->generateInitCode($groupVariables, $type, $pointer, $variable);\n if ($nextCode && $additionalCode) {\n $additionalCode .= PHP_EOL . $nextCode;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f8fe8e4d246cbf40311af55992c8768b555c62fd9c5c9dabc2c3b8d28d27d120" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$this->classes' type is not compatible with declaration", + "markdown": "Parameter '$this-\\>classes' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 104, + "startColumn": 38, + "charOffset": 2519, + "charLength": 14, + "snippet": { + "text": "$this->classes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 102, + "startColumn": 1, + "charOffset": 2442, + "charLength": 133, + "snippet": { + "text": "\n // classes file (classes.html)\n $file = new File\\ClassesFile($this->classes);\n $this->theme->drawFile($file);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fa621e674e168d6feb8f151a9b2bdd6bc097733c75fcb6d25886c648c211dc9c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$itemVariable' type is not compatible with declaration", + "markdown": "Parameter '$itemVariable' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArray.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 572, + "startColumn": 92, + "charOffset": 25132, + "charLength": 13, + "snippet": { + "text": "$itemVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 570, + "startColumn": 1, + "charOffset": 25011, + "charLength": 177, + "snippet": { + "text": "\n default:\n throw new CompilerException('Unknown ' . $itemVariable->getType(), $itemVariable);\n }\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fee7a8d8a870c2637f5c056dc8883ddb4c3d5710ef05d3d7a39bb27addaf0585" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpParamsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Parameter '$exprCompiled' type is not compatible with declaration", + "markdown": "Parameter '$exprCompiled' type is not compatible with declaration" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArray.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 577, + "startColumn": 56, + "charOffset": 25266, + "charLength": 13, + "snippet": { + "text": "$exprCompiled" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 575, + "startColumn": 1, + "charOffset": 25189, + "charLength": 108, + "snippet": { + "text": "\n default:\n throw new CompilerException('Unknown', $exprCompiled);\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "feff6d8b16365cc191d70df5c3f718ac8cb24d1e5b07b7a41345c24af24ac9fe" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPointlessBooleanExpressionInConditionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Boolean expression can be simplified", + "markdown": "Boolean expression can be simplified" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PregMatchOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 151, + "startColumn": 17, + "charOffset": 4765, + "charLength": 35, + "snippet": { + "text": "false == $variable->isInitialized()" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 149, + "startColumn": 1, + "charOffset": 4734, + "charLength": 180, + "snippet": { + "text": " }\n\n if (false == $variable->isInitialized()) {\n $variable->initVariant($context);\n $variable->setIsInitialized(true, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "147f13a42d43a5451cab35bdaba785b62a7d8aaab9b2300c9f34fdfc9dff66e3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 326, + "startColumn": 36, + "charOffset": 13135, + "charLength": 16, + "snippet": { + "text": "zvalNullOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 324, + "startColumn": 1, + "charOffset": 13009, + "charLength": 250, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalNullOperator . '(' . $variableLeftCode . ')',\n $expression['left']\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "08307be2837006ef237f0a187a964e96828266bca4c95f5afb26624ec3b9e582" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertySub.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 35, + "charOffset": 1606, + "charLength": 15, + "snippet": { + "text": "getCompleteName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1430, + "charLength": 248, + "snippet": { + "text": " if (!$propertyDefinition = $classDefinition->getProperty($property)) {\n throw CompilerException::classDoesNotHaveProperty(\n $classDefinition->getCompleteName(),\n $property,\n $statement" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0ae026673c17c3158d0d031b33535bc1d90b45bbbfd06893ac042af2418819f1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 668, + "startColumn": 44, + "charOffset": 29995, + "charLength": 16, + "snippet": { + "text": "zvalNullOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 666, + "startColumn": 1, + "charOffset": 29845, + "charLength": 286, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalNullOperator . '(' . $variableCode . ')',\n $expression['left']\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0b78ff5f70bb01049fbb4359c580388d1de4af4eedc32a645207dd7020af5632" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 417, + "startColumn": 75, + "charOffset": 18672, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 415, + "startColumn": 1, + "charOffset": 18491, + "charLength": 317, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode(\n ) . ')',\n $expression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0d582d5ece2523d02b292aa8f38c65211fc2b66523f3a7191dad09b1cdedccc2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertySub.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 91, + "startColumn": 45, + "charOffset": 2585, + "charLength": 13, + "snippet": { + "text": "getClassEntry" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 89, + "startColumn": 1, + "charOffset": 2526, + "charLength": 217, + "snippet": { + "text": "\n try {\n $classEntry = $classDefinition->getClassEntry($compilationContext);\n } catch (Exception $e) {\n throw new CompilerException($e->getMessage(), $statement, $e->getCode(), $e);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1149134c7f94b52585233fb13644542b51ae8bdef2ffc7833ecbb9b3dd3e42cc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 356, + "startColumn": 44, + "charOffset": 14519, + "charLength": 12, + "snippet": { + "text": "zvalOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 354, + "startColumn": 1, + "charOffset": 14369, + "charLength": 302, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalOperator . '(' . $variableLeftCode . ', ' . $variableRight . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1203833a9c8f8f4d85487b6276018a0779c475ded4bbee99f1a9e21a5c0e5501" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Property.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 411, + "startColumn": 63, + "charOffset": 12521, + "charLength": 13, + "snippet": { + "text": "getInitMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 409, + "startColumn": 1, + "charOffset": 12424, + "charLength": 202, + "snippet": { + "text": "\n if (!$this->isStatic()) {\n $constructParentMethod = $parentClassDefinition?->getInitMethod();\n $constructMethod = $classDefinition->getInitMethod();\n } else {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "14e9d45cd1c9703acc7438db420dbc4d9597b1b1a7e9e5d5ce42818d9217903b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 746, + "startColumn": 74, + "charOffset": 33813, + "charLength": 21, + "snippet": { + "text": "zvalBoolFalseOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 744, + "startColumn": 1, + "charOffset": 33619, + "charLength": 280, + "snippet": { + "text": " case 'bool':\n $zvalBoolOperator = 'true' === $right->getCode(\n ) ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator;\n\n return new CompiledExpression(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2302723284c89040c1ddb20f3b6eeaaec69fdaff812816274bb68bed8738b3f0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 541, + "startColumn": 63, + "charOffset": 24684, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 539, + "startColumn": 1, + "charOffset": 24490, + "charLength": 345, + "snippet": { + "text": " 'int',\n '((int) (' . $variableLeft->getName(\n ) . ') ' . $this->bitOperator . ' ' . $variableRight->getName() . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2e7a5d44b66d04c404c71b3ae08c24990d64c0c085a3370ee60de104841fe891" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Stubs/Generator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 172, + "startColumn": 87, + "charOffset": 4773, + "charLength": 9, + "snippet": { + "text": "isBundled" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 170, + "startColumn": 1, + "charOffset": 4587, + "charLength": 355, + "snippet": { + "text": " $hasAliasForExtends = $aliasManager->isAlias($extendsClassDefinition->getShortName());\n\n $source .= ' extends ' . ($hasAliasForExtends || $extendsClassDefinition->isBundled() ? '' : '\\\\');\n $source .= $hasAliasForExtends ? $extendsClassDefinition->getShortName(\n ) : $extendsClassDefinition->getCompleteName();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "397b5ca132c9805176f284e0c6fee1249a986fb027d23196df3ef6ded7b27110" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 445, + "startColumn": 62, + "charOffset": 20227, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 443, + "startColumn": 1, + "charOffset": 20040, + "charLength": 338, + "snippet": { + "text": " 'bool',\n '(' . $variableLeft->getName(\n ) . ' ' . $this->bitOperator . ' ' . $variableRight->getName() . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3b2a7321b1df0466e037cedf6f05124d749dfbe3015f8ff361401b8fd373599c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 740, + "startColumn": 44, + "charOffset": 33450, + "charLength": 16, + "snippet": { + "text": "zvalLongOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 738, + "startColumn": 1, + "charOffset": 33300, + "charLength": 317, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalLongOperator . '(' . $variableCode . ', \\'' . $right->getCode() . '\\')',\n $expression['left']\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3b644aeb6c95ec9d6cec51533a2610131b74715ff15404f7ce43ff4cf1a19a03" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 154, + "startColumn": 74, + "charOffset": 5824, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 152, + "startColumn": 1, + "charOffset": 5661, + "charLength": 287, + "snippet": { + "text": " return new CompiledExpression(\n 'int',\n '(' . $left->getBooleanCode() . ' ' . $this->bitOperator . '((' . $right->getCode(\n ) . ') ? 1 : 0))',\n $expression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "431e1d06ebdd4a1b054992506bdbd255a9651fbc6b98282d63c78701e40579d1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 161, + "startColumn": 70, + "charOffset": 6181, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 159, + "startColumn": 1, + "charOffset": 6017, + "charLength": 274, + "snippet": { + "text": " Types::T_BOOL => new CompiledExpression(\n 'bool',\n '(' . $left->getBooleanCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode() . ')',\n $expression\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "49407df3adba653e7aa0c56481e01d02ddcb62eeaa1859b8825d16687c8deaa6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 732, + "startColumn": 44, + "charOffset": 33052, + "charLength": 16, + "snippet": { + "text": "zvalLongOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 730, + "startColumn": 1, + "charOffset": 32902, + "charLength": 313, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalLongOperator . '(' . $variableCode . ', ' . $right->getCode() . ')',\n $expression['left']\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4a001eb86fe07ee27d6420d526dbfb313708eefd74655dde48a3718a15030a42" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 774, + "startColumn": 52, + "charOffset": 35271, + "charLength": 16, + "snippet": { + "text": "zvalLongOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 772, + "startColumn": 1, + "charOffset": 35097, + "charLength": 355, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalLongOperator . '(' . $variableCode . ', ' . $variableRight->getName(\n ) . ')',\n $expression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5115527f55f97eabbbdcf5545cbc1d673fca52de44ac1432f9d478bf72ab37af" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 790, + "startColumn": 52, + "charOffset": 36173, + "charLength": 16, + "snippet": { + "text": "zvalBoolOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 788, + "startColumn": 1, + "charOffset": 35999, + "charLength": 355, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalBoolOperator . '(' . $variableCode . ', ' . $variableRight->getName(\n ) . ')',\n $expression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5a30ef682cab3ab1c1e6494d47329ddb7ce791b0061884b2475d843cd590bdcb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 746, + "startColumn": 44, + "charOffset": 33783, + "charLength": 20, + "snippet": { + "text": "zvalBoolTrueOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 744, + "startColumn": 1, + "charOffset": 33619, + "charLength": 280, + "snippet": { + "text": " case 'bool':\n $zvalBoolOperator = 'true' === $right->getCode(\n ) ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator;\n\n return new CompiledExpression(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5a77fc73bf5733e1b584aa05d199d1ce2151ac0666567f24d47519a70724f8af" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 694, + "startColumn": 52, + "charOffset": 31365, + "charLength": 12, + "snippet": { + "text": "zvalOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 692, + "startColumn": 1, + "charOffset": 31191, + "charLength": 338, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalOperator . '(' . $variableCode . ', ' . $variableRight . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5d2635ca908ddf6f44429f2a88f755288017f054873a766d0802ce8c17e0cafe" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 450, + "startColumn": 62, + "charOffset": 19876, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 448, + "startColumn": 1, + "charOffset": 19690, + "charLength": 337, + "snippet": { + "text": " 'int',\n '(' . $variableLeft->getName(\n ) . ' ' . $this->bitOperator . ' ' . $variableRight->getName() . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "65965f22f35f67e7f539ce48dc22da7c7fcd2010bfa1b9bca1837ae1f0ae833a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Stubs/Generator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 174, + "startColumn": 42, + "charOffset": 4924, + "charLength": 15, + "snippet": { + "text": "getCompleteName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 172, + "startColumn": 1, + "charOffset": 4687, + "charLength": 266, + "snippet": { + "text": " $source .= ' extends ' . ($hasAliasForExtends || $extendsClassDefinition->isBundled() ? '' : '\\\\');\n $source .= $hasAliasForExtends ? $extendsClassDefinition->getShortName(\n ) : $extendsClassDefinition->getCompleteName();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6b3c735b2957305e8dec23f04c9ddce79f4c7b33e7a358b94a5fafaa1ac31728" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 415, + "startColumn": 75, + "charOffset": 17907, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 413, + "startColumn": 1, + "charOffset": 17727, + "charLength": 316, + "snippet": { + "text": " return new CompiledExpression(\n 'int',\n '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode(\n ) . ')',\n $expression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6c8944c42ddedd21cbb6217ac586f7f537eff8f46825b0055ea26281d30ef516" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Stubs/Generator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 170, + "startColumn": 83, + "charOffset": 4669, + "charLength": 12, + "snippet": { + "text": "getShortName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 168, + "startColumn": 1, + "charOffset": 4572, + "charLength": 226, + "snippet": { + "text": " }\n\n $hasAliasForExtends = $aliasManager->isAlias($extendsClassDefinition->getShortName());\n\n $source .= ' extends ' . ($hasAliasForExtends || $extendsClassDefinition->isBundled() ? '' : '\\\\');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "75852d80a0a7344aa989ad48560ed13237bba36f0e65333ade21f0f3829a7c4d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 336, + "startColumn": 36, + "charOffset": 13510, + "charLength": 18, + "snippet": { + "text": "zvalStringOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 334, + "startColumn": 1, + "charOffset": 13384, + "charLength": 281, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalStringOperator . '(' . $variableLeftCode . ', \"' . $right->getCode() . '\")',\n $expression['left']\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7c6d83bb68d5b138ae1cacaaff17bfba153208c7659d2ab66a05fe402fd1e718" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 508, + "startColumn": 55, + "charOffset": 22716, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 506, + "startColumn": 1, + "charOffset": 22554, + "charLength": 296, + "snippet": { + "text": " 'int',\n '((int) (' . $left->getCode(\n ) . ') ' . $this->bitOperator . ' ' . $right->getBooleanCode() . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "80fa75dfd96509134e6644e0b34e717a8f3a74dd97e67eedf18030f1ae95fc16" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertySub.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 79, + "startColumn": 43, + "charOffset": 2251, + "charLength": 15, + "snippet": { + "text": "getCompleteName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 77, + "startColumn": 1, + "charOffset": 2078, + "charLength": 248, + "snippet": { + "text": " sprintf(\n \"Cannot access private static property '%s::%s out of its declaring context\",\n $classDefinition->getCompleteName(),\n $property\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9249d77cae491a23f4c9f74d226b10a7fda657305300bdd8f0bb77b7b4a2fc3e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 286, + "startColumn": 74, + "charOffset": 11425, + "charLength": 21, + "snippet": { + "text": "zvalBoolFalseOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 284, + "startColumn": 1, + "charOffset": 11179, + "charLength": 381, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n $boolOperator = '1' == $left->getBooleanCode(\n ) ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator;\n $variableRight = $compilationContext->backend->getVariableCode($variableRight);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "941821390873ca981e0dc770df59020eb60167fe4085d715fbb28f8666e16bc5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 803, + "startColumn": 52, + "charOffset": 36898, + "charLength": 12, + "snippet": { + "text": "zvalOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 801, + "startColumn": 1, + "charOffset": 36724, + "charLength": 338, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalOperator . '(' . $variableCode . ', ' . $variableRight . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9474740ae3f4b25cc86d339c7b8f237598408977bb756ec756879afa5331aaef" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 644, + "startColumn": 52, + "charOffset": 28930, + "charLength": 12, + "snippet": { + "text": "zvalOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 642, + "startColumn": 1, + "charOffset": 28756, + "charLength": 338, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalOperator . '(' . $variableCode . ', ' . $variableRight . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9706098f5bea50b9eb7f89dc2113668b347545459d972d83b2c65b17083cc7aa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 637, + "startColumn": 52, + "charOffset": 30071, + "charLength": 12, + "snippet": { + "text": "zvalOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 635, + "startColumn": 1, + "charOffset": 29822, + "charLength": 364, + "snippet": { + "text": " $expectedSymbol = $compilationContext->backend->getVariableCode($expected);\n $compilationContext->codePrinter->output(\n $this->zvalOperator . '(' . $expectedSymbol . ', ' . $op1 . ', ' . $op2 . ');'\n );\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9bc3b14f6c78be3ac464e6edd2223841328c76de7a24c38b7346a172fcf7161a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Stubs/Generator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 173, + "startColumn": 71, + "charOffset": 4869, + "charLength": 12, + "snippet": { + "text": "getShortName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 171, + "startColumn": 1, + "charOffset": 4686, + "charLength": 266, + "snippet": { + "text": "\n $source .= ' extends ' . ($hasAliasForExtends || $extendsClassDefinition->isBundled() ? '' : '\\\\');\n $source .= $hasAliasForExtends ? $extendsClassDefinition->getShortName(\n ) : $extendsClassDefinition->getCompleteName();\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9f5848c04acb93424be7df056c0b4444a1be3d565264948e4f8e67e0a34e9871" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 591, + "startColumn": 52, + "charOffset": 27961, + "charLength": 12, + "snippet": { + "text": "zvalOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 589, + "startColumn": 1, + "charOffset": 27720, + "charLength": 368, + "snippet": { + "text": " $expected = $this->getExpected($compilationContext, $expression);\n $compilationContext->backend->zvalOperator(\n $this->zvalOperator,\n $expected,\n $variableLeft," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a151d7edf3b73ba43e5c062f5a4520487821361fdb39950106e8cefa34b918a2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 757, + "startColumn": 44, + "charOffset": 34312, + "charLength": 18, + "snippet": { + "text": "zvalStringOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 755, + "startColumn": 1, + "charOffset": 34162, + "charLength": 317, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalStringOperator . '(' . $variableCode . ', \"' . $right->getCode() . '\")',\n $expression['left']\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a250d637f65537bd38f0e2b6cb5c3e6bbd9055385b9fa2c0a740235c62a9c5d3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertySub.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 59, + "startColumn": 54, + "charOffset": 1483, + "charLength": 11, + "snippet": { + "text": "getProperty" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 57, + "startColumn": 1, + "charOffset": 1383, + "charLength": 241, + "snippet": { + "text": " $method = $this->methodName;\n\n if (!$propertyDefinition = $classDefinition->getProperty($property)) {\n throw CompilerException::classDoesNotHaveProperty(\n $classDefinition->getCompleteName()," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a3e9d1561226aa1a166db47ec64ab5f515d290c254d8d88d7b2d1a382c15b295" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 592, + "startColumn": 52, + "charOffset": 26237, + "charLength": 20, + "snippet": { + "text": "zvalBoolTrueOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 590, + "startColumn": 1, + "charOffset": 25993, + "charLength": 463, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n $boolOperator = '1' == $left->getBooleanCode(\n ) ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator;\n $variableRightCode = $compilationContext->backend->getVariableCode(\n $variableRight" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "acb81faf3f562643ddf7901855530e9da2e95547a7e8c40f909e08116091796d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 782, + "startColumn": 52, + "charOffset": 35722, + "charLength": 18, + "snippet": { + "text": "zvalDoubleOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 780, + "startColumn": 1, + "charOffset": 35548, + "charLength": 357, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalDoubleOperator . '(' . $variableCode . ', ' . $variableRight->getName(\n ) . ')',\n $expression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aded87bf1fd17b821e54e32008020682d5f7195dc508cecd2675c55ab39346e5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. Method does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. Method does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilationContext.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 164, + "startColumn": 59, + "charOffset": 4576, + "charLength": 12, + "snippet": { + "text": "getNamespace" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 162, + "startColumn": 1, + "charOffset": 4438, + "charLength": 271, + "snippet": { + "text": " {\n $isFunction = $this->currentMethod instanceof FunctionDefinition;\n $namespace = $isFunction ? $this->currentMethod->getNamespace() : $this->classDefinition->getNamespace();\n\n return Name::fetchFQN($className, $namespace, $this->aliasManager);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bc360fecc9142da0d5d08640221541712dd015b9487e1f1ceabd4cbc021c7835" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 538, + "startColumn": 62, + "charOffset": 25119, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 536, + "startColumn": 1, + "charOffset": 24932, + "charLength": 338, + "snippet": { + "text": " 'bool',\n '(' . $variableLeft->getName(\n ) . ' ' . $this->bitOperator . ' ' . $variableRight->getName() . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c58ff67213cc33f432944a56d7f7e5dc26716cec6435153b87a4d050c3a319c5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 286, + "startColumn": 44, + "charOffset": 11395, + "charLength": 20, + "snippet": { + "text": "zvalBoolTrueOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 284, + "startColumn": 1, + "charOffset": 11179, + "charLength": 381, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n $boolOperator = '1' == $left->getBooleanCode(\n ) ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator;\n $variableRight = $compilationContext->backend->getVariableCode($variableRight);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c69bf1a12a54e443bf45b0b765858484f87905ddd95a02e9dad4173ca219bc6c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Property.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 414, + "startColumn": 63, + "charOffset": 12689, + "charLength": 19, + "snippet": { + "text": "getStaticInitMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 412, + "startColumn": 1, + "charOffset": 12538, + "charLength": 261, + "snippet": { + "text": " $constructMethod = $classDefinition->getInitMethod();\n } else {\n $constructParentMethod = $parentClassDefinition?->getStaticInitMethod();\n $constructMethod = $classDefinition->getStaticInitMethod();\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c9a7f93d6405ec35c5a09820e9016918c6aecc2820035603b4f589fc0c3ba3ee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 624, + "startColumn": 44, + "charOffset": 27771, + "charLength": 16, + "snippet": { + "text": "zvalNullOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 622, + "startColumn": 1, + "charOffset": 27621, + "charLength": 286, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalNullOperator . '(' . $variableCode . ')',\n $expression['left']\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cd1a7333425d415c07a9963a7691089891cdee9eea4a74ba08e53846a7ffce5e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 675, + "startColumn": 44, + "charOffset": 30326, + "charLength": 18, + "snippet": { + "text": "zvalStringOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 673, + "startColumn": 1, + "charOffset": 30176, + "charLength": 317, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalStringOperator . '(' . $variableCode . ', \"' . $right->getCode() . '\")',\n $expression['left']\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d2bf82cd985d427251551f10abd1dc9644ac3270867edfe714a0a38abfa63847" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 693, + "startColumn": 52, + "charOffset": 33524, + "charLength": 12, + "snippet": { + "text": "zvalOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 691, + "startColumn": 1, + "charOffset": 33283, + "charLength": 368, + "snippet": { + "text": " $expected = $this->getExpected($compilationContext, $expression);\n $compilationContext->backend->zvalOperator(\n $this->zvalOperator,\n $expected,\n $variableLeft," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d5b25338010e22ca91c5950d755df57bc5685abd5a182fee8394dfe3be0bf258" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 592, + "startColumn": 82, + "charOffset": 26267, + "charLength": 21, + "snippet": { + "text": "zvalBoolFalseOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 590, + "startColumn": 1, + "charOffset": 25993, + "charLength": 463, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n $boolOperator = '1' == $left->getBooleanCode(\n ) ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator;\n $variableRightCode = $compilationContext->backend->getVariableCode(\n $variableRight" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "da795729063535a2976dee085c7dcad1f2451ed7fc3963afdef88624166d3aec" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 870, + "startColumn": 62, + "charOffset": 40140, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 868, + "startColumn": 1, + "charOffset": 40000, + "charLength": 234, + "snippet": { + "text": " Types::T_BOOL => new CompiledExpression(\n 'bool',\n '(' . $left->getBooleanCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode() . ')',\n $expression\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e5fc937390c8938d24a7b6f3fc5376e5999fa440b5d1284ee100d0b548e36b34" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 201, + "startColumn": 44, + "charOffset": 7708, + "charLength": 19, + "snippet": { + "text": "zvalLongNegOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 199, + "startColumn": 1, + "charOffset": 7558, + "charLength": 307, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalLongNegOperator . '(' . $variableCode . ', ' . $left->getCode() . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ec57cba638568f5aad5dd77e2d63f5871c97bf1ffd61edc271c6de3b614b2007" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. BitwiseBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 162, + "startColumn": 74, + "charOffset": 6173, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 160, + "startColumn": 1, + "charOffset": 6010, + "charLength": 283, + "snippet": { + "text": " return new CompiledExpression(\n 'int',\n '(' . $left->getBooleanCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode(\n ) . ')',\n $expression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f55f56c595355636a0913b0d68f7b7a84823ff4b8d31b8b47403e87ac3711f52" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 524, + "startColumn": 52, + "charOffset": 22820, + "charLength": 21, + "snippet": { + "text": "zvalDoubleNegOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 522, + "startColumn": 1, + "charOffset": 22646, + "charLength": 351, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalDoubleNegOperator . '(' . $variableRightCode . ', ' . $variableCode . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f6baeb7ff32c7f665a088ac32d323d9100013a845018d4e90e3052dc65c72bb7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. DefinitionRuntime does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertySub.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 75, + "startColumn": 35, + "charOffset": 1953, + "charLength": 15, + "snippet": { + "text": "getCompleteName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 73, + "startColumn": 1, + "charOffset": 1870, + "charLength": 236, + "snippet": { + "text": "\n if ($propertyDefinition->isPrivate()) {\n if ($classDefinition->getCompleteName() != $compilationContext->classDefinition->getCompleteName()) {\n throw new CompilerException(\n sprintf(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f918d160ffcb008c29c334c9b7d5dede2cee77d147f72612566071a4b8a5e88a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ComparisonBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 446, + "startColumn": 52, + "charOffset": 18877, + "charLength": 19, + "snippet": { + "text": "zvalLongNegOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 444, + "startColumn": 1, + "charOffset": 18703, + "charLength": 349, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n $this->zvalLongNegOperator . '(' . $variableRightCode . ', ' . $variableCode . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f9dfeaad18f70570ac535f4d9f45dc53140e08ad01b24aa229da86552d20129b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpPossiblePolymorphicInvocationInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy", + "markdown": "Potentially polymorphic call. ArithmeticalBaseOperator does not have members in its hierarchy" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 503, + "startColumn": 75, + "charOffset": 23141, + "charLength": 11, + "snippet": { + "text": "bitOperator" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 501, + "startColumn": 1, + "charOffset": 22960, + "charLength": 317, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode(\n ) . ')',\n $expression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fc1d4f594b0925566c1f6ffefa368ddd7b43f33342f10ec3e7ef86aa626c808e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpRedundantOptionalArgumentInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Argument matches the parameter's default value", + "markdown": "Argument matches the parameter's default value" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 715, + "startColumn": 85, + "charOffset": 23880, + "charLength": 9, + "snippet": { + "text": "'request'" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 713, + "startColumn": 1, + "charOffset": 23697, + "charLength": 349, + "snippet": { + "text": " $initializers = $this->config->get('initializers');\n if (is_array($initializers)) {\n $invokeRequestInitializers = $this->processCodeInjection($initializers, 'request');\n $includes .= PHP_EOL . $invokeRequestInitializers[0];\n $reqInitializers = $invokeRequestInitializers[1];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2a6918923d2f7967f904d0f2d2a47c7da370e1e25b04d3547275942dfdf915c5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpRedundantOptionalArgumentInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Argument matches the parameter's default value", + "markdown": "Argument matches the parameter's default value" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Comparison/ComparisonBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 320, + "startColumn": 21, + "charOffset": 12907, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 318, + "startColumn": 1, + "charOffset": 12808, + "charLength": 167, + "snippet": { + "text": " $left->getCode(),\n $compilationContext,\n true\n );\n switch ($right->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6425689b29e6af4dd7bedf04223f88c02eb7eae761bedd0170290c6c60760d41" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpRedundantOptionalArgumentInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Argument matches the parameter's default value", + "markdown": "Argument matches the parameter's default value" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 693, + "startColumn": 83, + "charOffset": 22676, + "charLength": 9, + "snippet": { + "text": "'request'" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 691, + "startColumn": 1, + "charOffset": 22498, + "charLength": 340, + "snippet": { + "text": " $destructors = $this->config->get('destructors');\n if (is_array($destructors)) {\n $invokeRequestDestructors = $this->processCodeInjection($destructors, 'request');\n $includes .= PHP_EOL . $invokeRequestDestructors[0];\n $reqDestructors = $invokeRequestDestructors[1];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dacb089e9f1080dfb643f8b710e571fa7cc7c77dad429b7512b9c18553e8bc17" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CountOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 728, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 664, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "01ff59fbe23e7c77b25a245955f0b17e1481c5f7db4e3c2be765eb455ab90e3b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FuncGetArgsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 16, + "charOffset": 767, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 703, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "086d105526102e2b6ab14c5766c9811e99fcfa05c930e10ae8245f953c35f50b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarExportOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 820, + "charLength": 24, + "snippet": { + "text": "CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 756, + "charLength": 128, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0cd73e06b28a00b9928d6061d1e476644b0fbdf7b5321a2d5e55b27d69e53df8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CeilOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 765, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 701, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0eaabf68b5f2b1ff5c7a1905ca8369e189a69d410c00dcc02776923e8f3b2ebb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CompareMtimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 790, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 726, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0f6af6981f52ca6d0131df747a8ebab8f412faa361aa995a6e74eb42b8e38f1c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IntvalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 771, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 707, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1386fc3b7201b740bb7459ccdc5ab0036656d071cfcba8f0d3503cdeb97f0433" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ExitOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 16, + "charOffset": 744, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 680, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "17054d07b1c5437d71964cc6bd5592b24bf479358c5e7b43f69e33a5e99373ee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrposOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 771, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 707, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1aa571e6808e4a908b45284f87e178baa3be1c1fad33e183f27b031a46c3fe38" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/UniqueKeyOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 16, + "charOffset": 892, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 828, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1f1dbee54f11e79cd7ed7f35e33b086ca5458a484dd641a96bab917fdf3cb394" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StripslashesOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 16, + "charOffset": 850, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 786, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2f810297185e9a88c33d354289c0eb5c3f70b3e9b73ea043b8795f5a78d60d1f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrReplaceOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 784, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 720, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "32c7493ca2a0702dbe1add784f9b9c42e1fe2506ec61c20e86a87612309b3dac" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsScalarOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 16, + "charOffset": 798, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 734, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "38cce484770d15b21c9750323c7b065413dd652de901fc07e8e96398b8ee9d07" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FileGetContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 800, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 736, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "45c4613cb8614d804903d2e1734b0d078da66b4458385f1625b1327da38b962f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MemstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 16, + "charOffset": 763, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 699, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4658411ec766baafb6cbb5650b3eaeac43cff79fc7781353cb6b3a3352f81036" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MicrotimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 780, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 716, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4b958ed4a6088502dacbe7e6cde0ad7c613306a2c0b5cb6181316cfc237664df" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/InterfaceExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 799, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 735, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4f772090b06f610bdcb016f28f45195bb7f24644af811cf945a92e5e4c69ebee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PowOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 16, + "charOffset": 813, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 749, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5274c15bce7ba46e479a72cf59f12c2892d3c37b7e6faaf73defbbff4e17624a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/CharType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 16, + "charOffset": 878, + "charLength": 29, + "snippet": { + "text": "bool|mixed|CompiledExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 811, + "charLength": 138, + "snippet": { + "text": " * @param array $expression\n *\n * @return bool|mixed|CompiledExpression\n *\n * @throws ReflectionException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "540425f02075f2ad0d45098c65e2d663a68ee1052c90acac483466f0b1c3b8bd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrtoupperOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 16, + "charOffset": 894, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 830, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "555c7583f8dde7863ddc8e2a85808cb8ce8064e82aa89e84edac11a8ea22040b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/ArrayType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 16, + "charOffset": 2856, + "charLength": 23, + "snippet": { + "text": "bool|CompiledExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 2789, + "charLength": 132, + "snippet": { + "text": " * @param array $expression\n *\n * @return bool|CompiledExpression\n *\n * @throws ReflectionException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "56771485c7b23305cf1c05aac094f5cae53599c5fce12546282874e8d8e023af" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ExplodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 767, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 703, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5d19d244b9e175dc66d682b04b2d38c1efd69d70fbec49475642ec5f0c24689e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 33, + "startColumn": 16, + "charOffset": 727, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 31, + "startColumn": 1, + "charOffset": 663, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6602ff83df032e44c3500c7d01bb870c8103d490c9d9475ba131269bc8e8778b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FunctionExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 16, + "charOffset": 742, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 678, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "675cdd78b523b00eb34db92a62282588ec1ef464e644b4bca4d581682663c624" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/DoublevalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 780, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 716, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6769ec13716ba86b942455abef81ac31df276686bb8ffb770c4d456f4fa012c4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FcloseOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 771, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 707, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "67d3bab24004532e669e9fe7c8fca994b6f5d8a6ede6ce6189a96cee3f155971" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GettypeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 774, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 710, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6a76b0b7fe220022ac757e1732f2602ba78df4b7af34e0f10e34d6847316b09b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrlenOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 731, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 667, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6acfc2c8bb4f81b12bb29400ea353c107ca2e57b429ad69fa78f083179b4f5f1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 809, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 745, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6c8111d1b2a99e64ccc90a0acfdd1b4dd9a2c38d28083f7c0649e231b913c498" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ClassExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 787, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 723, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6d7147329c61c2d657716f899c1c1f7dc0f1ffcfab4e6d9d55278fcb66cb147b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/RoundOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 16, + "charOffset": 851, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 787, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "72ab96a239a504a3c0209d1a1b95525f3887290fe01632df8bad9b6a44bf095e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FileExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 784, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 720, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "794a792675e6ac605a0b95f184bd60b3af8da101d8cb3640a79a4a90c645c226" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FwriteOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 771, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 707, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8206f46e2aba99345d004f349080f1dfc60e326816e466d8d5a333c504729016" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrtokOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 777, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 713, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "88f0f4d304e89ba18e0a189fe1aa37333523636ddefde9098906e3ad7c98d41f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ImplodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 767, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 703, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8aa70ea5429896417de0dc5f96929e777371be402867ce12500bcedda574f06f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ArrayKeysOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 16, + "charOffset": 781, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 717, + "charLength": 140, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @return false|CompiledExpression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8c583bdaa5332c5d5f841fb5eaf0c678f1374cfdabc8e6eaa7c4d3d1e7e9dc7b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/TimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 16, + "charOffset": 744, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 680, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8f3c1c8ffaf738efd7a82889dee03a7a3d20239f00da59c27a7fcc25f486e455" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/UniquePathKeyOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 794, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 730, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "99a86f5c26747ee66b9abc53dcb1e2afa68ef67a5f9906d99381f927a0af19b1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsNumericOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 741, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 677, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a3c50c4a3d211121517e987ac2f649d1eebc26fcc01240ebcc39e59964e035fb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CallUserFuncOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 16, + "charOffset": 829, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 765, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a48c1344f9755cee10f34721e73aba5eedd629f8a028b519ffe92ecb5db29c7a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonEncodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 744, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 680, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a70a7f36077cf6f9730ffb093c3301736881654c32f3fe0eb212afc719e6be20" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/BasenameOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 16, + "charOffset": 816, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 752, + "charLength": 140, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @return false|CompiledExpression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aa5435a3af537b4df14309192049cec8e1982454767ede699e1940b7217d90e2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/AssignVariableOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 69, + "startColumn": 16, + "charOffset": 1574, + "charLength": 5, + "snippet": { + "text": "mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 67, + "startColumn": 1, + "charOffset": 1550, + "charLength": 73, + "snippet": { + "text": "\n /**\n * @return mixed\n */\n public function getExpression()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aaa3217a6af5ae3bd071e44f6c05f19e0eac1d1a60c009e8de074e0a8f8f2b58" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FeofOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 725, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 661, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ac57d9dc53e1089b0dc312d11e38473020fa606f3125b09d172b353fd8f2bb48" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonDecodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 744, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 680, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ac5a00b7d1fe23ba620d6942cd80bb825010c5b47a39071616122180e09fb586" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/SubstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 771, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 707, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ae94023ef92c332012e4633c5d75d5b3a1ba4a2dc8e92b4631832c74e5566286" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 16, + "charOffset": 785, + "charLength": 23, + "snippet": { + "text": "bool|CompiledExpression" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 710, + "charLength": 187, + "snippet": { + "text": " * @param CompilationContext $compilationContext\n *\n * @return bool|CompiledExpression\n */\n public function compile($expression, CompilationContext $compilationContext)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aed5d57d6fd3cc3927f311a4c4458d391af4cc9ab61873448606f2867eccea39" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CamelizeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 16, + "charOffset": 954, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 890, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b822827c2ed993be1467d43f2cde370309eb3c28e2f4e6c92738c6e6f67c5b5f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FloorOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 768, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 704, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ba13f9a36d1740dad1e47fdb1b23833ad144428529566b07475cd18f90145ab1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 795, + "charLength": 24, + "snippet": { + "text": "CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 731, + "charLength": 128, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bbd94624b1d6c979dd2a64686e4f032536a0dc7af962f52a5e4a5810b4d4854e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 32, + "startColumn": 16, + "charOffset": 680, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 30, + "startColumn": 1, + "charOffset": 616, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bf76af1b147c4bc15d5ddae57e25d92945422a9effd92bdaf59bbc68042d6f1a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 778, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 714, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c34ed8b3bed8582f5c6f996733caa0588b1eced652621f0152bc83045dab4692" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetNsClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 785, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 721, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cbc4b1fb21d9efc9dd254e119d5f96bf09fb8fcb6867114f3c2c8b06577aa3fe" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MethodExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 16, + "charOffset": 738, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 674, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ccf987ce33804342a458a0aa71542ebc0e505effba981697657df8fc0fcd41fd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Builder/Operators/AssignVariableOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 85, + "startColumn": 16, + "charOffset": 1811, + "charLength": 6, + "snippet": { + "text": "string" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 83, + "startColumn": 1, + "charOffset": 1787, + "charLength": 72, + "snippet": { + "text": "\n /**\n * @return string\n */\n public function getVariable()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cecede694cecbf62cb985a900c30ccccc996859220d355d2c13aba31280cf065" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FilePutContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 800, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 736, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d4849ae176e656c599d1d50b9cbbc862e29253f9e33559acd7a43636a36a8282" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsCallableOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 744, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 680, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "daaf75cca5ff6533cbf3b24c2d3c489f14cd3ea9390768fa9b19cb5f9cde1298" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 783, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 719, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dae2572da5fd15a939eb165a54e9cc13b4dc45a6247b88c2711b8f1030219015" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MergeAppendOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 787, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 723, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "de827be31e6c9760a58211dabd9228b60dcc96a7a22e70e063ba31e4cd328847" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/LdexpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 16, + "charOffset": 807, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 743, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e104ae90304cb568b2146ef5c3fa48274c53409cbf6e8d30473d5fb2f5de36b3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetCalledClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 797, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 733, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e68a9be2f1b603ab37ba8137766da1e127edaa8381eca2062ae134292bdffff7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarDumpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 16, + "charOffset": 774, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 710, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e9776c33e7f4ea01703ed02401b6e1b6eee331697302c8ba3a76dbf5df7d14f8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/HashEqualsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 784, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 720, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ed69fd7b802c00067ba6db4386086c52e2cf93a389079b1904af85ec62329740" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/EndsWithOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 16, + "charOffset": 851, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 787, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eeae0b8239090fffa97a058530e0b59af7898ec3da72bc8f7ee6909a935ee71f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateInstanceOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 16, + "charOffset": 941, + "charLength": 24, + "snippet": { + "text": "CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 877, + "charLength": 128, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f5571172c5ff2aace0a987fc71d0c965b02e36bf64589ba1a5692fc045b5d085" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateArrayOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 16, + "charOffset": 805, + "charLength": 24, + "snippet": { + "text": "CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 741, + "charLength": 128, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f57a8edd1e9f3c4a9a0b49eb6fbb6a4cc597c339acb12a93af59ed33251f1b09" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FuncNumArgsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 33, + "startColumn": 16, + "charOffset": 727, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 31, + "startColumn": 1, + "charOffset": 663, + "charLength": 190, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ff3a85536c6f29ee678610bf0a90baab8c68af5ba9f6c716d952e1c3e03160fa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpReturnDocTypeMismatchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Return type in PHPDoc does not match the actual return type", + "markdown": "Return type in PHPDoc does not match the actual return type" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/EvalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 16, + "charOffset": 790, + "charLength": 29, + "snippet": { + "text": "bool|CompiledExpression|mixed" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 726, + "charLength": 133, + "snippet": { + "text": " * @param CompilationContext $context\n *\n * @return bool|CompiledExpression|mixed\n *\n * @throws CompilerException" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ffd6b3ae2ebbc3149a440c34aa03b1e6377b2d7428f8415d7f681294a2564c64" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpStatementHasEmptyBodyInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Statement has empty body", + "markdown": "Statement has empty body" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/DocblockParser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 99, + "startColumn": 13, + "charOffset": 2372, + "charLength": 2, + "snippet": { + "text": "if" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 97, + "startColumn": 1, + "charOffset": 2312, + "charLength": 179, + "snippet": { + "text": " $currentChar = $this->currentChar;\n\n if ($this->ignoreSpaces && ctype_space($currentChar)) {\n } else {\n if (!$this->commentOpen) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5909ea6a95173876e265533dd44ca507aa0059c05afe1a562efa0af98a485176" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpStatementHasEmptyBodyInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Statement has empty body", + "markdown": "Statement has empty body" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ExitOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 9, + "charOffset": 1104, + "charLength": 2, + "snippet": { + "text": "if" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 1041, + "charLength": 172, + "snippet": { + "text": "\n $context->headersManager->add('kernel/exit');\n if (isset($expression['parameters'])) {\n // TODO: protect resolvedParams[0] from restore\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "94331957a9d0d34a33d4711e9f980667faeff91ab4e655df4dd6a1dd63e60724" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpStatementHasEmptyBodyInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Statement has empty body", + "markdown": "Statement has empty body" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 487, + "startColumn": 31, + "charOffset": 22488, + "charLength": 4, + "snippet": { + "text": "else" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 485, + "startColumn": 1, + "charOffset": 22385, + "charLength": 206, + "snippet": { + "text": " );\n }\n } else {\n // TODO:, raise an exception here?\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cdf62d936d284f33c9549ea48e1fb2ea40a83fe14c53c4f3e325fd6d59a1b950" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpStrictComparisonWithOperandsOfDifferentTypesInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Operands have incompatible types", + "markdown": "Operands have incompatible types" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 191, + "startColumn": 31, + "charOffset": 6965, + "charLength": 3, + "snippet": { + "text": "===" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 189, + "startColumn": 1, + "charOffset": 6786, + "charLength": 391, + "snippet": { + "text": " if ('return_value' != $symbolVariable->getName()) {\n $line = $compilationContext->symbolTable->getLastCallLine();\n if (false === $line || ($line > 0 && $line < $expression['line'])) {\n $numberMutations = $compilationContext->symbolTable->getExpectedMutations(\n $symbolVariable->getName()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2044d1fd4ed1f721aaef771b63d122a3c8ccf288402eb65333c37428fdfa1775" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpStrictComparisonWithOperandsOfDifferentTypesInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Operands have incompatible types", + "markdown": "Operands have incompatible types" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArrayAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 178, + "startColumn": 31, + "charOffset": 5565, + "charLength": 3, + "snippet": { + "text": "===" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 176, + "startColumn": 1, + "charOffset": 5386, + "charLength": 391, + "snippet": { + "text": " if ('return_value' != $symbolVariable->getName()) {\n $line = $compilationContext->symbolTable->getLastCallLine();\n if (false === $line || ($line > 0 && $line < $expression['line'])) {\n $numberMutations = $compilationContext->symbolTable->getExpectedMutations(\n $symbolVariable->getName()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2d35583c64d82c44a4c6fc6b34050f9bedf8b22f96fca4fda646c355b9a0257a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpStrictComparisonWithOperandsOfDifferentTypesInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Operands have incompatible types", + "markdown": "Operands have incompatible types" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArrayAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 221, + "startColumn": 31, + "charOffset": 7550, + "charLength": 3, + "snippet": { + "text": "===" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 219, + "startColumn": 1, + "charOffset": 7370, + "charLength": 392, + "snippet": { + "text": " if ('return_value' !== $symbolVariable->getName()) {\n $line = $compilationContext->symbolTable->getLastCallLine();\n if (false === $line || ($line > 0 && $line < $expression['line'])) {\n $numberMutations = $compilationContext->symbolTable->getExpectedMutations(\n $symbolVariable->getName()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "67d6ea83b3ddde3efc015b1b3a897b7cb52513f0597346a8eb91b2b36dfa6a07" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpSwitchCanBeReplacedWithMatchExpressionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "'switch' statement can be converted to 'match' expression", + "markdown": "'switch' statement can be converted to 'match' expression" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 217, + "startColumn": 9, + "charOffset": 6201, + "charLength": 6, + "snippet": { + "text": "switch" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 215, + "startColumn": 1, + "charOffset": 6142, + "charLength": 136, + "snippet": { + "text": " $isVariable = $index instanceof Variable;\n\n switch ($index->getType()) {\n case 'int':\n case 'uint':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "38c729d4e7ac1250d0852e312f821c2ffeea6697026f0f37a5a05869e3ff51b9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpSwitchCanBeReplacedWithMatchExpressionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "'switch' statement can be converted to 'match' expression", + "markdown": "'switch' statement can be converted to 'match' expression" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1398, + "startColumn": 17, + "charOffset": 49544, + "charLength": 6, + "snippet": { + "text": "switch" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1396, + "startColumn": 1, + "charOffset": 49423, + "charLength": 220, + "snippet": { + "text": " if (is_object($parameters)) {\n foreach ($parameters->getParameters() as $parameter) {\n switch ($parameter['data-type']) {\n case 'int':\n case 'uint':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6b0c14c3e4c567f267b95993de75df24e6777abe7de167ce2b6c0ee477024ff1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpSwitchCanBeReplacedWithMatchExpressionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "'switch' statement can be converted to 'match' expression", + "markdown": "'switch' statement can be converted to 'match' expression" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1778, + "startColumn": 13, + "charOffset": 61609, + "charLength": 6, + "snippet": { + "text": "switch" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1776, + "startColumn": 1, + "charOffset": 61543, + "charLength": 182, + "snippet": { + "text": " {\n if ($value instanceof GlobalConstant) {\n switch ($value->getName()) {\n case 'ZEPHIR_GLOBAL(global_null)':\n $value = 'null';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d7cfdef1b9a137729e7bb5e221a634f6549732be4a43b3622948352a8c420a08" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpSwitchStatementWitSingleBranchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Switch has only single case", + "markdown": "Switch has only single case" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 106, + "startColumn": 17, + "charOffset": 4199, + "charLength": 6, + "snippet": { + "text": "switch" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 104, + "startColumn": 1, + "charOffset": 4121, + "charLength": 238, + "snippet": { + "text": " $expr = new Expression($assignment['expr']);\n\n switch ($assignment['assign-type']) {\n case 'variable':\n if (!$readDetector->detect($variable, $assignment['expr'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4b0512b0a9c975e29f2d2e4c5b7a44d7a2e6998b4687e7f7ab9124ae86af1b2d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpSwitchStatementWitSingleBranchInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Switch has only single case", + "markdown": "Switch has only single case" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Passes/LocalContextPass.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 376, + "startColumn": 21, + "charOffset": 12041, + "charLength": 6, + "snippet": { + "text": "switch" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 374, + "startColumn": 1, + "charOffset": 11908, + "charLength": 298, + "snippet": { + "text": " case 'variable-append':\n $this->markVariableNoLocal($assignment['variable']);\n switch ($assignment['expr']['type']) {\n case 'variable':\n $this->markVariableNoLocal($assignment['expr']['value']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "57701aacf1cda8168f76c54f7d396660e2fec19f5f6ce18bfd0d8ad0e5b420ee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 55, + "charOffset": 1443, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1382, + "charLength": 140, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "024997eaf6c686e9b72cf4a67c6eb009dbf68bfa3fb52b7c0ad1d3e50e7d6e2d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Command'", + "markdown": "Undefined class 'Command'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/AbstractCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 39, + "charOffset": 327, + "charLength": 7, + "snippet": { + "text": "Command" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 129, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Command\\Command;\n\nabstract class AbstractCommand extends Command" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "05c44d767a4dfc7c9e7c334fe304e7aed5401548f81cb8b8af2c2844cf80dcda" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 28, + "startColumn": 37, + "charOffset": 925, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 26, + "startColumn": 1, + "charOffset": 784, + "charLength": 262, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\EventDispatcher\\EventDispatcher;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0743d6b0347eb5969bbabbe5fc8357bdbc543f6fe5e002a32cd8ac58a71c01b3" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 187, + "startColumn": 53, + "charOffset": 5156, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 185, + "startColumn": 1, + "charOffset": 5037, + "charLength": 177, + "snippet": { + "text": " * @return InputDefinition An InputDefinition instance\n */\n protected function getDefaultInputDefinition(): InputDefinition\n {\n return new InputDefinition([" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0824b598bb93fa59b037632761b904f52d74143dfa857ec9789de2cccb05eada" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 37, + "charOffset": 377, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 205, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "08b26d355b9e3b55b1e1105c60b86b0352a5d91113abbcbdd0a185a045351efd" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ConsoleErrorEvent'", + "markdown": "Undefined class 'ConsoleErrorEvent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/ErrorListener.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 37, + "charOffset": 317, + "charLength": 17, + "snippet": { + "text": "ConsoleErrorEvent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 162, + "snippet": { + "text": "namespace Zephir\\Console;\n\nuse Symfony\\Component\\Console\\Event\\ConsoleErrorEvent;\nuse Zephir\\Exception\\CompilerException;\nuse Zephir\\Exception\\ExceptionInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "08d9aaceb4a4336130f260e0c57fb99964033f21e9c16aec3d77e2fcdb5cc961" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 32, + "charOffset": 1491, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1453, + "charLength": 116, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n // call generate" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "096c5a873a819c9ab2638d123d3b5047a16401fb40f7aafb07b0c000c71961bd" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 37, + "charOffset": 496, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 355, + "charLength": 228, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0d20b604698ddac62bfd11e78f51c44e15f3284046a953dfcd9f0db8037c4c45" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'RuntimeException'", + "markdown": "Undefined class 'RuntimeException'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 105, + "startColumn": 45, + "charOffset": 3149, + "charLength": 16, + "snippet": { + "text": "RuntimeException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 103, + "startColumn": 1, + "charOffset": 3040, + "charLength": 189, + "snippet": { + "text": " try {\n return parent::doRun($input, $output);\n } catch (CommandNotFoundException | RuntimeException $e) {\n fprintf(STDERR, $e->getMessage() . PHP_EOL);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0d90d61a2d5da9f05789e4723f8f85adbbe8a631b3033a5ee59eb71df48d62dc" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 37, + "charOffset": 479, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 337, + "charLength": 212, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Exception\\FileSystemException;\nuse Zephir\\Os;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0de89a0aaa0a2b9d3ae879eaab7ce24acf9e2b11e2f8718ff6df247fec22fb1e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 32, + "charOffset": 1717, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1679, + "charLength": 145, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output): int\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0e93b2890029f86ee2275b328a2e4d99edae3b7603c74dd3429d21b1741f92ff" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 62, + "startColumn": 19, + "charOffset": 1492, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 60, + "startColumn": 1, + "charOffset": 1389, + "charLength": 148, + "snippet": { + "text": " protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);\n\n try {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0ecc8caa32572ec486932935842bd4cb6753fe8c9407e2c4a1a8b92b4b8b6b98" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/RemoveOptionsTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 16, + "charOffset": 615, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 527, + "charLength": 167, + "snippet": { + "text": " $filtered = array_filter(\n $definition->getOptions(),\n fn(InputOption $option) => !in_array($option->getName(), $names, true)\n );\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0ffeec19f522147cca10e8c7da4886854ce176c51681d0743fb0229c42a6c6b2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 72, + "startColumn": 21, + "charOffset": 2008, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 70, + "startColumn": 1, + "charOffset": 1912, + "charLength": 165, + "snippet": { + "text": " 'Output directory to generate theme'\n ),\n new InputOption(\n 'options',\n null," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "112cbd5a4440de4c5acace12b155ade36acf57cdac01f4ef4325adb44f0fe1ad" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ArrayInput'", + "markdown": "Undefined class 'ArrayInput'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 37, + "charOffset": 340, + "charLength": 10, + "snippet": { + "text": "ArrayInput" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 168, + "snippet": { + "text": "\nuse Exception;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "114d039fd48208f74454fad325749b7ec72a25e41e7a08dd785e3b86f39a282a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 37, + "charOffset": 533, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 394, + "charLength": 213, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;\nuse Zephir\\Exception\\CompilerException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "11f8e65bf73d3c66a1261b1f182e9191ff34f5f7531c11770ab0d5db250cb75a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ListCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 9, + "charOffset": 884, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 829, + "charLength": 108, + "snippet": { + "text": " protected function configure(): void\n {\n parent::configure();\n\n $this->setHidden(true);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "13413098d8f2eae7efb7f95102f02cf8cfe5aa92a0e3f9866ccff827d64ed38d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 19, + "charOffset": 1794, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1686, + "charLength": 222, + "snippet": { + "text": " protected function execute(InputInterface $input, OutputInterface $output): int\n {\n $io = new SymfonyStyle($input, $output);\n\n $jobs = $input->hasOption('jobs') ? (int)$input->getOption('jobs') : null;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "137b721b7f0abdeb6082c6bb3034110002236ca72fb520353db152899fe927dc" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 56, + "startColumn": 44, + "charOffset": 1502, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 54, + "startColumn": 1, + "charOffset": 1452, + "charLength": 107, + "snippet": { + "text": " }\n\n protected function createDefinition(): InputDefinition\n {\n return new InputDefinition(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "14c054f7a6dfac04c94f2149fc6ecff1c1850b10a44d28f8eaa7ea3b9dd73680" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ConsoleErrorEvent'", + "markdown": "Undefined class 'ConsoleErrorEvent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/ErrorListener.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 36, + "charOffset": 558, + "charLength": 17, + "snippet": { + "text": "ConsoleErrorEvent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 501, + "charLength": 170, + "snippet": { + "text": "class ErrorListener\n{\n public function onCommandError(ConsoleErrorEvent $event): void\n {\n if (!filter_var(getenv('ZEPHIR_DEBUG'), FILTER_VALIDATE_BOOLEAN)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1664219a4f695705d52999fd65aed89a9d22cb071c0521a4ebdcfd6c9cd0ff7a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ExceptionInterface'", + "markdown": "Undefined class 'ExceptionInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 84, + "startColumn": 18, + "charOffset": 2417, + "charLength": 18, + "snippet": { + "text": "ExceptionInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 82, + "startColumn": 1, + "charOffset": 2251, + "charLength": 301, + "snippet": { + "text": " // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument.\n $input->bind($this->getDefinition());\n } catch (ExceptionInterface) {\n // Errors must be ignored, full binding/validation happens later when the command is known.\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "17a3c996f81b5aae35061ab37bc478b8b034086a4cb6535b05855a7f93d4d5eb" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'EventDispatcher'", + "markdown": "Undefined class 'EventDispatcher'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 27, + "charOffset": 1466, + "charLength": 15, + "snippet": { + "text": "EventDispatcher" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1383, + "charLength": 199, + "snippet": { + "text": " parent::__construct('Zephir', Zephir::VERSION);\n\n $dispatcher = new EventDispatcher();\n $dispatcher->addListener(ConsoleEvents::ERROR, [new ErrorListener(), 'onCommandError']);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "197b12de32a690996d39a5cb01b9ae2c6a97d6920579d3946f6e4778787b35a7" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 210, + "startColumn": 17, + "charOffset": 6125, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 208, + "startColumn": 1, + "charOffset": 6061, + "charLength": 166, + "snippet": { + "text": " 'vernum',\n null,\n InputOption::VALUE_NONE,\n 'Print the version of the compiler as integer'\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1ca72ca2ab7cc00c9840077bcb3062b326c84f9125d41f0bf643c1465c8fe939" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ArrayInput'", + "markdown": "Undefined class 'ArrayInput'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 79, + "startColumn": 31, + "charOffset": 2284, + "charLength": 10, + "snippet": { + "text": "ArrayInput" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 77, + "startColumn": 1, + "charOffset": 2239, + "charLength": 170, + "snippet": { + "text": "\n try {\n $command->run(new ArrayInput($arguments), $output);\n } catch (Exception $e) {\n $io->getErrorStyle()->error($e->getMessage());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1d0c7630c6250fd41f99dafe3c48f615cff30a0bbd534b2711425ccba5253a1a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'BaseApplication'", + "markdown": "Undefined class 'BaseApplication'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 33, + "charOffset": 1325, + "charLength": 15, + "snippet": { + "text": "BaseApplication" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 1274, + "charLength": 102, + "snippet": { + "text": "use const STDERR;\n\nfinal class Application extends BaseApplication\n{\n public function __construct()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1d4f1bef6ccef7ba087356cc49a1aa983b94fceded5c2e3a92102a9df444538d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 37, + "charOffset": 325, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 189, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1f94eef3340f89187fab4bdeb2d33992b68f203f4d875bf3a2673b6c0e8bf97d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 32, + "charOffset": 2016, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 1978, + "charLength": 177, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output): int\n {\n $namespace = $this->sanitizeNamespace($input->getArgument('namespace'));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "201c24925430e508e91d5f6b2c50e31e083fc84e72c9dcd322f52c899f30e612" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'CommandNotFoundException'", + "markdown": "Undefined class 'CommandNotFoundException'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 41, + "charOffset": 541, + "charLength": 24, + "snippet": { + "text": "CommandNotFoundException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 405, + "charLength": 279, + "snippet": { + "text": "use Symfony\\Component\\Console\\Command\\HelpCommand;\nuse Symfony\\Component\\Console\\ConsoleEvents;\nuse Symfony\\Component\\Console\\Exception\\CommandNotFoundException;\nuse Symfony\\Component\\Console\\Exception\\ExceptionInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2048ae8ebd92a740a14836a703933872f7bdb52bd0bc8bffb90b5d05e198e6fd" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerAwareTrait'", + "markdown": "Undefined class 'LoggerAwareTrait'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 9, + "charOffset": 1544, + "charLength": 16, + "snippet": { + "text": "LoggerAwareTrait" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1511, + "charLength": 59, + "snippet": { + "text": "{\n use CompilerTrait;\n use LoggerAwareTrait;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "209a8c6d65370a6d7776f69b17e60bebc5e19366df1602948404f42cbe14d060" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Logger'", + "markdown": "Undefined class 'Logger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 105, + "startColumn": 15, + "charOffset": 2807, + "charLength": 6, + "snippet": { + "text": "Logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 103, + "startColumn": 1, + "charOffset": 2768, + "charLength": 113, + "snippet": { + "text": "\n$parser = new Parser();\n$logger = new Logger('zephir', [\n $consoleStdErrorHandler,\n $consoleStdOutHandler," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "20c866375027fe241e804cdcc8eadc0882ad5353aafc9884215a589bfffac7f9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'NullLogger'", + "markdown": "Undefined class 'NullLogger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 36, + "charOffset": 1851, + "charLength": 10, + "snippet": { + "text": "NullLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 1735, + "charLength": 217, + "snippet": { + "text": " $this->config = $config;\n $this->classes = $classes;\n $this->logger = new NullLogger();\n $this->templatesPath = $templatesPath;\n $this->options = $options;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2212a7df922f368b00a0428a22c429d2a5b3c7a00dfa2675ba45f9a728a9745b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerInterface'", + "markdown": "Undefined class 'LoggerInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler/CompilerFileFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 13, + "charOffset": 294, + "charLength": 15, + "snippet": { + "text": "LoggerInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 106, + "snippet": { + "text": "namespace Zephir\\Compiler;\n\nuse Psr\\Log\\LoggerInterface;\nuse Zephir\\AliasManager;\nuse Zephir\\CompilerFile;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "22973076ed36990cbe33e2a9f5f0c4010c32ce03447fe1a0f4bdfeeab91f669d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Config'", + "markdown": "Undefined class 'Config'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": ".php-cs-fixer.dist.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 26, + "charOffset": 986, + "charLength": 6, + "snippet": { + "text": "Config" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 916, + "charLength": 115, + "snippet": { + "text": " ->notPath('#tests/ext-bootstrap.php#');\n\n$config = new PhpCsFixer\\Config();\n$config\n ->setRiskyAllowed(true)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "22d86635b33ca385fc6648c14671972795305141d05edf3589265f70918dc82c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Command'", + "markdown": "Undefined class 'Command'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 175, + "startColumn": 16, + "charOffset": 4826, + "charLength": 7, + "snippet": { + "text": "Command" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 173, + "startColumn": 1, + "charOffset": 4783, + "charLength": 149, + "snippet": { + "text": " * {@inheritdoc}\n *\n * @return Command[] An array of default Command instances\n */\n protected function getDefaultCommands(): array" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "22ddc2dff75b01e29f44417dbe8279bef2fc7ef68fdde560b5955573021333c4" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputArgument'", + "markdown": "Undefined class 'InputArgument'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 190, + "startColumn": 42, + "charOffset": 5256, + "charLength": 13, + "snippet": { + "text": "InputArgument" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 188, + "startColumn": 1, + "charOffset": 5172, + "charLength": 165, + "snippet": { + "text": " {\n return new InputDefinition([\n new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),\n\n new InputOption(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "24598d840743d84635eb18f5915ee7707f142cee2dc8546e2c5607eac640c09a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'NullLogger'", + "markdown": "Undefined class 'NullLogger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 38, + "charOffset": 1714, + "charLength": 10, + "snippet": { + "text": "NullLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1592, + "charLength": 142, + "snippet": { + "text": " $this->config = $config;\n $this->context = $context;\n $this->logger = new NullLogger();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2576acb061f1073d9bba5790deeac165d9a201c8c709c9eacd955e62f5ae3183" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Finder'", + "markdown": "Undefined class 'Finder'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": ".php-cs-fixer.dist.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 22, + "charOffset": 548, + "charLength": 6, + "snippet": { + "text": "Finder" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 521, + "charLength": 86, + "snippet": { + "text": "EOF;\n\n$finder = PhpCsFixer\\Finder::create()\n ->in(__DIR__)\n ->append([__FILE__])" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "257ce527a6f118fe918331075ad58d0947e249613e1488569a6a9f3a920c4393" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputArgument'", + "markdown": "Undefined class 'InputArgument'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 74, + "startColumn": 21, + "charOffset": 1863, + "charLength": 13, + "snippet": { + "text": "InputArgument" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 72, + "startColumn": 1, + "charOffset": 1775, + "charLength": 177, + "snippet": { + "text": " new InputArgument(\n 'namespace',\n InputArgument::REQUIRED,\n 'The extension namespace'\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "262c5dc1835cf7b3139ea7c74dd5bde89591ab87f6764e265054fd0bca661269" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 55, + "charOffset": 1236, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1175, + "charLength": 142, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n if (!$this->filesystem->isInitialized()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "28d47c886e570751e3fbee695c41b5ad0bb1a232c234891fd856a44359ea44a7" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 67, + "startColumn": 27, + "charOffset": 1846, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 65, + "startColumn": 1, + "charOffset": 1777, + "charLength": 219, + "snippet": { + "text": " * @throws Exception|Throwable\n */\n public function doRun(InputInterface $input, OutputInterface $output): int\n {\n if (true === $input->hasParameterOption(['--dumpversion', '-dumpversion'], true)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "28dbe7c035a093a46e4456874b24b071f083cf6541c9b1828e49d87c5d29abc5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'HelpCommand'", + "markdown": "Undefined class 'HelpCommand'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 39, + "charOffset": 443, + "charLength": 11, + "snippet": { + "text": "HelpCommand" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 296, + "charLength": 270, + "snippet": { + "text": "use Symfony\\Component\\Console\\Application as BaseApplication;\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Command\\HelpCommand;\nuse Symfony\\Component\\Console\\ConsoleEvents;\nuse Symfony\\Component\\Console\\Exception\\CommandNotFoundException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "29e29092f764510e43f5304eb6353e3363fddcf9ec3ed29e3cb7a7986433ccc6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/AbstractCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 9, + "charOffset": 552, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 461, + "charLength": 207, + "snippet": { + "text": " public function mergeApplicationDefinition(bool $mergeArgs = true): void\n {\n parent::mergeApplicationDefinition($mergeArgs);\n\n $this->removeOptions(['dumpversion', 'version', 'vernum']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2e1b87fd84b53822b19dac9045145382073ec3b391d606f08f62711ca09f2876" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 37, + "charOffset": 486, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 341, + "charLength": 267, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "328083067688e2199d0b7c3aae08c03fc07304d58630f1cf7990a25254106cb8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'CommandNotFoundException'", + "markdown": "Undefined class 'CommandNotFoundException'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 105, + "startColumn": 18, + "charOffset": 3122, + "charLength": 24, + "snippet": { + "text": "CommandNotFoundException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 103, + "startColumn": 1, + "charOffset": 3040, + "charLength": 189, + "snippet": { + "text": " try {\n return parent::doRun($input, $output);\n } catch (CommandNotFoundException | RuntimeException $e) {\n fprintf(STDERR, $e->getMessage() . PHP_EOL);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "329bef857af3fdbc298883a942ec4e91c71b4cb8e4584e312ff298ff259cfab9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'NullLogger'", + "markdown": "Undefined class 'NullLogger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 13, + "charOffset": 315, + "charLength": 10, + "snippet": { + "text": "NullLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 272, + "charLength": 119, + "snippet": { + "text": "\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse ReflectionException;\nuse Zephir\\Class\\Definition\\Definition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "336200ae402758bb8c07e4dbfdaa6390bfdc05d4b8b4264625821b4a76284c42" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerInterface'", + "markdown": "Undefined class 'LoggerInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilationContext.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 108, + "startColumn": 13, + "charOffset": 2725, + "charLength": 15, + "snippet": { + "text": "LoggerInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 106, + "startColumn": 1, + "charOffset": 2683, + "charLength": 133, + "snippet": { + "text": " * Global logger.\n */\n public ?LoggerInterface $logger = null;\n /**\n * Whether the current method is static or not." + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "35171be01d3eb9b3984ea176a9e1f1d1d362bba25904f08da47cc1fcff524d52" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 37, + "charOffset": 325, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 188, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "35930481aea105a001006d9ffee46e53337cb1bed298a95a32437f9dede48571" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 20, + "charOffset": 1543, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1459, + "charLength": 147, + "snippet": { + "text": " protected function createDefinition(): InputDefinition\n {\n return new InputDefinition(\n [\n new InputOption(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "36d8620336fb281296a92fa5382ce70a3a5896e0b2cc0386141e42f54c43ccd5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 198, + "startColumn": 17, + "charOffset": 5576, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 196, + "startColumn": 1, + "charOffset": 5432, + "charLength": 349, + "snippet": { + "text": " \"Print the version of the compiler and don't do anything else (also works with a single hyphen)\"\n ),\n new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Print this help message'),\n new InputOption('--no-ansi', null, InputOption::VALUE_NONE, 'Disable ANSI output'),\n new InputOption(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3762bfd3ab63756d683a6892aa3f3e991c92ee71aad66731552e061b664b75fc" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 38, + "charOffset": 431, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 229, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "37db4839ac4a27b82a594db4edfeb936d77d096f74204aca7c896cd92697ad5c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LineFormatter'", + "markdown": "Undefined class 'LineFormatter'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 23, + "charOffset": 312, + "charLength": 13, + "snippet": { + "text": "LineFormatter" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 92, + "snippet": { + "text": "namespace Zephir\\Logger\\Formatter;\n\nuse Monolog\\Formatter\\LineFormatter;\nuse Zephir\\Config;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "38c847935ad62e3273de7332055979941ea6485f2730d2223f2ee75cdf54adc8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'RuntimeException'", + "markdown": "Undefined class 'RuntimeException'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 161, + "startColumn": 23, + "charOffset": 4858, + "charLength": 16, + "snippet": { + "text": "RuntimeException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 159, + "startColumn": 1, + "charOffset": 4754, + "charLength": 192, + "snippet": { + "text": " // If sanitizing returns an empty string\n if (empty($namespace)) {\n throw new RuntimeException('Cannot obtain a valid initial namespace for the project.');\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "38da71dc01ad67f0d6a7b9879acd3a3cbcf826288bde28d93a131455ec2c84ea" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'NullLogger'", + "markdown": "Undefined class 'NullLogger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 13, + "charOffset": 338, + "charLength": 10, + "snippet": { + "text": "NullLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 273, + "charLength": 139, + "snippet": { + "text": "use DirectoryIterator;\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse RecursiveDirectoryIterator;\nuse RecursiveIteratorIterator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "390bd85a904d958e23106649c1124057e9fd090198a8cf66578391a8d91246e0" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputArgument'", + "markdown": "Undefined class 'InputArgument'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 37, + "charOffset": 769, + "charLength": 13, + "snippet": { + "text": "InputArgument" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 627, + "charLength": 261, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "390c7fb96f9df6fbac9812e1ec36545b43223b045ee6d3380045d5329479af38" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 37, + "charOffset": 430, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 257, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3970e997899369cad05bf8147c0864f9ccef597f6f830be7f72e77d4a6d87881" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 24, + "charOffset": 1655, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1545, + "charLength": 164, + "snippet": { + "text": " // call generate\n $command = $this->getApplication()->find('generate');\n $io = new SymfonyStyle($input, $output);\n\n $arguments = [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "399fcb5074596658ef2c723b40325d3c525787225ef4f938ebb9d05fb5ed4a4b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 38, + "charOffset": 543, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 405, + "charLength": 205, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3b96584f9f6c1fff33b93306c50ab261b23c96c6f275928db4d5d98f0b79e76e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ArrayInput'", + "markdown": "Undefined class 'ArrayInput'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 24, + "startColumn": 37, + "charOffset": 721, + "charLength": 10, + "snippet": { + "text": "ArrayInput" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 22, + "startColumn": 1, + "charOffset": 567, + "charLength": 269, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\ExceptionInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3e7bf756b09bed2da3484ddafbe9f64c64d742f9c5f7b7bfb2ac835097910e5c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 55, + "charOffset": 1123, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 1062, + "charLength": 152, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $command = $this->getApplication()->find('clean');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3eca0cb6e80e8bdba52d65a75aebea9e25f8590b65c582748976aa18f9240398" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 37, + "charOffset": 373, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 204, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3f586ac3fc7fc0f267e3be849e22c8ec7a9abde983898db7f599fac8f233db36" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 20, + "charOffset": 1658, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1574, + "charLength": 111, + "snippet": { + "text": " protected function createDefinition(): InputDefinition\n {\n return new InputDefinition([]);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3fc3e7d341a73a3c1e3b65bf0cbef10b62d81ebe2f8f354c0d070b6bde36bbeb" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Logger'", + "markdown": "Undefined class 'Logger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 96, + "startColumn": 61, + "charOffset": 2518, + "charLength": 6, + "snippet": { + "text": "Logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 94, + "startColumn": 1, + "charOffset": 2412, + "charLength": 182, + "snippet": { + "text": "$formatter = new CompilerFormatter($config);\n\n$consoleStdErrorHandler = new StreamHandler('php://stderr', Logger::WARNING, false);\n$consoleStdErrorHandler->setFormatter($formatter);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "41ad1115aa03768aa9fa0249c8f18c4dd93a39b8ad1b0f79225066e4dee728a9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ListCommand'", + "markdown": "Undefined class 'ListCommand'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ListCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 39, + "charOffset": 327, + "charLength": 11, + "snippet": { + "text": "ListCommand" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 101, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Command\\ListCommand as Command;\n\n/**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "430e06b98ede133db017fdece011a788833995f6a1e061381951f4cdd595aab0" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 199, + "startColumn": 17, + "charOffset": 5673, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 197, + "startColumn": 1, + "charOffset": 5545, + "charLength": 265, + "snippet": { + "text": " ),\n new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Print this help message'),\n new InputOption('--no-ansi', null, InputOption::VALUE_NONE, 'Disable ANSI output'),\n new InputOption(\n '--verbose'," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "45fa0c4760407a79efeeb0175c0e0900be5041a19ff041b9f627e2ec08e55758" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 15, + "charOffset": 1683, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1641, + "charLength": 109, + "snippet": { + "text": " * {@inheritdoc}\n *\n * @param InputInterface $input\n * @param OutputInterface $output\n *" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "46a817a4c5fa377eddc37481f2cc4def7da36fc7177c741511ea623d20c9afb2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ArrayInput'", + "markdown": "Undefined class 'ArrayInput'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 100, + "startColumn": 38, + "charOffset": 2984, + "charLength": 10, + "snippet": { + "text": "ArrayInput" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 98, + "startColumn": 1, + "charOffset": 2902, + "charLength": 137, + "snippet": { + "text": " $command = $this->find('list');\n\n return $command->run(new ArrayInput(['command' => 'list']), $output);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "47bc82e6d07cfe62a3a920d72876bb827f35e66d3b73600ab625fe3d9756a258" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 119, + "startColumn": 31, + "charOffset": 3409, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 117, + "startColumn": 1, + "charOffset": 3335, + "charLength": 99, + "snippet": { + "text": " public function getHelp(): string\n {\n return Zephir::LOGO . parent::getHelp();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4a0221700d66a3d93def1db9d4350ed4c2578ef23ff9e9a2cc25668d6fc98f7d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 9, + "charOffset": 1391, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1343, + "charLength": 141, + "snippet": { + "text": " public function __construct()\n {\n parent::__construct('Zephir', Zephir::VERSION);\n\n $dispatcher = new EventDispatcher();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4a2790a65d6f27efc8d5e4f96ee7aa5479eb932751ab802e27cf379789a58e3b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 38, + "charOffset": 1195, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1044, + "charLength": 422, + "snippet": { + "text": " ->setDescription('Compile a Zephir extension')\n ->setDefinition($this->createDefinition())\n ->addOption('dev', null, InputOption::VALUE_NONE, 'Compile the extension in development mode')\n ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Compile the extension in production mode')\n ->addOption('jobs', 'j', InputOption::VALUE_REQUIRED, 'Set make -j (job slots)')" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4a44bd0764f82d35cbab37c4f9d6cebf01fe71a39281e189ba10626277c1ad36" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 41, + "charOffset": 1515, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1258, + "charLength": 425, + "snippet": { + "text": " ->setDescription('Installs the extension in the extension directory (may require root password)')\n ->addOption('dev', null, InputOption::VALUE_NONE, 'Install the extension in development mode')\n ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Install the extension in production mode')\n ->setHelp($this->getDevelopmentModeHelp() . PHP_EOL . $this->getZflagsHelp())\n ;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4c7cb9fb43eae2304426f1078418d9339f7db211eddf8e084d93041e5c63b8d9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 19, + "charOffset": 1428, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1373, + "charLength": 100, + "snippet": { + "text": "\n $this->filesystem->clean();\n $io = new SymfonyStyle($input, $output);\n\n try {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4caf172f60c4e8e1da4095ec9b3dee453395a929286abdabae45d6656c2a42d2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 55, + "charOffset": 1740, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1679, + "charLength": 145, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output): int\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4d6c7bad5bcd5c407c20c9464e847076f39d8bd5a97a0ca5634e58fb28ffa1f5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerAwareTrait'", + "markdown": "Undefined class 'LoggerAwareTrait'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 13, + "charOffset": 308, + "charLength": 16, + "snippet": { + "text": "LoggerAwareTrait" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 272, + "charLength": 109, + "snippet": { + "text": "\nuse DirectoryIterator;\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse RecursiveDirectoryIterator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4ed3a38f24f602d8c14da7af9678d2dac47fa661e7c4d4b8632f708f71e96a02" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 38, + "charOffset": 1066, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 895, + "charLength": 435, + "snippet": { + "text": " ->setDescription('Generates/Compiles/Installs a Zephir extension')\n ->setDefinition($this->createDefinition())\n ->addOption('dev', null, InputOption::VALUE_NONE, 'Build the extension in development mode')\n ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Build the extension in production mode')\n ->setHelp($this->getDevelopmentModeHelp() . PHP_EOL . $this->getZflagsHelp())" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "514496549d142a6196744f3c93189e864432655974c626edcde16d3fdcb21060" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 55, + "charOffset": 1514, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1453, + "charLength": 116, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n // call generate" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "51eb4b85cbbbcaaf4d778b60f30015bf7fdece6b65c68159a2483bb82df676c9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 17, + "charOffset": 1213, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1186, + "charLength": 88, + "snippet": { + "text": " }\n\n $vars = parent::normalize($record);\n\n $output = $this->format;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5285f60d3bd042321196aba617d3c90c1da7cc8c17e58a8809e025cb844578ed" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerAwareTrait'", + "markdown": "Undefined class 'LoggerAwareTrait'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 9, + "charOffset": 972, + "charLength": 16, + "snippet": { + "text": "LoggerAwareTrait" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 942, + "charLength": 72, + "snippet": { + "text": "class Documentation\n{\n use LoggerAwareTrait;\n\n protected $baseUrl;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5618ff051f60e7d874230cf2dd9e4c3c77e4b4b51ce34b1c0d0f12848b0fd989" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 75, + "startColumn": 21, + "charOffset": 2098, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 73, + "startColumn": 1, + "charOffset": 2021, + "charLength": 160, + "snippet": { + "text": " 'options',\n null,\n InputOption::VALUE_REQUIRED,\n 'Theme options'\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5637878808dc3de0128f6b9e7582c2c5f4dbb86634253f92f13f6e1d35ef1aec" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'StreamHandler'", + "markdown": "Undefined class 'StreamHandler'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 96, + "startColumn": 31, + "charOffset": 2488, + "charLength": 13, + "snippet": { + "text": "StreamHandler" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 94, + "startColumn": 1, + "charOffset": 2412, + "charLength": 182, + "snippet": { + "text": "$formatter = new CompilerFormatter($config);\n\n$consoleStdErrorHandler = new StreamHandler('php://stderr', Logger::WARNING, false);\n$consoleStdErrorHandler->setFormatter($formatter);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "57fb982a12c167219b357faaec138ea1b31ea2597ad800e693765970e76a8cde" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'NullLogger'", + "markdown": "Undefined class 'NullLogger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 13, + "charOffset": 315, + "charLength": 10, + "snippet": { + "text": "NullLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 272, + "charLength": 125, + "snippet": { + "text": "\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse Zephir\\Class\\Definition\\Definition;\nuse Zephir\\Documentation\\File;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "586ca828af7c6204ad7d15c2e4f5c43df2b16529f0167a26bdb9f8631a6a6006" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 37, + "charOffset": 493, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 352, + "charLength": 257, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "59a2dcab7984fe72a127d9479dab89ecde5658749f783c27161cd9ec833dc35f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 37, + "charOffset": 480, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 341, + "charLength": 192, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;\nuse Zephir\\Config;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5aa474698b699a882e4681d76c23667c62f6b4ee5de6bb1d57da666ad4c1746c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 19, + "charOffset": 1599, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1496, + "charLength": 179, + "snippet": { + "text": " protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);\n\n $trace = $input->getOption('trace');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5b4d5fdfb7bc8a43798aa66aacb5d676551456e46f4b8d5e5b8a0e2a5b38ff11" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'RuntimeException'", + "markdown": "Undefined class 'RuntimeException'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 154, + "startColumn": 23, + "charOffset": 4595, + "charLength": 16, + "snippet": { + "text": "RuntimeException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 152, + "startColumn": 1, + "charOffset": 4508, + "charLength": 163, + "snippet": { + "text": " // Prevent \"\" namespace\n if (empty($namespace)) {\n throw new RuntimeException('Not enough arguments (missing: \"namespace\").');\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5b7c1501daf60f8f6259e229584ea4ee5176896f37e60feaabbce5fa4e04c0e1" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'StreamHandler'", + "markdown": "Undefined class 'StreamHandler'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 99, + "startColumn": 29, + "charOffset": 2623, + "charLength": 13, + "snippet": { + "text": "StreamHandler" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 97, + "startColumn": 1, + "charOffset": 2543, + "charLength": 181, + "snippet": { + "text": "$consoleStdErrorHandler->setFormatter($formatter);\n\n$consoleStdOutHandler = new StreamHandler('php://stdout', Logger::INFO, false);\n$consoleStdOutHandler->setFormatter($formatter);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5ba40ba85eb5efeea42fea8bbe7b794992073f1b9a880898d2165e7deca5c471" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/DevelopmentModeAwareTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 15, + "charOffset": 477, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 406, + "charLength": 119, + "snippet": { + "text": " * Checks if the development mode is enabled.\n *\n * @param InputInterface $input\n *\n * @return bool" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5ba6a9fc40a6894402ddb58fe0e102f39177e23ef5d640f2f09e0b27db8ad069" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 38, + "charOffset": 427, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 225, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5d8f2eeb930c74faa4833c60ec561c558ae723f0f35ee790333fcbec953702bc" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ArrayInput'", + "markdown": "Undefined class 'ArrayInput'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 96, + "startColumn": 38, + "charOffset": 2772, + "charLength": 10, + "snippet": { + "text": "ArrayInput" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 94, + "startColumn": 1, + "charOffset": 2720, + "charLength": 177, + "snippet": { + "text": "\n try {\n return $command->run(new ArrayInput($arguments), $output);\n } catch (Exception $e) {\n $io->getErrorStyle()->error($e->getMessage());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5db2b878bf34d3cbfb583b9a4a701847c4f69f31d9b351b5c2a950d474aaa594" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 67, + "startColumn": 50, + "charOffset": 1869, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 65, + "startColumn": 1, + "charOffset": 1777, + "charLength": 219, + "snippet": { + "text": " * @throws Exception|Throwable\n */\n public function doRun(InputInterface $input, OutputInterface $output): int\n {\n if (true === $input->hasParameterOption(['--dumpversion', '-dumpversion'], true)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5eceebe737bdb23680a713cde5e761d09604161237b4dc07f1bce432a77893a4" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LineFormatter'", + "markdown": "Undefined class 'LineFormatter'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 39, + "charOffset": 725, + "charLength": 13, + "snippet": { + "text": "LineFormatter" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 616, + "charLength": 219, + "snippet": { + "text": " * Formatter for warnings/notices/errors generated in compilation.\n */\nfinal class CompilerFormatter extends LineFormatter\n{\n public const SIMPLE_FORMAT = \" %level_name%: %message% in %file% on line %line% %type%\\n\";" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5f8b66499f91219813536fdc97153871a172c18278b343f4f15d4e821ce04c0d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputArgument'", + "markdown": "Undefined class 'InputArgument'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 37, + "charOffset": 435, + "charLength": 13, + "snippet": { + "text": "InputArgument" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 312, + "charLength": 242, + "snippet": { + "text": "use Psr\\Log\\LoggerInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "63c4dee159b864a1861d2b8158d62c3197899b47f709d8bed5cfcbd1968ae1ff" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'NullLogger'", + "markdown": "Undefined class 'NullLogger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 13, + "charOffset": 315, + "charLength": 10, + "snippet": { + "text": "NullLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 272, + "charLength": 106, + "snippet": { + "text": "\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse ReflectionException;\nuse Zephir\\Class\\Constant;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6403a1c84dad62f45c05ed6daf875887d104830f6f80ffd15325e2d51b0789f6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Command'", + "markdown": "Undefined class 'Command'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 39, + "charOffset": 396, + "charLength": 7, + "snippet": { + "text": "Command" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 281, + "charLength": 219, + "snippet": { + "text": "use Exception;\nuse Symfony\\Component\\Console\\Application as BaseApplication;\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Command\\HelpCommand;\nuse Symfony\\Component\\Console\\ConsoleEvents;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "65e3c7a16848534a50030fb767db497ad6634c82789e1f2b9a561b5e5a6e6488" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ListCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 34, + "startColumn": 9, + "charOffset": 678, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 32, + "startColumn": 1, + "charOffset": 592, + "charLength": 192, + "snippet": { + "text": " public function mergeApplicationDefinition($mergeArgs = true): void\n {\n parent::mergeApplicationDefinition($mergeArgs);\n\n $this->removeOptions(['dumpversion', 'version']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6a09e9d2a369e6cd0b3140bba934b50bd74e269382ef7f670c233c175ee353d8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ConsoleEvents'", + "markdown": "Undefined class 'ConsoleEvents'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 34, + "charOffset": 1518, + "charLength": 13, + "snippet": { + "text": "ConsoleEvents" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1439, + "charLength": 186, + "snippet": { + "text": "\n $dispatcher = new EventDispatcher();\n $dispatcher->addListener(ConsoleEvents::ERROR, [new ErrorListener(), 'onCommandError']);\n\n $this->setDispatcher($dispatcher);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6cb6ba96e5950c227f9a8c8cc96db5009050db75970f3df692972148e047375c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 65, + "startColumn": 19, + "charOffset": 1794, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 63, + "startColumn": 1, + "charOffset": 1691, + "charLength": 148, + "snippet": { + "text": " protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);\n\n try {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6cf664de8412c3dbe5ac4e5ecc44d6bce445df1bcd3a2e51a2b87c337e4334c2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 37, + "charOffset": 446, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 304, + "charLength": 212, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Throwable;\nuse Zephir\\Exception\\FileSystemException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6eac88ebf625cd24eac1e34237c350a4c1fe82346b00126bd7edc60bd9b88c80" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 37, + "charOffset": 377, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 205, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "70aa110ec294afdca34a553aa0b3db1c42526bf1d86214da56103ea97fc2cdb6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 37, + "charOffset": 378, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 208, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "711d36f1102a099b578abdb432deec54a28f4069738f3c88d277913c5e6b856c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'HelpCommand'", + "markdown": "Undefined class 'HelpCommand'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 179, + "startColumn": 21, + "charOffset": 4959, + "charLength": 11, + "snippet": { + "text": "HelpCommand" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 177, + "startColumn": 1, + "charOffset": 4882, + "charLength": 118, + "snippet": { + "text": " protected function getDefaultCommands(): array\n {\n return [new HelpCommand(), new ListCommand()];\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "715061b3c1a251d78eb686adc2527a0368d95688c2a878934bdfd150f304410c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerInterface'", + "markdown": "Undefined class 'LoggerInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 13, + "charOffset": 1106, + "charLength": 15, + "snippet": { + "text": "LoggerInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 1019, + "charLength": 203, + "snippet": { + "text": " private Backend $backend;\n private Config $config;\n private LoggerInterface $logger;\n\n public function __construct(Backend $backend, Config $config, LoggerInterface $logger)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "737f587b2911411e7934b7fe9f5f06f7fb40dc1ceba6a632c17037ff8c0eb8c6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Command'", + "markdown": "Undefined class 'Command'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ListCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 23, + "startColumn": 33, + "charOffset": 479, + "charLength": 7, + "snippet": { + "text": "Command" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 21, + "startColumn": 1, + "charOffset": 375, + "charLength": 141, + "snippet": { + "text": " * Displays the list of all available commands for the application.\n */\nfinal class ListCommand extends Command\n{\n use RemoveOptionsTrait;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "779c505ceb777e8ff9ed150f65c59551399095414c87ecd3fa9049862431548d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputArgument'", + "markdown": "Undefined class 'InputArgument'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 72, + "startColumn": 21, + "charOffset": 1795, + "charLength": 13, + "snippet": { + "text": "InputArgument" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 70, + "startColumn": 1, + "charOffset": 1725, + "charLength": 162, + "snippet": { + "text": " return new InputDefinition(\n [\n new InputArgument(\n 'namespace',\n InputArgument::REQUIRED," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "78ffdd278cd48b2f29c9cd3fb80da666ed3bb61eec3f359b17226464441b1caa" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/DevelopmentModeAwareTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 49, + "charOffset": 582, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 506, + "charLength": 163, + "snippet": { + "text": " * @return bool\n */\n protected function isDevelopmentModeEnabled(InputInterface $input): bool\n {\n if (false === $input->getOption('no-dev')) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7919938334f72beb6675e5bfa9191c431bdb86f535a9c0f962d493b4f22601f7" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 37, + "charOffset": 873, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 733, + "charLength": 258, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7a07551b27a62fc4fd7b2f9637dec973504aadf982b9de0b20e3f7f5df2bdf49" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 198, + "startColumn": 45, + "charOffset": 5604, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 196, + "startColumn": 1, + "charOffset": 5432, + "charLength": 349, + "snippet": { + "text": " \"Print the version of the compiler and don't do anything else (also works with a single hyphen)\"\n ),\n new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Print this help message'),\n new InputOption('--no-ansi', null, InputOption::VALUE_NONE, 'Disable ANSI output'),\n new InputOption(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7a0fab4392e1507852c64b06ace7dd6c1a639d03834636dc723ad1b3e63eea18" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'StreamHandler'", + "markdown": "Undefined class 'StreamHandler'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 15, + "startColumn": 21, + "charOffset": 293, + "charLength": 13, + "snippet": { + "text": "StreamHandler" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 13, + "startColumn": 1, + "charOffset": 247, + "charLength": 108, + "snippet": { + "text": "declare(strict_types=1);\n\nuse Monolog\\Handler\\StreamHandler;\nuse Monolog\\Logger;\nuse Zephir\\Backend\\Backend;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7e955e46d67ee34131637445ca09172c7dc562f3d19921aa5ddd2a2753270ee9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Logger'", + "markdown": "Undefined class 'Logger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 99, + "startColumn": 59, + "charOffset": 2653, + "charLength": 6, + "snippet": { + "text": "Logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 97, + "startColumn": 1, + "charOffset": 2543, + "charLength": 181, + "snippet": { + "text": "$consoleStdErrorHandler->setFormatter($formatter);\n\n$consoleStdOutHandler = new StreamHandler('php://stdout', Logger::INFO, false);\n$consoleStdOutHandler->setFormatter($formatter);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "80ba959c7cd103f59e760b8775a0e9dd28b99535d79d87fc6c2380c1e180991a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 41, + "charOffset": 1174, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 974, + "charLength": 366, + "snippet": { + "text": " ->setDefinition($this->createDefinition())\n ->addOption('dev', null, InputOption::VALUE_NONE, 'Build the extension in development mode')\n ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Build the extension in production mode')\n ->setHelp($this->getDevelopmentModeHelp() . PHP_EOL . $this->getZflagsHelp())\n ;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8119a681b8e2bc13535e2a32c2c9cc963f2fca74be222c795256a45faaca5e9a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Logger'", + "markdown": "Undefined class 'Logger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 13, + "charOffset": 320, + "charLength": 6, + "snippet": { + "text": "Logger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 272, + "charLength": 104, + "snippet": { + "text": "\nuse Monolog\\Handler\\StreamHandler;\nuse Monolog\\Logger;\nuse Zephir\\Backend\\Backend;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "81578dff98382510cf92f5eba515e02661024d6bbb6e3f8a164eae86e5c18b1b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 37, + "charOffset": 325, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 193, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "81fbd15b734e2ee9405bfce3ed9d5db2be67128f1807852066b9d8262957c31f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 55, + "charOffset": 2039, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 1978, + "charLength": 177, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output): int\n {\n $namespace = $this->sanitizeNamespace($input->getArgument('namespace'));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "848b484ec2a1d9f8a7363137a0732300244e3c5275ffb88b8308a5bac4886ccb" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InvalidArgumentException'", + "markdown": "Undefined class 'InvalidArgumentException'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 41, + "charOffset": 329, + "charLength": 24, + "snippet": { + "text": "InvalidArgumentException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 205, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Exception\\InvalidArgumentException;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "869611735ef9276ca5974977dfe30efddb6d09407a95ee7db7455aeb9903e400" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'NullLogger'", + "markdown": "Undefined class 'NullLogger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 150, + "startColumn": 36, + "charOffset": 4005, + "charLength": 10, + "snippet": { + "text": "NullLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 148, + "startColumn": 1, + "charOffset": 3904, + "charLength": 233, + "snippet": { + "text": " private CompilerFileFactory $compilerFileFactory,\n ) {\n $this->logger = new NullLogger();\n $this->stringManager = new StringsManager();\n $this->fcallManager = $this->backend->getFcallManager();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "871309371770865075e914d19d08d10961eed87b974e1d5f2b497644fd45f7be" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 37, + "charOffset": 441, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 304, + "charLength": 255, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8723da959b6a914d9a1086b8d5d858721bb821f079366b3db1884549a48ed3d4" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 56, + "startColumn": 44, + "charOffset": 1617, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 54, + "startColumn": 1, + "charOffset": 1567, + "charLength": 111, + "snippet": { + "text": " }\n\n protected function createDefinition(): InputDefinition\n {\n return new InputDefinition([]);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "87937588e5c45ac81c6e71b95a7355c5e48f3363e9c0b56c5128bf8614d71964" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerAwareTrait'", + "markdown": "Undefined class 'LoggerAwareTrait'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 13, + "charOffset": 285, + "charLength": 16, + "snippet": { + "text": "LoggerAwareTrait" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 112, + "snippet": { + "text": "namespace Zephir;\n\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse Zephir\\Class\\Definition\\Definition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8a48df61dd192690e0f261c2aa471d1b297897a1538558f6d3e970595795e408" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 70, + "startColumn": 20, + "charOffset": 1744, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 68, + "startColumn": 1, + "charOffset": 1660, + "charLength": 149, + "snippet": { + "text": " protected function createDefinition(): InputDefinition\n {\n return new InputDefinition(\n [\n new InputArgument(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8a8212bce373dd762505150fdaa6a1f2affd5ed87c72abf4be47b7afdc8d050f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 66, + "startColumn": 21, + "charOffset": 1795, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 64, + "startColumn": 1, + "charOffset": 1709, + "charLength": 153, + "snippet": { + "text": " 'The API theme to be used'\n ),\n new InputOption(\n 'output',\n 'o'," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8de802b2c79170132ab38b1af2c9d6e3490eabbc93abd2b3739c6a9573f55bb0" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 44, + "charOffset": 1320, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1270, + "charLength": 111, + "snippet": { + "text": " }\n\n protected function createDefinition(): InputDefinition\n {\n return new InputDefinition([]);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8e4311f655b056407c730ec14b7d27ebd8f3066e623ba5674cba091e2eea9fe2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 37, + "charOffset": 539, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 399, + "charLength": 237, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Zephir\\Backend\\Backend;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "90b17ddefa7fdf56d5e103ada2fdc17811d7baa4ac66464cebfd72e32bec42d5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Exception'", + "markdown": "Undefined class 'Exception'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ArrayKeysOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 16, + "charOffset": 873, + "charLength": 9, + "snippet": { + "text": "Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 811, + "charLength": 168, + "snippet": { + "text": " *\n * @return false|CompiledExpression\n * @throws Exception\n */\n public function optimize(array $expression, Call $call, CompilationContext $context)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "91853990866c35dd3f9050c783ecf539cb12ec3a1dd4c3f967f9375e0ce7f89c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerInterface'", + "markdown": "Undefined class 'LoggerInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 13, + "charOffset": 324, + "charLength": 15, + "snippet": { + "text": "LoggerInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 161, + "snippet": { + "text": "\nuse DirectoryIterator;\nuse Psr\\Log\\LoggerInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\InputArgument;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "91dffb54d5a154834432c83d7ab313b4a4a64016041bd26941c41eadea9a9dac" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 55, + "charOffset": 2490, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 2429, + "charLength": 123, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $options = array_merge(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "933a4b28b15c0838a70ce7498c1c6e0f8a2f8c648109c306978d1b37bc30c8b0" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 21, + "charOffset": 1680, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1607, + "charLength": 167, + "snippet": { + "text": " 'path',\n 'p',\n InputOption::VALUE_REQUIRED,\n 'The API theme to be used'\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "971f8380e04987724a3bf456a8610c931e6f83eb8c8d72ba4accd082b019f9b5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 150, + "startColumn": 33, + "charOffset": 4217, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 148, + "startColumn": 1, + "charOffset": 4139, + "charLength": 147, + "snippet": { + "text": " public function getVerNum(): string\n {\n $version = explode('-', parent::getVersion());\n $version = explode('.', $version[0]);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "97d5c582bf60a72c89bbb7619e0fdf3b5b61ee3ba47867a965cbc27a5d63da18" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 195, + "startColumn": 17, + "charOffset": 5407, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 193, + "startColumn": 1, + "charOffset": 5338, + "charLength": 221, + "snippet": { + "text": " 'dumpversion',\n null,\n InputOption::VALUE_NONE,\n \"Print the version of the compiler and don't do anything else (also works with a single hyphen)\"\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "98cbc63f14aaf1e47eddb60e8817601dc761747db8ed69587105089f6dfe7143" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 38, + "charOffset": 480, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 342, + "charLength": 225, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9a32af2e448e420d9f4b85cb41411fad977e621c083d0d8539457388e7af8100" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 111, + "startColumn": 49, + "charOffset": 3102, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 109, + "startColumn": 1, + "charOffset": 3047, + "charLength": 138, + "snippet": { + "text": " }\n\n protected function sanitizeOptionsFromInput(InputInterface $input): array\n {\n $defaults = $this->getDefaultOptions();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9c7b70309a8ff6982c8ceae7f177f0375bf2b44883f6b225dd90749b7c356ee4" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 39, + "charOffset": 1288, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1125, + "charLength": 363, + "snippet": { + "text": " ->setName('generate')\n ->setDescription('Generates C code from the Zephir code without compiling it')\n ->addOption('trace', 't', InputOption::VALUE_NONE, 'Show trace message output (in case of exception error)')\n ->setHelp(sprintf('%s.', $this->getDescription()) . PHP_EOL . PHP_EOL . $this->getZflagsHelp())\n ;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9df6e613758bbc3e938878a2938970c3630f4b81baf1204a6cd74a7dc494ea40" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 32, + "charOffset": 1100, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 1062, + "charLength": 152, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $command = $this->getApplication()->find('clean');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9ec51c6d6692527d21a6c5f4e8d362f0315d0bb42df5b51d700a7a955cc19249" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'EventDispatcher'", + "markdown": "Undefined class 'EventDispatcher'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 39, + "charOffset": 1030, + "charLength": 15, + "snippet": { + "text": "EventDispatcher" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 889, + "charLength": 212, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\EventDispatcher\\EventDispatcher;\nuse Throwable;\nuse Zephir\\Console\\Command\\ListCommand;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9ec943cf7c76a5111cea37d0078b5126b0a328f42231036e1e8e49da6ce1a88e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 21, + "charOffset": 2288, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 2215, + "charLength": 188, + "snippet": { + "text": " 'url',\n null,\n InputOption::VALUE_REQUIRED,\n 'The base URL to be used when generating links'\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9f55e5f92517254487b63b181fce6641bb1344cea1d2d6eeb770bcc50660c494" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ExceptionInterface'", + "markdown": "Undefined class 'ExceptionInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 22, + "startColumn": 41, + "charOffset": 607, + "charLength": 18, + "snippet": { + "text": "ExceptionInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 20, + "startColumn": 1, + "charOffset": 456, + "charLength": 276, + "snippet": { + "text": "use Symfony\\Component\\Console\\ConsoleEvents;\nuse Symfony\\Component\\Console\\Exception\\CommandNotFoundException;\nuse Symfony\\Component\\Console\\Exception\\ExceptionInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a5e33fa50028460709bd79e425019d18bf825364c62a763b2dc599455165d101" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 37, + "charOffset": 388, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 216, + "snippet": { + "text": "use Exception;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a79cc92104c26b736a386953b425cbe1be780fd67fc76f8c10feb553bbc9db40" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 189, + "startColumn": 20, + "charOffset": 5197, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 187, + "startColumn": 1, + "charOffset": 5104, + "charLength": 204, + "snippet": { + "text": " protected function getDefaultInputDefinition(): InputDefinition\n {\n return new InputDefinition([\n new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a7c62d38c13c0104f4f5bc6484609699ba22d3850fc0d16761b22245748abe3b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 37, + "charOffset": 480, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 341, + "charLength": 195, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;\nuse Zephir\\Exception;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a7cabdee1825450b27909a1e853c76c7c8c5d034f501ca48ee5e9676ee7652e2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputArgument'", + "markdown": "Undefined class 'InputArgument'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 190, + "startColumn": 17, + "charOffset": 5231, + "charLength": 13, + "snippet": { + "text": "InputArgument" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 188, + "startColumn": 1, + "charOffset": 5172, + "charLength": 165, + "snippet": { + "text": " {\n return new InputDefinition([\n new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),\n\n new InputOption(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a9630a29f0e1dc44550832dab8f2a3dc66c0ac4ac6033cbde4e34cbe4700797f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 203, + "startColumn": 17, + "charOffset": 5849, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 201, + "startColumn": 1, + "charOffset": 5782, + "charLength": 234, + "snippet": { + "text": " '--verbose',\n '-v',\n InputOption::VALUE_NONE,\n 'Displays more detail in error messages from exceptions generated by commands ' .\n '(can also disable with -V)'" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aaaa40f6df62ad893c6d45d4a59a34a3a44d6c0b720779558ee468c34e08c18b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 9, + "charOffset": 1033, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 963, + "charLength": 99, + "snippet": { + "text": " public function __construct(private Config $config)\n {\n parent::__construct();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aade100c006f6d356fddc5f30128bfedd2d37b1666a1beae1cc9508d1c4e6da9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'RuntimeException'", + "markdown": "Undefined class 'RuntimeException'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 23, + "startColumn": 41, + "charOffset": 667, + "charLength": 16, + "snippet": { + "text": "RuntimeException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 21, + "startColumn": 1, + "charOffset": 501, + "charLength": 282, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\CommandNotFoundException;\nuse Symfony\\Component\\Console\\Exception\\ExceptionInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputArgument;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ab5b6b40069cb0d557475c4f78e6b389dbab60ca9998c82c6a60f372de56bf11" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 55, + "charOffset": 1745, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1684, + "charLength": 140, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ac04c36118ea4b625d8ec0fd0febe9b0b8e6873680c28cfc1801ce366eb604e3" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 37, + "charOffset": 340, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 171, + "snippet": { + "text": "\nuse Exception;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ac5c952907546bb042dfc46fb93fa237069bc9c389e9a36305420d225efc8b41" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 15, + "charOffset": 1720, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1662, + "charLength": 107, + "snippet": { + "text": " *\n * @param InputInterface $input\n * @param OutputInterface $output\n *\n * @return int" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ac72feec2a4b0030755dc1b6331103177615f4454e30cc6318ffaccbafe5fcea" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 57, + "startColumn": 20, + "charOffset": 1361, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 55, + "startColumn": 1, + "charOffset": 1277, + "charLength": 111, + "snippet": { + "text": " protected function createDefinition(): InputDefinition\n {\n return new InputDefinition([]);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ad9f39ab0b5cc71417470a34f4ee57a349d838df03ce75a9c17b4083597bc02b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'NullLogger'", + "markdown": "Undefined class 'NullLogger'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 128, + "startColumn": 35, + "charOffset": 2989, + "charLength": 10, + "snippet": { + "text": "NullLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 126, + "startColumn": 1, + "charOffset": 2908, + "charLength": 182, + "snippet": { + "text": " ) {\n $this->config = $config;\n $this->logger = new NullLogger();\n $this->aliasManager = $aliasManager;\n $this->filesystem = $filesystem;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b2c1330085d968f3620e40db5e37b410f7d29d4b4ebefde4be7f0c29903af281" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 19, + "charOffset": 1281, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 1215, + "charLength": 109, + "snippet": { + "text": " $arguments = ['command' => 'install'];\n\n $io = new SymfonyStyle($input, $output);\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b2dae96fdd4e8dedf276aeb462e24afaf5f28b4f2b552f17acd792154405c61f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 38, + "charOffset": 426, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 245, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Exception\\FileSystemException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b32bc99a7a30f7cdfefd0a9539f6e6269d2a65e138eec8a40e8d7f6b4f8b9150" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InvalidArgumentException'", + "markdown": "Undefined class 'InvalidArgumentException'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 124, + "startColumn": 27, + "charOffset": 3605, + "charLength": 24, + "snippet": { + "text": "InvalidArgumentException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 122, + "startColumn": 1, + "charOffset": 3482, + "charLength": 243, + "snippet": { + "text": " // Prevent \"\" values\n if (empty($value) || !preg_match('/.+/', $value)) {\n throw new InvalidArgumentException(\n sprintf('The \"--%s\" option requires a value.', $option)\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b3c8da4a29b71cf6f1689e0edfa1be73a17e4f56c63209c3b0840b882a99f6df" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'RuntimeException'", + "markdown": "Undefined class 'RuntimeException'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 41, + "charOffset": 381, + "charLength": 16, + "snippet": { + "text": "RuntimeException" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 213, + "snippet": { + "text": "use DirectoryIterator;\nuse Psr\\Log\\LoggerInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b3f800432edf184f22c31b8957e63fc994885d97da983e87870bdd5b4d9cd562" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerInterface'", + "markdown": "Undefined class 'LoggerInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler/CompilerFileFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 17, + "charOffset": 588, + "charLength": 15, + "snippet": { + "text": "LoggerInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 491, + "charLength": 135, + "snippet": { + "text": " private Config $config,\n private FileSystemInterface $filesystem,\n private LoggerInterface $logger,\n ) {\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b40693f655f3a8e6c6b5d111566c128e6af928c410fd60b46225f3861e59a827" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 213, + "startColumn": 48, + "charOffset": 6275, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 211, + "startColumn": 1, + "charOffset": 6150, + "charLength": 215, + "snippet": { + "text": " 'Print the version of the compiler as integer'\n ),\n new InputOption('--version', null, InputOption::VALUE_NONE, 'Print compiler version information and quit'),\n ]);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b42ded25be5fef73ef5870613b12005ef085a2ae24229769b9715a2a441c8002" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 57, + "startColumn": 38, + "charOffset": 1405, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 55, + "startColumn": 1, + "charOffset": 1225, + "charLength": 448, + "snippet": { + "text": " ->setName('install')\n ->setDescription('Installs the extension in the extension directory (may require root password)')\n ->addOption('dev', null, InputOption::VALUE_NONE, 'Install the extension in development mode')\n ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Install the extension in production mode')\n ->setHelp($this->getDevelopmentModeHelp() . PHP_EOL . $this->getZflagsHelp())" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b497b165ee87149b53a4233323f31ff2fa5ec3969dde46d2296742a76dafcc58" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 104, + "startColumn": 20, + "charOffset": 3073, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 102, + "startColumn": 1, + "charOffset": 3039, + "charLength": 189, + "snippet": { + "text": "\n try {\n return parent::doRun($input, $output);\n } catch (CommandNotFoundException | RuntimeException $e) {\n fprintf(STDERR, $e->getMessage() . PHP_EOL);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b576065717661f2145c53ff43643155879f0f823815295d08a67e2d7b85f6ed9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 38, + "charOffset": 975, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 837, + "charLength": 224, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\EventDispatcher\\EventDispatcher;\nuse Throwable;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b5a7acf2bc8cc9fef0d24410922d0f3a43e8717e5d68156158cf72afb696f6ba" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 37, + "charOffset": 484, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 342, + "charLength": 217, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;\nuse Zephir\\Exception\\ExceptionInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ba0b46928911e470f4b782b2d9d1a30cee1e64e3ed382865ffec5f3999ba1460" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 32, + "charOffset": 2467, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 2429, + "charLength": 123, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $options = array_merge(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ba1469f113c41142c3d4e65293e83f5e89dc577bb8a6c6763b245d1b8696ee7a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 24, + "charOffset": 2552, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 2444, + "charLength": 162, + "snippet": { + "text": " // call install\n $command = $this->getApplication()->find('install');\n $io = new SymfonyStyle($input, $output);\n\n $arguments = [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ba2bb90105105846960a2739af55868f52bb1d8565739da8f48e6b107576dbfb" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 69, + "startColumn": 21, + "charOffset": 1883, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 67, + "startColumn": 1, + "charOffset": 1808, + "charLength": 179, + "snippet": { + "text": " 'output',\n 'o',\n InputOption::VALUE_REQUIRED,\n 'Output directory to generate theme'\n )," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bb71de93f83bdb6657d6dadff9e850755683cc551c4585732bd4da4c829b00b4" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'parent'", + "markdown": "Undefined class 'parent'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 163, + "startColumn": 33, + "charOffset": 4580, + "charLength": 6, + "snippet": { + "text": "parent" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 161, + "startColumn": 1, + "charOffset": 4501, + "charLength": 173, + "snippet": { + "text": " public function getVersion(): string\n {\n $version = explode('-', parent::getVersion());\n\n if (isset($version[1]) && str_starts_with($version[1], '$')) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bc5be8338e6c3fbe51da993c65d95b73976b0a78ac103235b19aed87c2074bab" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerInterface'", + "markdown": "Undefined class 'LoggerInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 67, + "charOffset": 1198, + "charLength": 15, + "snippet": { + "text": "LoggerInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1094, + "charLength": 169, + "snippet": { + "text": " private LoggerInterface $logger;\n\n public function __construct(Backend $backend, Config $config, LoggerInterface $logger)\n {\n $this->backend = $backend;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bd34a15bde3bc0df9661a2dc50ede54e3bf757662c81a31b9a22d913d45836d3" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 71, + "startColumn": 24, + "charOffset": 2071, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 69, + "startColumn": 1, + "charOffset": 1963, + "charLength": 162, + "snippet": { + "text": " // call compile\n $command = $this->getApplication()->find('compile');\n $io = new SymfonyStyle($input, $output);\n\n $arguments = [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bfd55a5720b61b7b074cd6a7454b9fef2f4855eacbfa78cfe292210f80b5896c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 59, + "startColumn": 32, + "charOffset": 1527, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 57, + "startColumn": 1, + "charOffset": 1489, + "charLength": 140, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c4f5a096f5934eb716efbe567843f2f0138b68677d6ca9eb94f6c1dfade0124e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/DevelopmentModeAwareTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 37, + "charOffset": 325, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 108, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputInterface;\n\nuse const PHP_DEBUG;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c6400732c1983de448035d84a3c655ed7fb1291f342cdb440f85be8ebf2ea389" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerAwareTrait'", + "markdown": "Undefined class 'LoggerAwareTrait'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 13, + "charOffset": 285, + "charLength": 16, + "snippet": { + "text": "LoggerAwareTrait" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 97, + "snippet": { + "text": "namespace Zephir;\n\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse ReflectionException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c8e063faac74a59aea3a9125947bb12116aaf2a962abac452c09b884cb734db7" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Application'", + "markdown": "Undefined class 'Application'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 31, + "charOffset": 326, + "charLength": 11, + "snippet": { + "text": "Application" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 280, + "charLength": 175, + "snippet": { + "text": "\nuse Exception;\nuse Symfony\\Component\\Console\\Application as BaseApplication;\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Command\\HelpCommand;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cacc0ffd2750b3227552ad77632bb2f271e3a4e5e3b7655f86c01aae034e8137" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 200, + "startColumn": 17, + "charOffset": 5769, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 198, + "startColumn": 1, + "charOffset": 5560, + "charLength": 272, + "snippet": { + "text": " new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Print this help message'),\n new InputOption('--no-ansi', null, InputOption::VALUE_NONE, 'Disable ANSI output'),\n new InputOption(\n '--verbose',\n '-v'," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cae05d3c83478049884fa9dba80a71869d42daed47fc611de88e74780afe7c88" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 59, + "startColumn": 55, + "charOffset": 1550, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 57, + "startColumn": 1, + "charOffset": 1489, + "charLength": 140, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cb53125e0bbaa7e8a2bb33f002f7e79de74440e2e1672a372a762baf29cd09fd" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 213, + "startColumn": 17, + "charOffset": 6244, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 211, + "startColumn": 1, + "charOffset": 6150, + "charLength": 215, + "snippet": { + "text": " 'Print the version of the compiler as integer'\n ),\n new InputOption('--version', null, InputOption::VALUE_NONE, 'Print compiler version information and quit'),\n ]);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cc437989c29294a53f534421e8f5a634ee634aa474e879eb389d421e6d6cf1ed" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 32, + "charOffset": 1722, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1684, + "charLength": 140, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cd67725d7ed69330b398c138f95b3f2a6060b3d6abee48cdcad1cb584411e347" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 37, + "charOffset": 391, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 220, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Exception\\InvalidArgumentException;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cdc7421bc0f8714db6ae787d9eecf8d454f09989826b07aae792c59e318e8f35" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerAwareTrait'", + "markdown": "Undefined class 'LoggerAwareTrait'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 107, + "startColumn": 9, + "charOffset": 2603, + "charLength": 16, + "snippet": { + "text": "LoggerAwareTrait" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 105, + "startColumn": 1, + "charOffset": 2572, + "charLength": 57, + "snippet": { + "text": "final class Compiler\n{\n use LoggerAwareTrait;\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d142617841a5b321b1d3b25ddd7770e04215c895ac1da9fc48a0e253871395d2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 38, + "charOffset": 393, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 185, + "snippet": { + "text": "use Exception;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Throwable;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d6d6c071c271b1ae7faddef275f28c275956ccab8582a763fb66168d9d4c5bd5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerAwareTrait'", + "markdown": "Undefined class 'LoggerAwareTrait'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 13, + "charOffset": 285, + "charLength": 16, + "snippet": { + "text": "LoggerAwareTrait" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 97, + "snippet": { + "text": "namespace Zephir;\n\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse ReflectionException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d85be0324de454bc94e0aebd71422bdc4004642fd0f6efa85597dfb32924713f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 32, + "charOffset": 1213, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1175, + "charLength": 142, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n if (!$this->filesystem->isInitialized()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d8e63d1d7136363d7125692c81d4b62e1c19027952d17033a935d31e8ef3ed84" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerAwareTrait'", + "markdown": "Undefined class 'LoggerAwareTrait'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 9, + "charOffset": 810, + "charLength": 16, + "snippet": { + "text": "LoggerAwareTrait" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 777, + "charLength": 103, + "snippet": { + "text": "{\n use CompilerTrait;\n use LoggerAwareTrait;\n\n protected Definition $classDefinition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d9224d4e533ff0b1645c5b88c1d025d79bf23e9f2414e84018c3b8f5918837df" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 26, + "startColumn": 37, + "charOffset": 820, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 24, + "startColumn": 1, + "charOffset": 685, + "charLength": 252, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d9b7510e3ca00230ba156d5ef9e88682a09736dff6c20267891a1680df67c811" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 192, + "startColumn": 17, + "charOffset": 5325, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 190, + "startColumn": 1, + "charOffset": 5215, + "charLength": 175, + "snippet": { + "text": " new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),\n\n new InputOption(\n 'dumpversion',\n null," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d9f750cbf0a618f4e4469526745e50a435371b9612ede37d6292684d7c393a47" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'Command'", + "markdown": "Undefined class 'Command'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/AbstractCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 40, + "charOffset": 376, + "charLength": 7, + "snippet": { + "text": "Command" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 124, + "snippet": { + "text": "use Symfony\\Component\\Console\\Command\\Command;\n\nabstract class AbstractCommand extends Command\n{\n use RemoveOptionsTrait;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "db0a66b39a3484961b7207e83e1dc0e170b6904651cc08d09b0746a131d596c2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ConsoleEvents'", + "markdown": "Undefined class 'ConsoleEvents'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 31, + "charOffset": 486, + "charLength": 13, + "snippet": { + "text": "ConsoleEvents" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 358, + "charLength": 268, + "snippet": { + "text": "use Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Command\\HelpCommand;\nuse Symfony\\Component\\Console\\ConsoleEvents;\nuse Symfony\\Component\\Console\\Exception\\CommandNotFoundException;\nuse Symfony\\Component\\Console\\Exception\\ExceptionInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "de1a7b3c7ef1c0e9a1f7c237eb3faff7a9b26d923c48e8717c91a840de43c7b9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ArrayInput'", + "markdown": "Undefined class 'ArrayInput'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 37, + "charOffset": 325, + "charLength": 10, + "snippet": { + "text": "ArrayInput" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 188, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dee7e51920263f4269a7f0c9a0c1de26b71610c9d163f8e3b6609ac53af26e35" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'LoggerInterface'", + "markdown": "Undefined class 'LoggerInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilationContext.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 13, + "charOffset": 285, + "charLength": 15, + "snippet": { + "text": "LoggerInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 107, + "snippet": { + "text": "namespace Zephir;\n\nuse Psr\\Log\\LoggerInterface;\nuse Zephir\\Backend\\Backend;\nuse Zephir\\Cache\\FunctionCache;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e00a7c872c65a809a225b0921db0c81f0b245bfac09e2a739aa77dd3ea4414d7" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 207, + "startColumn": 17, + "charOffset": 6048, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 205, + "startColumn": 1, + "charOffset": 5972, + "charLength": 136, + "snippet": { + "text": " '(can also disable with -V)'\n ),\n new InputOption(\n 'vernum',\n null," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e13ac940dfd4454d7f3570bccea55c8924ccdcdc4cb6f208873f33dd1bc299a9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 37, + "charOffset": 325, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 189, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e28ef07e587b89352b7cc084d8d6ff6b78af97398a72df93eece0ba70fc3b3f2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 37, + "charOffset": 444, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 273, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\InvalidArgumentException;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e42c872f2f4d42c84138177fb06107ff6b8f77657e1fc5d558cee7814f605612" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ArrayInput'", + "markdown": "Undefined class 'ArrayInput'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 62, + "startColumn": 31, + "charOffset": 1803, + "charLength": 10, + "snippet": { + "text": "ArrayInput" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 60, + "startColumn": 1, + "charOffset": 1758, + "charLength": 170, + "snippet": { + "text": "\n try {\n $command->run(new ArrayInput($arguments), $output);\n } catch (Exception $e) {\n $io->getErrorStyle()->error($e->getMessage());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e456461c923c84984546eea5157b824d76348be8e35487ee1af8823cc9b2e347" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 78, + "startColumn": 21, + "charOffset": 2202, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 76, + "startColumn": 1, + "charOffset": 2127, + "charLength": 140, + "snippet": { + "text": " 'Theme options'\n ),\n new InputOption(\n 'url',\n null," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e578e9b38e43b839e0dbb0800e213502fd01fe03778b76ba708d48100cbaec0f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 44, + "charOffset": 1391, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 1341, + "charLength": 111, + "snippet": { + "text": " }\n\n protected function createDefinition(): InputDefinition\n {\n return new InputDefinition([]);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e6338c6cffea287240fa05eeadbd57ac9be600d0c72fc2dd3a66b11c8eeb1f06" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'SymfonyStyle'", + "markdown": "Undefined class 'SymfonyStyle'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 22, + "startColumn": 37, + "charOffset": 596, + "charLength": 12, + "snippet": { + "text": "SymfonyStyle" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 20, + "startColumn": 1, + "charOffset": 457, + "charLength": 172, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\n\nuse const PHP_EOL;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e669659ae2f3a4f75ff113288720ff5791312bcee2cd1d432a4972811496fa27" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'ArrayInput'", + "markdown": "Undefined class 'ArrayInput'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 41, + "charOffset": 1535, + "charLength": 10, + "snippet": { + "text": "ArrayInput" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1469, + "charLength": 196, + "snippet": { + "text": " */\n try {\n if (0 === $command->run(new ArrayInput($arguments), $output)) {\n if (Os::isWindows()) {\n system('cd ext && phpize --clean');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e7604e997a32f7a35bc808bfc839aa737a310918db7328f4135c73e76e08c485" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 21, + "charOffset": 1594, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1524, + "charLength": 135, + "snippet": { + "text": " return new InputDefinition(\n [\n new InputOption(\n 'path',\n 'p'," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e83810cc1cfa76f590dd9c6da68b8d84a77996989001ed06b1d14b648d4bbaae" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 50, + "startColumn": 41, + "charOffset": 1305, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 48, + "startColumn": 1, + "charOffset": 1103, + "charLength": 453, + "snippet": { + "text": " ->setDefinition($this->createDefinition())\n ->addOption('dev', null, InputOption::VALUE_NONE, 'Compile the extension in development mode')\n ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Compile the extension in production mode')\n ->addOption('jobs', 'j', InputOption::VALUE_REQUIRED, 'Set make -j (job slots)')\n ->setHelp($this->getDevelopmentModeHelp() . PHP_EOL . $this->getZflagsHelp())" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eb08f4bc66bfb53f2e79fbaf5c577b754038b9304955aa03f344fed92654a350" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 32, + "charOffset": 1420, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1382, + "charLength": 140, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $io = new SymfonyStyle($input, $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ec72b73c7cc6b2a28445fb048f3ea2f17081ae38c1422b44656ff382c13ad594" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 38, + "charOffset": 1411, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1158, + "charLength": 408, + "snippet": { + "text": " ->addOption('dev', null, InputOption::VALUE_NONE, 'Compile the extension in development mode')\n ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Compile the extension in production mode')\n ->addOption('jobs', 'j', InputOption::VALUE_REQUIRED, 'Set make -j (job slots)')\n ->setHelp($this->getDevelopmentModeHelp() . PHP_EOL . $this->getZflagsHelp())\n ;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "efc334889c1695b1642b738c68aae1eb08423e64fd914b38aa997547872d8bdb" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 38, + "charOffset": 546, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 408, + "charLength": 194, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Zephir\\Compiler;\nuse Zephir\\Config;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f33657a919a25745bae308a19bdc488c2db1d4038dc41de55bf678004d2b3993" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 22, + "startColumn": 38, + "charOffset": 592, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 20, + "startColumn": 1, + "charOffset": 450, + "charLength": 205, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Zephir\\Backend\\Backend;\nuse Zephir\\Config;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f477b5daf1ff3c9aaae3b60fc75b44e132619bca4f102d2da04b7d454c988223" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 199, + "startColumn": 48, + "charOffset": 5704, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 197, + "startColumn": 1, + "charOffset": 5545, + "charLength": 265, + "snippet": { + "text": " ),\n new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Print this help message'),\n new InputOption('--no-ansi', null, InputOption::VALUE_NONE, 'Disable ANSI output'),\n new InputOption(\n '--verbose'," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f86561272c4bd8ba742d9b1d3cc0d99a36b41149c8b46ab6311da49b88dfa6d5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 20, + "charOffset": 1432, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 1348, + "charLength": 111, + "snippet": { + "text": " protected function createDefinition(): InputDefinition\n {\n return new InputDefinition([]);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fa65cb2b09a12a527b07596159b999654ff5c79e116a4b32ac5d85eacf8f1e0c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputInterface'", + "markdown": "Undefined class 'InputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 37, + "charOffset": 378, + "charLength": 14, + "snippet": { + "text": "InputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 209, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fbeaa3fced82056dae7b166a5300c33864a9ddee2153586dd48ae8498be5a856" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputOption'", + "markdown": "Undefined class 'InputOption'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/RemoveOptionsTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 37, + "charOffset": 325, + "charLength": 11, + "snippet": { + "text": "InputOption" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 111, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputOption;\n\nuse function array_filter;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fcec9198044db87e515e2a7ff28bef35dea9b7ebc2efe98e8aed633f1f22af31" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'OutputInterface'", + "markdown": "Undefined class 'OutputInterface'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 38, + "charOffset": 427, + "charLength": 15, + "snippet": { + "text": "OutputInterface" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 225, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fdba3c7a7adcad9fa7a1c19d8079c5511b6e51e885a257c66e9515f385ae7786" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 185, + "startColumn": 16, + "charOffset": 5052, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 183, + "startColumn": 1, + "charOffset": 5009, + "charLength": 162, + "snippet": { + "text": " * {@inheritdoc}\n *\n * @return InputDefinition An InputDefinition instance\n */\n protected function getDefaultInputDefinition(): InputDefinition" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fee3d7541f28fb4cb3bbc56a4ab5fa675659af61348844b259c8b389bea6d750" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedClassInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined class 'InputDefinition'", + "markdown": "Undefined class 'InputDefinition'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 68, + "startColumn": 44, + "charOffset": 1703, + "charLength": 15, + "snippet": { + "text": "InputDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 66, + "startColumn": 1, + "charOffset": 1653, + "charLength": 107, + "snippet": { + "text": " }\n\n protected function createDefinition(): InputDefinition\n {\n return new InputDefinition(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ff3c23abfab85d2c80fbf870f4ce7acf19f7e8a89e27b936f5345c4e3bf7bd68" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedFieldInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Property 'format' is undefined", + "markdown": "Property 'format' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 57, + "startColumn": 26, + "charOffset": 1267, + "charLength": 6, + "snippet": { + "text": "format" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 55, + "startColumn": 1, + "charOffset": 1197, + "charLength": 96, + "snippet": { + "text": " $vars = parent::normalize($record);\n\n $output = $this->format;\n\n // unused" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "22c01ffd55e6d692892ff2c9fba7230e4af6ca055203b5ea047ed3072c92d5db" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedFunctionInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined function 'zephir_parse_file'", + "markdown": "Undefined function 'zephir_parse_file'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Parser/Parser.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 75, + "startColumn": 16, + "charOffset": 1790, + "charLength": 17, + "snippet": { + "text": "zephir_parse_file" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 73, + "startColumn": 1, + "charOffset": 1764, + "charLength": 73, + "snippet": { + "text": " }\n\n return zephir_parse_file($content, $filePath);\n }\n}" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5868b149b8869d7dd4f059e67b40a9562c6774c7f877357c6032cd55770c4f55" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedFunctionInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined function 'add_slashes'", + "markdown": "Undefined function 'add_slashes'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/VariablesManager.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 41, + "charOffset": 558, + "charLength": 11, + "snippet": { + "text": "add_slashes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 476, + "charLength": 118, + "snippet": { + "text": "use function strlen;\nuse function substr;\nuse function Zephir\\Backend\\ZendEngine3\\add_slashes;\n\nclass VariablesManager" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6b8cc5a366a458d231f187853473249c10349a98e7da996e24793a9418a5ce6b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedFunctionInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined function 'add_slashes'", + "markdown": "Undefined function 'add_slashes'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/VariablesManager.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 167, + "startColumn": 27, + "charOffset": 4949, + "charLength": 11, + "snippet": { + "text": "add_slashes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 165, + "startColumn": 1, + "charOffset": 4855, + "charLength": 225, + "snippet": { + "text": " switch ($value['type']) {\n case Types::T_STRING:\n $string = add_slashes($value['value']);\n $context->backend->assignString($variable, $string, $context);\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9951b8845a70724ccfa8c8feb9371ad44a6dfed4b04a44621532e84c6d4784a8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedFunctionInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined function 'add_slashes'", + "markdown": "Undefined function 'add_slashes'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/VariablesManager.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 139, + "startColumn": 27, + "charOffset": 4082, + "charLength": 11, + "snippet": { + "text": "add_slashes" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 137, + "startColumn": 1, + "charOffset": 4021, + "charLength": 192, + "snippet": { + "text": "\n case Types::T_STRING:\n $string = add_slashes($value['value']);\n $context->backend->assignString($variable, $string, $context);\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c7ce793070b22bdbec92190f190b2b52db6a0e72c35feef25fec014a362a9a6a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setHidden' is undefined", + "markdown": "Method 'setHidden' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ListCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 16, + "charOffset": 921, + "charLength": 9, + "snippet": { + "text": "setHidden" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 876, + "charLength": 69, + "snippet": { + "text": " parent::configure();\n\n $this->setHidden(true);\n }\n}" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "081bf9de8d757d7350736d90f6c6e08c8b96e5ebee8d65a424d84706fc20acd6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getDescription' is undefined", + "markdown": "Method 'getDescription' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 45, + "charOffset": 1378, + "charLength": 14, + "snippet": { + "text": "getDescription" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1180, + "charLength": 277, + "snippet": { + "text": " ->setDescription('Generates a HTML API based on the classes exposed in the extension')\n ->setDefinition($this->createDefinition())\n ->setHelp(sprintf('%s.', $this->getDescription()) . PHP_EOL . PHP_EOL . $this->getZflagsHelp())\n ;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0a0b1bbef84917316a8e860b3d1cdfff5128879495fa0709abd632828d4d331c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setLogger' is undefined", + "markdown": "Method 'setLogger' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler/CompilerFileFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 41, + "startColumn": 20, + "charOffset": 1057, + "charLength": 9, + "snippet": { + "text": "setLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 39, + "startColumn": 1, + "charOffset": 950, + "charLength": 159, + "snippet": { + "text": " $compiler->setClassName($className);\n $compiler->setFilePath($filePath);\n $compiler->setLogger($this->logger);\n\n return $compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0ba8b82a476b53e0aca0afb6f21cdaa92e9c2fcaba704a7700ed31cf37bfebcb" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 119, + "startColumn": 15, + "charOffset": 3382, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 117, + "startColumn": 1, + "charOffset": 3333, + "charLength": 172, + "snippet": { + "text": "\n$application = new Application();\n$application->add(new ApiCommand($compiler, $config));\n$application->add(new BuildCommand());\n$application->add(new CleanCommand($disk));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0f528339669795d94db5a87f6bb3332e541a68d40e4ac2f7be2d94c66c6d8df6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 127, + "startColumn": 15, + "charOffset": 3787, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 125, + "startColumn": 1, + "charOffset": 3650, + "charLength": 209, + "snippet": { + "text": "$application->add(new InitCommand($backend, $config, $logger));\n$application->add(new InstallCommand($compiler, $config));\n$application->add(new ListCommand());\n$application->add(new StubsCommand($compiler));\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1740f0c3328cdffc0549e2b3788e15baba23ba0b6eaf8ee770a98454c7340c2f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getDescription' is undefined", + "markdown": "Method 'getDescription' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 45, + "charOffset": 1146, + "charLength": 14, + "snippet": { + "text": "getDescription" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 990, + "charLength": 190, + "snippet": { + "text": " ->setName('clean')\n ->setDescription('Cleans any object files created by the extension')\n ->setHelp(sprintf('%s.', $this->getDescription()))\n ;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "18ecf3f4ecccb4b62f4a9bc409a5b6c826660f0e3b5f73b92cfc5542016aba70" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setName' is undefined", + "markdown": "Method 'setName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 15, + "charOffset": 1002, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 968, + "charLength": 183, + "snippet": { + "text": " {\n $this\n ->setName('stubs')\n ->setDescription('Generates stubs that can be used in a PHP IDE')\n ->setDefinition($this->createDefinition())" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1a0ad5fc0d59cac5055140156828482f41e681f7ff2844d031dad34dfb1a3d01" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getApplication' is undefined", + "markdown": "Method 'getApplication' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 87, + "startColumn": 27, + "charOffset": 2494, + "charLength": 14, + "snippet": { + "text": "getApplication" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 85, + "startColumn": 1, + "charOffset": 2443, + "charLength": 140, + "snippet": { + "text": "\n // call install\n $command = $this->getApplication()->find('install');\n $io = new SymfonyStyle($input, $output);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "295372e0c63c193776edc3944b493a562fe939f2008d239ca9b5d5334b36463c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getDefinition' is undefined", + "markdown": "Method 'getDefinition' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 83, + "startColumn": 33, + "charOffset": 2382, + "charLength": 13, + "snippet": { + "text": "getDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 81, + "startColumn": 1, + "charOffset": 2237, + "charLength": 305, + "snippet": { + "text": " try {\n // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument.\n $input->bind($this->getDefinition());\n } catch (ExceptionInterface) {\n // Errors must be ignored, full binding/validation happens later when the command is known." + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2f4244a596e0344e31796b28a1b8fe6dd053b3a09fe6c76521b49529dd0af7b8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setLogger' is undefined", + "markdown": "Method 'setLogger' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 116, + "startColumn": 12, + "charOffset": 3313, + "charLength": 9, + "snippet": { + "text": "setLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 114, + "startColumn": 1, + "charOffset": 3190, + "charLength": 177, + "snippet": { + "text": "$compiler->setOptimizersPath($rootPath.'/src/Optimizers');\n$compiler->setTemplatesPath($rootPath.'/templates');\n$compiler->setLogger($logger);\n\n$application = new Application();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "30452368c1fd346ccc41f3a466560f228d477be06def4aa901bd3601cddc9527" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'run' is undefined", + "markdown": "Method 'run' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 130, + "startColumn": 15, + "charOffset": 3874, + "charLength": 3, + "snippet": { + "text": "run" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 128, + "startColumn": 1, + "charOffset": 3811, + "charLength": 70, + "snippet": { + "text": "$application->add(new StubsCommand($compiler));\n\n$application->run();\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3eee82d8bb1a91c901e8c72e5bf1e37f3f223adfb96034dc9cfacc7e2b4353ec" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'stringify' is undefined", + "markdown": "Method 'stringify' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 143, + "startColumn": 35, + "charOffset": 4215, + "charLength": 9, + "snippet": { + "text": "stringify" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 141, + "startColumn": 1, + "charOffset": 4094, + "charLength": 194, + "snippet": { + "text": " foreach ($vars as $var => $val) {\n $placeholder = '%' . $var . '%';\n $realValue = $this->stringify($val);\n\n if (!str_contains($output, $placeholder)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "44129377aeca27fa47dda673cd531ab1703748711cdeef01b38e8bb494aa5cd9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setName' is undefined", + "markdown": "Method 'setName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 15, + "charOffset": 878, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 844, + "charLength": 184, + "snippet": { + "text": " {\n $this\n ->setName('build')\n ->setDescription('Generates/Compiles/Installs a Zephir extension')\n ->setDefinition($this->createDefinition())" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "452e343b36bbb5ab7b0f1cfdcc810c50e1a8b84a92f910721b0131abda03a064" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setName' is undefined", + "markdown": "Method 'setName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 15, + "charOffset": 1139, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1105, + "charLength": 265, + "snippet": { + "text": " {\n $this\n ->setName('generate')\n ->setDescription('Generates C code from the Zephir code without compiling it')\n ->addOption('trace', 't', InputOption::VALUE_NONE, 'Show trace message output (in case of exception error)')" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4bc0710fd961c6ab463de76d02492ae5ea57c2019d7305addeb664c93999c135" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method '__construct' is undefined", + "markdown": "Method '__construct' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 43, + "startColumn": 17, + "charOffset": 1068, + "charLength": 11, + "snippet": { + "text": "__construct" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 41, + "startColumn": 1, + "charOffset": 962, + "charLength": 127, + "snippet": { + "text": " public function __construct(private Compiler $compiler, private Config $config)\n {\n parent::__construct();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4cd640672f3f168e5fc91161bafcd2087eecca2022a6eae7c8d525f2c8d9d0a6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getDescription' is undefined", + "markdown": "Method 'getDescription' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 45, + "charOffset": 1196, + "charLength": 14, + "snippet": { + "text": "getDescription" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1019, + "charLength": 256, + "snippet": { + "text": " ->setDescription('Generates stubs that can be used in a PHP IDE')\n ->setDefinition($this->createDefinition())\n ->setHelp(sprintf('%s.', $this->getDescription()) . PHP_EOL . PHP_EOL . $this->getZflagsHelp())\n ;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4eee20cccc70bca2a52a833ef500a50b18765ee666292cfaa7df27287c19db78" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'find' is undefined", + "markdown": "Method 'find' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 98, + "startColumn": 31, + "charOffset": 2932, + "charLength": 4, + "snippet": { + "text": "find" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 96, + "startColumn": 1, + "charOffset": 2875, + "charLength": 153, + "snippet": { + "text": "\n if ($wantsHelp) {\n $command = $this->find('list');\n\n return $command->run(new ArrayInput(['command' => 'list']), $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "50a2fcc4b615d74dce0833da3d91d362cde209f842c3efa75ff4fd2af72510e8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getApplication' is undefined", + "markdown": "Method 'getApplication' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 27, + "charOffset": 1596, + "charLength": 14, + "snippet": { + "text": "getApplication" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1539, + "charLength": 147, + "snippet": { + "text": " {\n // call generate\n $command = $this->getApplication()->find('generate');\n $io = new SymfonyStyle($input, $output);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "542d13646db26923151ff941b41781ef4da4d63578c38ccf07b4a539b42f4c30" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method '__construct' is undefined", + "markdown": "Method '__construct' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 42, + "startColumn": 17, + "charOffset": 905, + "charLength": 11, + "snippet": { + "text": "__construct" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 40, + "startColumn": 1, + "charOffset": 851, + "charLength": 75, + "snippet": { + "text": " $this->compiler = $compiler;\n\n parent::__construct();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "552933fd95c95da5c703803758d440d6c9c1ebfec6c4ef8a19c6652e0428ebac" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getType' is undefined", + "markdown": "Method 'getType' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/CloneOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 76, + "charOffset": 1748, + "charLength": 7, + "snippet": { + "text": "getType" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1605, + "charLength": 187, + "snippet": { + "text": " );\n if ('variable' !== $clonedVariable->getType()) {\n throw new CompilerException('Variable type: ' . $exprVariable->getType() . ' cannot be cloned');\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5c4aa6ff8b28dd8a4a03d952777491afb05e873bde484cc064ba070c1488d96f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'stringify' is undefined", + "markdown": "Method 'stringify' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 99, + "startColumn": 52, + "charOffset": 2819, + "charLength": 9, + "snippet": { + "text": "stringify" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 97, + "startColumn": 1, + "charOffset": 2594, + "charLength": 271, + "snippet": { + "text": " $output = str_replace('%file%', $this->stringify($vars['file']), $output);\n $output = str_replace('%line%', $this->stringify($vars['line']), $output);\n $output = str_replace('%type%', $this->stringify($vars['type']), $output);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "77941b542c55206582f288dd198c9822f4bd04ad9d12b3671255b4c98ca9d8eb" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setLogger' is undefined", + "markdown": "Method 'setLogger' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 211, + "startColumn": 24, + "charOffset": 5965, + "charLength": 9, + "snippet": { + "text": "setLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 209, + "startColumn": 1, + "charOffset": 5843, + "charLength": 239, + "snippet": { + "text": "\n $documentator = new Documentation($this->files, $this->config, $templatesPath, $options);\n $documentator->setLogger($this->logger);\n\n $this->logger->info('Generating API into ' . $documentator->getOutputDirectory());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "79ef006643eebeea9b025ef6271e3a4ba741ff8edf911bc45d5c91c05943bebd" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getApplication' is undefined", + "markdown": "Method 'getApplication' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 70, + "startColumn": 27, + "charOffset": 2013, + "charLength": 14, + "snippet": { + "text": "getApplication" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 68, + "startColumn": 1, + "charOffset": 1962, + "charLength": 140, + "snippet": { + "text": "\n // call compile\n $command = $this->getApplication()->find('compile');\n $io = new SymfonyStyle($input, $output);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7fa41522c267c36bae81e9b7f8e980c491c5fd49a2c3e14fd5d963c109e055ad" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setName' is undefined", + "markdown": "Method 'setName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 15, + "charOffset": 1025, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 991, + "charLength": 166, + "snippet": { + "text": " {\n $this\n ->setName('compile')\n ->setDescription('Compile a Zephir extension')\n ->setDefinition($this->createDefinition())" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "824e104ef0a6392fa451cc707399336752a475fd907755bab6dfd610e4bf1d5f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setName' is undefined", + "markdown": "Method 'setName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 15, + "charOffset": 1165, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1131, + "charLength": 202, + "snippet": { + "text": " {\n $this\n ->setName('api')\n ->setDescription('Generates a HTML API based on the classes exposed in the extension')\n ->setDefinition($this->createDefinition())" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "876d34a7cc433d8522ebc433c36a1fffef6ee60f0c9b3830b28893fecdca0301" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setName' is undefined", + "markdown": "Method 'setName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 36, + "startColumn": 15, + "charOffset": 849, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 34, + "startColumn": 1, + "charOffset": 815, + "charLength": 236, + "snippet": { + "text": " {\n $this\n ->setName('fullclean')\n ->setDescription('Cleans any object files created by the extension (including files generated by phpize)')\n ->setHelp(sprintf('%s.', $this->getDescription()))" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "89e9f9f9c1ae0d18ed217f0cfa4e0a2a294008ee9f253bca9b29904ada8575ef" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'stringify' is undefined", + "markdown": "Method 'stringify' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 98, + "startColumn": 52, + "charOffset": 2732, + "charLength": 9, + "snippet": { + "text": "stringify" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 96, + "startColumn": 1, + "charOffset": 2593, + "charLength": 271, + "snippet": { + "text": "\n $output = str_replace('%file%', $this->stringify($vars['file']), $output);\n $output = str_replace('%line%', $this->stringify($vars['line']), $output);\n $output = str_replace('%type%', $this->stringify($vars['type']), $output);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8be38c395e2b53a6b1e918786b12b864bd251c000502b22719f55ecad0cc23d5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method '__construct' is undefined", + "markdown": "Method '__construct' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 17, + "charOffset": 1142, + "charLength": 11, + "snippet": { + "text": "__construct" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1090, + "charLength": 73, + "snippet": { + "text": " $this->config = $config;\n\n parent::__construct();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8d3a9931c27b24cd3b1ae6d6280904cc0833655a818d5939bea3ac61983d406e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getDescription' is undefined", + "markdown": "Method 'getDescription' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 45, + "charOffset": 1033, + "charLength": 14, + "snippet": { + "text": "getDescription" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 835, + "charLength": 232, + "snippet": { + "text": " ->setName('fullclean')\n ->setDescription('Cleans any object files created by the extension (including files generated by phpize)')\n ->setHelp(sprintf('%s.', $this->getDescription()))\n ;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "92c5844a1ee2f0052fedf8285161da65c33ffb42fcda0d1db596b633a2ef82e7" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 121, + "startColumn": 15, + "charOffset": 3476, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 119, + "startColumn": 1, + "charOffset": 3368, + "charLength": 230, + "snippet": { + "text": "$application->add(new ApiCommand($compiler, $config));\n$application->add(new BuildCommand());\n$application->add(new CleanCommand($disk));\n$application->add(new CompileCommand($compiler));\n$application->add(new FullCleanCommand());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "930e483da436e442c3308bef469747557a8c1e20b0fdf075a0f67cb15f3225c8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setLogger' is undefined", + "markdown": "Method 'setLogger' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/ClosureArrow.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 24, + "charOffset": 1403, + "charLength": 9, + "snippet": { + "text": "setLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1281, + "charLength": 254, + "snippet": { + "text": "\n $compilerFile = new CompilerFileAnonymous($classDefinition, $compilationContext->config);\n $compilerFile->setLogger($compilationContext->logger);\n\n $compilationContext->compiler->addClassDefinition($compilerFile, $classDefinition);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9db70a558d9297b807a326f79e8582b7ef1a7b298e2c5a27da3ae784c4c647be" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 126, + "startColumn": 15, + "charOffset": 3728, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 124, + "startColumn": 1, + "charOffset": 3599, + "charLength": 259, + "snippet": { + "text": "$application->add(new GenerateCommand($compiler));\n$application->add(new InitCommand($backend, $config, $logger));\n$application->add(new InstallCommand($compiler, $config));\n$application->add(new ListCommand());\n$application->add(new StubsCommand($compiler));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a13167d505aad6977d194f8b2f617e7213f983b5082f9ab1ff6232fa40f1d124" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setName' is undefined", + "markdown": "Method 'setName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 15, + "charOffset": 1239, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1205, + "charLength": 269, + "snippet": { + "text": " {\n $this\n ->setName('install')\n ->setDescription('Installs the extension in the extension directory (may require root password)')\n ->addOption('dev', null, InputOption::VALUE_NONE, 'Install the extension in development mode')" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a17286fc12bac793d17026c0b5d058a5214a1c30e0923c51c047919764f5707c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getDescription' is undefined", + "markdown": "Method 'getDescription' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 45, + "charOffset": 1415, + "charLength": 14, + "snippet": { + "text": "getDescription" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1159, + "charLength": 335, + "snippet": { + "text": " ->setDescription('Generates C code from the Zephir code without compiling it')\n ->addOption('trace', 't', InputOption::VALUE_NONE, 'Show trace message output (in case of exception error)')\n ->setHelp(sprintf('%s.', $this->getDescription()) . PHP_EOL . PHP_EOL . $this->getZflagsHelp())\n ;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aa95e5c9b4496f5cec1ffa8cd7552c13bd82b6137d5313e1b4de87aa2ec03de1" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'stringify' is undefined", + "markdown": "Method 'stringify' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 97, + "startColumn": 52, + "charOffset": 2645, + "charLength": 9, + "snippet": { + "text": "stringify" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 95, + "startColumn": 1, + "charOffset": 2579, + "charLength": 275, + "snippet": { + "text": " }\n\n $output = str_replace('%file%', $this->stringify($vars['file']), $output);\n $output = str_replace('%line%', $this->stringify($vars['line']), $output);\n $output = str_replace('%type%', $this->stringify($vars['type']), $output);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b22f58ef866e5e0651f8d64e3127762c65deada042924f56a67351c7618677ed" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 120, + "startColumn": 15, + "charOffset": 3437, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 118, + "startColumn": 1, + "charOffset": 3334, + "charLength": 221, + "snippet": { + "text": "$application = new Application();\n$application->add(new ApiCommand($compiler, $config));\n$application->add(new BuildCommand());\n$application->add(new CleanCommand($disk));\n$application->add(new CompileCommand($compiler));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b3f0383f3a8f5a7faee788d658fcbc7c4fff4e197249b46ac4696c1e4a3b1c6c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method '__construct' is undefined", + "markdown": "Method '__construct' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 17, + "charOffset": 907, + "charLength": 11, + "snippet": { + "text": "__construct" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 849, + "charLength": 79, + "snippet": { + "text": " $this->filesystem = $filesystem;\n\n parent::__construct();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b6cb3934525b804efb6288872597546d739c7247033821d001dd82eba94343e0" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 124, + "startColumn": 15, + "charOffset": 3613, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 122, + "startColumn": 1, + "charOffset": 3506, + "charLength": 266, + "snippet": { + "text": "$application->add(new CompileCommand($compiler));\n$application->add(new FullCleanCommand());\n$application->add(new GenerateCommand($compiler));\n$application->add(new InitCommand($backend, $config, $logger));\n$application->add(new InstallCommand($compiler, $config));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ba0105d5ad5ed8419d46f1951ef903a08a9ef3d747b4a6c1bb6264bda9089c2d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method '__construct' is undefined", + "markdown": "Method '__construct' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 17, + "charOffset": 1349, + "charLength": 11, + "snippet": { + "text": "__construct" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1298, + "charLength": 72, + "snippet": { + "text": " $this->logger = $logger;\n\n parent::__construct();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bc8550a80179c893059683b23e4b68730f6dc9da38cf14c248444e08eced19ae" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 123, + "startColumn": 15, + "charOffset": 3570, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 121, + "startColumn": 1, + "charOffset": 3462, + "charLength": 251, + "snippet": { + "text": "$application->add(new CleanCommand($disk));\n$application->add(new CompileCommand($compiler));\n$application->add(new FullCleanCommand());\n$application->add(new GenerateCommand($compiler));\n$application->add(new InitCommand($backend, $config, $logger));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bd06637a4f28f558f8bd0acff9234af72d2198582257b4411f4eaaec70c4b22c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getName' is undefined", + "markdown": "Method 'getName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 136, + "startColumn": 24, + "charOffset": 3948, + "charLength": 7, + "snippet": { + "text": "getName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 134, + "startColumn": 1, + "charOffset": 3716, + "charLength": 295, + "snippet": { + "text": " '%s %s by the Phalcon Team' . PHP_EOL .\n 'Thanks to the work by: Andres Gutierrez and Serghei Iakovlev %s',\n $this->getName(),\n $version[0],\n $commit" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bf407dfaa84f2d8479daad919c7dcc7537be872e87c92981d02237a93000009a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getCompleteName' is undefined", + "markdown": "Method 'getCompleteName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 187, + "startColumn": 39, + "charOffset": 5291, + "charLength": 15, + "snippet": { + "text": "getCompleteName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 185, + "startColumn": 1, + "charOffset": 5152, + "charLength": 236, + "snippet": { + "text": " if (isset($this->functionDefinitions[$funcName])) {\n throw new CompilerException(\n \"Function '\" . $func->getCompleteName() . \"' was defined more than one time\",\n $statement\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c108f4a0e4b91182015e3a6257d7d5e721443843c6e72bb19be28319b0acc95f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 122, + "startColumn": 15, + "charOffset": 3520, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 120, + "startColumn": 1, + "charOffset": 3423, + "charLength": 226, + "snippet": { + "text": "$application->add(new BuildCommand());\n$application->add(new CleanCommand($disk));\n$application->add(new CompileCommand($compiler));\n$application->add(new FullCleanCommand());\n$application->add(new GenerateCommand($compiler));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c60ba50b0785707c10c03e465ebdfd6b770678c3aee4a6319a897b605414108e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setName' is undefined", + "markdown": "Method 'setName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 15, + "charOffset": 1446, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1412, + "charLength": 167, + "snippet": { + "text": " {\n $this\n ->setName('init')\n ->setDescription('Initializes a Zephir extension')\n ->setDefinition($this->createDefinition())" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cbb14899e93686779b2b66806d9dc8d676bdb3fc9b7941e699953137d6e46dd8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getApplication' is undefined", + "markdown": "Method 'getApplication' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 29, + "charOffset": 1182, + "charLength": 14, + "snippet": { + "text": "getApplication" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 1069, + "charLength": 193, + "snippet": { + "text": " protected function execute(InputInterface $input, OutputInterface $output)\n {\n $command = $this->getApplication()->find('clean');\n $arguments = ['command' => 'install'];\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d3b3cf695f30bd18c520023585559873113ecd841bdc64fd598efa5e6c3ee63c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setDispatcher' is undefined", + "markdown": "Method 'setDispatcher' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 16, + "charOffset": 1598, + "charLength": 13, + "snippet": { + "text": "setDispatcher" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1485, + "charLength": 147, + "snippet": { + "text": " $dispatcher->addListener(ConsoleEvents::ERROR, [new ErrorListener(), 'onCommandError']);\n\n $this->setDispatcher($dispatcher);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d66c99d07841d47b4816e62746b451cadfe6549bf52977467e70f07d9aec2263" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method '__construct' is undefined", + "markdown": "Method '__construct' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 17, + "charOffset": 1042, + "charLength": 11, + "snippet": { + "text": "__construct" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 988, + "charLength": 75, + "snippet": { + "text": " $this->compiler = $compiler;\n\n parent::__construct();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dc495b2d113d446baa4c2e542a125ae02321148deafccf30affffed7214d14bc" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method '__construct' is undefined", + "markdown": "Method '__construct' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 40, + "startColumn": 17, + "charOffset": 928, + "charLength": 11, + "snippet": { + "text": "__construct" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 38, + "startColumn": 1, + "charOffset": 874, + "charLength": 75, + "snippet": { + "text": " $this->compiler = $compiler;\n\n parent::__construct();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ddfa50335005f318d6d89f6b5c3f6c405a07d8b9ad222882fbc944c5d60540f4" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getDescription' is undefined", + "markdown": "Method 'getDescription' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 64, + "startColumn": 45, + "charOffset": 1624, + "charLength": 14, + "snippet": { + "text": "getDescription" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 62, + "startColumn": 1, + "charOffset": 1462, + "charLength": 196, + "snippet": { + "text": " ->setDescription('Initializes a Zephir extension')\n ->setDefinition($this->createDefinition())\n ->setHelp(sprintf('%s.', $this->getDescription()))\n ;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eb354ae2e84bdab210a5b49bd31f45ec1c52398d209ac333de1303adbe2c7031" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setName' is undefined", + "markdown": "Method 'setName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 45, + "startColumn": 15, + "charOffset": 1004, + "charLength": 7, + "snippet": { + "text": "setName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 43, + "startColumn": 1, + "charOffset": 970, + "charLength": 194, + "snippet": { + "text": " {\n $this\n ->setName('clean')\n ->setDescription('Cleans any object files created by the extension')\n ->setHelp(sprintf('%s.', $this->getDescription()))" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "edc398b3688a3e8c7dc5ecfabbc027fefed67e3c6ce7dc4634500c4ba6eeda75" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 128, + "startColumn": 15, + "charOffset": 3825, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 126, + "startColumn": 1, + "charOffset": 3714, + "charLength": 166, + "snippet": { + "text": "$application->add(new InstallCommand($compiler, $config));\n$application->add(new ListCommand());\n$application->add(new StubsCommand($compiler));\n\n$application->run();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ef7ac0f9edfd9e4793007ea62aca80f29fcd8b96f2af7a16027a601fd1cb75ab" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'setLogger' is undefined", + "markdown": "Method 'setLogger' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/Closure.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 72, + "startColumn": 24, + "charOffset": 1720, + "charLength": 9, + "snippet": { + "text": "setLogger" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 70, + "startColumn": 1, + "charOffset": 1577, + "charLength": 275, + "snippet": { + "text": "\n $compilerFile = new CompilerFileAnonymous($classDefinition, $compilationContext->config, $compilationContext);\n $compilerFile->setLogger($compilationContext->logger);\n\n $compilationContext->compiler->addClassDefinition($compilerFile, $classDefinition);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f42138d4f258beead7401a9e270158301f1752f55abd329e079cd9bfe4d5d41e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'add' is undefined", + "markdown": "Method 'add' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 125, + "startColumn": 15, + "charOffset": 3664, + "charLength": 3, + "snippet": { + "text": "add" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 123, + "startColumn": 1, + "charOffset": 3556, + "charLength": 254, + "snippet": { + "text": "$application->add(new FullCleanCommand());\n$application->add(new GenerateCommand($compiler));\n$application->add(new InitCommand($backend, $config, $logger));\n$application->add(new InstallCommand($compiler, $config));\n$application->add(new ListCommand());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f51d5ebe09f7be1d29478be0952b73a6041524b2b5fbed5645df53021fffc048" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getCommandName' is undefined", + "markdown": "Method 'getCommandName' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 89, + "startColumn": 29, + "charOffset": 2610, + "charLength": 14, + "snippet": { + "text": "getCommandName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 87, + "startColumn": 1, + "charOffset": 2553, + "charLength": 158, + "snippet": { + "text": "\n $wantsHelp = false;\n $name = $this->getCommandName($input);\n\n if ($name && 'help' == strtolower($name) && 2 == $_SERVER['argc']) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fb339b1521de295a6ae44f807a4a5abd8cc5c7dd6ecde4c83a69451a6629c66f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedMethodInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Method 'getDefinition' is undefined", + "markdown": "Method 'getDefinition' is undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/RemoveOptionsTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 30, + "charOffset": 509, + "charLength": 13, + "snippet": { + "text": "getDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 417, + "charLength": 143, + "snippet": { + "text": " protected function removeOptions(array $names): void\n {\n $definition = $this->getDefinition();\n\n $filtered = array_filter(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fcbd72980d25338c133f860a7b5379b1a1b37a0ed38aa71c0e28bb948dacf642" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 31, + "charOffset": 372, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 208, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "013cd648e61bf885586319efcb43543cd92f9819deef327a6f884068175daffc" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 28, + "startColumn": 31, + "charOffset": 919, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 26, + "startColumn": 1, + "charOffset": 784, + "charLength": 262, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\EventDispatcher\\EventDispatcher;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0244bbec6d4d3ed30c74e5f38536c51be16d5653d28172aafac160e673d0f908" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Console'", + "markdown": "Undefined namespace 'Console'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 23, + "charOffset": 478, + "charLength": 7, + "snippet": { + "text": "Console" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 358, + "charLength": 268, + "snippet": { + "text": "use Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Command\\HelpCommand;\nuse Symfony\\Component\\Console\\ConsoleEvents;\nuse Symfony\\Component\\Console\\Exception\\CommandNotFoundException;\nuse Symfony\\Component\\Console\\Exception\\ExceptionInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "03d80e846f2d1fdf6339db808e9b334922211e215293f6366121a39796feff4e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 22, + "startColumn": 31, + "charOffset": 585, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 20, + "startColumn": 1, + "charOffset": 450, + "charLength": 205, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Zephir\\Backend\\Backend;\nuse Zephir\\Config;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "08d8e43411a5daba385245f7bee877d1e45d5e4548448f972eca8eeb540ff22d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 31, + "charOffset": 480, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 341, + "charLength": 267, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0b737caa68978447f18189deff2d0cd07075923e1b5f12ca00595c7ca9bddf9c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 31, + "charOffset": 533, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 399, + "charLength": 237, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Zephir\\Backend\\Backend;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0c6dbd8ee50a440788d17206f9bee097b5b9c0e3312b0b6a6828ab948f24e5ae" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 435, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 304, + "charLength": 255, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "10378de4df3dd3d252d694f07bd476b88feef926ff8e6fca0f99e9f9e4bca1ff" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/DevelopmentModeAwareTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 108, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputInterface;\n\nuse const PHP_DEBUG;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "13e537e0b0c1d81850b901b648fb047d087613cf74606c659b33da40d8c9403c" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Style'", + "markdown": "Undefined namespace 'Style'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 478, + "charLength": 5, + "snippet": { + "text": "Style" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 342, + "charLength": 217, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;\nuse Zephir\\Exception\\ExceptionInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1777f61dfbd4f6b181c36891fe3714b2591790b9e35d5767015623dc84722774" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Style'", + "markdown": "Undefined namespace 'Style'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 22, + "startColumn": 31, + "charOffset": 590, + "charLength": 5, + "snippet": { + "text": "Style" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 20, + "startColumn": 1, + "charOffset": 457, + "charLength": 172, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\n\nuse const PHP_EOL;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1b8ca54926535207349bfd88065b2d2ccc012d73acd3f23b2cb16e24267dcb34" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 386, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 185, + "snippet": { + "text": "use Exception;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Throwable;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1f0aa6c0c469d197250e12389d5eff7e657e575e7ec961983d1defeca127608e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Handler'", + "markdown": "Undefined namespace 'Handler'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 15, + "startColumn": 13, + "charOffset": 285, + "charLength": 7, + "snippet": { + "text": "Handler" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 13, + "startColumn": 1, + "charOffset": 247, + "charLength": 108, + "snippet": { + "text": "declare(strict_types=1);\n\nuse Monolog\\Handler\\StreamHandler;\nuse Monolog\\Logger;\nuse Zephir\\Backend\\Backend;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "31e96a0c9e818a88a851c75e829caad15e6a268e29feaf414c22d17a4ae6f839" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 193, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "32f074ff819b849ecd1fdceaf97d5b2a7e6b98694a7e7f1debaddf2d5f4957b0" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 9, + "charOffset": 311, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 272, + "charLength": 106, + "snippet": { + "text": "\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse ReflectionException;\nuse Zephir\\Class\\Constant;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "330b5e0d006c5e809f925ba09d6a276333b829a7bb58a8d57a6cdaf682c8ba2d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 9, + "charOffset": 334, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 273, + "charLength": 139, + "snippet": { + "text": "use DirectoryIterator;\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse RecursiveDirectoryIterator;\nuse RecursiveIteratorIterator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3313df33ff2d82e651260b0d8df1e3a516846372ab096508af8f88c2e392fd24" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 424, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 229, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "347d215cb213025478fc37de135fc7ac006bcf06d1ec44017fd8d2fef37f17fa" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'ZendEngine3'", + "markdown": "Undefined namespace 'ZendEngine3'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/VariablesManager.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 29, + "charOffset": 546, + "charLength": 11, + "snippet": { + "text": "ZendEngine3" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 476, + "charLength": 118, + "snippet": { + "text": "use function strlen;\nuse function substr;\nuse function Zephir\\Backend\\ZendEngine3\\add_slashes;\n\nclass VariablesManager" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3d7c6f1c2b0e1dc6d1eca2bc1fdc9304f7b3cbf166e78b40da66ae5c9822001a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 188, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3e78389c18722879dd5ab3ae4e5634dde2fb93a69638693784f56b7e49340c0f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 9, + "charOffset": 311, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 272, + "charLength": 119, + "snippet": { + "text": "\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse ReflectionException;\nuse Zephir\\Class\\Definition\\Definition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3f335c313e1cc9cf6ac762bfda32106630e5534965bac21c5252165a38347526" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 9, + "charOffset": 281, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 97, + "snippet": { + "text": "namespace Zephir;\n\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse ReflectionException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "443da23df032641608b53fc0c7fe39623d6a02328de84931e109dcb3fddbf403" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 490, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 355, + "charLength": 228, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "45587045d101c2a74bc507d059c4c3559a37db581cd53be5bc1d6ddf0fceed6a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 9, + "charOffset": 320, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 161, + "snippet": { + "text": "\nuse DirectoryIterator;\nuse Psr\\Log\\LoggerInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\InputArgument;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "498a019c51596c1382b1b31ba63a4e9b2a9f04c43451c8f53e2b75b05d52fed6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 189, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4bd3a0d0db558151bc2f5386224f422552ca74259f9df5d8952409cdd1673cb9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 473, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 342, + "charLength": 225, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4e539c2da67778b444bc6d99f212be54f6b045d6a387ee5da022a8cbb3ffee76" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 9, + "charOffset": 281, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 112, + "snippet": { + "text": "namespace Zephir;\n\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse Zephir\\Class\\Definition\\Definition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5084f9df695de0baf604549eeef29e8a50a79447f44949f96ced42a49225deda" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 429, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 312, + "charLength": 242, + "snippet": { + "text": "use Psr\\Log\\LoggerInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "50ac1ee2046ee64e8b00940d1f6ebd55338ab677c05d0fe4ac650633ba2dd908" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Command'", + "markdown": "Undefined namespace 'Command'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 435, + "charLength": 7, + "snippet": { + "text": "Command" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 296, + "charLength": 270, + "snippet": { + "text": "use Symfony\\Component\\Console\\Application as BaseApplication;\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Command\\HelpCommand;\nuse Symfony\\Component\\Console\\ConsoleEvents;\nuse Symfony\\Component\\Console\\Exception\\CommandNotFoundException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "51e849512e7ee77041b778c8617afb8b291c6674f3d54abaf225fcc7caf102fb" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler/CompilerFileFactory.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 9, + "charOffset": 290, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 106, + "snippet": { + "text": "namespace Zephir\\Compiler;\n\nuse Psr\\Log\\LoggerInterface;\nuse Zephir\\AliasManager;\nuse Zephir\\CompilerFile;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "57116e0c4b68cae60d1ae36f4325964670e1e7d0369243db8bea237ef3b5a714" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 189, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5923fa39d430e6245cafe306e5daee42d5f6d09c3fae9a70c12d57728a99afc5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 26, + "startColumn": 31, + "charOffset": 814, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 24, + "startColumn": 1, + "charOffset": 685, + "charLength": 252, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5b897ac5452046ad9253ca17fdec51f9687486d9fdd8c44acf179d355283f015" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Style'", + "markdown": "Undefined namespace 'Style'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 474, + "charLength": 5, + "snippet": { + "text": "Style" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 341, + "charLength": 192, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;\nuse Zephir\\Config;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5eb4377bf10c57c30ca12bb05776bbf339440eaa85fd03929981ca58a30480df" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 31, + "charOffset": 371, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 205, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "61799bde1bba18f521257989311d3c592fb855c7691cec7b867d10a1ec52c99f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 25, + "startColumn": 31, + "charOffset": 763, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 23, + "startColumn": 1, + "charOffset": 627, + "charLength": 261, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "734960dcfc8468f6f7d63c3694a5c316839568f5832da533ea6a2c30627c58fd" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 31, + "charOffset": 536, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 405, + "charLength": 205, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "73e86b2cf1981618fb2acbdbad0ac1fefffb33516dfb55a9c55b7d15e277687e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 31, + "charOffset": 334, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 171, + "snippet": { + "text": "\nuse Exception;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "74537af4af34929a98e28cdc852181c18217040e06bce43fbe06997818943460" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Command'", + "markdown": "Undefined namespace 'Command'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 388, + "charLength": 7, + "snippet": { + "text": "Command" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 281, + "charLength": 219, + "snippet": { + "text": "use Exception;\nuse Symfony\\Component\\Console\\Application as BaseApplication;\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Command\\HelpCommand;\nuse Symfony\\Component\\Console\\ConsoleEvents;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "74985da6f239c3778c05b6d9eea5b1eb06908cac318b31eb9efee0579f18a6de" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Style'", + "markdown": "Undefined namespace 'Style'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 473, + "charLength": 5, + "snippet": { + "text": "Style" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 337, + "charLength": 212, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Exception\\FileSystemException;\nuse Zephir\\Os;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7670410bfc23da2945eb9189f8734d5680c42e84b33b654518c8a4e9872c14e5" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'EventDispatcher'", + "markdown": "Undefined namespace 'EventDispatcher'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 30, + "startColumn": 23, + "charOffset": 1014, + "charLength": 15, + "snippet": { + "text": "EventDispatcher" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 28, + "startColumn": 1, + "charOffset": 889, + "charLength": 212, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\EventDispatcher\\EventDispatcher;\nuse Throwable;\nuse Zephir\\Console\\Command\\ListCommand;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7a019f68639d773f966c9ce954117d9acc6d98e8d260530d2e8eeea506a430c2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 31, + "charOffset": 372, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 209, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7ca8add743248e186ed950d6acbb16b5d7a0e8557ad7016303036515d388f834" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Event'", + "markdown": "Undefined namespace 'Event'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/ErrorListener.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 311, + "charLength": 5, + "snippet": { + "text": "Event" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 162, + "snippet": { + "text": "namespace Zephir\\Console;\n\nuse Symfony\\Component\\Console\\Event\\ConsoleErrorEvent;\nuse Zephir\\Exception\\CompilerException;\nuse Zephir\\Exception\\ExceptionInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8002949bcf67732520d24227c8d1468015482ba99cb308cdd3f1657874c1d261" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Console'", + "markdown": "Undefined namespace 'Console'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 23, + "charOffset": 318, + "charLength": 7, + "snippet": { + "text": "Console" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 280, + "charLength": 175, + "snippet": { + "text": "\nuse Exception;\nuse Symfony\\Component\\Console\\Application as BaseApplication;\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Command\\HelpCommand;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "823f3992a13ed1e873c574b9dd4e58b2c39c7cbe3a20dd40c83fb5198dbf8965" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 9, + "charOffset": 304, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 272, + "charLength": 109, + "snippet": { + "text": "\nuse DirectoryIterator;\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse RecursiveDirectoryIterator;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "82ffcf7eb0af0e1d3a9a208b4498bed70ffb057bda305af6c5469486ff8d6909" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Exception'", + "markdown": "Undefined namespace 'Exception'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 22, + "startColumn": 31, + "charOffset": 597, + "charLength": 9, + "snippet": { + "text": "Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 20, + "startColumn": 1, + "charOffset": 456, + "charLength": 276, + "snippet": { + "text": "use Symfony\\Component\\Console\\ConsoleEvents;\nuse Symfony\\Component\\Console\\Exception\\CommandNotFoundException;\nuse Symfony\\Component\\Console\\Exception\\ExceptionInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "84d60e9df13440978a47bf8daef91af1d7a93e0af7d1493c65425f0d61d26bb3" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/RemoveOptionsTrait.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 111, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\InputOption;\n\nuse function array_filter;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8799cac1c6b02f5d8239e3818b3af300ca05fc47f7fb90036aaa98dafe34b6dc" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 31, + "charOffset": 367, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 204, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8e18ae416b9071da01f62f225f75d7965b8473f9c24d14e962adc94b66a95a8e" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Style'", + "markdown": "Undefined namespace 'Style'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 474, + "charLength": 5, + "snippet": { + "text": "Style" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 341, + "charLength": 195, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;\nuse Zephir\\Exception;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "90f72e36086e56ad76c444a300a3052bdc0c55d17de9a77b08d40a312ce6f2f7" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Formatter'", + "markdown": "Undefined namespace 'Formatter'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Logger/Formatter/CompilerFormatter.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 13, + "charOffset": 302, + "charLength": 9, + "snippet": { + "text": "Formatter" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 92, + "snippet": { + "text": "namespace Zephir\\Logger\\Formatter;\n\nuse Monolog\\Formatter\\LineFormatter;\nuse Zephir\\Config;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "969a797a51eacd2ae9afce3718d2f1214a21ffbc3b993d96abc9239df29d0a25" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Exception'", + "markdown": "Undefined namespace 'Exception'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 371, + "charLength": 9, + "snippet": { + "text": "Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 213, + "snippet": { + "text": "use DirectoryIterator;\nuse Psr\\Log\\LoggerInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9713dfdef948963b04eea9fcca9f376e89658642db59d8f9ea4be04d4d08a9a8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 420, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 225, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "97e66bec5ba6452d931d0405b99b44ab74633aa2c65d099c31524d6d46449f2d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 31, + "charOffset": 334, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 168, + "snippet": { + "text": "\nuse Exception;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9c1f82eb2570f951c2de1f03bb9a31c9f29bd40fd6c1b3ff06a057f2afdfbb97" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilationContext.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 9, + "charOffset": 281, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 107, + "snippet": { + "text": "namespace Zephir;\n\nuse Psr\\Log\\LoggerInterface;\nuse Zephir\\Backend\\Backend;\nuse Zephir\\Cache\\FunctionCache;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a3f677c19d100a32e2e1cf9f6b456118a1c070f4e323b2bbb6a484b9a3b584c1" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 382, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 216, + "snippet": { + "text": "use Exception;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a73346b0d32436c8735ed89dd8c30a8c2f93247728f9dcc40901d61f146f4ff6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 420, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 225, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a98413724194573b609a819beeee1846c75cfad31cc81350faa757ad1cc1d460" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 31, + "charOffset": 867, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 733, + "charLength": 258, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aee7343fb88c737b7f2eb480f87658e966452606534b86eb248ce3c96fd92143" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'PhpCsFixer'", + "markdown": "Undefined namespace 'PhpCsFixer'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": ".php-cs-fixer.dist.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 15, + "charOffset": 975, + "charLength": 10, + "snippet": { + "text": "PhpCsFixer" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 916, + "charLength": 115, + "snippet": { + "text": " ->notPath('#tests/ext-bootstrap.php#');\n\n$config = new PhpCsFixer\\Config();\n$config\n ->setRiskyAllowed(true)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b554a4d8f10adc7d0eceffafcc314ed6a440664c69657fd2610e6968f67ddb6d" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 438, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 273, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\InvalidArgumentException;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ba2b0b169e6108d5780fa95713186fbbb17a7fb4bbeeaf773d3fc3719fcc5a3a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Style'", + "markdown": "Undefined namespace 'Style'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 31, + "charOffset": 527, + "charLength": 5, + "snippet": { + "text": "Style" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 394, + "charLength": 213, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Compiler;\nuse Zephir\\Exception\\CompilerException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bdbc148a11434144618d763ab3d1cb9f46009a9797ea5a3f947afc436252cb74" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 188, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c1f18519c196bc59814e2c151204a20f4522b107d4550338b7a730aed73cb6f0" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 31, + "charOffset": 385, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 220, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Exception\\InvalidArgumentException;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c24e7f427c411d315e2a433a55ba0b3ee5e5aa00d376520d1b631e83afe56d3a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 9, + "charOffset": 311, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 272, + "charLength": 125, + "snippet": { + "text": "\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse Zephir\\Class\\Definition\\Definition;\nuse Zephir\\Documentation\\File;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c986a1df354a86c011c87b52d4c2f63e132c356011d0551115ebc966a21e190a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InstallCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 17, + "startColumn": 31, + "charOffset": 371, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 15, + "startColumn": 1, + "charOffset": 288, + "charLength": 205, + "snippet": { + "text": "\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ca60fc3292a0aac461693aba4f64b1647c3223ca8d69626e82f262382c3634dc" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 29, + "startColumn": 31, + "charOffset": 968, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 27, + "startColumn": 1, + "charOffset": 837, + "charLength": 224, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\EventDispatcher\\EventDispatcher;\nuse Throwable;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cbc903146377ccbb4e7fec52e8b49926dc6fc7e1533b0e5950f10f89785274a8" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/BuildCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 31, + "charOffset": 487, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 352, + "charLength": 257, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cbcc121b9a080e10fd106bd88c18f588858df90f5bdb9fbcd4dbe042cc39fd60" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Log'", + "markdown": "Undefined namespace 'Log'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 9, + "charOffset": 281, + "charLength": 3, + "snippet": { + "text": "Log" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 97, + "snippet": { + "text": "namespace Zephir;\n\nuse Psr\\Log\\LoggerAwareTrait;\nuse Psr\\Log\\NullLogger;\nuse ReflectionException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d0b3bbeaa1c2b9edb2f442723db79ac9ad2b3281503ddaa1de135bba31cbbb53" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Command'", + "markdown": "Undefined namespace 'Command'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/AbstractCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 7, + "snippet": { + "text": "Command" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 129, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Command\\Command;\n\nabstract class AbstractCommand extends Command" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d5ccb09e96abc74c6311876f0109c3335aa937141ae0d8f11666b7c8ce4bb2b6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Command'", + "markdown": "Undefined namespace 'Command'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ListCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 7, + "snippet": { + "text": "Command" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 101, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Command\\ListCommand as Command;\n\n/**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d611c10483c9398d877bf6a7a08181417ca8f86157f2d16a1b03bc2b2f2b4a0b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Exception'", + "markdown": "Undefined namespace 'Exception'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 23, + "startColumn": 31, + "charOffset": 657, + "charLength": 9, + "snippet": { + "text": "Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 21, + "startColumn": 1, + "charOffset": 501, + "charLength": 282, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\CommandNotFoundException;\nuse Symfony\\Component\\Console\\Exception\\ExceptionInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputArgument;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d62086227efc5cc49a55f20c4428081559d482d445c223430a1356160a9f8ba9" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 20, + "startColumn": 31, + "charOffset": 539, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 18, + "startColumn": 1, + "charOffset": 408, + "charLength": 194, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Zephir\\Compiler;\nuse Zephir\\Config;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d7120f43e45b40544a321f06a027ad4db45a0770ae6352e3f40b6921bd72636b" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Style'", + "markdown": "Undefined namespace 'Style'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 19, + "startColumn": 31, + "charOffset": 440, + "charLength": 5, + "snippet": { + "text": "Style" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 17, + "startColumn": 1, + "charOffset": 304, + "charLength": 212, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Throwable;\nuse Zephir\\Exception\\FileSystemException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d91a5fd7c9884e83624cbd322cecd85de03190dc9308d9844b0f97307c97a84a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Output'", + "markdown": "Undefined namespace 'Output'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/FullCleanCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 419, + "charLength": 6, + "snippet": { + "text": "Output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 245, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Zephir\\Exception\\FileSystemException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e25e36e4d0b37abc2680f2e40752200c01de342b20a9526a5a76c457aac55a4f" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Monolog'", + "markdown": "Undefined namespace 'Monolog'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 5, + "charOffset": 312, + "charLength": 7, + "snippet": { + "text": "Monolog" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 272, + "charLength": 104, + "snippet": { + "text": "\nuse Monolog\\Handler\\StreamHandler;\nuse Monolog\\Logger;\nuse Zephir\\Backend\\Backend;\nuse Zephir\\Compiler;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e68cde025f679c97518c484b977f0c11bb6bbbd3c01daf5093774093b099b3c0" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 24, + "startColumn": 31, + "charOffset": 715, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 22, + "startColumn": 1, + "charOffset": 567, + "charLength": 269, + "snippet": { + "text": "use Symfony\\Component\\Console\\Exception\\ExceptionInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;\nuse Symfony\\Component\\Console\\Input\\ArrayInput;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ee9d591b9fd6687f74f8afd6dce20051baa32237852d786eec7ced6b01c4e48a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Exception'", + "markdown": "Undefined namespace 'Exception'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 16, + "startColumn": 31, + "charOffset": 319, + "charLength": 9, + "snippet": { + "text": "Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 14, + "startColumn": 1, + "charOffset": 254, + "charLength": 205, + "snippet": { + "text": "namespace Zephir\\Console\\Command;\n\nuse Symfony\\Component\\Console\\Exception\\InvalidArgumentException;\nuse Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f86e41bf5dc36131a8390f5ee0c27e9d52a8de1500052254dd5ef137a95537ab" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'PhpCsFixer'", + "markdown": "Undefined namespace 'PhpCsFixer'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": ".php-cs-fixer.dist.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 27, + "startColumn": 11, + "charOffset": 537, + "charLength": 10, + "snippet": { + "text": "PhpCsFixer" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 25, + "startColumn": 1, + "charOffset": 521, + "charLength": 86, + "snippet": { + "text": "EOF;\n\n$finder = PhpCsFixer\\Finder::create()\n ->in(__DIR__)\n ->append([__FILE__])" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fc005e58123fb437e6d058e33468d8ffd2363668c14f14db3f490075fdcd741a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Input'", + "markdown": "Undefined namespace 'Input'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 18, + "startColumn": 31, + "charOffset": 424, + "charLength": 5, + "snippet": { + "text": "Input" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 16, + "startColumn": 1, + "charOffset": 289, + "charLength": 257, + "snippet": { + "text": "use Symfony\\Component\\Console\\Input\\InputDefinition;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fc97b959d6a3286de20d21fdbbecadccf42efe0f9746427b8da276fa93eb24a1" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedNamespaceInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Undefined namespace 'Exception'", + "markdown": "Undefined namespace 'Exception'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 21, + "startColumn": 31, + "charOffset": 531, + "charLength": 9, + "snippet": { + "text": "Exception" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 19, + "startColumn": 1, + "charOffset": 405, + "charLength": 279, + "snippet": { + "text": "use Symfony\\Component\\Console\\Command\\HelpCommand;\nuse Symfony\\Component\\Console\\ConsoleEvents;\nuse Symfony\\Component\\Console\\Exception\\CommandNotFoundException;\nuse Symfony\\Component\\Console\\Exception\\ExceptionInterface;\nuse Symfony\\Component\\Console\\Exception\\RuntimeException;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fe5072469d80ea33c4119a2bc3aefdff935933512f6c2ba4e2a32add70bf221a" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 250, + "startColumn": 62, + "charOffset": 10149, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 248, + "startColumn": 1, + "charOffset": 9983, + "charLength": 243, + "snippet": { + "text": " case 'object-property-append':\n $let = new LetObjectPropertyAppend();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "026f3ec34b7fde574a1c05d63b6bd2445988c589a806c37a56fa7e6817197824" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variable' is probably undefined", + "markdown": "Variable '$variable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 217, + "startColumn": 48, + "charOffset": 7228, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 215, + "startColumn": 1, + "charOffset": 7088, + "charLength": 212, + "snippet": { + "text": " $exprVariable,\n isset($this->statement['key']) ? $keyVariable : null,\n isset($this->statement['value']) ? $variable : null,\n $duplicateKey,\n $duplicateHash," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "037ae5dfb0c16d94044982b627b5392d60ce53c99d237f51d60f1f61aa0b2d88" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$parameterCode' is probably undefined", + "markdown": "Variable '$parameterCode' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 819, + "startColumn": 65, + "charOffset": 28442, + "charLength": 14, + "snippet": { + "text": "$parameterCode" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 817, + "startColumn": 1, + "charOffset": 28250, + "charLength": 321, + "snippet": { + "text": " $context->headersManager->add('kernel/operators');\n $context->symbolTable->mustGrownStack(true);\n $codePrinter->output('if (EXPECTED(Z_TYPE_P(' . $parameterCode . ') == IS_STRING)) {');\n $codePrinter->increaseLevel();\n $targetVar = $var['name'];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0478961172d81e1e8c4d21fd854562c86def6929eea1c2ebdb5b998ffc2fe33f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classDefinition' is probably undefined", + "markdown": "Variable '$classDefinition' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 467, + "startColumn": 34, + "charOffset": 21346, + "charLength": 16, + "snippet": { + "text": "$classDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 465, + "startColumn": 1, + "charOffset": 21257, + "charLength": 250, + "snippet": { + "text": "\n if (0 == $numberImplemented) {\n if (!$classDefinition->isInterface()) {\n if (count($classTypes) > 1) {\n throw new CompilerException(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0488b6b0ac3b4d72ce335f366435f4fedf5c4b6a7d4d6a81faff883bb941cde1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 159, + "startColumn": 25, + "charOffset": 6358, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 157, + "startColumn": 1, + "charOffset": 6258, + "charLength": 198, + "snippet": { + "text": " $variable,\n $symbolVariable,\n $resolvedExpr,\n $readDetector,\n $compilationContext," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "051f57b2d31db11a9a4f1dc4d2d64545a5ac86de6a05dd4e641afba95b02c643" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$method' is probably undefined", + "markdown": "Variable '$method' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 780, + "startColumn": 88, + "charOffset": 36215, + "charLength": 7, + "snippet": { + "text": "$method" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 778, + "startColumn": 1, + "charOffset": 35967, + "charLength": 350, + "snippet": { + "text": " $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 2, $paramCount);\n $codePrinter->output(\n $macro . '(' . $symbolCode . ', ' . $variableCode . ', ' . $method->getInternalName(\n ) . $paramsStr . ');'\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "05bc3b2f76428b77cd159c3db184e8c8d3574d27530a8e8ebaf4e16a94d0fd7e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$method' is probably undefined", + "markdown": "Variable '$method' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Cache/MethodCache.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 123, + "startColumn": 15, + "charOffset": 4471, + "charLength": 7, + "snippet": { + "text": "$method" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 121, + "startColumn": 1, + "charOffset": 4446, + "charLength": 161, + "snippet": { + "text": " }\n\n if (!($method instanceof ReflectionMethod)) {\n if ($method->getClassDefinition()->isExternal()) {\n return 'NULL, 0';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "07fa6e4d267f29ae3ed83f6ef1beb2ccd92186336ae69b2e65f6434127bca53b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$references' is probably undefined", + "markdown": "Variable '$references' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 830, + "startColumn": 23, + "charOffset": 38158, + "charLength": 11, + "snippet": { + "text": "$references" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 828, + "startColumn": 1, + "charOffset": 38037, + "charLength": 252, + "snippet": { + "text": " // Release parameters marked as references\n if (isset($expression['parameters'])) {\n if (count($references)) {\n foreach ($params as $position => $param) {\n if (isset($references[$position])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "09745733bf0921d99b1907ff53de3a66639b7e879add28885e16c1f3f5737782" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$name' is probably undefined", + "markdown": "Variable '$name' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Stubs/MethodDocBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 167, + "startColumn": 39, + "charOffset": 4570, + "charLength": 5, + "snippet": { + "text": "$name" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 165, + "startColumn": 1, + "charOffset": 4470, + "charLength": 189, + "snippet": { + "text": " switch ($docType) {\n case 'param':\n $this->parameters[$name] = [$type, $description];\n break;\n case 'return':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0f7d4e033ab0b3c39681f579a68921d6ca3cffe53217d84d99c1b85bde1c22dc" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 543, + "startColumn": 40, + "charOffset": 21308, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 541, + "startColumn": 1, + "charOffset": 21117, + "charLength": 308, + "snippet": { + "text": " $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount);\n $codePrinter->output(\n $macro . '(' . $symbol . ', ' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "114dbfa2f647d708f012a0cbedb0cc650839d0869aaae29e0278592bf57eeeec" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$functionName' is probably undefined", + "markdown": "Variable '$functionName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/Variable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1074, + "startColumn": 29, + "charOffset": 40529, + "charLength": 13, + "snippet": { + "text": "$functionName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1072, + "startColumn": 1, + "charOffset": 40369, + "charLength": 328, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n $codePrinter->output(\n $functionName . '(' . $symbol . ', ' . $compilationContext->backend->getVariableCode(\n $tempVariable\n ) . ');'" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1533a3d28f70641df858e5968c9e8529f61dd8a0224ca3ea29587a8636ab724d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classDefinition' is probably undefined", + "markdown": "Variable '$classDefinition' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 87, + "startColumn": 13, + "charOffset": 2886, + "charLength": 16, + "snippet": { + "text": "$classDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 85, + "startColumn": 1, + "charOffset": 2835, + "charLength": 114, + "snippet": { + "text": "\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $statement" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "163555d417cd4b2eb199ae753ff2aea0bad25cbbcd5bfa50b9c5689e3f8eecd0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$defaultIndex' is probably undefined", + "markdown": "Variable '$defaultIndex' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/SwitchStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 181, + "startColumn": 13, + "charOffset": 6243, + "charLength": 13, + "snippet": { + "text": "$defaultIndex" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 179, + "startColumn": 1, + "charOffset": 6220, + "charLength": 102, + "snippet": { + "text": " }\n\n if ($defaultIndex === count($clauses) - 1) {\n return $clauses;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "16c62bba7eb3f1b6f907dfbc8f51b1a4393007f0d87d339244920b9a7e31e143" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 260, + "startColumn": 62, + "charOffset": 10668, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 258, + "startColumn": 1, + "charOffset": 10480, + "charLength": 265, + "snippet": { + "text": " case 'object-property-array-index-append':\n $let = new LetObjectPropertyArrayIndexAppend();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "18b46d126dcdb3dee7c6ec2b2c5b0869ff7fe3614dbfffab64e577eb4ceb9772" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 168, + "startColumn": 62, + "charOffset": 6697, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 166, + "startColumn": 1, + "charOffset": 6544, + "charLength": 230, + "snippet": { + "text": " case 'variable-append':\n $let = new LetVariableAppend();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "196ab6ac405bb1a63b2c883f9486d50b4c26502f92c6f27b2e6a651534d1ea74" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classEntry' is probably undefined", + "markdown": "Variable '$classEntry' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/InstanceOfOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 136, + "startColumn": 57, + "charOffset": 5982, + "charLength": 11, + "snippet": { + "text": "$classEntry" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 134, + "startColumn": 1, + "charOffset": 5867, + "charLength": 168, + "snippet": { + "text": " return new CompiledExpression(\n 'bool',\n 'zephir_instance_of_ev(' . $symbol . ', ' . $classEntry . ')',\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1bf9d6b21da4535103cce50ecbe2f2dc3fa9d592c882c5e7aa2271d212023e49" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 178, + "startColumn": 62, + "charOffset": 7183, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 176, + "startColumn": 1, + "charOffset": 7006, + "charLength": 254, + "snippet": { + "text": " case 'variable-dynamic-object-property':\n $let = new LetObjectDynamicProperty();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1cc24d286996ffa24a3883107849ee51d604c90d7f2fe5e3fb25219e7bc35989" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 183, + "startColumn": 62, + "charOffset": 7442, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 181, + "startColumn": 1, + "charOffset": 7261, + "charLength": 258, + "snippet": { + "text": " case 'string-dynamic-object-property':\n $let = new LetObjectDynamicStringProperty();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1e560a1ac063c49111c815139b84055f34713c8bd78ab458ea095461eb254011" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 721, + "startColumn": 57, + "charOffset": 28893, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 719, + "startColumn": 1, + "charOffset": 28750, + "charLength": 321, + "snippet": { + "text": " } else {\n $compilationContext->codePrinter->output(\n 'ZEPHIR_CALL_CE_STATIC_ZVAL(' . $symbol . ', ' . $classEntry . ', ' . $methodNameVariable->getName(\n ) . ', ' . $cachePointer . ', ' . implode(', ', $params) . ');'\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "27944d21aef6617792a48e519d94f7c34e7a69f8b383a042e749111216a98104" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 221, + "startColumn": 25, + "charOffset": 8955, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 219, + "startColumn": 1, + "charOffset": 8847, + "charLength": 203, + "snippet": { + "text": " $variable,\n $assignment['property'],\n $resolvedExpr,\n $compilationContext,\n $assignment" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2a89f7b51dd70e61b06609e51ecb43f0804866c89a9253d0cdfabf50680b4911" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$typeKey' is probably undefined", + "markdown": "Variable '$typeKey' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 126, + "startColumn": 39, + "charOffset": 3411, + "charLength": 8, + "snippet": { + "text": "$typeKey" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 124, + "startColumn": 1, + "charOffset": 3228, + "charLength": 278, + "snippet": { + "text": " if ('variable' == $key->getType()) {\n $var = $context->symbolTable->getVariableForRead($key->getCode(), $context);\n $keyStr = 'string' == $typeKey ?\n 'Z_STRVAL_P('\n . $this->getVariableCode($var)" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2d8c90b3b7b1c4cb243385ecc60d5f9bc36f6052014b35189ef97be1a1faeef9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$arrayNumKey' is probably undefined", + "markdown": "Variable '$arrayNumKey' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1130, + "startColumn": 91, + "charOffset": 39574, + "charLength": 12, + "snippet": { + "text": "$arrayNumKey" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1128, + "startColumn": 1, + "charOffset": 39384, + "charLength": 318, + "snippet": { + "text": " $macro = 'ZEND_HASH_' . $reverse . 'FOREACH_KEY_VAL';\n $codePrinter->output(\n $macro . '(Z_ARRVAL_P(' . $this->getVariableCode($exprVariable) . '), ' . $arrayNumKey->getName(\n ) . ', ' . $arrayStrKey->getName() . ', ' . $tempVariable->getName() . ')'\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "327162dce469b67039253092fe1bb55745d25084766d6e08159f47ee0b56d87f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classDefinition' is probably undefined", + "markdown": "Variable '$classDefinition' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 510, + "startColumn": 33, + "charOffset": 23233, + "charLength": 16, + "snippet": { + "text": "$classDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 508, + "startColumn": 1, + "charOffset": 23063, + "charLength": 305, + "snippet": { + "text": " sprintf(\n \"Method '%s::%s' is marked as '%s' and it does not return anything\",\n $classDefinition->getCompleteName(),\n $expression['name'],\n Types::T_VOID" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "33ce97068d591504e96ac3a99b0a5229719f82a2c111cfb3dea26fb4659d7cf7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$parameterVariable' is probably undefined", + "markdown": "Variable '$parameterVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 832, + "startColumn": 68, + "charOffset": 29140, + "charLength": 18, + "snippet": { + "text": "$parameterVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 830, + "startColumn": 1, + "charOffset": 29024, + "charLength": 196, + "snippet": { + "text": " break;\n case 'array':\n $context->backend->assignZval($inputParamVariable, $parameterVariable, $context);\n break;\n case 'object':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "33f8c145b89fd28d22807f323605ef63219582eca560f767338c4875b73748f7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$methodName' is probably undefined", + "markdown": "Variable '$methodName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 203, + "startColumn": 50, + "charOffset": 7093, + "charLength": 11, + "snippet": { + "text": "$methodName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 201, + "startColumn": 1, + "charOffset": 6909, + "charLength": 273, + "snippet": { + "text": " if ('this' == $variableVariable->getRealName()) {\n $classDefinition = $compilationContext->classDefinition;\n if (!$classDefinition->hasMethod($methodName)) {\n if ($check) {\n $found = false;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "36df782cb3fd0600c404dea03742049fad6075595e007776ec60ced80f241a43" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variableVariable' is probably undefined", + "markdown": "Variable '$variableVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 729, + "startColumn": 75, + "charOffset": 33779, + "charLength": 17, + "snippet": { + "text": "$variableVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 727, + "startColumn": 1, + "charOffset": 33569, + "charLength": 276, + "snippet": { + "text": " // Generate the code according to the call type\n if (self::CALL_NORMAL == $type || self::CALL_DYNAMIC_STRING == $type) {\n $realMethod = $this->getRealCalledMethod($compilationContext, $variableVariable, $methodName);\n\n $isInternal = false;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3aa8329d17b3cb033f614089c8401e76167f2a920e287ab5c6a8f16dcbbd5fee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$readOnly' is probably undefined", + "markdown": "Variable '$readOnly' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/FetchOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 18, + "charOffset": 3049, + "charLength": 9, + "snippet": { + "text": "$readOnly" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 3021, + "charLength": 99, + "snippet": { + "text": " }\n\n $flags = $readOnly ? '1' : '0';\n\n switch ($expression['right']['type']) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3e193fbb86b218686de3e9c3a347f471269ced40e2682b5fed97ef192f0ca2c6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variableRight' is probably undefined", + "markdown": "Variable '$variableRight' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ConcatOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 100, + "startColumn": 90, + "charOffset": 3601, + "charLength": 14, + "snippet": { + "text": "$variableRight" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 98, + "startColumn": 1, + "charOffset": 3379, + "charLength": 268, + "snippet": { + "text": " if ('string' == $left->getType() && 'variable' == $right->getType()) {\n $compilationContext->codePrinter->output(\n 'ZEPHIR_CONCAT_SV(' . $expectedCode . ', \"' . $left->getCode() . '\", ' . $variableRight . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4563407537fe09ed1b2f954a940b8bfad6cabf6e47f588ba416a971c56f03f57" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 232, + "startColumn": 25, + "charOffset": 9377, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 230, + "startColumn": 1, + "charOffset": 9269, + "charLength": 203, + "snippet": { + "text": " $variable,\n $assignment['property'],\n $resolvedExpr,\n $compilationContext,\n $assignment" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "45efbafc98df13ac59fdfc818a14f053c76227d8e15ad114390834ea598fbb91" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 446, + "startColumn": 40, + "charOffset": 17480, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 444, + "startColumn": 1, + "charOffset": 17289, + "charLength": 308, + "snippet": { + "text": " $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount);\n $codePrinter->output(\n $macro . '(' . $symbol . ', ' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "465613b9ab6f348c89a64ea626048249b398bbd27f878fc5fa28629238c92157" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$keyStr' is probably undefined", + "markdown": "Variable '$keyStr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 180, + "startColumn": 19, + "charOffset": 5275, + "charLength": 7, + "snippet": { + "text": "$keyStr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 178, + "startColumn": 1, + "charOffset": 5182, + "charLength": 151, + "snippet": { + "text": " . $this->getVariableCode($variable)\n . ', '\n . $keyStr\n . ', '\n . $valueStr" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "47c6299635672d3dbc4d878e15e0b34efef3fe7cfc11846b239665126a0fdd82" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variable' is probably undefined", + "markdown": "Variable '$variable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 381, + "startColumn": 65, + "charOffset": 13121, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 379, + "startColumn": 1, + "charOffset": 12963, + "charLength": 238, + "snippet": { + "text": " $compilationContext->codePrinter->output(\n 'ZEPHIR_ITERATOR_COPY('\n . $compilationContext->backend->getVariableCode($variable)\n . ', '\n . $iteratorVariable->getName()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "49ea00a4c4478a2a6b500a3fe605958b135ebecf5def3b278d446f00e57c40f8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$method' is probably undefined", + "markdown": "Variable '$method' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 787, + "startColumn": 63, + "charOffset": 36580, + "charLength": 7, + "snippet": { + "text": "$method" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 785, + "startColumn": 1, + "charOffset": 36365, + "charLength": 302, + "snippet": { + "text": " $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 0, $paramCount);\n $codePrinter->output(\n $macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4d784608301249034374ca495c3ae3fb55d0d961ef76e900c2c4ecea2c6a8d9f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$functionName' is probably undefined", + "markdown": "Variable '$functionName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 229, + "startColumn": 29, + "charOffset": 8566, + "charLength": 13, + "snippet": { + "text": "$functionName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 227, + "startColumn": 1, + "charOffset": 8465, + "charLength": 303, + "snippet": { + "text": " );\n $codePrinter->output(\n $functionName . '(' . $context->backend->getVariableCode(\n $tempVariable\n ) . ', ' . $context->backend->getVariableCode($resolvedVariable) . ')'" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4daf7a5a08ea3aa28934600cbdce3970d4d7b7d0fbffd279b28188e2d0df38e9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$parameterCode' is probably undefined", + "markdown": "Variable '$parameterCode' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 802, + "startColumn": 70, + "charOffset": 27646, + "charLength": 14, + "snippet": { + "text": "$parameterCode" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 800, + "startColumn": 1, + "charOffset": 27528, + "charLength": 189, + "snippet": { + "text": " case 'int':\n case 'long':\n $codePrinter->output($var['name'] . ' = Z_LVAL_P(' . $parameterCode . ');');\n break;\n case 'uint':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "520af7ab75154d18eb4cef9d1d88b62bba95626be81a4b76195b42e887bdcf0b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 429, + "startColumn": 59, + "charOffset": 16510, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 427, + "startColumn": 1, + "charOffset": 16385, + "charLength": 239, + "snippet": { + "text": " } else {\n $codePrinter->output(\n 'ZEPHIR_CALL_' . $context . '(' . $symbol . ', \"' . $methodName . '\", ' . $cachePointer . $paramsStr . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "536f4b4f914438c48ab8a30522286c39f52bf3292066cc32d96cc3ebd9e86547" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbolVariable' is probably undefined", + "markdown": "Variable '$symbolVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 242, + "startColumn": 14, + "charOffset": 8815, + "charLength": 15, + "snippet": { + "text": "$symbolVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 240, + "startColumn": 1, + "charOffset": 8719, + "charLength": 209, + "snippet": { + "text": " * Variable that receives a property value must be polymorphic\n */\n if (!$symbolVariable->isVariable()) {\n throw new CompilerException(\n 'Cannot use variable: '" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "563b718b92a6604050e6746a5f2eac178e1578bd97b753eba6f1acd4fd18c004" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classDefinition' is probably undefined", + "markdown": "Variable '$classDefinition' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 607, + "startColumn": 37, + "charOffset": 27165, + "charLength": 16, + "snippet": { + "text": "$classDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 605, + "startColumn": 1, + "charOffset": 26963, + "charLength": 350, + "snippet": { + "text": " 'Passing possible incorrect type for parameter: %s::%s(%s), ' .\n 'passing: %s, expecting: %s',\n $classDefinition->getCompleteName(),\n $method->getName(),\n $parameter['name']," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5d77b0f52fcc666d23068ae409e75a5ce599b58e0c120588f54ba66556db12c2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$keyStr' is probably undefined", + "markdown": "Variable '$keyStr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 160, + "startColumn": 19, + "charOffset": 4596, + "charLength": 7, + "snippet": { + "text": "$keyStr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 158, + "startColumn": 1, + "charOffset": 4503, + "charLength": 151, + "snippet": { + "text": " . $this->getVariableCode($variable)\n . ', '\n . $keyStr\n . ', '\n . $valueStr" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "66ea9664b3bd1d538a66c1170f61fe46c271613a112cff499443afa978810ab7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$completeName' is probably undefined", + "markdown": "Variable '$completeName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Cache/StaticMethodCache.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 83, + "startColumn": 26, + "charOffset": 2809, + "charLength": 13, + "snippet": { + "text": "$completeName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 81, + "startColumn": 1, + "charOffset": 2729, + "charLength": 143, + "snippet": { + "text": "\n if (!($method instanceof ReflectionMethod)) {\n $this->cache[$completeName][$method->getName()] = $functionCache;\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6a21819e8f2cc24db8eebf11a5595d8cf2fd002356a3602ada817f312dd73cdf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classMethod' is probably undefined", + "markdown": "Variable '$classMethod' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 270, + "startColumn": 25, + "charOffset": 10348, + "charLength": 12, + "snippet": { + "text": "$classMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 268, + "startColumn": 1, + "charOffset": 10219, + "charLength": 301, + "snippet": { + "text": " * Private methods must be called in their declaration scope\n */\n if ($classMethod->isPrivate()) {\n if ($classMethod->getClassDefinition() !== $classDefinition) {\n throw new CompilerException(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "77a838bb07d392da7534fa692661c87b15ee9380b2caff2162d5b128a8a5c164" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classInterfaceDefinition' is probably undefined", + "markdown": "Variable '$classInterfaceDefinition' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Definition/Definition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 555, + "startColumn": 60, + "charOffset": 17651, + "charLength": 25, + "snippet": { + "text": "$classInterfaceDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 553, + "startColumn": 1, + "charOffset": 17503, + "charLength": 194, + "snippet": { + "text": " */\n if (!$this->isAbstract() && !$this->isInterface()) {\n $this->checkInterfaceImplements($this, $classInterfaceDefinition);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "83158b8cbc62726f9f1e9e0d13353c74cd7edead1379f424e7c2b1acc59686c5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$methodName' is probably undefined", + "markdown": "Variable '$methodName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 729, + "startColumn": 94, + "charOffset": 33798, + "charLength": 11, + "snippet": { + "text": "$methodName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 727, + "startColumn": 1, + "charOffset": 33569, + "charLength": 276, + "snippet": { + "text": " // Generate the code according to the call type\n if (self::CALL_NORMAL == $type || self::CALL_DYNAMIC_STRING == $type) {\n $realMethod = $this->getRealCalledMethod($compilationContext, $variableVariable, $methodName);\n\n $isInternal = false;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "88cddc05fa5aef4a6b82cbda96c2ec5e93371d20fc958a4ff0eb70751b4facc7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$nh' is probably undefined", + "markdown": "Variable '$nh' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/NamespaceAccessor.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 73, + "startColumn": 13, + "charOffset": 1739, + "charLength": 3, + "snippet": { + "text": "$nh" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 71, + "startColumn": 1, + "charOffset": 1712, + "charLength": 60, + "snippet": { + "text": " }\n\n $nh->addClass($class);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8ac5c8cf5ed0a49e25925904edddce13dc61bef87962042dcaf9493120a048af" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$arrayStrKey' is probably undefined", + "markdown": "Variable '$arrayStrKey' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1131, + "startColumn": 28, + "charOffset": 39624, + "charLength": 12, + "snippet": { + "text": "$arrayStrKey" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1129, + "startColumn": 1, + "charOffset": 39450, + "charLength": 293, + "snippet": { + "text": " $codePrinter->output(\n $macro . '(Z_ARRVAL_P(' . $this->getVariableCode($exprVariable) . '), ' . $arrayNumKey->getName(\n ) . ', ' . $arrayStrKey->getName() . ', ' . $tempVariable->getName() . ')'\n );\n } elseif (isset($keyVariable)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8b3285bb6310260625ea96f2da69deb7cd49396ec2c922d966a3a12db218cbee" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variableMethod' is probably undefined", + "markdown": "Variable '$variableMethod' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 793, + "startColumn": 25, + "charOffset": 36770, + "charLength": 15, + "snippet": { + "text": "$variableMethod" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 791, + "startColumn": 1, + "charOffset": 36682, + "charLength": 189, + "snippet": { + "text": " } else {\n if (self::CALL_DYNAMIC == $type) {\n switch ($variableMethod->getType()) {\n case 'string':\n case 'variable':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8d0afa23be120e300a6b5dac39ad8f541d129ed2a790b570516926aa338fdde1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 173, + "startColumn": 62, + "charOffset": 6928, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 171, + "startColumn": 1, + "charOffset": 6775, + "charLength": 230, + "snippet": { + "text": " case 'object-property':\n $let = new LetObjectProperty();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8d5535bc0a4247def45ff79db69b3098adbb0c6eacff99d62bccc97ae7215e60" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$functionName' is probably undefined", + "markdown": "Variable '$functionName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/Variable.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1185, + "startColumn": 29, + "charOffset": 45772, + "charLength": 13, + "snippet": { + "text": "$functionName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1183, + "startColumn": 1, + "charOffset": 45612, + "charLength": 383, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n $codePrinter->output(\n $functionName . '(' . $compilationContext->backend->getVariableCode(\n $symbolVariable\n ) . ', ' . $compilationContext->backend->getVariableCode($tempVariable) . ');'" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8fca84141fea76a069d4f18e2b1cc23c6f1112808c54b61c0ac143941e2e1064" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbolVariable' is probably undefined", + "markdown": "Variable '$symbolVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArrayAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 351, + "startColumn": 21, + "charOffset": 12282, + "charLength": 15, + "snippet": { + "text": "$symbolVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 349, + "startColumn": 1, + "charOffset": 12146, + "charLength": 285, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n $codePrinter->output(\n $symbolVariable->getName(\n ) . ' = ZEPHIR_STRING_OFFSET(' . $variableCode . ', ' . $exprIndex->getCode() . ');'\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "91128bb6e5037012ad7b0b9b3735b272a539df2829d9d2c0cd12c3114988fcd6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$parameterCode' is probably undefined", + "markdown": "Variable '$parameterCode' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 813, + "startColumn": 70, + "charOffset": 28150, + "charLength": 14, + "snippet": { + "text": "$parameterCode" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 811, + "startColumn": 1, + "charOffset": 28031, + "charLength": 192, + "snippet": { + "text": " break;\n case 'double':\n $codePrinter->output($var['name'] . ' = Z_DVAL_P(' . $parameterCode . ');');\n break;\n case 'string':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "92f23b7a94b3d10556c67ef465859ccc4c8c2b89126eda24e786fe7415aef70a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variable' is probably undefined", + "markdown": "Variable '$variable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 895, + "startColumn": 20, + "charOffset": 32481, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 893, + "startColumn": 1, + "charOffset": 32362, + "charLength": 255, + "snippet": { + "text": " $compilationContext->headersManager->add('kernel/operators');\n $codePrinter->output(\n \"\\t\" . $variable->getName(\n ) . ' = ZEPHIR_STRING_OFFSET(' . $stringVariableCode . ', ' . $tempVariable->getName() . ');'\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "92f6d211d13efc156cda24635ba4bd051f9973a57e86722f67a565b2921c5abe" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classDefinition' is probably undefined", + "markdown": "Variable '$classDefinition' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/StaticConstantAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 94, + "startColumn": 14, + "charOffset": 3257, + "charLength": 16, + "snippet": { + "text": "$classDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 92, + "startColumn": 1, + "charOffset": 3170, + "charLength": 196, + "snippet": { + "text": " * so we need to check that they effectively do exist\n */\n if (!$classDefinition->hasConstant($constant)) {\n throw new CompilerException(\n sprintf(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "93846f50c4b7610e23818dbd151b49ac7c212d4b2c241d74381b65a401f3a696" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$completeName' is probably undefined", + "markdown": "Variable '$completeName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Cache/MethodCache.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 188, + "startColumn": 26, + "charOffset": 6814, + "charLength": 13, + "snippet": { + "text": "$completeName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 186, + "startColumn": 1, + "charOffset": 6734, + "charLength": 143, + "snippet": { + "text": "\n if (!($method instanceof ReflectionMethod)) {\n $this->cache[$completeName][$method->getName()] = $functionCache;\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "93906612f9b25c32a5d3e14de14bfb4d3670f953346d4d05e3df3f285e219472" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$keyVariable' is probably undefined", + "markdown": "Variable '$keyVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 565, + "startColumn": 34, + "charOffset": 20220, + "charLength": 12, + "snippet": { + "text": "$keyVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 563, + "startColumn": 1, + "charOffset": 20129, + "charLength": 202, + "snippet": { + "text": " */\n if (isset($this->statement['key'])) {\n $codePrinter->output($keyVariable->getName() . ' = 0;');\n }\n $codePrinter->output($flagVariable->getName() . ' = 0;');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "99d877b3794f7c3b257f7a498eabc4bad8168c0bb30951b304df5d0b81bd9c7f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 631, + "startColumn": 52, + "charOffset": 25124, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 629, + "startColumn": 1, + "charOffset": 24986, + "charLength": 300, + "snippet": { + "text": " } else {\n $compilationContext->codePrinter->output(\n 'ZEPHIR_CALL_CE_STATIC(' . $symbol . ', ' . $classEntry . ', \"' . $methodName . '\", ' . $cachePointer . ', ' . implode(\n ', ',\n $params" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9cb68bf14642500e324cb0cefc8cc148b6028708a114d712b7850e5441e6be81" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$writeDetector' is probably undefined", + "markdown": "Variable '$writeDetector' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Method/Method.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1060, + "startColumn": 37, + "charOffset": 40765, + "charLength": 14, + "snippet": { + "text": "$writeDetector" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1058, + "startColumn": 1, + "charOffset": 40589, + "charLength": 351, + "snippet": { + "text": " $name = $parameter['name'];\n if (!$this->localContext instanceof LocalContextPass) {\n if ($writeDetector->detect($name, $this->statements->getStatements())) {\n $parametersToSeparate[$name] = true;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a16ef00fa79548dcae3bc0193443518516486d37bdd6e0b1262dc3ea72e29e9a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$method' is probably undefined", + "markdown": "Variable '$method' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 775, + "startColumn": 67, + "charOffset": 35864, + "charLength": 7, + "snippet": { + "text": "$method" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 773, + "startColumn": 1, + "charOffset": 35637, + "charLength": 329, + "snippet": { + "text": " $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 1, $paramCount);\n $codePrinter->output(\n $macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');'\n );\n } else {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a1edb73aea69f8f4580c89a8dd0b1ddc28819710095840ec0e105b1b479534f9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variableLeft' is probably undefined", + "markdown": "Variable '$variableLeft' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ConcatOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 112, + "startColumn": 68, + "charOffset": 4121, + "charLength": 13, + "snippet": { + "text": "$variableLeft" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 110, + "startColumn": 1, + "charOffset": 3919, + "charLength": 271, + "snippet": { + "text": " if ('variable' == $left->getType() && 'variable' == $right->getType()) {\n $compilationContext->codePrinter->output(\n 'zephir_concat_function(' . $expectedCode . ', ' . $variableLeft . ', ' . $variableRight . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a324ee2f9eb371bb0d89fa63e8d1263b68f55d91a4973810c6a2867bd9dd3087" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variableLeft' is probably undefined", + "markdown": "Variable '$variableLeft' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ConcatOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 106, + "startColumn": 62, + "charOffset": 3843, + "charLength": 13, + "snippet": { + "text": "$variableLeft" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 104, + "startColumn": 1, + "charOffset": 3649, + "charLength": 268, + "snippet": { + "text": " if ('variable' == $left->getType() && 'string' == $right->getType()) {\n $compilationContext->codePrinter->output(\n 'ZEPHIR_CONCAT_VS(' . $expectedCode . ', ' . $variableLeft . ', \"' . $right->getCode() . '\");'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a69933d2eea5ef3f2a77253cbd0b3e9de6afaa646723b0223d7cfc5fb372b412" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 245, + "startColumn": 62, + "charOffset": 9905, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 243, + "startColumn": 1, + "charOffset": 9747, + "charLength": 235, + "snippet": { + "text": " case 'array-index-append':\n $let = new LetArrayIndexAppend();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aab74018d9c392c78091fcc6f2701731ea6457c5eacf73c39ac200e0cd7ea235" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 199, + "startColumn": 25, + "charOffset": 8146, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 197, + "startColumn": 1, + "charOffset": 8038, + "charLength": 203, + "snippet": { + "text": " $variable,\n $assignment['property'],\n $resolvedExpr,\n $compilationContext,\n $assignment" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b2adbb1592bb01feb1a106c10915635c431ef30b79e77dc0a88c4a1672d29cb5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$parameterVariable' is probably undefined", + "markdown": "Variable '$parameterVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 809, + "startColumn": 63, + "charOffset": 27969, + "charLength": 18, + "snippet": { + "text": "$parameterVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 807, + "startColumn": 1, + "charOffset": 27844, + "charLength": 209, + "snippet": { + "text": " case 'bool':\n $codePrinter->output(\n $var['name'] . ' = ' . $this->getBoolCode($parameterVariable, $context, false) . ';'\n );\n break;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b62800f5808e8062a4d27899f18491191fdfbd9c4db2d552d493a767d5d61b13" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$keyVariable' is probably undefined", + "markdown": "Variable '$keyVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 704, + "startColumn": 36, + "charOffset": 25951, + "charLength": 12, + "snippet": { + "text": "$keyVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 702, + "startColumn": 1, + "charOffset": 25835, + "charLength": 155, + "snippet": { + "text": " $keyVariableName = $this->statement['key'];\n } else {\n $keyVariableName = $keyVariable->getName();\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b8f2c0ac3e25121092c10d6717f9590f672dde68d465442cf75fe06b4c98d942" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 290, + "startColumn": 62, + "charOffset": 12031, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 288, + "startColumn": 1, + "charOffset": 11866, + "charLength": 242, + "snippet": { + "text": " case 'dynamic-variable-string':\n $let = new LetExportSymbolString();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "badf62250adf4948d0e882a5d86f4231b70b469487c6ddf7295c9adf38a1faed" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 255, + "startColumn": 62, + "charOffset": 10402, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 253, + "startColumn": 1, + "charOffset": 10227, + "charLength": 252, + "snippet": { + "text": " case 'object-property-array-index':\n $let = new LetObjectPropertyArrayIndex();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bb1cfadf3749b484118846c93983be70728d02d371ee32e32923acd593b1cbcf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$keyVariable' is probably undefined", + "markdown": "Variable '$keyVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 205, + "startColumn": 22, + "charOffset": 6716, + "charLength": 12, + "snippet": { + "text": "$keyVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 203, + "startColumn": 1, + "charOffset": 6629, + "charLength": 295, + "snippet": { + "text": " */\n if (isset($this->statement['key'])) {\n if (!$keyVariable->isTemporal()) {\n $detector->setDetectionFlags(WriteDetector::DETECT_ALL);\n if ($detector->detect($keyVariable->getName(), $this->statement['statements'])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bfa7cf46701555e0763d5ffa2ae360380c980c26730d56d5878d766e88ef84e1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$keyVariable' is probably undefined", + "markdown": "Variable '$keyVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 602, + "startColumn": 34, + "charOffset": 21546, + "charLength": 12, + "snippet": { + "text": "$keyVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 600, + "startColumn": 1, + "charOffset": 21466, + "charLength": 124, + "snippet": { + "text": "\n if (isset($this->statement['key'])) {\n $codePrinter->output($keyVariable->getName() . '++;');\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c0f7084639f878111424c42ff3c86085ba85a4e83ae03d05400ace630d3ee183" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 285, + "startColumn": 62, + "charOffset": 11788, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 283, + "startColumn": 1, + "charOffset": 11636, + "charLength": 229, + "snippet": { + "text": " case 'dynamic-variable':\n $let = new LetExportSymbol();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c258637910a7c21ce402573aa65a0dbcb483d6b2416e3aa1022ad17f8467ec34" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbolVariable' is probably undefined", + "markdown": "Variable '$symbolVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArrayAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 367, + "startColumn": 29, + "charOffset": 12932, + "charLength": 15, + "snippet": { + "text": "$symbolVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 365, + "startColumn": 1, + "charOffset": 12825, + "charLength": 276, + "snippet": { + "text": " case 'long':\n $codePrinter->output(\n $symbolVariable->getName(\n ) . ' = ZEPHIR_STRING_OFFSET(' . $variableCode . ', ' . $variableIndex->getName() . ');'\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c44c6d368bef3354c67b79a3a0619909a3821e2ff776c30623f0c52dca56d710" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$references' is probably undefined", + "markdown": "Variable '$references' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 580, + "startColumn": 23, + "charOffset": 25711, + "charLength": 11, + "snippet": { + "text": "$references" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 578, + "startColumn": 1, + "charOffset": 25673, + "charLength": 169, + "snippet": { + "text": " );\n\n if (count($references)) {\n foreach ($params as $position => $param) {\n if (isset($references[$position])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c522df1d348644fe1922b69bc4bab8d77e854ce6e6dcda9f7cb9467740a3ce16" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$keyVariable' is probably undefined", + "markdown": "Variable '$keyVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 886, + "startColumn": 19, + "charOffset": 32222, + "charLength": 12, + "snippet": { + "text": "$keyVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 884, + "startColumn": 1, + "charOffset": 32149, + "charLength": 163, + "snippet": { + "text": " $codePrinter->output(\n \"\\t\"\n . $keyVariable->getName()\n . ' = '\n . $tempVariable->getName()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c526828167f6d64458ff538258992805abd639a4475ecb7adbbc1dbfd5e3b058" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$keyVariable' is probably undefined", + "markdown": "Variable '$keyVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 216, + "startColumn": 46, + "charOffset": 7160, + "charLength": 12, + "snippet": { + "text": "$keyVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 214, + "startColumn": 1, + "charOffset": 7036, + "charLength": 236, + "snippet": { + "text": " $compilationContext->backend->forStatement(\n $exprVariable,\n isset($this->statement['key']) ? $keyVariable : null,\n isset($this->statement['value']) ? $variable : null,\n $duplicateKey," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c844049d7f2fbf459ff38af30da6c3f4b138ee13d484ba01a21505b3bd558d80" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$functionName' is probably undefined", + "markdown": "Variable '$functionName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 150, + "startColumn": 29, + "charOffset": 4948, + "charLength": 13, + "snippet": { + "text": "$functionName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 148, + "startColumn": 1, + "charOffset": 4847, + "charLength": 303, + "snippet": { + "text": " );\n $codePrinter->output(\n $functionName . '(' . $context->backend->getVariableCode(\n $tempVariable\n ) . ', ' . $context->backend->getVariableCode($resolvedVariable) . ')'" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c91038888f8e1926db97be376b45fef59e390a72c0852d22be3c805de7f0f0af" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$methodName' is probably undefined", + "markdown": "Variable '$methodName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 189, + "startColumn": 47, + "charOffset": 6547, + "charLength": 11, + "snippet": { + "text": "$methodName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 187, + "startColumn": 1, + "charOffset": 6470, + "charLength": 151, + "snippet": { + "text": " }\n } else {\n return $builtInType->invokeMethod($methodName, $caller, $compilationContext, $this, $expression);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cf7a62107a30e72f731c4f3ad2100e94952854f425e0d1d88077eabfc5c1ebf3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 240, + "startColumn": 62, + "charOffset": 9669, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 238, + "startColumn": 1, + "charOffset": 9524, + "charLength": 222, + "snippet": { + "text": " case 'array-index':\n $let = new LetArrayIndex();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cfda1ccfa56a03d8d43e69651c89f80dc4302a7b6e9258851fe260ebd20851fd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 442, + "startColumn": 51, + "charOffset": 14575, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 440, + "startColumn": 1, + "charOffset": 14461, + "charLength": 213, + "snippet": { + "text": " }\n $codePrinter->output(\n 'ZEPHIR_CALL_FUNCTION(' . $symbol . ', \"' . $funcName . '\", ' . $cachePointer . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d6decf687136b647bf6a4294ed26dcc1a6d88b08ef1489e3ffd6aa8bcd73c13d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 612, + "startColumn": 52, + "charOffset": 24194, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 610, + "startColumn": 1, + "charOffset": 24056, + "charLength": 260, + "snippet": { + "text": " } else {\n $compilationContext->codePrinter->output(\n 'ZEPHIR_CALL_CE_STATIC(' . $symbol . ', ' . $classEntry . ', \"' . $methodName . '\", ' . $cachePointer . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "da1f3ba969f54c2fed5ad1354c6b0a88192ae92023d6cdd4e8efd19a38c0603d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 466, + "startColumn": 43, + "charOffset": 15739, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 464, + "startColumn": 1, + "charOffset": 15561, + "charLength": 296, + "snippet": { + "text": " $codePrinter->output(\n strtr('ZEPHIR_CALL_FUNCTION(:symbol, \":func\", :pointer, :params);', [\n ':symbol' => $symbol,\n ':func' => $funcName,\n ':pointer' => $cachePointer," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dcae8241fb864acb6089bbf75e1fcd422a45124474b8b1c4f9ad6177667fd31f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classDefinition' is probably undefined", + "markdown": "Variable '$classDefinition' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 272, + "startColumn": 21, + "charOffset": 10952, + "charLength": 16, + "snippet": { + "text": "$classDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 270, + "startColumn": 1, + "charOffset": 10847, + "charLength": 214, + "snippet": { + "text": " if (\n in_array($className, ['self', 'static']) ||\n $classDefinition == $compilationContext->classDefinition\n ) {\n $this->call(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "deda8997a44648b98c33ca9d1d65b0c28029c9821735e09467cc29bb16be11ad" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 702, + "startColumn": 57, + "charOffset": 27907, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 700, + "startColumn": 1, + "charOffset": 27764, + "charLength": 289, + "snippet": { + "text": " } else {\n $compilationContext->codePrinter->output(\n 'ZEPHIR_CALL_CE_STATIC_ZVAL(' . $symbol . ', ' . $classEntry . ', ' . $methodNameVariable->getName(\n ) . ', ' . $cachePointer . ');'\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e2fc4b39ca95dc33bdef5f095e769b550cf7d5587cee994f13b403b88e66c6b9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$indexVariable' is probably undefined", + "markdown": "Variable '$indexVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 321, + "startColumn": 17, + "charOffset": 10460, + "charLength": 14, + "snippet": { + "text": "$indexVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 319, + "startColumn": 1, + "charOffset": 10433, + "charLength": 110, + "snippet": { + "text": " }\n\n switch ($indexVariable->getType()) {\n case 'variable':\n case 'mixed':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e4f00810a352c41fdb366eb9383c608e37a3eb6be6bd7b3fa1a3c7853b923ed9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variableVariable' is probably undefined", + "markdown": "Variable '$variableVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 809, + "startColumn": 21, + "charOffset": 37368, + "charLength": 17, + "snippet": { + "text": "$variableVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 807, + "startColumn": 1, + "charOffset": 37231, + "charLength": 227, + "snippet": { + "text": " $compilationContext->backend->callMethod(\n $isExpecting ? $symbolVariable : null,\n $variableVariable,\n $variableMethod,\n $cachePointer," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e675f1e09fc76d74fa0df5100fbab3148325a5bb4cef32b913bd7005d8f4cfd6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$currentClassDefinition' is probably undefined", + "markdown": "Variable '$currentClassDefinition' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 292, + "startColumn": 29, + "charOffset": 11760, + "charLength": 23, + "snippet": { + "text": "$currentClassDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 290, + "startColumn": 1, + "charOffset": 11651, + "charLength": 226, + "snippet": { + "text": " $mustInit,\n $isExpecting,\n $currentClassDefinition,\n $compilationContext,\n $method ?? null" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e6e3c7c2a1a7b923e59cb9f2aad58067d97294934b24ef0b90ec46ed989e979f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variableVariable' is probably undefined", + "markdown": "Variable '$variableVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 201, + "startColumn": 27, + "charOffset": 6935, + "charLength": 17, + "snippet": { + "text": "$variableVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 199, + "startColumn": 1, + "charOffset": 6855, + "charLength": 253, + "snippet": { + "text": " */\n if (self::CALL_NORMAL == $type) {\n if ('this' == $variableVariable->getRealName()) {\n $classDefinition = $compilationContext->classDefinition;\n if (!$classDefinition->hasMethod($methodName)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e8531e2492e48078847d786730149bade471a4a948676e68bfcfaabf5c19a4da" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$variableRight' is probably undefined", + "markdown": "Variable '$variableRight' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ConcatOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 112, + "startColumn": 91, + "charOffset": 4144, + "charLength": 14, + "snippet": { + "text": "$variableRight" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 110, + "startColumn": 1, + "charOffset": 3919, + "charLength": 271, + "snippet": { + "text": " if ('variable' == $left->getType() && 'variable' == $right->getType()) {\n $compilationContext->codePrinter->output(\n 'zephir_concat_function(' . $expectedCode . ', ' . $variableLeft . ', ' . $variableRight . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ed25aa7c0f853434204e5f094732392e7fead749a81dd34419fe98a79146f120" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbolVariable' is probably undefined", + "markdown": "Variable '$symbolVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 111, + "startColumn": 13, + "charOffset": 3741, + "charLength": 15, + "snippet": { + "text": "$symbolVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 109, + "startColumn": 1, + "charOffset": 3646, + "charLength": 228, + "snippet": { + "text": " * Variable that receives a property value must be polymorphic\n */\n if ($symbolVariable && !$symbolVariable->isVariable()) {\n throw new CompilerException(\n 'Cannot use variable: '" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "efda358bbdd210437ddfc46740deb62ca1d69de7ad89b0b5f2b255433eb21732" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$symbol' is probably undefined", + "markdown": "Variable '$symbol' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 558, + "startColumn": 52, + "charOffset": 22117, + "charLength": 7, + "snippet": { + "text": "$symbol" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 556, + "startColumn": 1, + "charOffset": 21999, + "charLength": 253, + "snippet": { + "text": " } else {\n $codePrinter->output(\n 'ZEPHIR_CALL_CE_STATIC(' . $symbol . ', ' . $classEntry . ', \"' . $methodName . '\", ' . $cachePointer . $paramsStr . ');'\n );\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f075606a0535243fe1394f218c3f050fa65479869a99161fb0c89164a944b29a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$parameterCode' is probably undefined", + "markdown": "Variable '$parameterCode' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 805, + "startColumn": 79, + "charOffset": 27796, + "charLength": 14, + "snippet": { + "text": "$parameterCode" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 803, + "startColumn": 1, + "charOffset": 27670, + "charLength": 198, + "snippet": { + "text": " break;\n case 'uint':\n $codePrinter->output($var['name'] . ' = ZEND_ABS(Z_LVAL_P(' . $parameterCode . '));');\n break;\n case 'bool':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f488c8dffd90f907bf6408887bf01ac25e8d9e2870e3c9ac02a4e1295dc462f9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$methodName' is probably undefined", + "markdown": "Variable '$methodName' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/MethodCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 353, + "startColumn": 66, + "charOffset": 14635, + "charLength": 11, + "snippet": { + "text": "$methodName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 351, + "startColumn": 1, + "charOffset": 14535, + "charLength": 262, + "snippet": { + "text": " }\n\n if (!$classDefinition->hasMethod($methodName)) {\n if (!$classDefinition->isInterface()) {\n if (1 == count($classTypes)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f5b92092a6900c3eba81dbe9ed567d9b807db957e009b06641ed355af5042ee7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$resolvedExpr' is probably undefined", + "markdown": "Variable '$resolvedExpr' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 210, + "startColumn": 25, + "charOffset": 8546, + "charLength": 13, + "snippet": { + "text": "$resolvedExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 208, + "startColumn": 1, + "charOffset": 8438, + "charLength": 203, + "snippet": { + "text": " $variable,\n $assignment['property'],\n $resolvedExpr,\n $compilationContext,\n $assignment" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f60f20ee49cf94c5e68af6c1f277ef493099e6a8e604cf6455d5e622d8f25d95" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$keyVariable' is probably undefined", + "markdown": "Variable '$keyVariable' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 710, + "startColumn": 54, + "charOffset": 26148, + "charLength": 12, + "snippet": { + "text": "$keyVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 708, + "startColumn": 1, + "charOffset": 26007, + "charLength": 187, + "snippet": { + "text": " * Create an implicit 'let' operation, TODO: use a builder.\n */\n $this->getLetStatement($keyVariableName, $keyVariable, $compilationContext);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fa4f5264a57eef70659a4ffd278eadaf450dc87f0e1d7c64e6ec0464b40596a2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$classDefinition' is probably undefined", + "markdown": "Variable '$classDefinition' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/StaticPropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 13, + "charOffset": 2938, + "charLength": 16, + "snippet": { + "text": "$classDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 2887, + "charLength": 115, + "snippet": { + "text": "\n $this->checkClassHasProperty(\n $classDefinition,\n $property,\n $expression" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fcdcb750baca3e6a8ec60f01acb1d9c44131dc71e5a98ea3114c56c027ff1f67" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUndefinedVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Variable '$className' is probably undefined", + "markdown": "Variable '$className' is probably undefined" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 271, + "startColumn": 30, + "charOffset": 10897, + "charLength": 10, + "snippet": { + "text": "$className" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 269, + "startColumn": 1, + "charOffset": 10826, + "charLength": 202, + "snippet": { + "text": " } else {\n if (\n in_array($className, ['self', 'static']) ||\n $classDefinition == $compilationContext->classDefinition\n ) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fe752e12cb70279b252e8f2d77a88ea56fb68565cfbe47409bcb53cd57472cab" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 28, + "charOffset": 1657, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1535, + "charLength": 211, + "snippet": { + "text": " $leftExpr = new Expression($expression['left']);\n $leftExpr->setReadOnly(true);\n $left = $leftExpr->compile($compilationContext);\n\n $rightExpr = new Expression($expression['right']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "058204ac99ecb9dc4d28d140a8420642069a1b4bf7fda28ad914906e7c3cda3d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarDumpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 34, + "charOffset": 1085, + "charLength": 23, + "snippet": { + "text": "getResolvedParamsAsExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 992, + "charLength": 222, + "snippet": { + "text": "\n $context->headersManager->add('kernel/variables');\n $resolvedParams = $call->getResolvedParamsAsExpr($expression['parameters'], $context, $expression);\n\n foreach ($resolvedParams as $resolvedParam) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "05a8d5a6510b4a7afa7207bb3e66385b09cd6e03e75d105ea7dc6b148fc206ec" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ImplodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 62, + "startColumn": 34, + "charOffset": 1639, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 60, + "startColumn": 1, + "charOffset": 1595, + "charLength": 177, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $context->headersManager->add('kernel/string');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "06e1cb9a56a9747c1e481a8fc0d8cf13d9a9e6574b7135e0e3decf0d73778ebf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 51, + "charOffset": 1632, + "charLength": 26, + "snippet": { + "text": "getInternalClassDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1500, + "charLength": 301, + "snippet": { + "text": " } else {\n if ($compiler->isBundledClass($className)) {\n $classDefinition = $compiler->getInternalClassDefinition($className);\n } else {\n throw new CompilerException(\"Cannot locate class '\" . $className . \"'\", $statement);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "09e9f833b6f8f6d81b218a938156602470b3d5e504b0f987f1692dcefe758f7c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/WhileStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 18, + "charOffset": 1688, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1569, + "charLength": 159, + "snippet": { + "text": " $st = new StatementsBlock($this->statement['statements']);\n $st->isLoop(true);\n $st->compile($compilationContext);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0b421468e713b77d1449a6159e2f5ddcf8b0d884855a5372e678e67a993078ff" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 183, + "startColumn": 27, + "charOffset": 7407, + "charLength": 6, + "snippet": { + "text": "assign" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 181, + "startColumn": 1, + "charOffset": 7261, + "charLength": 258, + "snippet": { + "text": " case 'string-dynamic-object-property':\n $let = new LetObjectDynamicStringProperty();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "11b20f79d12f094f67173ec61d9175221610057160f171e8c399aa2d67d9230e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 148, + "startColumn": 37, + "charOffset": 4953, + "charLength": 20, + "snippet": { + "text": "getOffsetExpressions" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 146, + "startColumn": 1, + "charOffset": 4810, + "charLength": 268, + "snippet": { + "text": " */\n $variableExpr = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext);\n $offsetExpressions = $this->getOffsetExpressions($statement, $compilationContext);\n\n $compilationContext->backend->assignStaticPropertyArrayMulti(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "16eb566ef243ac343596d303a38c33025e9671488e858470a5901aabf42b26cd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GettypeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 34, + "charOffset": 1473, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1387, + "charLength": 237, + "snippet": { + "text": " $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1a078e8e830a6354c63a69d20fae3db4b156ce2bfd6989b63c8dae8d1fee365d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FileGetContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 34, + "charOffset": 1501, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1398, + "charLength": 254, + "snippet": { + "text": " $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1caa4574958733f04eed7b381c4f704ca000d3880cb7edb83ab92479473ee0e2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/StubsCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 66, + "startColumn": 30, + "charOffset": 1625, + "charLength": 5, + "snippet": { + "text": "stubs" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 64, + "startColumn": 1, + "charOffset": 1524, + "charLength": 210, + "snippet": { + "text": " try {\n // TODO: Move all the stuff from the compiler\n $this->compiler->stubs();\n } catch (ExceptionInterface $e) {\n $io->getErrorStyle()->error($e->getMessage());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1f2c791ec494039c167530b9a76970b11f0ed9bb4807528725d4034b1db78c62" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 32, + "charOffset": 1239, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1117, + "charLength": 196, + "snippet": { + "text": " $expr = new Expression($propertyAccess['left']);\n $expr->setReadOnly(true);\n $exprVariable = $expr->compile($compilationContext);\n\n switch ($exprVariable->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1fc001e56de0b7a308d5e13cba24c05d2ed5a2840aaa49c746e42fc6fc437c06" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/LdexpOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 34, + "charOffset": 1334, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1290, + "charLength": 131, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams(\n $expression['parameters'],\n $context," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "20965cc8028d754493534d478227ddf13dafc5dcd12050b9e7ae8b6474433619" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 34, + "charOffset": 1490, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1404, + "charLength": 237, + "snippet": { + "text": " $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "22786f7db32e67d8268194b1bb76a0af7a34a476b49c806b461501665bf5ecc1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 178, + "startColumn": 27, + "charOffset": 7148, + "charLength": 6, + "snippet": { + "text": "assign" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 176, + "startColumn": 1, + "charOffset": 7006, + "charLength": 254, + "snippet": { + "text": " case 'variable-dynamic-object-property':\n $let = new LetObjectDynamicProperty();\n $let->assign($variable, $symbolVariable, $resolvedExpr, $compilationContext, $assignment);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2354e112f8ae2b75b2108db12fcc0ed2ad87b201e429397dab0def24cf67a82b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 229, + "startColumn": 27, + "charOffset": 9255, + "charLength": 12, + "snippet": { + "text": "assignStatic" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 227, + "startColumn": 1, + "charOffset": 9102, + "charLength": 250, + "snippet": { + "text": " case 'static-property-array-index-append':\n $let = new LetStaticPropertyArrayIndexAppend();\n $let->assignStatic(\n $variable,\n $assignment['property']," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "25a1a0c3d8e0eb07408d9e02c353fb09ef945c7854e1341b22b2473b4bfb1de8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsScalarOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 34, + "charOffset": 1140, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1096, + "charLength": 229, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('bool', 'zephir_is_scalar(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "28740837148a65f64e8d2b5f79d41efd1cd8c92dbd4c1956dddf2dc21b1b824b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/VarExportOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 34, + "charOffset": 1410, + "charLength": 23, + "snippet": { + "text": "getResolvedParamsAsExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1317, + "charLength": 214, + "snippet": { + "text": "\n $context->headersManager->add('kernel/variables');\n $resolvedParams = $call->getResolvedParamsAsExpr($expression['parameters'], $context, $expression);\n $resolvedParam = $resolvedParams[0];\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2ada072364cfb791004c1573423768a848c1dd1b913bc91583766b9a01d7e684" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/FetchOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 218, + "startColumn": 72, + "charOffset": 9117, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 216, + "startColumn": 1, + "charOffset": 8987, + "charLength": 286, + "snippet": { + "text": " $exprVariableProperty->setReadOnly(true);\n\n $exprCompiledVariableProperty = $exprVariableProperty->compile($compilationContext);\n if ('variable' != $exprCompiledVariableProperty->getType()) {\n throw new CompilerException(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2bf62575669ae07c93a6d3637501066125593bde2dcd0eee412635e9df9c6ffa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/CloneOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 48, + "charOffset": 1133, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 1039, + "charLength": 227, + "snippet": { + "text": " $exprVariable->setExpectReturn(true);\n\n $exprCompiledVariable = $exprVariable->compile($compilationContext);\n if ('variable' !== $exprCompiledVariable->getType()) {\n throw new CompilerException(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2cdc30b7ca3a71c262494497a75e007183ad570a4447db407702e3d7c96ed609" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 77, + "startColumn": 25, + "charOffset": 2101, + "charLength": 5, + "snippet": { + "text": "throw" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 75, + "startColumn": 1, + "charOffset": 1938, + "charLength": 265, + "snippet": { + "text": " $extThemePath = $documentation->findThemePathByName($themeInfos['extends']);\n if (!$extThemePath) {\n throw new Exception('Unable to find extended theme ' . $themeInfos['extends']);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2d2a7db807c49b413723940c652eb553ec37f6ff0042787dbf83e66d4b4e5b7d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 34, + "charOffset": 1510, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1407, + "charLength": 254, + "snippet": { + "text": " $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2f6e74335946d391cefbf16bde0d5bca3c143691ba2fcd61878fa0cac9f79bfd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/PropertyDynamicAccess.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 32, + "charOffset": 1246, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 1149, + "charLength": 171, + "snippet": { + "text": "\n $expr = new Expression($propertyAccess['left']);\n $exprVariable = $expr->compile($compilationContext);\n\n switch ($exprVariable->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "311462ae10ec57fbad7e8ea7237feae1e19f1562a2ac7170daa30bf50bee00b2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MemstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 54, + "startColumn": 34, + "charOffset": 1331, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 52, + "startColumn": 1, + "charOffset": 1287, + "charLength": 177, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $context->headersManager->add('kernel/string');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "31dc7a6612aeb3949b8b5a3bc889a672134a8dd11c4af68c42b5b7e3366bed99" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/FetchOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 96, + "startColumn": 56, + "charOffset": 3386, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 94, + "startColumn": 1, + "charOffset": 3282, + "charLength": 252, + "snippet": { + "text": " $exprVariable->setNoisy(false);\n\n $exprCompiledVariable = $exprVariable->compile($compilationContext);\n if ('variable' != $exprCompiledVariable->getType()) {\n throw new CompilerException(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "33c05e1f70539f80e51c3f7121505dbd962938a77f6e479a67ef2728ddc20f9b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateArrayOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 66, + "startColumn": 38, + "charOffset": 1788, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 64, + "startColumn": 1, + "charOffset": 1702, + "charLength": 215, + "snippet": { + "text": "\n if (isset($expression['parameters'])) {\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n } else {\n $resolvedParams = null;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3593ae7217d7fbfd64da8c50c30150e05f32b328c49a44cf4fa9c0529fe65b2e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FeofOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 34, + "charOffset": 1122, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1034, + "charLength": 268, + "snippet": { + "text": " $context->headersManager->add('kernel/file');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('bool', 'zephir_feof(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3688fb9d2e3b49ae006777be350b80568a75c48a38dd78045023bc04099a75c0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 62, + "startColumn": 34, + "charOffset": 1538, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 60, + "startColumn": 1, + "charOffset": 1452, + "charLength": 237, + "snippet": { + "text": " $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "38a419d9bddd3ad976b6924b47aa4ab6488403dfc8f50299adebb51fc434df04" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/SubstrOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 34, + "charOffset": 1306, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 1230, + "charLength": 213, + "snippet": { + "text": " * Process parameters.\n */\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $params = [];\n $flags = '0';" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3c02a6232c7806cf7b47b2db552c31a13e11040da857f995beff4bf381aa680d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 340, + "startColumn": 28, + "charOffset": 11005, + "charLength": 12, + "snippet": { + "text": "compileClass" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 338, + "startColumn": 1, + "charOffset": 10921, + "charLength": 146, + "snippet": { + "text": " }\n $class = true;\n $this->compileClass($compilationContext);\n break;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "45374465a7bd8b9c874642063aa282a0163b1ecf1c3742a87268eb4604fb4312" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 96, + "startColumn": 26, + "charOffset": 2736, + "charLength": 3, + "snippet": { + "text": "api" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 94, + "startColumn": 1, + "charOffset": 2656, + "charLength": 113, + "snippet": { + "text": "\n // TODO: Move all the stuff from the compiler\n $this->compiler->api($options);\n\n return 0;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "46965dd234931b9ca280b677d75e7b4fedd67c136a3bb872139662ef1a1b0fc2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 451, + "startColumn": 30, + "charOffset": 14753, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 449, + "startColumn": 1, + "charOffset": 14571, + "charLength": 287, + "snippet": { + "text": " $codePrinter = $compilationContext->codePrinter;\n $codePrinter->output('PHP_FUNCTION(' . $functionDefinition->getInternalName() . ') {');\n $functionDefinition->compile($compilationContext);\n $codePrinter->output('}');\n $codePrinter->outputBlankLine();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "489ad3044c2063744931368ea177e4952c0cb251a32f1ad3d3fb2a0fa66eda1b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/RoundOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 34, + "charOffset": 1602, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1463, + "charLength": 290, + "snippet": { + "text": " $context->headersManager->add('kernel/math');\n $symbolVariable->setDynamicTypes('double');\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "49f2b07d45334ac67b04c2a3f85e8cc71f35d03dffc070a71b123c7c71ed8d3b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 28, + "charOffset": 1425, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1303, + "charLength": 211, + "snippet": { + "text": " $leftExpr = new Expression($expression['left']);\n $leftExpr->setReadOnly(true);\n $left = $leftExpr->compile($compilationContext);\n\n $rightExpr = new Expression($expression['right']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4a79841715a69be86ea716df97df18911568c984cd989ab764d924965348a866" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonDecodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 57, + "startColumn": 34, + "charOffset": 1475, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 55, + "startColumn": 1, + "charOffset": 1385, + "charLength": 178, + "snippet": { + "text": " $context->headersManager->add('kernel/string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n /*" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4ca8ecd1b0adb525321cf823250d60be79fedef690039b61efa5d448e3a2d8b8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CallUserFuncOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 67, + "startColumn": 34, + "charOffset": 1760, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 65, + "startColumn": 1, + "charOffset": 1682, + "charLength": 165, + "snippet": { + "text": " $call->addCallStatusFlag($context);\n\n $resolvedParams = $call->getReadOnlyResolvedParams(\n $expression['parameters'],\n $context," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4dfa41e1d349556bc19e0b5240684aa90de0caef2c4662d882159564abfadf76" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Bitwise/BitwiseBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 30, + "charOffset": 1583, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1456, + "charLength": 193, + "snippet": { + "text": " $rightExpr = new Expression($expression['right']);\n $rightExpr->setReadOnly(true);\n $right = $rightExpr->compile($compilationContext);\n\n switch ($left->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4e266bcaef1f10a638f3ac88a9b60e0bf0366a22127e70b2b145eea750ea6278" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IntvalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 34, + "charOffset": 1213, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1120, + "charLength": 279, + "snippet": { + "text": " $context->headersManager->add('kernel/operators');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('long', 'zephir_get_intval(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "50276403c48223d799a02f2c0e5d8dd1fc2fcbc280752723141b1af00826ec68" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FuncGetArgOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 67, + "startColumn": 34, + "charOffset": 1852, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 65, + "startColumn": 1, + "charOffset": 1747, + "charLength": 211, + "snippet": { + "text": " $symbol = $context->backend->getVariableCode($symbolVariable);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n // zephir_get_intval" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "50f3f4c97d2eacfde436307cc141c34a271b81ab339e1dc85870dff0f2724dc7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/HashEqualsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 59, + "startColumn": 34, + "charOffset": 1562, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 57, + "startColumn": 1, + "charOffset": 1486, + "charLength": 227, + "snippet": { + "text": " * Process parameters.\n */\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "53c08feae57a9e4cb8f15249fab969705c5dd39260cf520e550fc7dc0bc97854" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1183, + "startColumn": 23, + "charOffset": 40914, + "charLength": 6, + "snippet": { + "text": "render" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1181, + "startColumn": 1, + "charOffset": 40848, + "charLength": 109, + "snippet": { + "text": " $argInfo->setRichFormat(true);\n\n $argInfo->render();\n\n /** Generate FE's */" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "56cb72e2d8f585b38be38decf801d1c7f0596a21129d65c2b83d2a0d0d5303ce" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/TryCatchStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 139, + "startColumn": 27, + "charOffset": 5403, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 137, + "startColumn": 1, + "charOffset": 5311, + "charLength": 165, + "snippet": { + "text": "\n $ifStatement = new IfStatement($primaryIf->build());\n $ifStatement->compile($compilationContext);\n\n $codePrinter->decreaseLevel();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "56de6bc280bec8c99087cf322c3b9c38d86dc2858a87a293cdd86ceb6baa5239" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "zephir", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 73, + "startColumn": 9, + "charOffset": 1926, + "charLength": 5, + "snippet": { + "text": "throw" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 71, + "startColumn": 1, + "charOffset": 1803, + "charLength": 201, + "snippet": { + "text": "set_error_handler(static function ($code, $message, $file = '', $line = -1) {\n if (error_reporting() & $code) {\n throw new ErrorException($message, 0, $code, (string) $file, $line);\n }\n});" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "57049d4ad6949911927e80a0bd59c5e6cda2a6d83c49cbb10941a536db0c4ead" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ModOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 38, + "startColumn": 34, + "charOffset": 980, + "charLength": 16, + "snippet": { + "text": "preCompileChecks" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 36, + "startColumn": 1, + "charOffset": 860, + "charLength": 208, + "snippet": { + "text": " public function compile($expression, CompilationContext $compilationContext)\n {\n [$left, $right] = $this->preCompileChecks($expression, $compilationContext);\n\n switch ($left->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5f01d5bfac1062c2f88d9f0480160ba4b6fc6c99bcc73f6460769363e0c200dd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrtoupperOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 64, + "startColumn": 34, + "charOffset": 1652, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 62, + "startColumn": 1, + "charOffset": 1563, + "charLength": 176, + "snippet": { + "text": " $symbolVariable->setDynamicTypes($this->type);\n\n $resolvedParams = $call->getReadOnlyResolvedParams(\n $expression['parameters'],\n $context," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5f4e2d050822d7398495511790e7e83662c51453db425e8ef5dc3a2e8bfbfa25" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndexAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 57, + "startColumn": 16, + "charOffset": 1494, + "charLength": 33, + "snippet": { + "text": "_assignPropertyArrayMultipleIndex" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 55, + "startColumn": 1, + "charOffset": 1468, + "charLength": 132, + "snippet": { + "text": " }\n\n $this->_assignPropertyArrayMultipleIndex($symbolVariable, $resolvedExpr, $compilationContext, $statement);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "60b153fd754ba67223569d26ab804ccad663a5bb26c0ee12de6d13cb7198551a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrposOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 59, + "startColumn": 34, + "charOffset": 1541, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 57, + "startColumn": 1, + "charOffset": 1497, + "charLength": 226, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n if (count($resolvedParams) >= 3) {\n $context->headersManager->add('kernel/operators');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "63996e6c383cab231737851ac86ddbd927933783c61122633c3ab07ff66c67b6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/UniqueKeyOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 23, + "charOffset": 1333, + "charLength": 16, + "snippet": { + "text": "processOptimizer" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 1204, + "charLength": 183, + "snippet": { + "text": " throw new CompilerException(\"'unique_key' only accepts two parameter\", $expression);\n }\n return $this->processOptimizer($call, $context, $expression);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6516af273098651b31363391a4ab13b379ceb9a06ac469b8711f2976a5fe290c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Logical/LogicalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 35, + "startColumn": 28, + "charOffset": 990, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 33, + "startColumn": 1, + "charOffset": 857, + "charLength": 222, + "snippet": { + "text": " $leftExpr = new Expression($expression['left']);\n $leftExpr->setReadOnly($this->readOnly);\n $left = $leftExpr->compile($compilationContext);\n\n $rightExpr = new Expression($expression['right']);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "66a01edf1b73634b7ee8c457b3c146595b5296b3ab7f13bf77978f9ddaa0b829" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/RequireStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 16, + "charOffset": 1134, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 1035, + "charLength": 136, + "snippet": { + "text": " $expr = new Expression($expression);\n $expr->setExpectReturn(false);\n $expr->compile($compilationContext);\n }\n}" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "66d24236a3b476cfa7383872998df5a6712bc2804cb46098133fe98cf5036e9b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/EmptyOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 46, + "startColumn": 28, + "charOffset": 1237, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 44, + "startColumn": 1, + "charOffset": 1115, + "charLength": 229, + "snippet": { + "text": " $leftExpr = new Expression($expression['left']);\n $leftExpr->setReadOnly(true);\n $left = $leftExpr->compile($compilationContext);\n\n if ('variable' != $left->getType() && 'array' != $left->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "674d8bd06a8bab8ac747e2f50b62ca964e688c43948238ffd68909d9ed86b561" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 191, + "startColumn": 36, + "charOffset": 5765, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 189, + "startColumn": 1, + "charOffset": 5649, + "charLength": 187, + "snippet": { + "text": " ): void {\n $expression = new Expression($statement['index-expr'][0]);\n $exprIndex = $expression->compile($compilationContext);\n\n switch ($exprIndex->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "709e41f3f2238bd805a27a0c4d2cf0471ec56f0aa04ac1f051047da649493c38" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 16, + "charOffset": 1105, + "charLength": 17, + "snippet": { + "text": "getResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1040, + "charLength": 203, + "snippet": { + "text": " * Resolve parameters as vars\n */\n $call->getResolvedParams($expression['parameters'], $context, $expression);\n /**\n * Get CompiledExpression(s) for resolved var(s)." + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7366a19ea8240f6a71ee8011fce677ebac2e64d274baf61dc3939df8e5d8eef6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 218, + "startColumn": 27, + "charOffset": 8833, + "charLength": 12, + "snippet": { + "text": "assignStatic" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 216, + "startColumn": 1, + "charOffset": 8693, + "charLength": 237, + "snippet": { + "text": " case 'static-property-array-index':\n $let = new LetStaticPropertyArrayIndex();\n $let->assignStatic(\n $variable,\n $assignment['property']," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "73905fcc489be20164137b34e6b77d95f9fd90ad3ee09e4f564f7a1c9c061779" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsCallableOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 34, + "charOffset": 1086, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 1042, + "charLength": 231, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('bool', 'zephir_is_callable(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "74b8b25b119cad6f2420964fc0da05e63b20f16bca79623f58117df39f64baa9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 74, + "startColumn": 24, + "charOffset": 1592, + "charLength": 15, + "snippet": { + "text": "getTemplatePath" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 72, + "startColumn": 1, + "charOffset": 1530, + "charLength": 138, + "snippet": { + "text": " $$name = $value;\n }\n $path = $this->getTemplatePath($this->template);\n ob_start();\n include $path;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "75892121ae31ed20c6a8e24a48e48437f6cc5da107ea6b45446d57820e6b1148" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 128, + "startColumn": 39, + "charOffset": 3811, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 126, + "startColumn": 1, + "charOffset": 3675, + "charLength": 211, + "snippet": { + "text": " $expression = new Expression($indexExpr);\n $expression->setReadOnly(true);\n $exprIndex = $expression->compile($compilationContext);\n\n switch ($exprIndex->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7c94c635fcc2b334f5ade983a98fe12112ffa6fea81093fdfcc879ef8139a4ab" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/UniquePathKeyOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 34, + "charOffset": 1647, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1559, + "charLength": 236, + "snippet": { + "text": " $context->headersManager->add('kernel/file');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $symbol = $context->backend->getVariableCode($symbolVariable);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7e24a202af0b0f444009c6a16fcb0f1565ac495c413ec674a49f34ba6a222213" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ConcatOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 291, + "startColumn": 33, + "charOffset": 11085, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 289, + "startColumn": 1, + "charOffset": 11038, + "charLength": 187, + "snippet": { + "text": " }\n\n return $expression->compile($context);\n } catch (Exception $e) {\n throw new CompilerException($e->getMessage(), $expression->getExpression());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7ea1954cc8fc4676861cbfdfd23a073c2b7ee0d00771e146213f4e4d4a324e45" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrlenOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 34, + "charOffset": 1130, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1040, + "charLength": 279, + "snippet": { + "text": " $context->headersManager->add('kernel/string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('int', 'zephir_fast_strlen_ev(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7f067130abd2543d7ab798cee2524810d7847b63935758de5e7029963e8e15e6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StrReplaceOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 65, + "startColumn": 34, + "charOffset": 1715, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 63, + "startColumn": 1, + "charOffset": 1629, + "charLength": 210, + "snippet": { + "text": " $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n if ($call->mustInitSymbolVariable()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8078f79741e86903114a771c0d0b286de85650fe00b0d4584fe29545b17e819e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/FetchOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 128, + "startColumn": 40, + "charOffset": 4963, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 126, + "startColumn": 1, + "charOffset": 4842, + "charLength": 221, + "snippet": { + "text": " $expr->setReadOnly(true);\n $expr->setNoisy(false);\n $resolvedExpr = $expr->compile($compilationContext);\n\n return $compilationContext->backend->arrayIssetFetch(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "81b59ea5b44cdcbff77fde8778f43a8740c1219b112969d624654815bcc95927" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CountOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 34, + "charOffset": 1070, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 45, + "startColumn": 1, + "charOffset": 1026, + "charLength": 233, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('int', 'zephir_fast_count_int(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8429543d977fdba668eb125e00ccfe0e6a1553697edccfbc34466e2fafe18e8c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/NewInstanceTypeOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 33, + "charOffset": 2284, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 2237, + "charLength": 200, + "snippet": { + "text": "\n try {\n return $expression->compile($compilationContext);\n } catch (Exception $e) {\n throw new CompilerException($e->getMessage(), $expression, $e->getCode(), $e);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8875b706acdb41a206c2a875a2a761727ca06c201816d39d115f7590d5cf48bf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 180, + "startColumn": 46, + "charOffset": 5307, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 178, + "startColumn": 1, + "charOffset": 5178, + "charLength": 204, + "snippet": { + "text": " */\n $indexExpression = new Expression($statement['index-expr'][0]);\n $resolvedIndex = $indexExpression->compile($compilationContext);\n\n switch ($resolvedIndex->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "88fd1ead2bae802e8bf788a58c13fba12e898009ddac3e94beb8fe201a6c6351" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ClassExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 50, + "startColumn": 34, + "charOffset": 1231, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 48, + "startColumn": 1, + "charOffset": 1187, + "charLength": 132, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n /*" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8c582779566eeab9ce7afaa2610c23ccc94bb2b2eb759b2b16452a52341de06b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ArrayKeysOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 64, + "startColumn": 34, + "charOffset": 1582, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 62, + "startColumn": 1, + "charOffset": 1497, + "charLength": 236, + "snippet": { + "text": " $symbolVariable->setDynamicTypes('array');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8ed24cccee92d65966c5fca21c9f398ba3c07a2484e57f70d9365c3a4f3afbbe" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 163, + "startColumn": 13, + "charOffset": 4099, + "charLength": 5, + "snippet": { + "text": "throw" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 161, + "startColumn": 1, + "charOffset": 4042, + "charLength": 127, + "snippet": { + "text": "\n if (!file_exists($inputFilename)) {\n throw new Exception(\"Template not found : $inputFilename\");\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8f2ad894c0e98c730bfa285705cb108f9b1b96e45ac793768450ac892ffb9528" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 94, + "startColumn": 20, + "charOffset": 2764, + "charLength": 25, + "snippet": { + "text": "_assignArrayIndexMultiple" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 92, + "startColumn": 1, + "charOffset": 2619, + "charLength": 231, + "snippet": { + "text": " $this->_assignArrayIndexSingle($symbolVariable, $resolvedExpr, $compilationContext, $statement);\n } else {\n $this->_assignArrayIndexMultiple(\n $variable,\n $symbolVariable," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9005412ec4bac501aa83cd9812cabb34268a7b0e230c80277fd4fa87b0dedb81" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 354, + "startColumn": 20, + "charOffset": 11410, + "charLength": 15, + "snippet": { + "text": "compileFunction" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 352, + "startColumn": 1, + "charOffset": 11284, + "charLength": 184, + "snippet": { + "text": " /* ensure functions are handled last */\n foreach ($this->functionDefinitions as $funcDef) {\n $this->compileFunction($compilationContext, $funcDef);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "91944d50bbf8c2516544f83fce1031d730c23356c4e7e1cf41391adbf26887aa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FwriteOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 34, + "charOffset": 1458, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1355, + "charLength": 261, + "snippet": { + "text": " $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n if ($symbolVariable) {\n if ($call->mustInitSymbolVariable()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9204906a35f880fe6ab38f278768a494e2e6797f91512117df7df4a7ae34748c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/TryCatchStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 43, + "startColumn": 18, + "charOffset": 1187, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 41, + "startColumn": 1, + "charOffset": 1046, + "charLength": 181, + "snippet": { + "text": " if (isset($this->statement['statements'])) {\n $st = new StatementsBlock($this->statement['statements']);\n $st->compile($compilationContext);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9313d0e3f5177ce659a3d5e0a615094e13d7cef65924cca4fa5be5fc7a39078a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFileAnonymous.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 104, + "startColumn": 16, + "charOffset": 3097, + "charLength": 12, + "snippet": { + "text": "compileClass" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 102, + "startColumn": 1, + "charOffset": 3040, + "charLength": 159, + "snippet": { + "text": " $codePrinter->outputBlankLine();\n\n $this->compileClass($compilationContext);\n\n $completeName = $this->classDefinition->getCompleteName();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "95272fe2f53297c994cec847080b8c8d46df69fcc75248cbe024a606db8591d2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MicrotimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 66, + "startColumn": 38, + "charOffset": 1957, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 64, + "startColumn": 1, + "charOffset": 1847, + "charLength": 293, + "snippet": { + "text": " } else {\n $symbolVariable->setDynamicTypes('double');\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n if ($call->mustInitSymbolVariable()) {\n $symbolVariable->initVariant($context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "95b9f7f76ad8af58a0b5ce96ef48f40dccb8217c899788e63770f19f40cc4349" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 71, + "startColumn": 17, + "charOffset": 1759, + "charLength": 5, + "snippet": { + "text": "throw" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 69, + "startColumn": 1, + "charOffset": 1630, + "charLength": 254, + "snippet": { + "text": " $themeInfos = json_decode(file_get_contents($themeInfosPath), true);\n if (!$themeInfos) {\n throw new Exception(\"Cant parse file $themeInfosPath\");\n } else {\n $this->themeInfos = $themeInfos;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "96c8c59b26e37283e3279d2cc9622a5f3f2fbdf679b48b4722e233d75fd43133" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Logical/LogicalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 39, + "startColumn": 30, + "charOffset": 1159, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 37, + "startColumn": 1, + "charOffset": 1021, + "charLength": 204, + "snippet": { + "text": " $rightExpr = new Expression($expression['right']);\n $rightExpr->setReadOnly($this->readOnly);\n $right = $rightExpr->compile($compilationContext);\n\n switch ($left->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "984815910c86f8d9ce8239a2a007fc9ef4b5e720e2f175ac614a776365af9a6e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/RangeInclusiveOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 29, + "charOffset": 1729, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1649, + "charLength": 117, + "snippet": { + "text": " $expression->setReadOnly($this->readOnly);\n\n return $expression->compile($compilationContext);\n }\n}" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "99b3c2e094c4f401957f1bac89416883544ae194492ce39c223a4b35be0f6366" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CamelizeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 74, + "startColumn": 34, + "charOffset": 1988, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 72, + "startColumn": 1, + "charOffset": 1902, + "charLength": 204, + "snippet": { + "text": " $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n if (isset($resolvedParams[1])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9ccff521497c3b7b633061f0f0acdf5b71d1eca2557e52d39eab7467b78b4402" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/TernaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 29, + "charOffset": 1729, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1657, + "charLength": 203, + "snippet": { + "text": "\n $expr = new EvalExpression();\n $condition = $expr->optimize($expression['left'], $compilationContext);\n $compilationContext->codePrinter->output('if (' . $condition . ') {');\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9dd4b8112bd602a54aba30d1fc90b6d513203696a591217378d545696c9a8323" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CreateInstanceOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 73, + "startColumn": 34, + "charOffset": 2003, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 71, + "startColumn": 1, + "charOffset": 1917, + "charLength": 237, + "snippet": { + "text": " $symbolVariable->setDynamicTypes('object');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a0537e2c1b10635714b41c242595672e7107268e7f325682420e93b13dc3fff1" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/InterfaceExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 65, + "startColumn": 34, + "charOffset": 1724, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 63, + "startColumn": 1, + "charOffset": 1680, + "charLength": 164, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n if (2 == count($resolvedParams)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a07dc967add38ae502a0ff91a5c8c14273f8a10169fa186659e25cdfededbf48" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/ShortTernaryOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 95, + "startColumn": 23, + "charOffset": 3422, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 93, + "startColumn": 1, + "charOffset": 3340, + "charLength": 204, + "snippet": { + "text": "\n $ifStatement = new IfStatement($ifBuilder->get());\n $ifStatement->compile($compilationContext);\n\n return new CompiledExpression('variable', $returnVariable->getName(), $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a494de956391ce243f00ad1dca866411daeedc7c47b7b20cb3013eb930b81aa3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CeilOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 34, + "charOffset": 1202, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1114, + "charLength": 270, + "snippet": { + "text": " $context->headersManager->add('kernel/math');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('double', 'zephir_ceil(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a4c708287dfdb0e0af4db24aa4e56ecc24fe89f086c49a3190c529af65487ca3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ExitOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 51, + "startColumn": 38, + "charOffset": 1384, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 49, + "startColumn": 1, + "charOffset": 1263, + "charLength": 294, + "snippet": { + "text": " $context->codePrinter->output('zephir_exit_empty();');\n } else {\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $context->codePrinter->output('zephir_exit(' . $resolvedParams[0] . ');');\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a6b9b1e408ba5d844aaf41339005d21ae83dc2e6a18a1bb7be579ac00810455d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/RangeExclusiveOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 29, + "charOffset": 1725, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1645, + "charLength": 117, + "snippet": { + "text": " $expression->setReadOnly($this->readOnly);\n\n return $expression->compile($compilationContext);\n }\n}" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a78ee4d04a05b9b7ab85485cc0e2a63b80d8f538c0929fa711f83954c09c3cc4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 38, + "charOffset": 1293, + "charLength": 23, + "snippet": { + "text": "getResolvedParamsAsExpr" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 1186, + "charLength": 192, + "snippet": { + "text": " * Get CompiledExpression(s) for resolved var(s).\n */\n $resolvedParams = $call->getResolvedParamsAsExpr(\n $expression['parameters'],\n $context," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "abc5e5127524bd78b0777896242c136e0eac82c5378d095ea3d94f747e97c2ce" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FileExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 34, + "charOffset": 1221, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1133, + "charLength": 204, + "snippet": { + "text": " $context->headersManager->add('kernel/file');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ae797951dfc7c505d4e6e99ad6ac1ec6711fd26a7d3269dfea37bd2fbce97b4c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 86, + "startColumn": 25, + "charOffset": 1876, + "charLength": 4, + "snippet": { + "text": "self" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 84, + "startColumn": 1, + "charOffset": 1807, + "charLength": 258, + "snippet": { + "text": " $newLevel = $this->nestedLevel + 1;\n\n $template = new self($this->theme, array_merge($this->data, $data), $fileName, $newLevel);\n $template->setPathToRoot($this->getPathToRoot());\n $template->setThemeOptions($this->themeOptions);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b355fa7752fb067e58eac5f666cb6f3e5cadd044c73a0c8ddd2054ed023471e9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Call.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 694, + "startColumn": 45, + "charOffset": 29310, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 692, + "startColumn": 1, + "charOffset": 29243, + "charLength": 144, + "snippet": { + "text": " }\n\n $params[] = $paramExpr->compile($compilationContext);\n continue;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "bed76e05b8eccd3efcedddd71877be3cbf7f48ec0efded0b72c93fdc3312c3c6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/EndsWithOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 55, + "startColumn": 34, + "charOffset": 1442, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 53, + "startColumn": 1, + "charOffset": 1398, + "charLength": 131, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams(\n $expression['parameters'],\n $context," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c2dcdd101895b04d77f528eab38b5902252915f11ec2c442583ab1ed202821ae" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/FetchOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 188, + "startColumn": 56, + "charOffset": 7650, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 186, + "startColumn": 1, + "charOffset": 7546, + "charLength": 252, + "snippet": { + "text": " $exprVariable->setNoisy(false);\n\n $exprCompiledVariable = $exprVariable->compile($compilationContext);\n if ('variable' != $exprCompiledVariable->getType()) {\n throw new CompilerException(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c5ad828ef0ba11955998bfa5ee20a0525b2cef7609d4f4c089eccad31225754d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 123, + "startColumn": 48, + "charOffset": 3479, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 121, + "startColumn": 1, + "charOffset": 3372, + "charLength": 216, + "snippet": { + "text": " $indexExpression = new Expression($indexExpr);\n\n $resolvedIndex = $indexExpression->compile($compilationContext);\n switch ($resolvedIndex->getType()) {\n case 'string':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c75398f199f4e24513c04e4cef64fa91bbf9cd4576852b10144534b284750299" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/DoublevalOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 34, + "charOffset": 1222, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1129, + "charLength": 284, + "snippet": { + "text": " $context->headersManager->add('kernel/operators');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('double', 'zephir_get_doubleval(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c805ddeaefd78b5657e1d38b75004b8ded33e73d0cf2e339f030d88a252fe016" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FilePutContentsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 60, + "startColumn": 34, + "charOffset": 1487, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 58, + "startColumn": 1, + "charOffset": 1384, + "charLength": 285, + "snippet": { + "text": " $this->checkNotVariableString($symbolVariable, $expression);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n if ($symbolVariable) {\n $symbol = $context->backend->getVariableCode($symbolVariable);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cb41ca92e3f50bc1083520eda8c58c9ed4fd280e99a166b8de7ee39a019cb18b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/StripslashesOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 63, + "startColumn": 34, + "charOffset": 1590, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 61, + "startColumn": 1, + "charOffset": 1504, + "charLength": 173, + "snippet": { + "text": " $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams(\n $expression['parameters'],\n $context," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cc5d9abee09df3adce2fc8fc7220ae7be34a98a3b362d76bff8e20067650c715" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/WhileStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 48, + "startColumn": 40, + "charOffset": 1176, + "charLength": 8, + "snippet": { + "text": "optimize" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 46, + "startColumn": 1, + "charOffset": 1082, + "charLength": 174, + "snippet": { + "text": "\n $expr = new EvalExpression();\n $condition = $expr->optimize($exprRaw, $compilationContext);\n $this->evalExpression = $expr;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cd5909d9f1e49cfa20f15afb199f446334b242f71b6952edcc2dbf0cbee3f114" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/EvalExpression.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 105, + "startColumn": 38, + "charOffset": 2381, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 103, + "startColumn": 1, + "charOffset": 2276, + "charLength": 147, + "snippet": { + "text": " $expr->setReadOnly(true);\n $expr->setEvalMode(true);\n $compiledExpression = $expr->compile($compilationContext);\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cef245004aff502b043b4cbeb58556f6f942dd83f7611a305200de216f858567" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/FetchOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 144, + "startColumn": 56, + "charOffset": 5554, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 142, + "startColumn": 1, + "charOffset": 5450, + "charLength": 252, + "snippet": { + "text": " $exprVariable->setNoisy(false);\n\n $exprCompiledVariable = $exprVariable->compile($compilationContext);\n if ('variable' != $exprCompiledVariable->getType()) {\n throw new CompilerException(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d042ebd0fd267081d7ed23065a9825d5598b072b5a13d8274b2c796803ccaf4d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/DivOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 34, + "charOffset": 957, + "charLength": 16, + "snippet": { + "text": "preCompileChecks" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 837, + "charLength": 208, + "snippet": { + "text": " public function compile($expression, CompilationContext $compilationContext)\n {\n [$left, $right] = $this->preCompileChecks($expression, $compilationContext);\n\n switch ($left->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d1142debd01360bfa02e1f26205fb8fe6735d056cb425b903c07fed4e5334b2b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/CompareMtimeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 57, + "startColumn": 34, + "charOffset": 1353, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 55, + "startColumn": 1, + "charOffset": 1271, + "charLength": 198, + "snippet": { + "text": " $call->processExpectedReturn($context);\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d2347e3c2914a14f50cb7390100835bd194540382e1bead7738da065f885c986" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 207, + "startColumn": 27, + "charOffset": 8424, + "charLength": 12, + "snippet": { + "text": "assignStatic" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 205, + "startColumn": 1, + "charOffset": 8293, + "charLength": 228, + "snippet": { + "text": " case 'static-property-append':\n $let = new LetStaticPropertyAppend();\n $let->assignStatic(\n $variable,\n $assignment['property']," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d3bb10256e9cb26108f37e2c5b784a4d659e4326f728c3478ffac91455a8ea91" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FloorOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 34, + "charOffset": 1205, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1117, + "charLength": 271, + "snippet": { + "text": " $context->headersManager->add('kernel/math');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('double', 'zephir_floor(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d58935995947ee351f7bd8918498fb4b7e3836a437f28043ae10c951314ad647" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FunctionExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 34, + "charOffset": 1320, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1230, + "charLength": 236, + "snippet": { + "text": " $context->headersManager->add('kernel/object');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n if (isset($str)) {\n return new CompiledExpression(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d8b27df55115a38f354154daf3b3ad5566067c24fcfd7863572da4764b7bd925" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GetNsClassOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 34, + "charOffset": 1600, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1514, + "charLength": 237, + "snippet": { + "text": " $symbolVariable->setDynamicTypes('string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n $this->checkInitSymbolVariable($call, $symbolVariable, $context);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "de775c6eb701b94f6d9b09a2a38df8fd9c54f30f12b9b52d85dd2ac2f73ebcf4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Arithmetical/ArithmeticalBaseOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 64, + "startColumn": 30, + "charOffset": 1815, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 62, + "startColumn": 1, + "charOffset": 1688, + "charLength": 193, + "snippet": { + "text": " $rightExpr = new Expression($expression['right']);\n $rightExpr->setReadOnly(true);\n $right = $rightExpr->compile($compilationContext);\n\n switch ($left->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "de7e819250c714af27c6142799e0f54795fdca0c9cb94c076249e177bdc5cbcb" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MethodExistsOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 34, + "charOffset": 1362, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1272, + "charLength": 194, + "snippet": { + "text": "\n $context->headersManager->add('kernel/object');\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n if (isset($str)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dedc82c6043ffcb3f96b1ea8f91c50a1c594db68d680fbbecb9376ad14f29649" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Code/ArgInfoDefinition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 228, + "startColumn": 29, + "charOffset": 7108, + "charLength": 5, + "snippet": { + "text": "throw" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 226, + "startColumn": 1, + "charOffset": 6954, + "charLength": 225, + "snippet": { + "text": " if (isset($parameter['cast'])) {\n if ($parameter['cast']['type'] !== 'variable') {\n throw new Exception('Unexpected exception');\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e54412f4ac86309b5587b43ad7212f5855cbf39be5d1a1f310c91dddcb50677b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/FcloseOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 34, + "charOffset": 1208, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1120, + "charLength": 270, + "snippet": { + "text": " $context->headersManager->add('kernel/file');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('bool', 'zephir_fclose(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e719cbd3a53fa62169557fed94cbf959eb10a572648674298eb3081867231b46" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/GenerateCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 82, + "startColumn": 30, + "charOffset": 2217, + "charLength": 8, + "snippet": { + "text": "generate" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 80, + "startColumn": 1, + "charOffset": 2116, + "charLength": 205, + "snippet": { + "text": " try {\n // TODO: Move all the stuff from the compiler\n $this->compiler->generate(true);\n } catch (InvalidArgumentException $e) {\n $io->getErrorStyle()->error(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e9bd1f8fa9a119d6f6bfa9cf14efcb61784bd8eae140d1f22b38839f813142ad" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/MergeAppendOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 57, + "startColumn": 34, + "charOffset": 1351, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 55, + "startColumn": 1, + "charOffset": 1262, + "charLength": 285, + "snippet": { + "text": " $context->headersManager->add('kernel/array');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n $context->codePrinter->output('zephir_merge_append(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');');\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ec10204a47ffe3d6b28d47a3ab06e7ed3315efa84fe3569bb1c2a2f269eabf15" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/CompileCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 69, + "startColumn": 30, + "charOffset": 2011, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 67, + "startColumn": 1, + "charOffset": 1910, + "charLength": 188, + "snippet": { + "text": " try {\n // TODO: Move all the stuff from the compiler\n $this->compiler->compile(\n $this->isDevelopmentModeEnabled($input),\n $jobs" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ed20e919a4907dc55342f1440274ed183374afa5968798517389f0ef5c3cf9fd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/JsonEncodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 53, + "startColumn": 34, + "charOffset": 1311, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 51, + "startColumn": 1, + "charOffset": 1221, + "charLength": 178, + "snippet": { + "text": " $context->headersManager->add('kernel/string');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n /*" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ef9225c121a7c7d04448be22654162608a31d36ec90cbea05a31d2849bc7af53" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 219, + "startColumn": 30, + "charOffset": 6123, + "charLength": 17, + "snippet": { + "text": "getResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 217, + "startColumn": 1, + "charOffset": 6034, + "charLength": 211, + "snippet": { + "text": " */\n if (isset($expression['parameters'])) {\n $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression);\n } else {\n $params = [];" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f1629e504eba62ea4d0e7804c185144f2a7fbb79ac3156d3cb430aaca566ca51" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndexAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 101, + "startColumn": 39, + "charOffset": 3159, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 99, + "startColumn": 1, + "charOffset": 3023, + "charLength": 211, + "snippet": { + "text": " $expression = new Expression($indexExpr);\n $expression->setReadOnly(true);\n $exprIndex = $expression->compile($compilationContext);\n\n switch ($exprIndex->getType()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f2e615b7575978398227af13aea002496da92c367206cc8ea4f5f7f7794bde5a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/ExplodeOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 74, + "startColumn": 34, + "charOffset": 2157, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 72, + "startColumn": 1, + "charOffset": 2113, + "charLength": 173, + "snippet": { + "text": " }\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n if (isset($resolvedParams[$limitOffset])) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f2e67be8303ee356096710488461dc06930f644f96d9e96b4300a04543826957" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/StaticCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 864, + "startColumn": 30, + "charOffset": 34350, + "charLength": 17, + "snippet": { + "text": "getResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 862, + "startColumn": 1, + "charOffset": 34250, + "charLength": 190, + "snippet": { + "text": " $params = [];\n if (!empty($expression['parameters'])) {\n $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f3197356d192c2b873c190caebbc13085bbbc0986e7f0440955c713f8bd7502b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/IsNumericOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 49, + "startColumn": 34, + "charOffset": 1143, + "charLength": 25, + "snippet": { + "text": "getReadOnlyResolvedParams" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 47, + "startColumn": 1, + "charOffset": 1050, + "charLength": 279, + "snippet": { + "text": " $context->headersManager->add('kernel/operators');\n\n $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);\n\n return new CompiledExpression('bool', 'zephir_is_numeric(' . $resolvedParams[0] . ')', $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f3d49f588110656b1aa199a4699e2d77324077ba4f9aa3d86f2a1360f89fb779" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 892, + "startColumn": 42, + "charOffset": 31322, + "charLength": 13, + "snippet": { + "text": "getClassEntry" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 890, + "startColumn": 1, + "charOffset": 31182, + "charLength": 188, + "snippet": { + "text": " public function declareConstant($type, $name, $value, CompilationContext $context): void\n {\n $ce = $context->classDefinition->getClassEntry($context);\n\n $dType = null;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f53edc6a571e3f2d6437e9dc59d66e3449109c5b6bb319648b8fd8857b36f61f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnhandledExceptionInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unhandled exceptions", + "markdown": "Unhandled exceptions" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/LetStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 136, + "startColumn": 40, + "charOffset": 5560, + "charLength": 7, + "snippet": { + "text": "compile" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 134, + "startColumn": 1, + "charOffset": 5502, + "charLength": 108, + "snippet": { + "text": " }\n\n $resolvedExpr = $expr->compile($compilationContext);\n\n /**" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fd1b7515c2d9e42c8d0e0a8e69f87204ecb3253bb3725be7dcb2b002b6924d00" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 246, + "startColumn": 44, + "charOffset": 6394, + "charLength": 18, + "snippet": { + "text": "{$this->localPath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 244, + "startColumn": 1, + "charOffset": 6255, + "charLength": 185, + "snippet": { + "text": " $redirect = \"{$this->localPath}/{$destination}\";\n if (!empty($this->basePath)) {\n $redirect = \"{$this->basePath}/{$this->localPath}/{$destination}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0744226bda42625f935ee9e260f4443c83a634c3de466db7f9a8d767a540e3d0" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 233, + "startColumn": 47, + "charOffset": 5929, + "charLength": 18, + "snippet": { + "text": "{$this->localPath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 231, + "startColumn": 1, + "charOffset": 5838, + "charLength": 130, + "snippet": { + "text": " {\n if (!empty($this->basePath)) {\n return require \"{$this->basePath}/{$this->localPath}/{$path}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "0942a690d5734b4d8aefe6c1575e7b251dad62eb31060e8f4cc6d0a9eae5e783" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2153, + "startColumn": 48, + "charOffset": 71545, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 2151, + "startColumn": 1, + "charOffset": 71416, + "charLength": 186, + "snippet": { + "text": " {\n if (!file_exists($path) || !is_dir($path) || !is_readable($path)) {\n $this->logger->warning(\"Directory '{$path}' is not readable. Skip...\");\n\n return;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "16b0d384df48edf1e5501fda2d48d4e86fd9fc8d3f1dc76611fb8ce091afee70" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 246, + "startColumn": 63, + "charOffset": 6413, + "charLength": 14, + "snippet": { + "text": "{$destination}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 244, + "startColumn": 1, + "charOffset": 6255, + "charLength": 185, + "snippet": { + "text": " $redirect = \"{$this->localPath}/{$destination}\";\n if (!empty($this->basePath)) {\n $redirect = \"{$this->basePath}/{$this->localPath}/{$destination}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1aa1de406bcffd937ca4bdf2b49b2ff2db55355eced756471bb90e33e082cc6f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Stubs/DocBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 76, + "startColumn": 63, + "charOffset": 2078, + "charLength": 15, + "snippet": { + "text": "{$this->indent}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 74, + "startColumn": 1, + "charOffset": 1953, + "charLength": 174, + "snippet": { + "text": " $line = preg_replace('#\\t#', $indent, $line);\n\n $this->lines[] = array_pop($this->lines) . \"\\n{$this->indent}\" . $line;\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "23b117bfe1f724f163d1b27a1ce061b6e3c6473b5fe08ca65fed6785c1e607ef" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 246, + "startColumn": 26, + "charOffset": 6376, + "charLength": 17, + "snippet": { + "text": "{$this->basePath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 244, + "startColumn": 1, + "charOffset": 6255, + "charLength": 185, + "snippet": { + "text": " $redirect = \"{$this->localPath}/{$destination}\";\n if (!empty($this->basePath)) {\n $redirect = \"{$this->basePath}/{$this->localPath}/{$destination}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "269e2def5f3a024bde6c0e5fa4bd0db1e63aaf1a0665334b336802c9da7bf000" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 262, + "startColumn": 88, + "charOffset": 6902, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 260, + "startColumn": 1, + "charOffset": 6749, + "charLength": 177, + "snippet": { + "text": " public function write(string $path, string $data): void\n {\n file_put_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . \"/{$path}\", $data);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2b5f75fea02f2c94df137a9d63b5f2cfff50d797bbc28156e3746b9d41714952" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1961, + "startColumn": 70, + "charOffset": 65923, + "charLength": 13, + "snippet": { + "text": "{$kernelPath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1959, + "startColumn": 1, + "charOffset": 65762, + "charLength": 201, + "snippet": { + "text": " if (!file_exists($kernelPath)) {\n if (!mkdir($kernelPath, 0775, true)) {\n throw new Exception(\"Cannot create kernel directory: {$kernelPath}\");\n }\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2c836e6693eb06f1c951a55ef7c388ea82b7fa873fe463ec84651cc95c1793b6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 52, + "startColumn": 42, + "charOffset": 1233, + "charLength": 11, + "snippet": { + "text": "{$variable}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 50, + "startColumn": 1, + "charOffset": 1110, + "charLength": 209, + "snippet": { + "text": " if (!$symbolVariable->isInitialized()) {\n throw new Exception(\n \"Cannot mutate variable '{$variable}' because it is not initialized\",\n $statement\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2ea220b83868934d83fa98fafab5a53a4a7823be777a68f77ce02c4b8b4e4053" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 233, + "startColumn": 66, + "charOffset": 5948, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 231, + "startColumn": 1, + "charOffset": 5838, + "charLength": 130, + "snippet": { + "text": " {\n if (!empty($this->basePath)) {\n return require \"{$this->basePath}/{$this->localPath}/{$path}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "34032bd6cffb452f006cfb9e8078981ce159662f2044a6b54fe9dedbd2fa2d1c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1405, + "startColumn": 31, + "charOffset": 47984, + "charLength": 13, + "snippet": { + "text": "{$currentDir}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1403, + "startColumn": 1, + "charOffset": 47900, + "charLength": 190, + "snippet": { + "text": " [\n ':cflags' => $gccFlags,\n ':stderr' => \"{$currentDir}/compile-errors.log\",\n ':stdout' => \"{$currentDir}/compile.log\",\n ]" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "34ad6b0c9e865904a001e8c2db074cff53f2a08d3e9d85572ed97df728404619" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 130, + "startColumn": 22, + "charOffset": 3656, + "charLength": 13, + "snippet": { + "text": "{$version[1]}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 128, + "startColumn": 1, + "charOffset": 3575, + "charLength": 119, + "snippet": { + "text": " {\n $version = explode('-', $this->getVersion());\n $commit = \"({$version[1]})\";\n\n return trim(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3561057bce6ef21d614035bbeb8c8cb53fccdf85e98006024f7ab5cdf3508dcd" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 93, + "startColumn": 35, + "charOffset": 2528, + "charLength": 12, + "snippet": { + "text": "{$namespace}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 91, + "startColumn": 1, + "charOffset": 2445, + "charLength": 170, + "snippet": { + "text": " $this->config->set('name', $namespace);\n\n if (!is_dir(\"{$namespace}/{$namespace}\")) {\n mkdir(\"{$namespace}/{$namespace}\", 0755, true);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "38c20b3d5e54c34b71ac278a36982febfbc35ff1d50e2bc847a61ad96acdb9a2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 684, + "startColumn": 52, + "charOffset": 23780, + "charLength": 12, + "snippet": { + "text": "{$className}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 682, + "startColumn": 1, + "charOffset": 23668, + "charLength": 167, + "snippet": { + "text": "\n if (!class_exists($className, false)) {\n throw new Exception(\"Class {$className} cannot be loaded\");\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "406743717208ec19b2beedd669300348fd4bb8edc3b454b54f8a1ae963e9aaf8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 94, + "startColumn": 33, + "charOffset": 2578, + "charLength": 12, + "snippet": { + "text": "{$namespace}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 92, + "startColumn": 1, + "charOffset": 2493, + "charLength": 123, + "snippet": { + "text": "\n if (!is_dir(\"{$namespace}/{$namespace}\")) {\n mkdir(\"{$namespace}/{$namespace}\", 0755, true);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4381ed73a05a882042683071903e278b9875030b8424327f7ea99adacedfad45" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GlobalsSetOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 52, + "charOffset": 2593, + "charLength": 13, + "snippet": { + "text": "{$globalName}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 2444, + "charLength": 233, + "snippet": { + "text": " if (!isset($globalDefinition['type'])) {\n throw new CompilerException(\n \"Unable to determine type for '{$globalName}' global variable.\",\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "44386274ba6d7bdac080ad7b66e77c8e72c24d9619b302d629c009b7dfb2ff0c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 93, + "startColumn": 22, + "charOffset": 2515, + "charLength": 12, + "snippet": { + "text": "{$namespace}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 91, + "startColumn": 1, + "charOffset": 2445, + "charLength": 170, + "snippet": { + "text": " $this->config->set('name', $namespace);\n\n if (!is_dir(\"{$namespace}/{$namespace}\")) {\n mkdir(\"{$namespace}/{$namespace}\", 0755, true);\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "490141b757ea379eb67e3b1e3b79bbc5b2f876d220d3f416cea1918983c2a190" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 201, + "startColumn": 87, + "charOffset": 5055, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 199, + "startColumn": 1, + "charOffset": 4907, + "charLength": 165, + "snippet": { + "text": " public function modificationTime(string $path): int\n {\n return filemtime($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . \"/{$path}\");\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4e4e4a853a15b9bc74fbb6262ce349819b277f48cc014ee02f0488fb52792c56" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1419, + "startColumn": 62, + "charOffset": 48459, + "charLength": 11, + "snippet": { + "text": "{$fileName}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1417, + "startColumn": 1, + "charOffset": 48325, + "charLength": 298, + "snippet": { + "text": " $fileName = $this->config->get('extension-name') ?: $namespace;\n\n if (false === file_exists(\"{$currentDir}/ext/modules/{$fileName}.so\")) {\n throw new CompilerException(\n 'Internal extension compilation failed. Check compile-errors.log for more information.'" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "51240dbcfd49b5ae90dbcadb27080ba319574d0238999f14687f4d42c0007556" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 580, + "startColumn": 41, + "charOffset": 18549, + "charLength": 12, + "snippet": { + "text": "{$namespace}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 578, + "startColumn": 1, + "charOffset": 18393, + "charLength": 266, + "snippet": { + "text": " if (!preg_match('/^[A-Z]/', $namespace)) {\n throw new CompilerException(\n \"Namespace '{$namespace}' must be in camelized-form\",\n $topStatement\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5c9c8d49b89fde08fc60c9c807e112d406e9f834215bc0dcf7702f627ee08f3e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GlobalsSetOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 74, + "startColumn": 51, + "charOffset": 2344, + "charLength": 13, + "snippet": { + "text": "{$globalName}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 72, + "startColumn": 1, + "charOffset": 2140, + "charLength": 288, + "snippet": { + "text": " if (!isset($resolvedParams[0]) || empty($resolvedParams[0]) || !is_string($resolvedParams[0])) {\n throw new CompilerException(\n \"Unable to reslove value for '{$globalName}' global variable.\",\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "5e39fa42356cc0ee7d760b4859a8529ffd59d1037ca5861a056b671d7601a54c" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Application.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 166, + "startColumn": 21, + "charOffset": 4695, + "charLength": 13, + "snippet": { + "text": "{$version[0]}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 164, + "startColumn": 1, + "charOffset": 4603, + "charLength": 125, + "snippet": { + "text": "\n if (isset($version[1]) && str_starts_with($version[1], '$')) {\n return \"{$version[0]}-source\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "6509e3f714963c85777eec80d297a703d4376982b73f373fb5b436bf7feb20c2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 105, + "startColumn": 32, + "charOffset": 3033, + "charLength": 15, + "snippet": { + "text": "{$propertyName}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 103, + "startColumn": 1, + "charOffset": 2891, + "charLength": 249, + "snippet": { + "text": " if (!$context->classDefinition->hasProperty($propertyName)) {\n throw new Exception(\n \"Property '{$propertyName}' is not defined on class '{$className}'\",\n $statement\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7285ae5ce278899938fa44a75b1ec6dbcf48f6dd8d615940256b79ca8a85b4b4" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 94, + "startColumn": 20, + "charOffset": 2565, + "charLength": 12, + "snippet": { + "text": "{$namespace}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 92, + "startColumn": 1, + "charOffset": 2493, + "charLength": 123, + "snippet": { + "text": "\n if (!is_dir(\"{$namespace}/{$namespace}\")) {\n mkdir(\"{$namespace}/{$namespace}\", 0755, true);\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7a0797103c0e544a065cc8d4bb538fd64e12ab7b880de585884f47ab92c4ca72" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1645, + "startColumn": 44, + "charOffset": 57329, + "charLength": 7, + "snippet": { + "text": "{$code}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1643, + "startColumn": 1, + "charOffset": 57223, + "charLength": 140, + "snippet": { + "text": " $output = \"array_init({$code});\";\n } else {\n $output = \"zephir_create_array({$code}, {$size}, 0);\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7a809fc545306e24950811727c4202b2e21a8e6d8116c4ad4ecb436298b54590" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GlobalsSetOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 94, + "startColumn": 66, + "charOffset": 3040, + "charLength": 16, + "snippet": { + "text": "{$internalValue}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 92, + "startColumn": 1, + "charOffset": 2959, + "charLength": 172, + "snippet": { + "text": " );\n\n $context->codePrinter->output(\"{$internalAccessor} = {$internalValue};\");\n\n return new CompiledExpression('null', null, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "82280abd26a7ffa24918f66015729d17578eb167eead5447d433dd461010ed58" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 690, + "startColumn": 52, + "charOffset": 24009, + "charLength": 12, + "snippet": { + "text": "{$className}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 688, + "startColumn": 1, + "charOffset": 23887, + "charLength": 198, + "snippet": { + "text": "\n if (!($optimizer instanceof OptimizerAbstract)) {\n throw new Exception(\"Class {$className} must be instance of OptimizerAbstract\");\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "873942ab4ee0e203aa501ed9c3b125c8b92a7affa5ffd72809c948b347d8c59f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 111, + "startColumn": 22, + "charOffset": 2703, + "charLength": 18, + "snippet": { + "text": "{$this->localPath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 109, + "startColumn": 1, + "charOffset": 2627, + "charLength": 115, + "snippet": { + "text": " $path = $this->localPath;\n } else {\n $path = \"{$this->localPath}/{$path}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "87e6083a6487943739224516cb11667a8bc724d36ba21dbe2f4f8afbc32c699e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 103, + "startColumn": 77, + "charOffset": 2511, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 101, + "startColumn": 1, + "charOffset": 2382, + "charLength": 146, + "snippet": { + "text": " public function delete(string $path): void\n {\n unlink($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . \"/{$path}\");\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "91553b3b6ca3650b04e23054da3c155e0b0938bd27fde998a4871d1de6c749a5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 236, + "startColumn": 96, + "charOffset": 6064, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 234, + "startColumn": 1, + "charOffset": 5958, + "charLength": 172, + "snippet": { + "text": " }\n\n $code = file_get_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . \"/{$path}\");\n\n return eval(str_replace('codePrinter->output(\"{$internalAccessor} = {$internalValue};\");\n\n return new CompiledExpression('null', null, $expression);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "990645484a140d3e1505be21478fc1f76548783caf643f7cd438f839317b6550" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 255, + "startColumn": 25, + "charOffset": 6663, + "charLength": 10, + "snippet": { + "text": "{$command}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 253, + "startColumn": 1, + "charOffset": 6589, + "charLength": 152, + "snippet": { + "text": " break;\n case 'stderr':\n system(\"{$command} 2> \" . escapeshellarg($redirect));\n break;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a390457ebb750e68850e8137aca7a8368acff8a6526c0edd665863f1018e6e62" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 233, + "startColumn": 29, + "charOffset": 5911, + "charLength": 17, + "snippet": { + "text": "{$this->basePath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 231, + "startColumn": 1, + "charOffset": 5838, + "charLength": 130, + "snippet": { + "text": " {\n if (!empty($this->basePath)) {\n return require \"{$this->basePath}/{$this->localPath}/{$path}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a8bb6c8e615b4e2aaaf6b482adc3b75979c2e33df8f999671ed2e2969a117517" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 252, + "startColumn": 25, + "charOffset": 6544, + "charLength": 10, + "snippet": { + "text": "{$command}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 250, + "startColumn": 1, + "charOffset": 6472, + "charLength": 166, + "snippet": { + "text": " default:\n case 'stdout':\n system(\"{$command} > \" . escapeshellarg($redirect));\n break;\n case 'stderr':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a8e35d2f08a59045e2e5fa936e183fec746a39d3fedab72594e4072f90d455a2" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1645, + "startColumn": 53, + "charOffset": 57338, + "charLength": 7, + "snippet": { + "text": "{$size}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1643, + "startColumn": 1, + "charOffset": 57223, + "charLength": 140, + "snippet": { + "text": " $output = \"array_init({$code});\";\n } else {\n $output = \"zephir_create_array({$code}, {$size}, 0);\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "aff97a177a1abbf419e2dc5a990c21979e9f2bea3e2b01b2338f4043359fccd7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 973, + "startColumn": 44, + "charOffset": 33526, + "charLength": 17, + "snippet": { + "text": "{$optimizersPath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 971, + "startColumn": 1, + "charOffset": 33372, + "charLength": 263, + "snippet": { + "text": " if (false === self::$loadedPrototypes) {\n $optimizersPath = $this->resolveOptimizersPath();\n FunctionCall::addOptimizerDir(\"{$optimizersPath}/FunctionCall\");\n\n $customOptimizersPaths = $this->config->get('optimizer-dirs');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b4ee667c7eae59ec21be133a66715807d37aafbb3ed6b6349130480b85f9e169" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 294, + "startColumn": 45, + "charOffset": 8774, + "charLength": 12, + "snippet": { + "text": "{$namespace}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 292, + "startColumn": 1, + "charOffset": 8659, + "charLength": 144, + "snippet": { + "text": "\n if (file_exists(\"$currentDir/ext/modules/{$namespace}.so\")) {\n unlink(\"$currentDir/ext/modules/{$namespace}.so\");\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c1b6721eec7920405a740bcd7e2a8965b33c1517a9eaac630ff34d76f1c364f8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 119, + "startColumn": 100, + "charOffset": 2972, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 117, + "startColumn": 1, + "charOffset": 2821, + "charLength": 216, + "snippet": { + "text": " public function file(string $path): array\n {\n $contents = file_get_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . \"/{$path}\");\n\n return preg_split(\"/\\r\\n|\\n|\\r/\", $contents);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c2161f5bb51173d8ecddc223ff72c1c462f788e9537bd439f758420ceb403e22" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 244, + "startColumn": 22, + "charOffset": 6276, + "charLength": 18, + "snippet": { + "text": "{$this->localPath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 242, + "startColumn": 1, + "charOffset": 6229, + "charLength": 200, + "snippet": { + "text": " {\n // fallback\n $redirect = \"{$this->localPath}/{$destination}\";\n if (!empty($this->basePath)) {\n $redirect = \"{$this->basePath}/{$this->localPath}/{$destination}\";" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c21b1289ec9ffa025c101452cc0a686418f421e1a8e84c49276279e223a9b993" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1406, + "startColumn": 31, + "charOffset": 48049, + "charLength": 13, + "snippet": { + "text": "{$currentDir}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1404, + "startColumn": 1, + "charOffset": 47914, + "charLength": 187, + "snippet": { + "text": " ':cflags' => $gccFlags,\n ':stderr' => \"{$currentDir}/compile-errors.log\",\n ':stdout' => \"{$currentDir}/compile.log\",\n ]\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c34e1f4646807a5daf3ed9b57283fe896d0fa433fb68cc788a0eaca9f315c153" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 111, + "startColumn": 41, + "charOffset": 2722, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 109, + "startColumn": 1, + "charOffset": 2627, + "charLength": 115, + "snippet": { + "text": " $path = $this->localPath;\n } else {\n $path = \"{$this->localPath}/{$path}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c711ccb28033b1ce7c508c214d32b93447aff21738262947909753036351bf29" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 293, + "startColumn": 50, + "charOffset": 8709, + "charLength": 12, + "snippet": { + "text": "{$namespace}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 291, + "startColumn": 1, + "charOffset": 8649, + "charLength": 153, + "snippet": { + "text": " }\n\n if (file_exists(\"$currentDir/ext/modules/{$namespace}.so\")) {\n unlink(\"$currentDir/ext/modules/{$namespace}.so\");\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c7e5791afdd68016e892b53c80e8f8d5c08885e9ddc0fe9e009bd8ca880aca0d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 227, + "startColumn": 95, + "charOffset": 5767, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 225, + "startColumn": 1, + "charOffset": 5620, + "charLength": 164, + "snippet": { + "text": " public function read(string $path): string\n {\n return file_get_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . \"/{$path}\");\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c88191659fda15c508696140042a22b5d3989d7f68319d7255d0384a2b934d0e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectProperty.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 105, + "startColumn": 74, + "charOffset": 3075, + "charLength": 12, + "snippet": { + "text": "{$className}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 103, + "startColumn": 1, + "charOffset": 2891, + "charLength": 249, + "snippet": { + "text": " if (!$context->classDefinition->hasProperty($propertyName)) {\n throw new Exception(\n \"Property '{$propertyName}' is not defined on class '{$className}'\",\n $statement\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cb549d89d070f3262e1f63cd95778d5a507b477c3ba24911399f1a9a70f6eda9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 183, + "startColumn": 41, + "charOffset": 4615, + "charLength": 7, + "snippet": { + "text": "{$path}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 181, + "startColumn": 1, + "charOffset": 4520, + "charLength": 115, + "snippet": { + "text": " $path = $this->localPath;\n } else {\n $path = \"{$this->localPath}/{$path}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cdc140433483f286363256acf9fcee7e60e05891a899841cc9f85f6f99ec542b" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1425, + "startColumn": 51, + "charOffset": 50555, + "charLength": 19, + "snippet": { + "text": "{$signaturePattern}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1423, + "startColumn": 1, + "charOffset": 50494, + "charLength": 90, + "snippet": { + "text": " }\n\n return \"void {$method->getInternalName()}({$signaturePattern})\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d36ce2c7de909d78da30b65294083c296346704d1b2d83e8b4d889ee803d775e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Code/ArgInfoDefinition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 200, + "startColumn": 22, + "charOffset": 5743, + "charLength": 7, + "snippet": { + "text": "{$flag}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 198, + "startColumn": 1, + "charOffset": 5652, + "charLength": 193, + "snippet": { + "text": "\n foreach ($this->parameters->getParameters() as $parameter) {\n switch (\"{$flag}:\" . $parameter['data-type']) {\n case '0:array':\n case '1:array':" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "d6274691fe6e38cb24d06e31983078a769a54459182579627855b02bbd434c4a" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 244, + "startColumn": 41, + "charOffset": 6295, + "charLength": 14, + "snippet": { + "text": "{$destination}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 242, + "startColumn": 1, + "charOffset": 6229, + "charLength": 200, + "snippet": { + "text": " {\n // fallback\n $redirect = \"{$this->localPath}/{$destination}\";\n if (!empty($this->basePath)) {\n $redirect = \"{$this->basePath}/{$this->localPath}/{$destination}\";" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dcc7b388fcaf7c4c2ed6b31a051953e75ea863065fa4490674a43fbd4aba3d22" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/FunctionCall/GlobalsSetOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 61, + "startColumn": 35, + "charOffset": 1763, + "charLength": 13, + "snippet": { + "text": "{$globalName}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 59, + "startColumn": 1, + "charOffset": 1621, + "charLength": 245, + "snippet": { + "text": " if (!$context->compiler->isExtensionGlobal($globalName)) {\n throw new CompilerException(\n \"Global variable '{$globalName}' cannot be written because it wasn't defined\",\n $expression\n );" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "df51f3a51a9729e173de63205d2bc8aa9fafa80bd49a8569980539566cc7579d" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FileSystem/HardDisk.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 183, + "startColumn": 22, + "charOffset": 4596, + "charLength": 18, + "snippet": { + "text": "{$this->localPath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 181, + "startColumn": 1, + "charOffset": 4520, + "charLength": 115, + "snippet": { + "text": " $path = $this->localPath;\n } else {\n $path = \"{$this->localPath}/{$path}\";\n }\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e12b2486ad882438cd6631638bf0113d34b52d41178978bf86390787e29b2cb9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1643, + "startColumn": 35, + "charOffset": 57257, + "charLength": 7, + "snippet": { + "text": "{$code}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1641, + "startColumn": 1, + "charOffset": 57192, + "charLength": 160, + "snippet": { + "text": "\n if (null === $size) {\n $output = \"array_init({$code});\";\n } else {\n $output = \"zephir_create_array({$code}, {$size}, 0);\";" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e3e99fb716d9b1fcf7754265d8a47e66b2c65bf4bec235fb9751ccc530985a25" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/CompilerFile.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 474, + "startColumn": 25, + "charOffset": 15459, + "charLength": 17, + "snippet": { + "text": "{$normalizedPath}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 472, + "startColumn": 1, + "charOffset": 15357, + "charLength": 177, + "snippet": { + "text": " $normalizedPath = $this->filesystem->normalizePath($this->filePath);\n\n $compilePath = \"{$normalizedPath}.json\";\n $zepRealPath = realpath($this->filePath);\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f3c5fe7ba788e77cec03d6d583a511f3e77c359a3165d1cd83ad100dc821e748" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryCurlyVarSyntaxInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary curly braces", + "markdown": "Unnecessary curly braces" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1419, + "startColumn": 36, + "charOffset": 48433, + "charLength": 13, + "snippet": { + "text": "{$currentDir}" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1417, + "startColumn": 1, + "charOffset": 48325, + "charLength": 298, + "snippet": { + "text": " $fileName = $this->config->get('extension-name') ?: $namespace;\n\n if (false === file_exists(\"{$currentDir}/ext/modules/{$fileName}.so\")) {\n throw new CompilerException(\n 'Internal extension compilation failed. Check compile-errors.log for more information.'" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f82060f1c599436ff729cd5982890885f078dc957f7239eefc5dfcf6d81f6724" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryLocalVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary local variable", + "markdown": "Unnecessary local variable" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Template.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 77, + "startColumn": 9, + "charOffset": 1677, + "charLength": 8, + "snippet": { + "text": "$content" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 75, + "startColumn": 1, + "charOffset": 1626, + "charLength": 103, + "snippet": { + "text": " ob_start();\n include $path;\n $content = ob_get_clean();\n\n return $content;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "3dbaf535a9729c410b46427e858b83feed1ea979061d3d3a0c376f3f52ad6031" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnnecessaryLocalVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unnecessary local variable", + "markdown": "Unnecessary local variable" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation/Theme.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 221, + "startColumn": 9, + "charOffset": 6487, + "charLength": 13, + "snippet": { + "text": "$pathFilename" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 219, + "startColumn": 1, + "charOffset": 6394, + "charLength": 175, + "snippet": { + "text": " $pathDirname = $path['dirname'];\n $pathBasename = $path['basename'];\n $pathFilename = $pathDirname . '/' . $pathBasename;\n\n return $pathFilename;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8bb021c4c1365e39c2bc198ff4e869ca92c5f366710172ad6811d5826d1bcf35" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnreachableStatementInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Unreachable statement", + "markdown": "Unreachable statement" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/EvalExpression.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 245, + "startColumn": 17, + "charOffset": 7920, + "charLength": 6, + "snippet": { + "text": "break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 243, + "startColumn": 1, + "charOffset": 7859, + "charLength": 89, + "snippet": { + "text": " );\n }\n break;\n\n default:" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "7e00aef051bb4499add808e48c30c7f58f4dfee2b92719fe251c61b71a871fab" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnreachableStatementInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Unreachable statement", + "markdown": "Unreachable statement" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 69, + "startColumn": 17, + "charOffset": 1796, + "charLength": 6, + "snippet": { + "text": "break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 67, + "startColumn": 1, + "charOffset": 1698, + "charLength": 229, + "snippet": { + "text": "\n return $this->passNativeFCall($compiledExpression, $expression);\n break;\n case 'variable':\n $variable = $context->symbolTable->getVariable($compiledExpression->getCode());" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "b785ddb5d65c3a56a8f5d288ffa2c359dcb504a1561d5784035f037a69890ae6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnreachableStatementInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Unreachable statement", + "markdown": "Unreachable statement" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Optimizers/MathOptimizer.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 25, + "charOffset": 2321, + "charLength": 6, + "snippet": { + "text": "break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 2207, + "charLength": 227, + "snippet": { + "text": "\n return $this->passNativeFCall($compiledExpression, $expression);\n break;\n case 'variable':\n $context->headersManager->add('kernel/math');" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f33e017278a7f4c5ba0c76b75b5c0352cc47bce5559843d5a0003748850fd572" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnreachableStatementInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Unreachable statement", + "markdown": "Unreachable statement" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Expression/NativeArray.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 574, + "startColumn": 17, + "charOffset": 25182, + "charLength": 6, + "snippet": { + "text": "break;" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 572, + "startColumn": 1, + "charOffset": 25041, + "charLength": 169, + "snippet": { + "text": " throw new CompilerException('Unknown ' . $itemVariable->getType(), $itemVariable);\n }\n break;\n\n default:" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fa4e32a343d35e4e95ceb3cd16eef395aea96c882ac0317b90bf1e196de93df2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedLocalVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused local variable 'i'. The value of the variable is not used anywhere.", + "markdown": "Unused local variable 'i'. The value of the variable is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Stubs/DocBlock.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 86, + "startColumn": 38, + "charOffset": 2424, + "charLength": 2, + "snippet": { + "text": "$i" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 84, + "startColumn": 1, + "charOffset": 2334, + "charLength": 206, + "snippet": { + "text": " $cleaned = [];\n $empty = 0;\n foreach ($description as $i => $line) {\n if (preg_match('#^([\\s\\t]+)?[*]([\\s\\t]+)?$#', $line)) {\n ++$empty;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "00aef91e089a8bbb176e1833d58806e4e4e034f6c9a21367efe9afe061c8550f" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedLocalVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused local variable 'e'. The value of the variable is not used anywhere.", + "markdown": "Unused local variable 'e'. The value of the variable is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Definition/Definition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1162, + "startColumn": 42, + "charOffset": 36628, + "charLength": 2, + "snippet": { + "text": "$e" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1160, + "startColumn": 1, + "charOffset": 36513, + "charLength": 180, + "snippet": { + "text": " $extendsClassDefinition->getName()\n );\n } catch (ReflectionException $e) {\n // Do nothing\n return false;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "00c6748c69d652175404e60cb78882fb041155dc279c93df65543920d5557d49" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedLocalVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused local variable 'exit'. The value of the variable is not used anywhere.", + "markdown": "Unused local variable 'exit'. The value of the variable is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1416, + "startColumn": 33, + "charOffset": 48317, + "charLength": 5, + "snippet": { + "text": "$exit" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1414, + "startColumn": 1, + "charOffset": 48247, + "charLength": 150, + "snippet": { + "text": " }, explode('&&', $command));\n\n exec($command, $output, $exit);\n $fileName = $this->config->get('extension-name') ?: $namespace;\n" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "12be4abb7119f62ee1ef8b1e2ffd283909308cc268f169aab4e37f21a663e360" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedLocalVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused local variable 'namespaceName'. The value of the variable is not used anywhere.", + "markdown": "Unused local variable 'namespaceName'. The value of the variable is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Documentation.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 112, + "startColumn": 34, + "charOffset": 2777, + "charLength": 14, + "snippet": { + "text": "$namespaceName" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 110, + "startColumn": 1, + "charOffset": 2682, + "charLength": 234, + "snippet": { + "text": " $byNamespace = $namespaceAccessor->getByNamespace();\n\n foreach ($byNamespace as $namespaceName => $nh) {\n // namespace files (namespace/ns1/n2/namespace.html)\n $nfile = new File\\NamespaceFile($nh);" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "39721715dc8ece8f8ad1ffadb9b81162480d625f1676eb1f36353699e8c011f5" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedLocalVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused local variable 'e'. The value of the variable is not used anywhere.", + "markdown": "Unused local variable 'e'. The value of the variable is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/FunctionCall.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 144, + "startColumn": 42, + "charOffset": 3989, + "charLength": 2, + "snippet": { + "text": "$e" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 142, + "startColumn": 1, + "charOffset": 3857, + "charLength": 195, + "snippet": { + "text": " try {\n $reflectionFunction = new ReflectionFunction($funcName);\n } catch (ReflectionException $e) {\n $reflectionFunction = null;\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8a17ec6817d93474eb576b91ef32331030a883fc65149bedfe16b275790c458e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedLocalVariableInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused local variable 'e'. The value of the variable is not used anywhere.", + "markdown": "Unused local variable 'e'. The value of the variable is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Class/Definition/Definition.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 257, + "startColumn": 50, + "charOffset": 6714, + "charLength": 2, + "snippet": { + "text": "$e" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 255, + "startColumn": 1, + "charOffset": 6569, + "charLength": 254, + "snippet": { + "text": " try {\n $params['default'] = $row->getDefaultValue();\n } catch (ReflectionException $e) {\n // TODO: dummy default value\n $params['default'] = true;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "dd172497a067d3a4629e1e9bac11447b148ca0940da6f974951f2a88d4ba9c9e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'calleeDefinition'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'calleeDefinition'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Call.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 389, + "startColumn": 9, + "charOffset": 14906, + "charLength": 17, + "snippet": { + "text": "$calleeDefinition" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 387, + "startColumn": 1, + "charOffset": 14823, + "charLength": 179, + "snippet": { + "text": " CompilationContext $compilationContext,\n array $expression,\n $calleeDefinition = null\n ): array {\n $codePrinter = $compilationContext->codePrinter;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "16e1b010249489ecc7a9a9b908bf0710f37daa151cf3a56b2cc892b517b36fb9" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'variable'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'variable'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 167, + "startColumn": 9, + "charOffset": 4837, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 165, + "startColumn": 1, + "charOffset": 4765, + "charLength": 164, + "snippet": { + "text": " */\n protected function _assignPropertyArraySingleIndex(\n $variable,\n ZephirVariable $symbolVariable,\n CompiledExpression $resolvedExpr," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "1a18e75b739cc9ca335d47dc02836a015fd952fba09a8356b22367394d49fb78" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'variable'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'variable'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ObjectPropertyArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 102, + "startColumn": 9, + "charOffset": 2771, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 100, + "startColumn": 1, + "charOffset": 2697, + "charLength": 166, + "snippet": { + "text": " */\n protected function _assignPropertyArrayMultipleIndex(\n $variable,\n ZephirVariable $symbolVariable,\n CompiledExpression $resolvedExpr," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "206803c3814fae7b71300731002a5f603b5058c522af18a49496d138dc6019e6" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'call'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'call'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/CharType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 44, + "startColumn": 81, + "charOffset": 1063, + "charLength": 5, + "snippet": { + "text": "$call" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 42, + "startColumn": 1, + "charOffset": 950, + "charLength": 199, + "snippet": { + "text": " * @throws Exception\n */\n public function toHex($caller, CompilationContext $compilationContext, Call $call, array $expression)\n {\n $exprBuilder = BuilderFactory::getInstance();" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "235cbf5ab9bc1f0906e88d546f09f786b5542b72bb9c46511d81d8f40856cdd3" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'context'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'context'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Operators/Other/InstanceOfOperator.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 141, + "startColumn": 79, + "charOffset": 6121, + "charLength": 8, + "snippet": { + "text": "$context" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 139, + "startColumn": 1, + "charOffset": 6036, + "charLength": 175, + "snippet": { + "text": " }\n\n private function prepareBackendSpecificCode($variable, CompilationContext $context): string\n {\n return strtr('Z_STRVAL_P(:p:name), Z_STRLEN_P(:p:name)', [" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2ed75b35db3f366332e4c78c8e57d9a3050d47c13dc8dcc8d3df6a28eede1a25" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'property'. The parameter's value is overwritten immediately.", + "markdown": "Unused parameter 'property'. The parameter's value is overwritten immediately." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/StaticPropertyAppend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 136, + "startColumn": 16, + "charOffset": 4499, + "charLength": 9, + "snippet": { + "text": "$property" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 134, + "startColumn": 1, + "charOffset": 4399, + "charLength": 200, + "snippet": { + "text": " protected function _assignStaticPropertyArrayMultipleIndex(\n $classEntry,\n string $property,\n CompiledExpression $resolvedExpr,\n CompilationContext $compilationContext," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "4cd7511adf37d4beb02f429809a179779e584b61408e7536f1029fda9e4f8051" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'call'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'call'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Types/ArrayType.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 93, + "startColumn": 80, + "charOffset": 3034, + "charLength": 5, + "snippet": { + "text": "$call" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 91, + "startColumn": 1, + "charOffset": 2922, + "charLength": 211, + "snippet": { + "text": " * @throws Exception\n */\n public function join($caller, CompilationContext $compilationContext, Call $call, array $expression)\n {\n $functionCall = BuilderFactory::getInstance()->statements()" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "9a36baa21707a9d91174f6bce42352d49d4b5efa0417f8382867ebfa2d1c16f8" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'output'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'output'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/ApiCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 88, + "startColumn": 71, + "charOffset": 2506, + "charLength": 7, + "snippet": { + "text": "$output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 86, + "startColumn": 1, + "charOffset": 2429, + "charLength": 123, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $options = array_merge(" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "adf6d5c89b53aa8bc97090004799b903fe2a14c4a7bb35825207e1e2b86b9423" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'context'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'context'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 1384, + "startColumn": 77, + "charOffset": 49010, + "charLength": 8, + "snippet": { + "text": "$context" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 1382, + "startColumn": 1, + "charOffset": 48904, + "charLength": 193, + "snippet": { + "text": " * @return string\n */\n public function getInternalSignature(Method $method, CompilationContext $context): string\n {\n if ($method->isInitializer() && !$method->isStatic()) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ae1b3f7ed45f86730858495f2e109beb675baadef00d31fb7514be2516bcf530" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'output'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'output'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Console/Command/InitCommand.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 81, + "startColumn": 71, + "charOffset": 2055, + "charLength": 7, + "snippet": { + "text": "$output" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 79, + "startColumn": 1, + "charOffset": 1978, + "charLength": 177, + "snippet": { + "text": " }\n\n protected function execute(InputInterface $input, OutputInterface $output): int\n {\n $namespace = $this->sanitizeNamespace($input->getArgument('namespace'));" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c3853f2f03510447fc448e1460c729b0057961cb0d453ce0e95a26b72b2628b7" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'variable'. The parameter's value is overwritten immediately.", + "markdown": "Unused parameter 'variable'. The parameter's value is overwritten immediately." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ExportSymbol.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 37, + "startColumn": 9, + "charOffset": 925, + "charLength": 9, + "snippet": { + "text": "$variable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 35, + "startColumn": 1, + "charOffset": 881, + "charLength": 150, + "snippet": { + "text": " */\n public function assign(\n $variable,\n ZephirVariable $symbolVariable = null,\n CompiledExpression $resolvedExpr = null," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "cbfc8418119d4412eae974b6a699df9b6569c48eef665e7aef369c0ba8509428" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'symbolVariable'. The parameter's value is overwritten immediately.", + "markdown": "Unused parameter 'symbolVariable'. The parameter's value is overwritten immediately." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/Let/ArrayIndex.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 118, + "startColumn": 24, + "charOffset": 3448, + "charLength": 15, + "snippet": { + "text": "$symbolVariable" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 116, + "startColumn": 1, + "charOffset": 3356, + "charLength": 198, + "snippet": { + "text": " protected function _assignArrayIndexMultiple(\n $variable,\n ZephirVariable $symbolVariable,\n CompiledExpression $resolvedExpr,\n CompilationContext $compilationContext," + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "e81c70c9e83a9869b6df9499f5c65f3ab697e76a0bac3caf09d2245f9bb48c0e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpUnusedParameterInspection", + "kind": "fail", + "level": "note", + "message": { + "text": "Unused parameter 'context'. The parameter's value is not used anywhere.", + "markdown": "Unused parameter 'context'. The parameter's value is not used anywhere." + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Backend/Backend.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 303, + "startColumn": 95, + "charOffset": 9052, + "charLength": 8, + "snippet": { + "text": "$context" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 301, + "startColumn": 1, + "charOffset": 8951, + "charLength": 168, + "snippet": { + "text": " }\n\n public function arrayIsset2(Variable $var, $resolvedExpr, $expression, CompilationContext $context)\n {\n if (!($resolvedExpr instanceof Variable)) {" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "ec63033ea941b3ac966a865ecef87f7e013586e960e212e39488ad0d8583f1ae" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpVoidFunctionResultUsedInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "'void' method 'compileIterator' result used", + "markdown": "'void' method 'compileIterator' result used" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Statements/ForStatement.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 58, + "startColumn": 27, + "charOffset": 1489, + "charLength": 53, + "snippet": { + "text": "$this->compileIterator($exprRaw, $compilationContext)" + }, + "sourceLanguage": "PHP" + }, + "contextRegion": { + "startLine": 56, + "startColumn": 1, + "charOffset": 1411, + "charLength": 201, + "snippet": { + "text": "\n if ('iterator' === $exprRaw['name']) {\n $status = $this->compileIterator($exprRaw, $compilationContext);\n if (false !== $status) {\n return;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c309cf8155e3555a8293a95cea9a2d4131cf63c8f3d9fcf1da18f10d6098efd7" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "PhpVulnerablePathsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "Vulnerable code flow", + "markdown": "Vulnerable code flow" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "templates/Api/themes/zephir/partials/source.phtml", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 43, + "startColumn": 1, + "charOffset": 1286, + "charLength": 139, + "snippet": { + "text": "\n\n\n
\n    getFilePath())) ?>\n
\n" + }, + "sourceLanguage": "PHP" + } + }, + "relationships": [ + { + "target": 1, + "kinds": [ + "includes" + ] + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "fbb12c6cf95fa45eb8c42c7f3119388a9694f22ad8284953aea3ca7e796a1015" + }, + "graphs": [ + { + "nodes": [ + { + "id": "1", + "location": { + "physicalLocation": { + "artifactLocation": { + "uri": "templates/Api/themes/zephir/partials/source.phtml", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 47, + "startColumn": 9, + "charOffset": 1357, + "charLength": 57, + "snippet": { + "text": "file_get_contents(realpath($compilerFile->getFilePath()))" + }, + "sourceLanguage": "PHP" + } + } + }, + "properties": { + "successors": [], + "predecessors": [], + "sanitized_vulnerabilities": [] + } + } + ], + "edges": [] + } + ], + "properties": { + "sources": [ + { + "file": "file://$PROJECT_DIR$/templates/Api/themes/zephir/partials/source.phtml", + "sanitized_vulnerabilities": [], + "text": "file_get_contents(realpath($compilerFile->getFilePath()))", + "order": "1" + } + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "sink": { + "text": "file_get_contents(realpath($compilerFile->getFilePath()))", + "fqn": "\\echo", + "vulnerabilities": [ + "XSS" + ] + }, + "tags": [ + "PHP" + ] + } + }, + { + "ruleId": "RegExpRedundantEscape", + "kind": "fail", + "level": "warning", + "message": { + "text": "Redundant character escape '\\#' in RegExp", + "markdown": "Redundant character escape `\\#` in RegExp" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2071, + "startColumn": 35, + "charOffset": 68885, + "charLength": 2, + "snippet": { + "text": "\\#" + }, + "sourceLanguage": "RegExp" + }, + "contextRegion": { + "startLine": 2069, + "startColumn": 1, + "charOffset": 68794, + "charLength": 259, + "snippet": { + "text": "\n foreach (file($constantsSource) as $line) {\n if (preg_match('/^\\#define[ \\t]+([A-Z0-9\\_]+)[ \\t]+([0-9]+)/', $line, $matches)) {\n $this->constants[$matches[1]] = ['int', $matches[2]];\n continue;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "55bbe496b5d7b31ec881efa363c7fc2800d4b622b1a7a215f3c8526d555347e2" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "RegExp" + ] + } + }, + { + "ruleId": "RegExpRedundantEscape", + "kind": "fail", + "level": "warning", + "message": { + "text": "Redundant character escape '\\_' in RegExp", + "markdown": "Redundant character escape `\\_` in RegExp" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2071, + "startColumn": 57, + "charOffset": 68907, + "charLength": 2, + "snippet": { + "text": "\\_" + }, + "sourceLanguage": "RegExp" + }, + "contextRegion": { + "startLine": 2069, + "startColumn": 1, + "charOffset": 68794, + "charLength": 259, + "snippet": { + "text": "\n foreach (file($constantsSource) as $line) {\n if (preg_match('/^\\#define[ \\t]+([A-Z0-9\\_]+)[ \\t]+([0-9]+)/', $line, $matches)) {\n $this->constants[$matches[1]] = ['int', $matches[2]];\n continue;" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "751dad78fca54e75105b6adc237c62bcd464d72357db6941134cab983be194ba" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "RegExp" + ] + } + }, + { + "ruleId": "RegExpRedundantEscape", + "kind": "fail", + "level": "warning", + "message": { + "text": "Redundant character escape '\\_' in RegExp", + "markdown": "Redundant character escape `\\_` in RegExp" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2075, + "startColumn": 57, + "charOffset": 69128, + "charLength": 2, + "snippet": { + "text": "\\_" + }, + "sourceLanguage": "RegExp" + }, + "contextRegion": { + "startLine": 2073, + "startColumn": 1, + "charOffset": 69024, + "charLength": 243, + "snippet": { + "text": " continue;\n }\n if (preg_match('/^\\#define[ \\t]+([A-Z0-9\\_]+)[ \\t]+(\\'(.){1}\\')/', $line, $matches)) {\n $this->constants[$matches[1]] = ['char', $matches[3]];\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "8797007a4c93c2bf1eca29dfb7ecdde078c9816b9cd75cb3d608c5e5ef08ffab" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "RegExp" + ] + } + }, + { + "ruleId": "RegExpRedundantEscape", + "kind": "fail", + "level": "warning", + "message": { + "text": "Redundant character escape '\\#' in RegExp", + "markdown": "Redundant character escape `\\#` in RegExp" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2075, + "startColumn": 35, + "charOffset": 69106, + "charLength": 2, + "snippet": { + "text": "\\#" + }, + "sourceLanguage": "RegExp" + }, + "contextRegion": { + "startLine": 2073, + "startColumn": 1, + "charOffset": 69024, + "charLength": 243, + "snippet": { + "text": " continue;\n }\n if (preg_match('/^\\#define[ \\t]+([A-Z0-9\\_]+)[ \\t]+(\\'(.){1}\\')/', $line, $matches)) {\n $this->constants[$matches[1]] = ['char', $matches[3]];\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "c6b165008e5487e1323819e02bb04a6abf9fc44738213f81258a1d2a9ce42ba3" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High", + "tags": [ + "RegExp" + ] + } + }, + { + "ruleId": "RegExpSimplifiable", + "kind": "fail", + "level": "note", + "message": { + "text": "'{1}' is redundant", + "markdown": "`{1}` is redundant" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "src/Compiler.php", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 2075, + "startColumn": 74, + "charOffset": 69145, + "charLength": 3, + "snippet": { + "text": "{1}" + }, + "sourceLanguage": "RegExp" + }, + "contextRegion": { + "startLine": 2073, + "startColumn": 1, + "charOffset": 69024, + "charLength": 243, + "snippet": { + "text": " continue;\n }\n if (preg_match('/^\\#define[ \\t]+([A-Z0-9\\_]+)[ \\t]+(\\'(.){1}\\')/', $line, $matches)) {\n $this->constants[$matches[1]] = ['char', $matches[3]];\n }" + }, + "sourceLanguage": "PHP" + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "project", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "a6493845445e0e7b4ef35d1e59bb8c6b9ca5f7f5b1c1818ff054db58a267f1cf" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate", + "tags": [ + "RegExp" + ] + } + } + ], + "automationDetails": { + "id": "project/qodana/2023-12-07", + "guid": "a73614b4-eeb6-4985-99a4-296503f9a841", + "properties": { + "jobUrl": "" + } + }, + "newlineSequences": [ + "\r\n", + "\n" + ], + "properties": { + "configProfile": "recommended", + "deviceId": "200820300000000-7ae6-504a-cf1a-901f5dd50b66" + } + } + ] +} \ No newline at end of file diff --git a/qodana.yaml b/qodana.yaml new file mode 100644 index 0000000000..5b01e8c468 --- /dev/null +++ b/qodana.yaml @@ -0,0 +1,47 @@ +#-------------------------------------------------------------------------------# +# Qodana analysis is configured by qodana.yaml file # +# https://www.jetbrains.com/help/qodana/qodana-yaml.html # +#-------------------------------------------------------------------------------# +version: "1.0" + +#Specify inspection profile for code analysis +profile: + name: qodana.recommended +#Enable inspections +#include: +# - name: + +#Disable inspections +#exclude: +# - name: +# paths: +# - + +php: + version: '8.0' #(Applied in CI/CD pipeline) + +#Execute shell command before Qodana execution (Applied in CI/CD pipeline) +#bootstrap: sh ./prepare-qodana.sh + +#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline) +#plugins: +# - id: #(plugin id can be found at https://plugins.jetbrains.com) + +#Specify Qodana linter for analysis (Applied in CI/CD pipeline) +linter: jetbrains/qodana-php:latest +exclude: + - name: All + paths: + - config + - ext + - kernel + - prototypes + - stub + - templates + - tests + - vendor + +include: + - name: CheckDependencyLicenses + - name: PhpVulnerablePathsInspection + - name: VulnerableLibrariesGlobal diff --git a/Library/AliasManager.php b/src/AliasManager.php similarity index 84% rename from Library/AliasManager.php rename to src/AliasManager.php index 4d82afe664..53bf1eb8cf 100644 --- a/Library/AliasManager.php +++ b/src/AliasManager.php @@ -13,7 +13,12 @@ namespace Zephir; +use function array_flip; +use function array_keys; +use function count; +use function explode; use function in_array; +use function trim; /** * Manage aliases in a file @@ -24,8 +29,6 @@ final class AliasManager /** * Adds a renaming in a "use" to the alias manager. - * - * @param array $useStatement */ public function add(array $useStatement): void { @@ -36,52 +39,24 @@ public function add(array $useStatement): void } } - /** - * Checks if a class name is an existing alias. - * - * @param string $alias - * - * @return bool - */ - public function isAlias(string $alias): bool - { - return isset($this->aliases[$alias]); - } - /** * Returns the class name according to an existing alias. - * - * @param string $alias - * - * @return string */ public function getAlias(string $alias): string { return $this->aliases[$alias]; } - /** - * Returns key-value pair of aliases. - * - * @return array - */ - public function getAliases(): array - { - return $this->aliases; - } - /** * Returns alias by fully qualified class name. * * @param string $className - fully qualified class name - * - * @return string */ public function getAliasForClassName(string $className): string { $keys = array_keys($this->aliases, trim($className, '\\')); - if (1 === \count($keys)) { + if (1 === count($keys)) { return $keys[0]; } @@ -89,51 +64,59 @@ public function getAliasForClassName(string $className): string } /** - * Check if class name use an aliasing in use statement. - * - * ex: use Events\ManagerInterface as EventsManagerInterface; - * - * @param string $alias - * - * @return bool + * Returns key-value pair of aliases. */ - public function isUseStatementAliased(string $alias): bool + public function getAliases(): array { - if ($this->isAlias($alias)) { - return $alias !== $this->implicitAlias($this->getAlias($alias)); - } + return $this->aliases; + } - return false; + /** + * Checks if a class name is an existing alias. + */ + public function isAlias(string $alias): bool + { + return isset($this->aliases[$alias]); } /** * Check if class name has explicit alias in `use` declaration. * * @param string $className - fully qualified class name - * - * @return bool */ public function isAliasPresentFor(string $className): bool { $extractAlias = $this->implicitAlias($className); $isClassDeclared = in_array($className, $this->aliases); - $classAlias = array_flip($this->aliases)[$className] ?? null; + $classAlias = array_flip($this->aliases)[$className] ?? null; return $isClassDeclared && $classAlias !== $extractAlias; } + /** + * Check if class name use an aliasing in use statement. + * + * ex: use Events\ManagerInterface as EventsManagerInterface; + */ + public function isUseStatementAliased(string $alias): bool + { + if ($this->isAlias($alias)) { + return $alias !== $this->implicitAlias($this->getAlias($alias)); + } + + return false; + } + /** * Extract implicit alias from use statement. * * @param string $className - FQCN or simple class name from use statement - * - * @return string */ private function implicitAlias(string $className): string { $parts = explode('\\', $className); - return $parts[\count($parts) - 1]; + return $parts[count($parts) - 1]; } } diff --git a/src/Backend/Backend.php b/src/Backend/Backend.php new file mode 100644 index 0000000000..d7f09bc5c5 --- /dev/null +++ b/src/Backend/Backend.php @@ -0,0 +1,2118 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Backend; + +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; +use Zephir\Code\Printer; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Compiler; +use Zephir\Config; +use Zephir\Exception; +use Zephir\Exception\CompilerException; +use Zephir\FunctionDefinition; +use Zephir\GlobalConstant; +use Zephir\Name; +use Zephir\Variable\Globals; +use Zephir\Variable\Variable; + +use function array_reverse; +use function count; +use function file_get_contents; +use function implode; +use function in_array; +use function is_array; +use function is_object; +use function rtrim; +use function sprintf; +use function strlen; +use function strtoupper; +use function substr; + +use const PHP_EOL; + +class Backend +{ + protected FcallManagerInterface $fcallManager; + + public function __construct( + protected Config $config, + protected string $kernelsPath, + protected string $templatesPath + ) { + $this->fcallManager = new FcallManager(); + } + + public function addArrayEntry( + Variable $variable, + $key, + $value, + CompilationContext $context, + $statement = null, + $useCodePrinter = true + ): void { + $type = null; + $keyType = 'assoc'; + + if (!isset($key)) { + $keyType = 'append'; + } elseif ($key instanceof CompiledExpression) { + $typeKey = $key->getType(); + if ('variable' === $typeKey || 'mixed' === $typeKey) { + $var = $context->symbolTable->getVariableForRead($key->getCode(), $context); + $typeKey = $var->getType(); + } + if (in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { + $keyType = 'index'; + } + } + if ('null' == $value) { + if (!isset($key)) { + $value = $this->resolveValue('null', $context); + $context->codePrinter->output( + 'zephir_array_append(' . $this->getVariableCode( + $variable + ) . ', ' . $value . ', PH_SEPARATE, "' . Compiler::getShortUserPath( + $statement['file'] + ) . '", ' . $statement['line'] . ');' + ); + + return; + } + } + + switch ($value->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + $type = 'long'; + break; + + case 'double': + $type = 'double'; + break; + + case 'string': + $type = 'stringl'; + break; + + case 'variable': + case 'array': + case 'mixed': + $type = 'zval'; + break; + } + + if (null === $type) { + throw new CompilerException('Unknown type mapping: ' . $value->getType()); + } + + if (isset($key)) { + if ('variable' == $key->getType()) { + $var = $context->symbolTable->getVariableForRead($key->getCode(), $context); + $keyStr = 'string' == $typeKey ? + 'Z_STRVAL_P(' + . $this->getVariableCode($var) + . '), Z_STRLEN_P(' + . $this->getVariableCode($var) + . ')' : + $this->getVariableCode($var); + } else { + $keyStr = 'string' == $key->getType() ? 'SL("' . $key->getCode() . '")' : $key->getCode(); + } + } + + if ('stringl' == $type) { + if ($value instanceof Variable) { + $valueStr = 'Z_STRVAL_P(' + . $this->getVariableCode($value) + . '), Z_STRLEN_P(' + . $this->getVariableCode($value) + . ')'; + } else { + $valueStr = 'SL("' . $value->getCode() . '")'; + } + } elseif ('zval' == $type) { + $valueStr = $this->getVariableCode($value); + } else { + $valueStr = $value->getCode(); + } + + if ('assoc' == $keyType) { + $output = 'add_assoc_' + . $type + . '_ex(' + . $this->getVariableCode($variable) + . ', ' + . $keyStr + . ', ' + . $valueStr + . ');'; + } elseif ('append' == $keyType) { + $output = 'zephir_array_append(' + . $this->getVariableCode($variable) + . ', ' + . $this->resolveValue($value, $context) + . ', PH_SEPARATE, "' + . Compiler::getShortUserPath($statement['file']) + . '", ' + . $statement['line'] + . ');'; + } else { + $output = 'add_index_' + . $type + . '(' + . $this->getVariableCode($variable) + . ', ' + . $keyStr + . ', ' + . $valueStr + . ');'; + } + + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + } + + public function addStaticProperty($classEntry, $property, $value, CompilationContext $context): void + { + $value = $this->resolveValue($value, $context); + $context->codePrinter->output( + 'zephir_add_static_property_ce(' + . $classEntry + . ', ZEND_STRL("' + . $property + . '"), ' + . $value + . ');' + ); + } + + public function arrayFetch( + Variable $var, + Variable $src, + $index, + $flags, + $arrayAccess, + CompilationContext $context, + $useCodePrinter = true + ) { + $context->headersManager->add('kernel/array'); + $isVariable = $index instanceof Variable; + + switch ($index->getType()) { + case 'int': + case 'uint': + case 'long': + $type = 'long'; + break; + + /* Types which map to the same */ + case 'variable': + case 'mixed': + case 'string': + $type = $index->getType(); + break; + + default: + throw new CompilerException( + sprintf('Variable type: %s cannot be used as array index without cast', $index->getType()), + $arrayAccess['right'] + ); + } + if ($isVariable && in_array($index->getType(), ['variable', 'string', 'mixed'])) { + $output = 'zephir_array_fetch(' + . $this->getVariableCode($var) + . ', ' + . $this->getVariableCode($src) + . ', ' + . $this->getVariableCode($index) + . ', ' + . $flags + . ', "' + . Compiler::getShortUserPath($arrayAccess['file']) + . '", ' + . $arrayAccess['line'] + . ');'; + } else { + if ($isVariable) { + $indexAccess = $this->getVariableCode($index); + } else { + $indexAccess = $index->getCode(); + if ('string' == $type) { + $indexAccess = 'SL("' . $indexAccess . '")'; + } + } + $output = 'zephir_array_fetch_' + . $type + . '(' + . $this->getVariableCode($var) + . ', ' + . $this->getVariableCode($src) + . ', ' + . $indexAccess + . ', ' + . $flags + . ', "' + . Compiler::getShortUserPath($arrayAccess['file']) + . '", ' + . $arrayAccess['line'] + . ');'; + } + + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + + public function arrayIsset(Variable $var, $resolvedExpr, $expression, CompilationContext $context) + { + if (!($resolvedExpr instanceof Variable)) { + if ('string' == $resolvedExpr->getType()) { + return new CompiledExpression( + 'bool', + 'zephir_array_isset_string(' + . $this->getVariableCode($var) + . ', SL("' + . $resolvedExpr->getCode() + . '"))', + $expression + ); + } + } + + return $this->arrayIsset2($var, $resolvedExpr, $expression, $context); + } + + public function arrayIsset2(Variable $var, $resolvedExpr, $expression, CompilationContext $context) + { + if (!($resolvedExpr instanceof Variable)) { + if ('string' == $resolvedExpr->getType()) { + return new CompiledExpression( + 'bool', + 'zephir_array_isset_string(' + . $this->getVariableCode($var) + . ', SS("' + . $resolvedExpr->getCode() + . '"))', + $expression + ); + } else { + return new CompiledExpression( + 'bool', + 'zephir_array_isset_long(' + . $this->getVariableCode($var) + . ', ' + . $resolvedExpr->getCode() . ')', + $expression + ); + } + } + + if ('int' == $resolvedExpr->getType() || 'long' == $resolvedExpr->getType()) { + return new CompiledExpression( + 'bool', + 'zephir_array_isset_long(' + . $this->getVariableCode($var) + . ', ' + . $this->getVariableCode($resolvedExpr) + . ')', + $expression + ); + } elseif ( + 'variable' == $resolvedExpr->getType() || + 'string' == $resolvedExpr->getType() || + 'mixed' === $resolvedExpr->getType() + ) { + return new CompiledExpression( + 'bool', + 'zephir_array_isset(' . $this->getVariableCode($var) . ', ' . $this->getVariableCode( + $resolvedExpr + ) . ')', + $expression + ); + } + + throw new CompilerException('[' . $resolvedExpr->getType() . ']', $expression); + } + + public function arrayIssetFetch( + Variable $target, + Variable $var, + $resolvedExpr, + $flags, + $expression, + CompilationContext $context + ) { + if (!($resolvedExpr instanceof Variable)) { + $code = $this->getVariableCode($target) . ', ' . $this->getVariableCode($var); + if ('string' == $resolvedExpr->getType()) { + return new CompiledExpression( + 'bool', + 'zephir_array_isset_string_fetch(' + . $code + . ', SL("' + . $resolvedExpr->getCode() + . '"), ' + . $flags + . ')', + $expression + ); + } + } + + return $this->arrayIssetFetch2($target, $var, $resolvedExpr, $flags, $expression, $context); + } + + public function arrayIssetFetch2( + Variable $target, + Variable $var, + $resolvedExpr, + $flags, + $expression, + CompilationContext $context + ) { + $code = $this->getVariableCode($target) . ', ' . $this->getVariableCode($var); + + if (!($resolvedExpr instanceof Variable)) { + if ('string' === $resolvedExpr->getType()) { + return new CompiledExpression( + 'bool', + 'zephir_array_isset_string_fetch(' . $code . ', SS("' . $resolvedExpr->getCode( + ) . '"), ' . $flags . ')', + $expression + ); + } elseif (in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { + return new CompiledExpression( + 'bool', + 'zephir_array_isset_long_fetch(' . $code . ', ' . $resolvedExpr->getCode() . ', ' . $flags . ')', + $expression + ); + } else { + $resolvedExpr = $context->symbolTable->getVariableForRead($resolvedExpr->getCode(), $context); + } + } + + if (in_array($resolvedExpr->getType(), ['int', 'long'])) { + return new CompiledExpression( + 'bool', + 'zephir_array_isset_long_fetch(' . $code . ', ' . $this->getVariableCode( + $resolvedExpr + ) . ', ' . $flags . ')', + $expression + ); + } elseif (in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { + return new CompiledExpression( + 'bool', + 'zephir_array_isset_fetch(' . $code . ', ' . $this->getVariableCode( + $resolvedExpr + ) . ', ' . $flags . ')', + $expression + ); + } + + throw new CompilerException('arrayIssetFetch [' . $resolvedExpr->getType() . ']', $expression); + } + + public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationContext $context): void + { + $context->headersManager->add('kernel/array'); + $variableCode = $this->getVariableCode($variable); + if ('string' == $exprIndex->getType()) { + $context->codePrinter->output( + 'zephir_array_unset_string(' . $variableCode . ', SL("' . $exprIndex->getCode() . '"), ' . $flags . ');' + ); + + return; + } + + $this->arrayUnset2($variable, $exprIndex, $flags, $context); + } + + public function arrayUnset2(Variable $variable, $exprIndex, $flags, CompilationContext $context): void + { + $context->headersManager->add('kernel/array'); + $variableCode = $this->getVariableCode($variable); + switch ($exprIndex->getType()) { + case 'int': + case 'uint': + case 'long': + $context->codePrinter->output( + 'zephir_array_unset_long(' . $variableCode . ', ' . $exprIndex->getCode() . ', ' . $flags . ');' + ); + break; + + case 'string': + $context->codePrinter->output( + 'zephir_array_unset_string(' . $variableCode . ', SS("' . $exprIndex->getCode( + ) . '"), ' . $flags . ');' + ); + break; + + case 'variable': + $variableIndex = $context->symbolTable->getVariableForRead( + $exprIndex->getCode(), + $context, + $exprIndex->getOriginal() + ); + $indexCode = $this->getVariableCode($variableIndex); + switch ($variableIndex->getType()) { + case 'int': + case 'uint': + case 'long': + $context->codePrinter->output( + 'zephir_array_unset_long(' . $variableCode . ', ' . $indexCode . ', ' . $flags . ');' + ); + break; + + case 'string': + case 'variable': + case 'mixed': + $context->codePrinter->output( + 'zephir_array_unset(' . $variableCode . ', ' . $indexCode . ', ' . $flags . ');' + ); + break; + + default: + throw new CompilerException( + 'Variable type: ' . $variableIndex->getType( + ) . ' cannot be used as array index without cast' + ); + } + break; + + default: + throw new CompilerException( + 'Cannot use expression: ' . $exprIndex->getType() . ' as array index without cast' + ); + } + } + + public function assignArrayMulti( + Variable $variable, + $symbolVariable, + $offsetExprs, + CompilationContext $compilationContext + ): void { + [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext); + + $symbol = $this->resolveValue($symbolVariable, $compilationContext, true); + $varCode = $this->getVariableCode($variable); + $compilationContext->codePrinter->output( + sprintf( + 'zephir_array_update_multi(%s, %s, SL("%s"), %d, %s);', + $varCode, + $symbol, + $keys, + $numberParams, + implode(', ', $offsetItems) + ) + ); + } + + public function assignArrayProperty(Variable $variable, $property, $key, $value, CompilationContext $context): void + { + $resolveValue = $this->resolveValue($value, $context); + if (isset($key)) { + $context->codePrinter->output( + 'zephir_update_property_array(' . $this->getVariableCode( + $variable + ) . ', SL("' . $property . '"), ' . $this->getVariableCode($key) . ', ' . $resolveValue . ');' + ); + } else { + $context->codePrinter->output( + 'zephir_update_property_array_append(' . $this->getVariableCode( + $variable + ) . ', SL("' . $property . '"), ' . $resolveValue . ');' + ); + } + } + + public function assignBool(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) + { + return $this->assignHelper('ZVAL_BOOL', $this->getVariableCode($variable), $value, $context, $useCodePrinter); + } + + public function assignDouble(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) + { + return $this->assignHelper('ZVAL_DOUBLE', $this->getVariableCode($variable), $value, $context, $useCodePrinter); + } + + public function assignLong(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) + { + return $this->assignHelper('ZVAL_LONG', $this->getVariableCode($variable), $value, $context, $useCodePrinter); + } + + public function assignNull(Variable $variable, CompilationContext $context, $useCodePrinter = true) + { + $output = 'ZVAL_NULL(' . $this->getVariableCode($variable) . ');'; + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + + public function assignPropertyArrayMulti( + Variable $variable, + $valueVariable, + $propertyName, + $offsetExprs, + CompilationContext $compilationContext + ): void { + [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext); + $valueVariable = $this->resolveValue($valueVariable, $compilationContext); + $variable->setUsed(true); + + $compilationContext->codePrinter->output( + sprintf( + 'zephir_update_property_array_multi(%s, SL("%s"), %s, SL("%s"), %d, %s);', + $variable->getName(), + $propertyName, + $valueVariable, + $keys, + $numberParams, + implode(', ', $offsetItems) + ) + ); + } + + public function assignStaticPropertyArrayMulti( + $classEntry, + $valueVariable, + $propertyName, + $offsetExprs, + CompilationContext $compilationContext + ): void { + [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext); + $valueVariable = $this->resolveValue($valueVariable, $compilationContext); + + $offsetStr = $offsetItems ? ', ' . implode(', ', $offsetItems) : ''; + $compilationContext->codePrinter->output( + sprintf( + 'zephir_update_static_property_array_multi_ce(%s, SL("%s"), %s, SL("%s"), %d%s);', + $classEntry, + $propertyName, + $valueVariable, + $keys, + $numberParams, + $offsetStr + ) + ); + } + + /** + * @param Variable $variable + * @param string|Variable|null $value + * @param CompilationContext $context + * @param bool $useCodePrinter + * + * @return string + */ + public function assignString( + Variable $variable, + $value, + CompilationContext $context, + bool $useCodePrinter = true + ): string { + return $this->assignHelper( + 'ZVAL_STRING', + $this->getVariableCode($variable), + $value, + $context, + $useCodePrinter + ); + } + + /** + * Assigns a zval to another. + * + * @param Variable $variable + * @param string $code + * @param CompilationContext $context + */ + public function assignZval(Variable $variable, $code, CompilationContext $context): void + { + $code = $this->resolveValue($code, $context); + if (!$variable->isDoublePointer()) { + $context->symbolTable->mustGrownStack(true); + $symbolVariable = $this->getVariableCode($variable); + $context->codePrinter->output('ZEPHIR_OBS_COPY_OR_DUP(' . $symbolVariable . ', ' . $code . ');'); + } else { + $context->codePrinter->output($variable->getName() . ' = ' . $code . ';'); + } + } + + public function callDynamicFunction( + $symbolVariable, + Variable $variable, + CompilationContext $context, + $params = [], + $cache = 'NULL', + $cacheSlot = 0 + ): void { + $paramStr = null != $params ? ', ' . implode(', ', $params) : ''; + if (!isset($symbolVariable)) { + $context->codePrinter->output( + 'ZEPHIR_CALL_ZVAL_FUNCTION(NULL, ' . $this->getVariableCode( + $variable + ) . ', ' . $cache . ', ' . $cacheSlot . $paramStr . ');' + ); + } elseif ('return_value' == $symbolVariable->getName()) { + $context->codePrinter->output( + 'ZEPHIR_RETURN_CALL_ZVAL_FUNCTION(' . $this->getVariableCode( + $variable + ) . ', ' . $cache . ', ' . $cacheSlot . $paramStr . ');' + ); + } else { + $context->codePrinter->output( + 'ZEPHIR_CALL_ZVAL_FUNCTION(' . $this->getVariableCode($symbolVariable) . ', ' . $this->getVariableCode( + $variable + ) . ', ' . $cache . ', ' . $cacheSlot . $paramStr . ');' + ); + } + } + + public function callMethod( + $symbolVariable, + Variable $variable, + $methodName, + $cachePointer, + $params, + CompilationContext $context + ): void { + $paramStr = null != $params ? ', ' . implode(', ', $params) : ''; + $macro = 'CALL_METHOD'; + if ($methodName instanceof Variable) { + $macro = 'CALL_METHOD_ZVAL'; + $methodName = $this->getVariableCode($methodName); + } else { + $methodName = '"' . $methodName . '"'; + } + + if (!isset($symbolVariable)) { + $context->codePrinter->output( + 'ZEPHIR_' . $macro . '(NULL, ' . $this->getVariableCode( + $variable + ) . ', ' . $methodName . ', ' . $cachePointer . $paramStr . ');' + ); + } elseif ('return_value' == $symbolVariable->getName()) { + $context->codePrinter->output( + 'ZEPHIR_RETURN_' . $macro . '(' . $this->getVariableCode( + $variable + ) . ', ' . $methodName . ', ' . $cachePointer . $paramStr . ');' + ); + } else { + $symbol = $this->getVariableCode($symbolVariable); + $context->codePrinter->output( + 'ZEPHIR_' . $macro . '(' . $symbol . ', ' . $this->getVariableCode( + $variable + ) . ', ' . $methodName . ', ' . $cachePointer . $paramStr . ');' + ); + } + } + + public function checkConstructor(Variable $var, CompilationContext $context): void + { + $context->codePrinter->output('if (zephir_has_constructor(' . $this->getVariableCode($var) . ')) {'); + } + + public function checkStrictType($type, $var, CompilationContext $context): void + { + $codePrinter = $context->codePrinter; + $conditions = []; + + $inputParamVariable = $context->symbolTable->getVariableForWrite($var['name'], $context); + $inputParamCode = $this->getVariableCode($inputParamVariable); + $cond = 'Z_TYPE_P(' . $inputParamCode . ') != '; + if ($context->symbolTable->hasVariable($var['name'] . '_param')) { + $parameterVariable = $context->symbolTable->getVariableForWrite($var['name'] . '_param', $context); + $parameterCode = $context->backend->getVariableCode($parameterVariable); + $cond = 'Z_TYPE_P(' . $parameterCode . ') != '; + } + + switch ($type) { + case 'int': + case 'uint': + case 'long': + $conditions[] = $cond . 'IS_LONG'; + break; + case 'bool': + $conditions[] = $cond . 'IS_TRUE'; + $conditions[] = $cond . 'IS_FALSE'; + break; + case 'double': + $conditions[] = $cond . 'IS_DOUBLE'; + break; + case 'string': + case 'ulong': + $conditions[] = $cond . 'IS_STRING'; + $conditions[] = $cond . 'IS_NULL'; + break; + case 'array': + break; + case 'object': + case 'resource': + $conditions[] = $cond . 'IS_' . strtoupper($type); + break; + case 'callable': + $conditions[] = 'zephir_is_callable(' . $inputParamCode . ') != 1'; + break; + default: + throw new CompilerException('Unknown type ' . $type); + } + + /* Generate verification code */ + if (count($conditions)) { + $codePrinter->output('if (UNEXPECTED(' . implode(' && ', $conditions) . ')) {'); + $codePrinter->increaseLevel(); + + $exceptionMessage = sprintf('SL("Parameter \'%s\' must be of the type %s")', $var['name'], $type); + $codePrinter->output( + sprintf( + 'zephir_throw_exception_string(spl_ce_InvalidArgumentException, %s);', + $exceptionMessage + ) + ); + + $codePrinter->output('RETURN_MM_NULL();'); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + } + + /* Assign param */ + switch ($type) { + case 'int': + case 'long': + $codePrinter->output($var['name'] . ' = Z_LVAL_P(' . $parameterCode . ');'); + break; + case 'uint': + $codePrinter->output($var['name'] . ' = ZEND_ABS(Z_LVAL_P(' . $parameterCode . '));'); + break; + case 'bool': + $codePrinter->output( + $var['name'] . ' = ' . $this->getBoolCode($parameterVariable, $context, false) . ';' + ); + break; + case 'double': + $codePrinter->output($var['name'] . ' = Z_DVAL_P(' . $parameterCode . ');'); + break; + case 'string': + case 'ulong': + $context->headersManager->add('kernel/operators'); + $context->symbolTable->mustGrownStack(true); + $codePrinter->output('if (EXPECTED(Z_TYPE_P(' . $parameterCode . ') == IS_STRING)) {'); + $codePrinter->increaseLevel(); + $targetVar = $var['name']; + $targetVar = '&' . $targetVar; + $codePrinter->output('zephir_get_strval(' . $targetVar . ', ' . $var['name'] . '_param);'); + $codePrinter->decreaseLevel(); + $codePrinter->output('} else {'); + $codePrinter->increaseLevel(); + $this->initVar($inputParamVariable, $context); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + break; + case 'array': + $context->backend->assignZval($inputParamVariable, $parameterVariable, $context); + break; + case 'object': + case 'resource': + case 'callable': + case 'mixed': + break; + default: + throw new CompilerException('Unknown type: ' . $type); + } + } + + public function concatSelf(Variable $variable, Variable $itemVariable, CompilationContext $context): void + { + $variable = $this->getVariableCode($variable); + $itemVariable = $this->getVariableCode($itemVariable); + $context->codePrinter->output('zephir_concat_self(' . $variable . ', ' . $itemVariable . ');'); + } + + public function copyOnWrite(Variable $target, $var, CompilationContext $context): void + { + if ('EG(exception)' === $var) { + $context->codePrinter->output('ZVAL_OBJ(' . $this->getVariableCode($target) . ', EG(exception));'); + $context->codePrinter->output('Z_ADDREF_P(' . $this->getVariableCode($target) . ');'); + + return; + } + + $globalsManager = new Globals(); + + if ($globalsManager->isSuperGlobal($target->getName())) { + $context->codePrinter->output( + sprintf( + 'ZEPHIR_HASH_COPY(%s, %s);', + $this->getVariableCode($target), + $this->resolveValue($var, $context) + ) + ); + } else { + $context->codePrinter->output( + sprintf( + 'ZEPHIR_CPY_WRT(%s, %s);', + $this->getVariableCode($target), + $this->resolveValue($var, $context) + ) + ); + } + } + + public function createClosure(Variable $variable, $classDefinition, CompilationContext $context): void + { + $symbol = $this->getVariableCode($variable); + $context->codePrinter->output( + 'zephir_create_closure_ex(' . $symbol . ', NULL, ' . $classDefinition->getClassEntry( + ) . ', SL("__invoke"));' + ); + } + + public function declareConstant($type, $name, $value, CompilationContext $context): void + { + $ce = $context->classDefinition->getClassEntry($context); + + $dType = null; + switch ($type) { + case 'bool': + $value = 'false' == $value ? '0' : 1; + break; + + case 'long': + case 'int': + $dType = 'long'; + break; + + case 'double': + break; + + case 'string': + case 'char': + if ('string' == $type || 'char' == $type) { + $value = '"' . Name::addSlashes($value) . '"'; + } + $dType = 'string'; + break; + } + + if (!isset($dType)) { + $dType = $type; + } + + if ('null' == $dType) { + $context->codePrinter->output('zephir_declare_class_constant_null(' . $ce . ', SL("' . $name . '"));'); + } else { + $context->codePrinter->output( + 'zephir_declare_class_constant_' . $dType . '(' . $ce . ', SL("' . $name . '"), ' . $value . ');' + ); + } + } + + public function declareVariables($method, $typeToVariables) + { + $varInitCode = []; + $additionalCode = $method ? $this->onPreInitVar($method) : ''; + + foreach ($typeToVariables as $type => $variables) { + [$pointer, $code] = $this->getTypeDefinition($type); + $code .= ' '; + $groupVariables = []; + + /** + * @var Variable[] $variables + */ + foreach ($variables as $variable) { + $nextCode = $this->generateInitCode($groupVariables, $type, $pointer, $variable); + if ($nextCode && $additionalCode) { + $additionalCode .= PHP_EOL . $nextCode; + } else { + $additionalCode .= $nextCode; + } + } + + $varInitCode[] = $code . implode(', ', $groupVariables) . ';'; + } + + /* Keep order consistent with previous zephir versions (BC-only) */ + $varInitCode = array_reverse($varInitCode); + if ($additionalCode) { + $varInitCode[] = $additionalCode; + } + + return $varInitCode; + } + + public function destroyIterator(Variable $iteratorVariable, CompilationContext $context): void + { + $context->codePrinter->output('zend_iterator_dtor(' . $iteratorVariable->getName() . ');'); + } + + public function fetchClass(Variable $zendClassEntry, $className, $guarded, CompilationContext $context): void + { + $context->headersManager->add('kernel/object'); + if ($guarded) { + $context->codePrinter->output('if (!' . $zendClassEntry->getName() . ') {'); + } + $context->codePrinter->output( + $zendClassEntry->getName() . ' = zephir_fetch_class_str_ex(' . $className . ', ZEND_FETCH_CLASS_AUTO);' + ); + if ($guarded) { + $context->codePrinter->output('}'); + } + } + + public function fetchClassEntry(string $str): string + { + return 'zephir_get_internal_ce(SL("' . $str . '"))'; + } + + public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true) + { + $name = $globalVar->getName(); + $output = strtr('zephir_get_global(&:name, SL(":name"));', [':name' => $name]); + + if ($useCodePrinter) { + $compilationContext->codePrinter->output($output); + } + + return $output; + } + + /** + * @param Variable $symbolVariable + * @param Variable $variableVariable + * @param Variable|string $property + * @param bool $readOnly + * @param CompilationContext $context + * + * @return void + */ + public function fetchProperty( + Variable $symbolVariable, + Variable $variableVariable, + $property, + $readOnly, + CompilationContext $context + ): void { + $flags = 'PH_NOISY_CC'; + if ($readOnly) { + $flags .= ' | PH_READONLY'; + } + + $variableCode = $this->getVariableCode($variableVariable); + $symbol = $this->getVariableCode($symbolVariable); + + if ($property instanceof Variable) { + $context->codePrinter->output( + sprintf( + 'zephir_read_property_zval(%s, %s, %s, %s);', + $symbol, + $variableCode, + $this->getVariableCode($property), + $flags + ) + ); + + return; + } + + $template = 'zephir_read_property(%s, %s, ZEND_STRL("%s"), %s);'; + /* Are we going to init default object property value? */ + if ($context->currentMethod && $context->currentMethod->isInitializer()) { + $template = 'zephir_read_property_ex(%s, %s, ZEND_STRL("%s"), %s);'; + } + + $context->codePrinter->output( + sprintf($template, $symbol, $variableCode, $property, $flags) + ); + } + + /** + * @param Variable $symbolVariable + * @param Definition $classDefinition + * @param $property + * @param bool $readOnly + * @param CompilationContext $context + * + * @throws Exception + */ + public function fetchStaticProperty( + Variable $symbolVariable, + $classDefinition, + $property, + $readOnly, + CompilationContext $context + ): void { + // TODO: maybe optimizations as well as above + $context->codePrinter->output( + sprintf( + 'zephir_read_static_property_ce(%s%s, %s, SL("%s"), PH_NOISY_CC%s);', + $symbolVariable->isDoublePointer() ? '' : '&', + $symbolVariable->getName(), + $classDefinition->getClassEntry(), + $property, + $readOnly ? ' | PH_READONLY' : '' + ) + ); + } + + public function forStatement( + Variable $exprVariable, + $keyVariable, + $variable, + $duplicateKey, + $duplicateHash, + $statement, + $statementBlock, + CompilationContext $compilationContext + ): void { + /** + * Create a temporary zval to fetch the items from the hash. + */ + $compilationContext->headersManager->add('kernel/fcall'); + $compilationContext->symbolTable->mustGrownStack(true); + if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_LAST_CALL_STATUS')) { + $callStatus = new Variable( + 'int', + 'ZEPHIR_LAST_CALL_STATUS', + $compilationContext->branchManager->getCurrentBranch() + ); + $callStatus->setIsInitialized(true, $compilationContext); + $callStatus->increaseUses(); + $callStatus->setReadOnly(true); + $compilationContext->symbolTable->addRawVariable($callStatus); + } + $tempVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); + $tempVariable->setIsDoublePointer(true); + $tempValidVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); + $codePrinter = $compilationContext->codePrinter; + + $codePrinter->output( + 'zephir_is_iterable(' . $this->getVariableCode( + $exprVariable + ) . ', ' . $duplicateHash . ', "' . Compiler::getShortUserPath( + $statement['file'] + ) . '", ' . $statement['line'] . ');' + ); + + $codePrinter->output('if (Z_TYPE_P(' . $this->getVariableCode($exprVariable) . ') == IS_ARRAY) {'); + $codePrinter->increaseLevel(); + + $reverse = $statement['reverse'] ? 'REVERSE_' : ''; + + if (isset($keyVariable)) { + $arrayNumKey = $compilationContext->symbolTable->addTemp('zend_ulong', $compilationContext); + $arrayStrKey = $compilationContext->symbolTable->addTemp('zend_string', $compilationContext); + } + + if (isset($keyVariable) && isset($variable)) { + $macro = 'ZEND_HASH_' . $reverse . 'FOREACH_KEY_VAL'; + $codePrinter->output( + $macro . '(Z_ARRVAL_P(' . $this->getVariableCode($exprVariable) . '), ' . $arrayNumKey->getName( + ) . ', ' . $arrayStrKey->getName() . ', ' . $tempVariable->getName() . ')' + ); + } elseif (isset($keyVariable)) { + $macro = 'ZEND_HASH_' . $reverse . 'FOREACH_KEY'; + $codePrinter->output( + $macro . '(Z_ARRVAL_P(' . $this->getVariableCode($exprVariable) . '), ' . $arrayNumKey->getName( + ) . ', ' . $arrayStrKey->getName() . ')' + ); + } else { + $macro = 'ZEND_HASH_' . $reverse . 'FOREACH_VAL'; + $codePrinter->output( + $macro . '(Z_ARRVAL_P(' . $this->getVariableCode($exprVariable) . '), ' . $tempVariable->getName() . ')' + ); + } + + $codePrinter->output('{'); + + if (isset($keyVariable)) { + $codePrinter->increaseLevel(); + if ($duplicateKey) { + $compilationContext->symbolTable->mustGrownStack(true); + $keyVariable->initVariant($compilationContext); + } + $codePrinter->output('if (' . $arrayStrKey->getName() . ' != NULL) { '); + $codePrinter->increaseLevel(); + if ($duplicateKey) { + $codePrinter->output( + 'ZVAL_STR_COPY(' . $this->getVariableCode($keyVariable) . ', ' . $arrayStrKey->getName() . ');' + ); + } else { + $codePrinter->output( + 'ZVAL_STR(' . $this->getVariableCode($keyVariable) . ', ' . $arrayStrKey->getName() . ');' + ); + } + $codePrinter->decreaseLevel(); + $codePrinter->output('} else {'); + $codePrinter->increaseLevel(); + $codePrinter->output( + 'ZVAL_LONG(' . $this->getVariableCode($keyVariable) . ', ' . $arrayNumKey->getName() . ');' + ); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + $codePrinter->decreaseLevel(); + } + + if (isset($variable)) { + $compilationContext->symbolTable->mustGrownStack(true); + $codePrinter->increaseLevel(); + $variable->initVariant($compilationContext); + $codePrinter->output( + 'ZVAL_COPY(' . $this->getVariableCode($variable) . ', ' . $this->getVariableCode($tempVariable) . ');' + ); + $codePrinter->decreaseLevel(); + } + + /** + * Compile statements in the 'for' block + */ + if (isset($statement['statements'])) { + $statementBlock->isLoop(true); + if (isset($statement['key'])) { + $statementBlock->getMutateGatherer()->increaseMutations($statement['key']); + } + $statementBlock->getMutateGatherer()->increaseMutations($statement['value']); + $statementBlock->compile($compilationContext); + } + + $codePrinter->output('} ZEND_HASH_FOREACH_END();'); + $codePrinter->decreaseLevel(); + + $codePrinter->output('} else {'); + $codePrinter->increaseLevel(); + + $codePrinter->output( + 'ZEPHIR_CALL_METHOD(NULL, ' . $this->getVariableCode($exprVariable) . ', "rewind", NULL, 0);' + ); + $codePrinter->output('zephir_check_call_status();'); + + $codePrinter->output('while (1) {'); + $codePrinter->increaseLevel(); + + $codePrinter->output( + 'ZEPHIR_CALL_METHOD(&' . $tempValidVariable->getName() . ', ' . $this->getVariableCode( + $exprVariable + ) . ', "valid", NULL, 0);' + ); + $codePrinter->output('zephir_check_call_status();'); + $codePrinter->output('if (!zend_is_true(&' . $tempValidVariable->getName() . ')) {'); + $codePrinter->increaseLevel(); + $codePrinter->output('break;'); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + + if (isset($keyVariable)) { + $codePrinter->output( + 'ZEPHIR_CALL_METHOD(' . $this->getVariableCode($keyVariable) . ', ' . $this->getVariableCode( + $exprVariable + ) . ', "key", NULL, 0);' + ); + $codePrinter->output('zephir_check_call_status();'); + } + + if (isset($variable)) { + $codePrinter->output( + 'ZEPHIR_CALL_METHOD(' . $this->getVariableCode($variable) . ', ' . $this->getVariableCode( + $exprVariable + ) . ', "current", NULL, 0);' + ); + $codePrinter->output('zephir_check_call_status();'); + } + + if (isset($statement['statements'])) { + $statementBlock->isLoop(true); + if (isset($statement['key'])) { + $statementBlock->getMutateGatherer()->increaseMutations($statement['key']); + } + $statementBlock->getMutateGatherer()->increaseMutations($statement['value']); + $statementBlock->compile($compilationContext); + } + + $codePrinter->output( + 'ZEPHIR_CALL_METHOD(NULL, ' . $this->getVariableCode($exprVariable) . ', "next", NULL, 0);' + ); + $codePrinter->output('zephir_check_call_status();'); + + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + + /* Since we do not observe, still do cleanup */ + $variable?->initVariant($compilationContext); + $keyVariable?->initVariant($compilationContext); + } + + public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable): ?string + { + $isComplex = in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); + + if ($isComplex && !$variable->isDoublePointer()) { + $groupVariables[] = $variable->getName(); + + return match ($variable->getRealname()) { + '__$null' => "\t" . 'ZVAL_NULL(&' . $variable->getName() . ');', + '__$true' => "\t" . 'ZVAL_BOOL(&' . $variable->getName() . ', 1);', + '__$false' => "\t" . 'ZVAL_BOOL(&' . $variable->getName() . ', 0);', + default => "\t" . 'ZVAL_UNDEF(&' . $variable->getName() . ');', + }; + } + + if ($variable->isLocalOnly()) { + $groupVariables[] = $variable->getName(); + + return null; + } + + if ($variable->isSuperGlobal()) { + $groupVariables[] = $variable->getName(); + + return null; + } + + if ($variable->isDoublePointer()) { + /* Double pointers for ZE3 are used as zval * */ + $ptr = $isComplex ? $pointer : $pointer . $pointer; + if ($variable->mustInitNull()) { + $groupVariables[] = $ptr . $variable->getName() . ' = NULL'; + } else { + $groupVariables[] = $ptr . $variable->getName(); + } + + return null; + } + + $defaultValue = $variable->getDefaultInitValue(); + if (null !== $defaultValue) { + switch ($type) { + case 'variable': + case 'string': + case 'array': + case 'resource': + case 'callable': + case 'object': + case 'mixed': + $groupVariables[] = $pointer . $variable->getName(); + break; + + case 'char': + $defaultValue = (string)$defaultValue; + if (strlen($defaultValue) > 4) { + if (strlen($defaultValue) > 10) { + throw new CompilerException( + "Invalid char literal: '" . substr($defaultValue, 0, 10) . "...'", + $variable->getOriginal() + ); + } else { + throw new CompilerException( + "Invalid char literal: '" . $defaultValue . "'", + $variable->getOriginal() + ); + } + } + /* no break */ + + default: + $groupVariables[] = $pointer . $variable->getName() . ' = ' . $defaultValue; + break; + } + + return null; + } + + if ($variable->mustInitNull() && $pointer) { + $groupVariables[] = $pointer . $variable->getName() . ' = NULL'; + + return null; + } + + $groupVariables[] = $pointer . $variable->getName(); + + return null; + } + + public function getBoolCode(Variable $variable, CompilationContext $context, $useCodePrinter = true): string + { + $code = '(Z_TYPE_P(' . $this->getVariableCode($variable) . ') == IS_TRUE)'; + if ($useCodePrinter) { + $context->codePrinter->output($code); + } + + return $code; + } + + public function getFcallManager(): FcallManagerInterface + { + return $this->fcallManager; + } + + /** + * Resolves the path to the source kernel files of the backend. + */ + public function getInternalKernelPath(): string + { + return $this->kernelsPath; + } + + /** + * @param Method $method + * @param CompilationContext $context + * + * @return string + */ + public function getInternalSignature(Method $method, CompilationContext $context): string + { + if ($method->isInitializer() && !$method->isStatic()) { + return 'zend_object *' . $method->getName() . '(zend_class_entry *class_type)'; + } + + if ($method->isInitializer() && $method->isStatic()) { + return 'void ' . $method->getName() . '()'; + } + + $signatureParameters = []; + $parameters = $method->getParameters(); + if (is_object($parameters)) { + foreach ($parameters->getParameters() as $parameter) { + switch ($parameter['data-type']) { + case 'int': + case 'uint': + case 'long': + case 'double': + case 'bool': + case 'char': + case 'uchar': + case 'string': + case 'array': + $signatureParameters[] = 'zval *' . $parameter['name'] . '_param_ext'; + break; + + default: + $signatureParameters[] = 'zval *' . $parameter['name'] . '_ext '; + break; + } + } + } + + $signaturePattern = + 'int ht, zend_execute_data *execute_data, zval *return_value, zval *this_ptr, int return_value_used'; + + if (count($signatureParameters)) { + $signaturePattern = sprintf('%s, %s', $signaturePattern, implode(', ', $signatureParameters)); + } + + return "void {$method->getInternalName()}({$signaturePattern})"; + } + + /** + * @param string $type + * @param CompilationContext $compilationContext + * + * @return Variable + */ + public function getScalarTempVariable( + string $type, + CompilationContext $compilationContext, + ): Variable { + return $compilationContext->symbolTable->getTempNonTrackedVariable($type, $compilationContext); + } + + /** + * Resolves the path to the source template file of the backend. + */ + public function getTemplateFileContents(string $filename): string + { + $templatePath = rtrim((string)$this->config->get('templatepath', 'backend'), '\\/'); + if (empty($templatePath)) { + $templatePath = $this->templatesPath; + } + + return file_get_contents("$templatePath/engine/$filename"); + } + + public function getTypeDefinition($type): array + { + if ($type === 'zend_ulong') { + return ['', 'zend_ulong']; + } elseif ($type === 'zend_string') { + return ['*', 'zend_string']; + } + + $pointer = null; + switch ($type) { + case 'int': + $code = 'zend_long'; + break; + + case 'uint': + $code = 'zend_ulong'; + break; + + case 'char': + $code = 'char'; + break; + + case 'uchar': + $code = 'unsigned char'; + break; + + case 'long': + $code = 'long'; + break; + + case 'ulong': + $code = 'unsigned long'; + break; + + case 'bool': + case 'zephir_ce_guard': + $code = 'zend_bool'; + break; + + case 'double': + $code = 'double'; + break; + + case 'string': + case 'variable': + case 'array': + case 'null': + case 'mixed': + $pointer = '*'; + $code = 'zval'; + break; + + case 'HashTable': + $pointer = '*'; + $code = 'HashTable'; + break; + + case 'HashPosition': + $code = 'HashPosition'; + break; + + case 'zend_class_entry': + case 'static_zend_class_entry': + $pointer = '*'; + $code = 'zend_class_entry'; + break; + + case 'zend_function': + $pointer = '*'; + $code = 'zend_function'; + break; + + case 'zend_object_iterator': + $pointer = '*'; + $code = 'zend_object_iterator'; + break; + + case 'zend_property_info': + $pointer = '*'; + $code = 'zend_property_info'; + break; + + case 'zephir_fcall_cache_entry': + case 'static_zephir_fcall_cache_entry': + $pointer = '*'; + $code = 'zephir_fcall_cache_entry'; + break; + + case 'zephir_method_globals': + $pointer = '*'; + $code = 'zephir_method_globals'; + break; + + default: + throw new CompilerException('Unsupported type in declare: ' . $type); + } + + return [$pointer, $code]; + } + + /** + * @param Variable $variableVariable + * @param string $operator + * @param string $value + * + * @return string + * + * @throws CompilerException + */ + public function getTypeofCondition( + Variable $variableVariable, + string $operator, + string $value, + ): string { + $variableName = $this->getVariableCode($variableVariable); + + return match ($value) { + 'array' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_ARRAY', + 'object' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_OBJECT', + 'null' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_NULL', + 'string' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_STRING', + 'int', 'long', 'integer' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_LONG', + 'double', 'float' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_DOUBLE', + 'boolean', 'bool' => '((Z_TYPE_P(' . $variableName . ') == IS_TRUE || Z_TYPE_P(' . $variableName . ') == IS_FALSE) ' . $operator . ' 1)', + 'resource' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_RESOURCE', + 'callable' => 'zephir_is_callable(' . $variableName . ') ' . $operator . ' 1', + default => throw new CompilerException( + sprintf('Unknown type: "%s" in typeof comparison', $value) + ), + }; + } + + public function getVariableCode(Variable $variable): string + { + $variable->setUsed(true); + + if ( + $variable->isDoublePointer() || + in_array($variable->getName(), ['this_ptr', 'return_value']) || + in_array($variable->getType(), ['int', 'long']) + ) { + return $variable->getName(); + } + + return '&' . $variable->getName(); + } + + public function ifVariableValueUndefined( + Variable $var, + CompilationContext $context, + $useBody = false, + $useCodePrinter = true + ): string { + if ($var->isDoublePointer()) { + return $this->ifVariableValueUndefined2($var, $context, $useBody, $useCodePrinter); + } + $body = 'ZEPHIR_IS_EMPTY(' . $this->getVariableCode($var) . ')'; + $output = 'if (' . $body . ') {'; + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $useBody ? $body : $output; + } + + public function ifVariableValueUndefined2( + Variable $var, + CompilationContext $context, + $onlyBody = false, + $useCodePrinter = true + ): string { + $body = '!' . $var->getName(); + $output = 'if (' . $body . ') {'; + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $onlyBody ? $body : $output; + } + + /** + * Initialize array + * + * Init empty array or specific size array. + * + * @param Variable $variable + * @param CompilationContext $context + * @param int|null $size + * + * @return void + */ + public function initArray(Variable $variable, CompilationContext $context, int $size = null): void + { + $code = $this->getVariableCode($variable); + + if (null === $size) { + $output = "array_init({$code});"; + } else { + $output = "zephir_create_array({$code}, {$size}, 0);"; + } + + $context->codePrinter->output($output); + } + + public function initObject(Variable $variable, $ce, CompilationContext $context, $useCodePrinter = true) + { + $variableAccess = $this->getVariableCode($variable); + if (!isset($ce)) { + $output = 'object_init(' . $variableAccess . ');'; + } else { + $output = 'object_init_ex(' . $variableAccess . ', ' . $ce . ');'; + } + + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + + public function initVar( + Variable $variable, + CompilationContext $context, + bool $useCodePrinter = true, + bool $second = false + ): string { + $macro = !$second ? 'ZEPHIR_INIT_VAR' : 'ZEPHIR_INIT_NVAR'; + $code = $macro . '(' . $this->getVariableCode($variable) . ');'; + if ($useCodePrinter) { + $context->codePrinter->output($code); + } + + return $code; + } + + /** + * @param Variable[] $variables + * @param CompilationContext $context + * + * @return string + * + * @throws CompilerException + */ + public function initializeVariableDefaults(array $variables, CompilationContext $context): string + { + $codePrinter = new Printer(); + $codePrinter->increaseLevel(); + + $oldCodePrinter = $context->codePrinter; + $context->codePrinter = $codePrinter; + + $variablesManager = new VariablesManager(); + + /* Initialize default values in dynamic variables */ + foreach ($variables as $variable) { + /* Do not initialize unused variable */ + if ($variable->getNumberUses() < 1) { + continue; + } + + /* The default init value to be used bellow. + Actually this value should be in array form and + provide 'type' and 'value' keys. */ + $value = $variable->getDefaultInitValue(); + if (!is_array($value)) { + continue; + } + + $variablesManager->initializeDefaults($variable, $value, $context); + } + + $context->codePrinter = $oldCodePrinter; + + return $codePrinter->getOutput(); + } + + public function onPostCompile(Method $method, CompilationContext $context): void + { + if (str_starts_with($method->getName(), 'zephir_init_properties')) { + $context->codePrinter->increaseLevel(); + $context->codePrinter->output('return Z_OBJ_P(this_ptr);'); + $context->codePrinter->decreaseLevel(); + $context->codePrinter->output('}'); + $context->codePrinter->decreaseLevel(); + } + } + + public function onPreCompile(Method $method, CompilationContext $context): void + { + /** + * Initialize the properties within create_object, handler code + */ + if (str_starts_with($method->getName(), 'zephir_init_properties')) { + $context->codePrinter->increaseLevel(); + $context->codePrinter->output('{'); + $context->codePrinter->increaseLevel(); + $context->codePrinter->output('zval local_this_ptr, *this_ptr = &local_this_ptr;'); + $context->codePrinter->output('ZEPHIR_CREATE_OBJECT(this_ptr, class_type);'); + $context->codePrinter->decreaseLevel(); + } + } + + public function onPreInitVar(Method $method): string + { + if (!$method instanceof FunctionDefinition && !$method->isInternal()) { + return "zval *this_ptr = getThis();\n"; // TODO: think about a better way to solve this. + } + + return ''; + } + + public function propertyIsset(Variable $var, $key) + { + return new CompiledExpression( + 'bool', + 'zephir_isset_property(' . $this->getVariableCode($var) . ', SL("' . $key . '"))', + null + ); + } + + /** + * @param $value + * @param CompilationContext $context + * + * @return bool|string|Variable + * + * @throws CompilerException + */ + public function resolveValue($value, CompilationContext $context): Variable | bool | string + { + if ($value instanceof GlobalConstant) { + switch ($value->getName()) { + case 'ZEPHIR_GLOBAL(global_null)': + $value = 'null'; + break; + case 'ZEPHIR_GLOBAL(global_true)': + $value = 'true'; + break; + case 'ZEPHIR_GLOBAL(global_false)': + $value = 'false'; + break; + default: + throw new CompilerException('Unknown constant ' . $value->getName()); + } + } + + if ('null' == $value || 'true' == $value || 'false' == $value) { + $varName = '__$' . $value; + if (!$context->symbolTable->hasVariable($varName)) { + $tempVariable = new Variable('variable', $varName, $context->branchManager->getCurrentBranch()); + $context->symbolTable->addRawVariable($tempVariable); + } + + $tempVariable = $context->symbolTable->getVariableForWrite($varName, $context); + $tempVariable->increaseUses(); + $tempVariable->setUsed(true); + + if ('null' == $value) { + $tempVariable->setDynamicTypes('null'); + } else { + $tempVariable->setDynamicTypes('bool'); + } + + $value = $this->getVariableCode($tempVariable); + } else { + if ($value instanceof CompiledExpression) { + if (in_array($value->getType(), ['array', 'variable', 'mixed'])) { + $value = $context->symbolTable->getVariableForWrite($value->getCode(), $context); + } else { + return $value->getCode(); + } + } + } + + if ($value instanceof Variable) { + $value = $this->getVariableCode($value); + } + + return $value; + } + + public function returnString($value, CompilationContext $context, $useCodePrinter = true) + { + return $this->returnHelper('RETURN_MM_STRING', $value, $context, $useCodePrinter); + } + + public function subStaticProperty($classEntry, $property, $value, CompilationContext $context): void + { + $value = $this->resolveValue($value, $context); + $context->codePrinter->output( + 'zephir_sub_static_property_ce(' . $classEntry . ', ZEND_STRL("' . $property . '"), ' . $value . ');' + ); + } + + public function updateArray( + Variable $symbolVariable, + $key, + $value, + CompilationContext $compilationContext, + $flags = null + ): void { + $value = $this->resolveValue($value, $compilationContext, true); + if (!isset($flags)) { + $flags = 'PH_COPY'; + } + + if ($key instanceof Variable) { + switch ($key->getType()) { + case 'string': + case 'variable': + $compilationContext->codePrinter->output( + 'zephir_array_update_zval(' . $this->getVariableCode( + $symbolVariable + ) . ', ' . $this->getVariableCode($key) . ', ' . $value . ', ' . $flags . ');' + ); + break; + + case 'int': + case 'uint': + case 'long': + $compilationContext->codePrinter->output( + 'zephir_array_update_long(' . $this->getVariableCode($symbolVariable) . ', ' . $key->getName( + ) . ', ' . $value . ', ' . $flags . ' ZEPHIR_DEBUG_PARAMS_DUMMY);' + ); + break; + + default: + throw new CompilerException( + 'updateArray: Found a variable with unsupported type ' . $key->getType() + ); + } + } elseif ($key instanceof CompiledExpression) { + switch ($key->getType()) { + case 'string': + $compilationContext->codePrinter->output( + 'zephir_array_update_string(' . $this->getVariableCode( + $symbolVariable + ) . ', SL("' . $key->getCode() . '"), ' . $value . ', ' . $flags . ');' + ); + break; + + case 'int': + $compilationContext->codePrinter->output( + 'zephir_array_update_long(' . $this->getVariableCode($symbolVariable) . ', ' . $key->getCode( + ) . ', ' . $value . ', ' . $flags . ' ZEPHIR_DEBUG_PARAMS_DUMMY);' + ); + break; + + case 'variable': + $this->updateArray( + $symbolVariable, + $compilationContext->symbolTable->getVariableForRead($key->getCode()), + $value, + $compilationContext, + $flags + ); + break; + + default: + throw new CompilerException( + 'updateArray: Found an expression with unsupported type ' . $key->getType() + ); + } + } else { + throw new CompilerException('?'); + } + } + + /** + * @param Variable $variable + * @param string|Variable $property + * @param mixed $value + * @param CompilationContext $context + * + * @return void + */ + public function updateProperty(Variable $variable, $property, $value, CompilationContext $context): void + { + $value = $this->resolveValue($value, $context); + + if ($property instanceof Variable) { + $context->codePrinter->output( + sprintf( + 'zephir_update_property_zval_zval(%s, %s, %s);', + $this->getVariableCode($variable), + $this->getVariableCode($property), + $value + ) + ); + + return; + } + + $template = 'zephir_update_property_zval(%s, ZEND_STRL("%s"), %s);'; + /* Are we going to init default object property value? */ + if ($context->currentMethod && $context->currentMethod->isInitializer()) { + $template = 'zephir_update_property_zval_ex(%s, ZEND_STRL("%s"), %s);'; + } + + $context->codePrinter->output( + sprintf($template, $this->getVariableCode($variable), $property, $value) + ); + } + + public function updateStaticProperty($classEntry, $property, $value, CompilationContext $context): void + { + // TODO(serghei): Sort out as well as above + $value = $this->resolveValue($value, $context); + $context->codePrinter->output( + 'zephir_update_static_property_ce(' . $classEntry . ', ZEND_STRL("' . $property . '"), ' . $value . ');' + ); + } + + public function zvalOperator( + $zvalOperator, + Variable $expected, + Variable $variableLeft, + Variable $variableRight, + CompilationContext $compilationContext + ): void { + $expected = $this->getVariableCode($expected); + $op1 = $this->getVariableCode($variableLeft); + $op2 = $this->getVariableCode($variableRight); + + $compilationContext->codePrinter->output($zvalOperator . '(' . $expected . ', ' . $op1 . ', ' . $op2 . ');'); + } + + /** + * Assign value to variable helper. + */ + protected function assignHelper( + string $macro, + string $variableName, + $value, + CompilationContext $context, + bool $useCodePrinter + ): string { + if ($value === null && $macro === 'ZVAL_STRING') { + return ''; + } + + if ($value instanceof Variable) { + $value = $value->getName(); + } else { + $value = 'ZVAL_STRING' === $macro ? '"' . $value . '"' : $value; + } + + $output = $macro . '(' . $variableName . ', ' . $value . ');'; + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + + protected function returnHelper( + string $macro, + $value, + CompilationContext $context, + $useCodePrinter, + $doCopy = null + ): string { + if ($value instanceof Variable) { + $value = $value->getName(); + } elseif ($macro === 'RETURN_MM_STRING' && !str_starts_with($value, 'ZEPHIR_GLOBAL')) { + $value = '"' . $value . '"'; + } + + $copyStr = ''; + if (true === $doCopy) { + $copyStr = ', 1'; + } elseif (false === $doCopy) { + $copyStr = ', 0'; + } elseif (isset($doCopy)) { + $copyStr = ', ' . $doCopy; + } + + $output = $macro . '(' . $value . $copyStr . ');'; + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + + /** + * Resolve expressions. + * + * @param CompiledExpression[]|string[] $offsetExprs + * @param CompilationContext $compilationContext + * + * @return array + * + * @throws CompilerException + */ + private function resolveOffsetExprs(array $offsetExprs, CompilationContext $compilationContext): array + { + $keys = ''; + $offsetItems = []; + $numberParams = 0; + + foreach ($offsetExprs as $offsetExpr) { + if ('a' == $offsetExpr) { + $keys .= 'a'; + ++$numberParams; + continue; + } + + switch ($offsetExpr->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + $keys .= 'l'; + $offsetItems[] = $offsetExpr->getCode(); + ++$numberParams; + break; + + case 'string': + $keys .= 's'; + $offsetItems[] = 'SL("' . $offsetExpr->getCode() . '")'; + $numberParams += 2; + break; + + case 'variable': + $variableIndex = $compilationContext->symbolTable->getVariableForRead( + $offsetExpr->getCode(), + $compilationContext, + ); + + switch ($variableIndex->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + $keys .= 'l'; + $offsetItems[] = $this->getVariableCode($variableIndex); + ++$numberParams; + break; + case 'string': + case 'variable': + $keys .= 'z'; + $offsetItems[] = $this->getVariableCode($variableIndex); + ++$numberParams; + break; + default: + throw new CompilerException( + sprintf('Variable: %s cannot be used as array index', $variableIndex->getType()), + $offsetExpr->getOriginal() + ); + } + break; + + default: + throw new CompilerException( + sprintf('Value: %s cannot be used as array index', $offsetExpr->getType()), + $offsetExpr->getOriginal() + ); + } + } + + return [$keys, $offsetItems, $numberParams]; + } +} diff --git a/Library/Backends/ZendEngine3/FcallManager.php b/src/Backend/FcallManager.php similarity index 63% rename from Library/Backends/ZendEngine3/FcallManager.php rename to src/Backend/FcallManager.php index 5647c3f2d5..8283db4b24 100644 --- a/Library/Backends/ZendEngine3/FcallManager.php +++ b/src/Backend/FcallManager.php @@ -9,54 +9,24 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Backends\ZendEngine3; +declare(strict_types=1); -use Zephir\CodePrinter; -use Zephir\Fcall\FcallManagerInterface; -use function Zephir\file_put_contents_ex; +namespace Zephir\Backend; + +use Zephir\Code\Printer; +use Zephir\FileSystem\HardDisk; + +use function implode; +use function ksort; +use function sprintf; class FcallManager implements FcallManagerInterface { protected array $requiredMacros = []; - public function macroIsRequired($macro): bool - { - return isset($this->requiredMacros[$macro]); - } - - /** - * {@inheritdoc} - * - * @param bool $static - * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable - * @param int $paramCount - * - * @return string - */ - public function getMacro($static, $doReturn, $paramCount) - { - $scope = $static ? 'STATIC' : ''; - $mode = 'CALL_INTERNAL_METHOD_NORETURN_P'; - - if ($doReturn) { - $mode = 'RETURN_CALL_INTERNAL_METHOD_P'; - if (2 === $doReturn) { - $mode = 'CALL_INTERNAL_METHOD_P'; - } - } - - $macroName = 'ZEPHIR_'.($scope ? $scope.'_' : '').$mode.$paramCount; - - if (!$this->macroIsRequired($macroName)) { - $this->requiredMacros[$macroName] = [$scope, $mode, $paramCount]; - } - - return $macroName; - } - - public function genFcallCode() + public function genFcallCode(): void { - $codePrinter = new CodePrinter(); + $codePrinter = new Printer(); $header = <<requiredMacros); foreach ($this->requiredMacros as $name => $info) { - list($scope, $mode, $paramCount) = $info; - $paramsStr = ''; - $retParam = ''; - $retValueUsed = '0'; - $params = []; - $zvals = []; + [$scope, $mode, $paramCount] = $info; + $paramsStr = ''; + $retParam = ''; + $retValueUsed = '0'; + $params = []; + $zvals = []; $initStatements = []; $postStatements = []; for ($i = 0; $i < $paramCount; ++$i) { - $params[] = 'p'.$i; + $params[] = 'p' . $i; } if ($paramCount) { - $paramsStr = ', '.implode(', ', $params); + $paramsStr = ', ' . implode(', ', $params); } if ('CALL_INTERNAL_METHOD_P' == $mode) { - $retValueUsed = '1'; - $retParam = 'return_value_ptr'; + $retValueUsed = '1'; + $retParam = 'return_value_ptr'; $initStatements[] = 'ZEPHIR_INIT_NVAR((return_value_ptr)); \\'; } - $objParam = $scope ? 'scope_ce, ' : 'object, '; - $macroName = $name.'('.($retParam ? $retParam.', ' : '').$objParam.'method'.$paramsStr.')'; - $codePrinter->output('#define '.$macroName.' \\'); + $objParam = $scope ? 'scope_ce, ' : 'object, '; + $macroName = $name . '(' . ($retParam ? $retParam . ', ' : '') . $objParam . 'method' . $paramsStr . ')'; + $codePrinter->output('#define ' . $macroName . ' \\'); if (!$retParam) { $retParam = 'return_value'; } @@ -113,7 +83,9 @@ public function genFcallCode() $codePrinter->output('ZEPHIR_BACKUP_SCOPE(); \\'); if (!$scope) { $codePrinter->output('ZEPHIR_SET_THIS(object); \\'); - $codePrinter->output('ZEPHIR_SET_SCOPE((Z_OBJ_P(object) ? Z_OBJCE_P(object) : NULL), (Z_OBJ_P(object) ? Z_OBJCE_P(object) : NULL)); \\'); + $codePrinter->output( + 'ZEPHIR_SET_SCOPE((Z_OBJ_P(object) ? Z_OBJCE_P(object) : NULL), (Z_OBJ_P(object) ? Z_OBJCE_P(object) : NULL)); \\' + ); } else { $codePrinter->output('ZEPHIR_SET_THIS_EXPLICIT_NULL(); \\'); $codePrinter->output('ZEPHIR_SET_SCOPE(scope_ce, scope_ce); \\'); @@ -121,13 +93,13 @@ public function genFcallCode() /* Create new zval's for parameters */ for ($i = 0; $i < $paramCount; ++$i) { - $zv = '_'.$params[$i]; - $zvals[] = $zv; - $initStatements[] = 'ZVAL_COPY(&'.$zv.', '.$params[$i].'); \\'; - $postStatements[] = 'Z_TRY_DELREF_P('.$params[$i].'); \\'; + $zv = '_' . $params[$i]; + $zvals[] = $zv; + $initStatements[] = 'ZVAL_COPY(&' . $zv . ', ' . $params[$i] . '); \\'; + $postStatements[] = 'Z_TRY_DELREF_P(' . $params[$i] . '); \\'; } if ($i) { - $codePrinter->output('zval '.implode(', ', $zvals).'; \\'); + $codePrinter->output('zval ' . implode(', ', $zvals) . '; \\'); } foreach ($initStatements as $statement) { $codePrinter->output($statement); @@ -137,9 +109,9 @@ public function genFcallCode() sprintf( 'method(0, execute_data, %s, %s%s%s); \\', $retParam, - ($scope ? 'NULL, ' : $objParam), + $scope ? 'NULL, ' : $objParam, $retValueUsed, - $i ? ', &'.implode(', &', $zvals) : '' + $i ? ', &' . implode(', &', $zvals) : '' ) ); @@ -161,6 +133,34 @@ public function genFcallCode() } $codePrinter->output('#endif'); - file_put_contents_ex($codePrinter->getOutput(), 'ext/kernel/fcall_internal.h'); + HardDisk::persistByHash($codePrinter->getOutput(), 'ext/kernel/fcall_internal.h'); + } + + /** + * @param bool $static + * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable + * @param int $paramCount + * + * @return string + */ + public function getMacro(bool $static, int $doReturn, int $paramCount): string + { + $scope = $static ? 'STATIC' : ''; + $mode = 'CALL_INTERNAL_METHOD_NORETURN_P'; + + if ($doReturn) { + $mode = 'RETURN_CALL_INTERNAL_METHOD_P'; + if (2 === $doReturn) { + $mode = 'CALL_INTERNAL_METHOD_P'; + } + } + + $macroName = 'ZEPHIR_' . ($scope ? $scope . '_' : '') . $mode . $paramCount; + + if (!isset($this->requiredMacros[$macroName])) { + $this->requiredMacros[$macroName] = [$scope, $mode, $paramCount]; + } + + return $macroName; } } diff --git a/Library/Fcall/FcallManagerInterface.php b/src/Backend/FcallManagerInterface.php similarity index 59% rename from Library/Fcall/FcallManagerInterface.php rename to src/Backend/FcallManagerInterface.php index 1af5aa596a..8b7751461b 100644 --- a/Library/Fcall/FcallManagerInterface.php +++ b/src/Backend/FcallManagerInterface.php @@ -9,25 +9,22 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Fcall; +declare(strict_types=1); + +namespace Zephir\Backend; -/** - * Zephir\Fcall\FcallManagerInterface. - */ interface FcallManagerInterface { - public function macroIsRequired($macro); + public function genFcallCode(): void; /** * Resolve internal fcall attributes to a suitable macro and ensure that it's generated during compilation. * * @param bool $static - * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable + * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable * @param int $paramCount * * @return string */ - public function getMacro($static, $doReturn, $paramCount); - - public function genFcallCode(); + public function getMacro(bool $static, int $doReturn, int $paramCount): string; } diff --git a/src/Backend/StringsManager.php b/src/Backend/StringsManager.php new file mode 100644 index 0000000000..e02b2a60f1 --- /dev/null +++ b/src/Backend/StringsManager.php @@ -0,0 +1,230 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Backend; + +use Zephir\FileSystem\HardDisk; +use Zephir\StringsManager as BaseStringsManager; + +use function count; +use function implode; +use function ksort; +use function strlen; +use function strtoupper; +use function substr; + +use const PHP_EOL; +use const SORT_STRING; + +/** + * Manages the concatenation keys for the extension and the interned strings + */ +class StringsManager extends BaseStringsManager +{ + /** + * Adds a concatenation combination to the manager. + */ + public function addConcatKey(string $key): void + { + $this->concatKeys[$key] = true; + } + + /** + * Generates the concatenation code. + */ + public function genConcatCode(): void + { + $code = ' +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +#include "php_ext.h" +#include +#include "ext.h" +#include "kernel/main.h" +#include "kernel/memory.h" +#include "kernel/concat.h"' . PHP_EOL . PHP_EOL; + $pcodeh = ' +#ifndef ZEPHIR_KERNEL_CONCAT_H +#define ZEPHIR_KERNEL_CONCAT_H +#include +#include +#include "kernel/main.h" +'; + $codeh = ''; + + $macros = []; + ksort($this->concatKeys, SORT_STRING); + foreach ($this->concatKeys as $key => $one) { + $len = strlen($key); + $params = []; + $zvalCopy = []; + $useCopy = []; + $avars = []; + $zvars = []; + $lengths = []; + $sparams = []; + $lparams = []; + for ($i = 0; $i < $len; ++$i) { + $n = $i + 1; + $t = substr($key, $i, 1); + $sparams[] = 'op' . $n; + if ('s' == $t) { + $params[] = 'const char *op' . $n . ', uint32_t op' . $n . '_len'; + $lparams[] = 'op' . $n . ', sizeof(op' . $n . ')-1'; + $lengths[] = 'op' . $n . '_len'; + $avars[$n] = 's'; + } else { + $params[] = 'zval *op' . $n; + $lparams[] = 'op' . $n; + $zvalCopy[] = 'op' . $n . '_copy'; + $useCopy[] = 'use_copy' . $n . ' = 0'; + $lengths[] = 'Z_STRLEN_P(op' . $n . ')'; + $zvars[] = $n; + $avars[$n] = 'v'; + } + } + + $macros[] = '#define ZEPHIR_CONCAT_' + . strtoupper($key) + . '(result, ' + . implode(', ', $sparams) + . ') \\' + . PHP_EOL + . "\t" + . ' zephir_concat_' + . $key + . '(result, ' + . implode(', ', $lparams) + . ', 0);'; + $macros[] = '#define ZEPHIR_SCONCAT_' + . strtoupper($key) + . '(result, ' + . implode(', ', $sparams) + . ') \\' + . PHP_EOL + . "\t" + . ' zephir_concat_' + . $key + . '(result, ' + . implode(', ', $lparams) + . ', 1);'; + $macros[] = ''; + + $proto = 'void zephir_concat_' + . $key + . '(zval *result, ' + . implode(', ', $params) + . ', int self_var)'; + + $codeh .= $proto . ';' . PHP_EOL; + + $code .= $proto . '{' . PHP_EOL . PHP_EOL; + + if (count($zvalCopy)) { + $code .= "\t" . 'zval result_copy, ' . implode(', ', $zvalCopy) . ';' . PHP_EOL; + $code .= "\t" . 'int use_copy = 0, ' . implode(', ', $useCopy) . ';' . PHP_EOL; + } else { + $code .= "\t" . 'zval result_copy;' . PHP_EOL; + $code .= "\t" . 'int use_copy = 0;' . PHP_EOL; + } + $code .= "\t" . 'size_t offset = 0, length;' . PHP_EOL . PHP_EOL; + + foreach ($zvars as $zvar) { + $code .= "\t" . 'if (Z_TYPE_P(op' . $zvar . ') != IS_STRING) {' . PHP_EOL; + $code .= "\t" . ' use_copy' . $zvar . ' = zend_make_printable_zval(op' . $zvar . ', &op' . $zvar . '_copy);' . PHP_EOL; + $code .= "\t" . ' if (use_copy' . $zvar . ') {' . PHP_EOL; + $code .= "\t" . ' op' . $zvar . ' = &op' . $zvar . '_copy;' . PHP_EOL; + $code .= "\t" . ' }' . PHP_EOL; + $code .= "\t" . '}' . PHP_EOL . PHP_EOL; + } + + $code .= "\t" . 'length = ' . implode(' + ', $lengths) . ';' . PHP_EOL; + $code .= "\t" . 'if (self_var) {' . PHP_EOL; + $code .= PHP_EOL; + $code .= "\t\t" . 'if (Z_TYPE_P(result) != IS_STRING) {' . PHP_EOL; + $code .= "\t\t\t" . 'use_copy = zend_make_printable_zval(result, &result_copy);' . PHP_EOL; + $code .= "\t\t\t" . 'if (use_copy) {' . PHP_EOL; + $code .= "\t\t\t\t" . 'ZEPHIR_CPY_WRT_CTOR(result, (&result_copy));' . PHP_EOL; + $code .= "\t\t\t" . '}' . PHP_EOL; + $code .= "\t\t" . '}' . PHP_EOL . PHP_EOL; + $code .= "\t\t" . 'offset = Z_STRLEN_P(result);' . PHP_EOL; + $code .= "\t\t" . 'length += offset;' . PHP_EOL; + $code .= "\t\t" . 'Z_STR_P(result) = zend_string_realloc(Z_STR_P(result), length, 0);' . PHP_EOL; + $code .= PHP_EOL; + $code .= "\t" . '} else {' . PHP_EOL; + $code .= "\t\t" . 'ZVAL_STR(result, zend_string_alloc(length, 0));' . PHP_EOL; + $code .= "\t" . '}' . PHP_EOL . PHP_EOL; + + $position = ''; + foreach ($avars as $n => $type) { + if ('s' == $type) { + $code .= "\t" . 'memcpy(Z_STRVAL_P(result) + offset' . $position . ', op' . $n . ', op' . $n . '_len);' . PHP_EOL; + $position .= ' + op' . $n . '_len'; + } else { + $code .= "\t" . 'memcpy(Z_STRVAL_P(result) + offset' . $position . ', Z_STRVAL_P(op' . $n . '), Z_STRLEN_P(op' . $n . '));' . PHP_EOL; + $position .= ' + Z_STRLEN_P(op' . $n . ')'; + } + } + + $code .= "\t" . 'Z_STRVAL_P(result)[length] = 0;' . PHP_EOL; + $code .= "\t" . 'zend_string_forget_hash_val(Z_STR_P(result));' . PHP_EOL; + + foreach ($zvars as $zvar) { + $code .= "\t" . 'if (use_copy' . $zvar . ') {' . PHP_EOL; + $code .= "\t" . ' zval_dtor(op' . $zvar . ');' . PHP_EOL; + $code .= "\t" . '}' . PHP_EOL . PHP_EOL; + } + + $code .= "\t" . 'if (use_copy) {' . PHP_EOL; + $code .= "\t" . ' zval_dtor(&result_copy);' . PHP_EOL; + $code .= "\t" . '}' . PHP_EOL . PHP_EOL; + + $code .= '}' . PHP_EOL . PHP_EOL; + } + + $code .= <<getType()) { case Types::T_VARIABLE: @@ -53,6 +61,33 @@ public function initializeDefaults(Variable $variable, array $value, Context $co } } + /** + * Initialize 'array' variables with default values. + * Meant for VariablesManager::initializeDefaults. + * + * @param Variable $variable + * @param array $value + * @param Context $context + * + * @return void + */ + private function initArrayVar(Variable $variable, array $value, Context $context): void + { + $context->symbolTable->mustGrownStack(true); + $context->backend->initVar($variable, $context); + + switch ($value['type']) { + case Types::T_NULL: + $context->backend->assignNull($variable, $context); + break; + + case Types::T_ARRAY: + case 'empty-array': + $context->backend->initArray($variable, $context); + break; + } + } + /** * Initialize 'dynamic' variables with default values. * Meant for VariablesManager::initializeDefaults. @@ -63,11 +98,11 @@ public function initializeDefaults(Variable $variable, array $value, Context $co * * @return void */ - private function initDynamicVar(Variable $variable, array $value, Context $context) + private function initDynamicVar(Variable $variable, array $value, Context $context): void { - /* These ones are system variables, do not add default values. + /* These are system variables, do not add default values. Also see: https://github.com/zephir-lang/zephir/issues/1660 */ - if (\in_array($variable->getName(), self::RESERVED_NAMES, true)) { + if (in_array($variable->getName(), self::RESERVED_NAMES, true)) { return; } @@ -89,7 +124,7 @@ private function initDynamicVar(Variable $variable, array $value, Context $conte case Types::T_CHAR: case Types::T_UCHAR: $this->validateCharValue($value); - $context->backend->assignLong($variable, "'".$value['value']."'", $context); + $context->backend->assignLong($variable, "'" . $value['value'] . "'", $context); break; case Types::T_NULL: @@ -109,9 +144,6 @@ private function initDynamicVar(Variable $variable, array $value, Context $conte case 'empty-array': $context->backend->initArray($variable, $context); break; - - default: - throw $this->invalidDefaulTypeException($variable, $value); } } @@ -125,7 +157,7 @@ private function initDynamicVar(Variable $variable, array $value, Context $conte * * @return void */ - private function initStringVar(Variable $variable, array $value, Context $context) + private function initStringVar(Variable $variable, array $value, Context $context): void { $context->symbolTable->mustGrownStack(true); $context->backend->initVar($variable, $context); @@ -139,79 +171,26 @@ private function initStringVar(Variable $variable, array $value, Context $contex case Types::T_NULL: $context->backend->assignString($variable, null, $context); break; - - default: - throw $this->invalidDefaulTypeException($variable, $value); - } - } - - /** - * Initialize 'array' variables with default values. - * Meant for VariablesManager::initializeDefaults. - * - * @param Variable $variable - * @param array $value - * @param Context $context - * - * @return void - */ - private function initArrayVar(Variable $variable, array $value, Context $context) - { - $context->symbolTable->mustGrownStack(true); - $context->backend->initVar($variable, $context); - - switch ($value['type']) { - case Types::T_NULL: - $context->backend->assignNull($variable, $context); - break; - - case Types::T_ARRAY: - case 'empty-array': - $context->backend->initArray($variable, $context); - break; - - default: - throw $this->invalidDefaulTypeException($variable, $value); } } - /** - * Create a compiler exception with 'Invalid default type' message. - * - * @param Variable $variable - * @param array $value - * - * @return Exception - */ - private function invalidDefaulTypeException(Variable $variable, array $value): Exception - { - new Exception( - sprintf( - 'Invalid default type: %s for data type: %s', - $value['type'], - $variable->getType() - ), - $variable->getOriginal() - ); - } - /** * Validate 'char' value type. * * @param array $value * - * @throws Exception - * * @return void + * + * @throws Exception */ - private function validateCharValue(array $value) + private function validateCharValue(array $value): void { - if (\strlen($value['value']) > 2) { + if (strlen($value['value']) > 2) { throw new Exception( sprintf( "Invalid char literal: '%s%s'", substr($value['value'], 0, 10), - \strlen($value['value']) > 10 ? '...' : '' + strlen($value['value']) > 10 ? '...' : '' ), $value ); diff --git a/Library/Branch.php b/src/Branch.php similarity index 80% rename from Library/Branch.php rename to src/Branch.php index eaba669db2..7c6e93e26e 100644 --- a/Library/Branch.php +++ b/src/Branch.php @@ -20,34 +20,31 @@ */ class Branch { - public const TYPE_ROOT = 0; - public const TYPE_CONDITIONAL_TRUE = 1; public const TYPE_CONDITIONAL_FALSE = 2; - public const TYPE_LOOP_INFINITE = 3; - public const TYPE_LOOP_CONDITIONAL = 4; - public const TYPE_SWITCH = 5; - public const TYPE_EXTERNAL = 6; - public const TYPE_UNKNOWN = 7; - - protected int $level = -1; - protected int $type = self::TYPE_ROOT; - protected ?bool $unreachable = null; - protected ?Branch $parentBranch = null; + public const TYPE_CONDITIONAL_TRUE = 1; + public const TYPE_EXTERNAL = 6; + public const TYPE_LOOP_CONDITIONAL = 4; + public const TYPE_LOOP_INFINITE = 3; + public const TYPE_ROOT = 0; + public const TYPE_SWITCH = 5; + public const TYPE_UNKNOWN = 7; + + protected int $level = -1; + protected ?Branch $parentBranch = null; protected ?StatementAbstract $relatedStatement = null; - + protected int $type = self::TYPE_ROOT; + protected ?bool $unreachable = null; /** * @var mixed */ private $uniqueId; /** - * Set the branch's parent. - * - * @param Branch $parentBranch + * @return int */ - public function setParentBranch(self $parentBranch): void + public function getLevel(): int { - $this->parentBranch = $parentBranch; + return $this->level; } /** @@ -61,13 +58,11 @@ public function getParentBranch(): ?self } /** - * Set the type of branch. One of the TYPE_* constants. - * - * @param int $type + * @return StatementAbstract|null */ - public function setType(int $type): void + public function getRelatedStatement(): ?StatementAbstract { - $this->type = $type; + return $this->relatedStatement; } /** @@ -81,13 +76,11 @@ public function getType(): int } /** - * Sets if the branch is unreachable. - * - * @param bool|null $unreachable + * @return mixed */ - public function setUnreachable(?bool $unreachable): void + public function getUniqueId() { - $this->unreachable = $unreachable; + return $this->uniqueId; } /** @@ -107,42 +100,48 @@ public function setLevel(int $level): void } /** - * @return int + * Set the branch's parent. + * + * @param Branch $parentBranch */ - public function getLevel(): int + public function setParentBranch(self $parentBranch): void { - return $this->level; + $this->parentBranch = $parentBranch; } /** - * @param $uniqueId + * @param StatementAbstract $relatedStatement */ - public function setUniqueId($uniqueId) + public function setRelatedStatement(StatementAbstract $relatedStatement): void { - $this->uniqueId = $uniqueId; + $this->relatedStatement = $relatedStatement; } /** - * @return mixed + * Set the type of branch. One of the TYPE_* constants. + * + * @param int $type */ - public function getUniqueId() + public function setType(int $type): void { - return $this->uniqueId; + $this->type = $type; } /** - * @param StatementAbstract $relatedStatement + * @param $uniqueId */ - public function setRelatedStatement(StatementAbstract $relatedStatement): void + public function setUniqueId($uniqueId): void { - $this->relatedStatement = $relatedStatement; + $this->uniqueId = $uniqueId; } /** - * @return StatementAbstract|null + * Sets if the branch is unreachable. + * + * @param bool|null $unreachable */ - public function getRelatedStatement(): ?StatementAbstract + public function setUnreachable(?bool $unreachable): void { - return $this->relatedStatement; + $this->unreachable = $unreachable; } } diff --git a/Library/BranchManager.php b/src/BranchManager.php similarity index 62% rename from Library/BranchManager.php rename to src/BranchManager.php index 9cf041daa8..70108e38b2 100644 --- a/Library/BranchManager.php +++ b/src/BranchManager.php @@ -9,39 +9,34 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; /** - * BranchManager. - * - * Records every branch created within a method allowing analyze conditional variable assignment + * Records every branch created within a method allowing to analyze conditional variable assignment */ class BranchManager { - /** @var Branch|null */ - protected $currentBranch; - - protected $level = 0; - - protected $uniqueId = 1; + protected ?Branch $currentBranch = null; - /** @var Branch|null */ - protected $rootBranch; + protected int $level = 0; + protected ?Branch $rootBranch; + protected int $uniqueId = 1; /** * Sets the current active branch in the manager. * * @param Branch $branch */ - public function addBranch(Branch $branch) + public function addBranch(Branch $branch): void { if ($this->currentBranch) { $branch->setParentBranch($this->currentBranch); - $this->currentBranch = $branch; - } else { - $this->currentBranch = $branch; } + $this->currentBranch = $branch; + $branch->setUniqueId($this->uniqueId); $branch->setLevel($this->level); @@ -53,24 +48,12 @@ public function addBranch(Branch $branch) } } - /** - * Removes a branch from the branch manager. - * - * @param Branch $branch - */ - public function removeBranch(Branch $branch) - { - $parentBranch = $branch->getParentBranch(); - $this->currentBranch = $parentBranch; - --$this->level; - } - /** * Returns the active branch in the manager. * * @return Branch|null */ - public function getCurrentBranch() + public function getCurrentBranch(): ?Branch { return $this->currentBranch; } @@ -80,16 +63,20 @@ public function getCurrentBranchId() return $this->currentBranch->getUniqueId(); } - public function setRootBranch(Branch $branch) + /** + * Removes a branch from the branch manager. + * + * @param Branch $branch + */ + public function removeBranch(Branch $branch): void { - $this->rootBranch = $branch; + $parentBranch = $branch->getParentBranch(); + $this->currentBranch = $parentBranch; + --$this->level; } - /** - * @return Branch|null - */ - public function getRootBranch() + public function setRootBranch(Branch $branch): void { - return $this->rootBranch; + $this->rootBranch = $branch; } } diff --git a/src/Builder/FunctionCallBuilder.php b/src/Builder/FunctionCallBuilder.php new file mode 100644 index 0000000000..bd964258b7 --- /dev/null +++ b/src/Builder/FunctionCallBuilder.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Builder; + +/** + * Allows to manually build a function call AST node + */ +class FunctionCallBuilder +{ + public function __construct( + protected string $name, + protected array $parameters, + protected int $type = 1, + protected ?string $file = null, + protected int $line = 0, + protected int $char = 0, + ) { + } + + public function get(): array + { + return [ + 'type' => 'fcall', + 'name' => $this->name, + 'call-type' => $this->type, + 'parameters' => $this->parameters, + 'file' => $this->file, + 'line' => $this->line, + 'char' => $this->char, + ]; + } +} diff --git a/Library/Builder/Operators/AbstractOperatorBuilder.php b/src/Builder/Operators/AbstractOperatorBuilder.php similarity index 95% rename from Library/Builder/Operators/AbstractOperatorBuilder.php rename to src/Builder/Operators/AbstractOperatorBuilder.php index 4fad1c2726..5f9226088f 100644 --- a/Library/Builder/Operators/AbstractOperatorBuilder.php +++ b/src/Builder/Operators/AbstractOperatorBuilder.php @@ -18,16 +18,14 @@ */ abstract class AbstractOperatorBuilder { + protected int $char = 0; + protected ?string $file = null; protected int $line = 0; - protected int $char = 0; - /** * Returns a builder definition. - * - * @return array */ abstract public function get(): array; } diff --git a/src/Builder/Operators/CastOperatorBuilder.php b/src/Builder/Operators/CastOperatorBuilder.php new file mode 100644 index 0000000000..97386a1d6c --- /dev/null +++ b/src/Builder/Operators/CastOperatorBuilder.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Builder\Operators; + +use Zephir\Builder\FunctionCallBuilder; + +/** + * Allows to manually build a 'cast' operator AST node + */ +class CastOperatorBuilder extends AbstractOperatorBuilder +{ + protected string $leftOperand; + + protected FunctionCallBuilder $rightOperand; + + public function __construct( + string $left, + FunctionCallBuilder $right, + string $file = null, + int $line = 0, + int $char = 0 + ) { + $this->leftOperand = $left; + $this->rightOperand = $right; + $this->file = $file; + $this->line = $line; + $this->char = $char; + } + + public function get(): array + { + return [ + 'type' => 'cast', + 'left' => $this->leftOperand, + 'right' => $this->rightOperand->get(), + 'file' => $this->file, + 'line' => $this->line, + 'char' => $this->char, + ]; + } +} diff --git a/Library/Builder/Operators/UnaryOperatorBuilder.php b/src/Builder/Operators/UnaryOperatorBuilder.php similarity index 67% rename from Library/Builder/Operators/UnaryOperatorBuilder.php rename to src/Builder/Operators/UnaryOperatorBuilder.php index b893e9904f..f0844101a9 100644 --- a/Library/Builder/Operators/UnaryOperatorBuilder.php +++ b/src/Builder/Operators/UnaryOperatorBuilder.php @@ -14,40 +14,25 @@ namespace Zephir\Builder\Operators; use function is_object; +use function method_exists; /** * Allows to manually build a unary operator AST node */ class UnaryOperatorBuilder extends AbstractOperatorBuilder { - /** - * Operator name - * - * @var string - */ - protected string $operator; - - /** - * Left Expression - * - * @var mixed - */ - protected $leftExpression; - - public function __construct(string $operator, $leftExpression, ?string $file = null, int $line = 0, int $char = 0) - { - $this->operator = $operator; - $this->leftExpression = $leftExpression; + public function __construct( + protected string $operator, + protected $leftExpression, + string $file = null, + int $line = 0, + int $char = 0, + ) { $this->file = $file; $this->line = $line; $this->char = $char; } - /** - * Returns a builder definition. - * - * @return array - */ public function get(): array { if (is_object($this->leftExpression) && method_exists($this->leftExpression, 'get')) { diff --git a/Library/Builder/Statements/AbstractStatementBuilder.php b/src/Builder/Statements/AbstractStatementBuilder.php similarity index 93% rename from Library/Builder/Statements/AbstractStatementBuilder.php rename to src/Builder/Statements/AbstractStatementBuilder.php index a788fbc70e..9ec1a69a04 100644 --- a/Library/Builder/Statements/AbstractStatementBuilder.php +++ b/src/Builder/Statements/AbstractStatementBuilder.php @@ -17,8 +17,6 @@ abstract class AbstractStatementBuilder { /** * Returns a builder definition. - * - * @return array */ abstract public function get(): array; } diff --git a/Library/Builder/Statements/IfStatementBuilder.php b/src/Builder/Statements/IfStatementBuilder.php similarity index 52% rename from Library/Builder/Statements/IfStatementBuilder.php rename to src/Builder/Statements/IfStatementBuilder.php index ae469a1291..ba7e431452 100644 --- a/Library/Builder/Statements/IfStatementBuilder.php +++ b/src/Builder/Statements/IfStatementBuilder.php @@ -21,34 +21,18 @@ */ class IfStatementBuilder extends AbstractStatementBuilder { - private AbstractOperatorBuilder $evalExpr; - - private StatementsBlockBuilder $ifBlock; - - private ?StatementsBlockBuilder $elseBlock; - - /** - * @param AbstractOperatorBuilder $evalExpr - * @param StatementsBlockBuilder $ifBlock - * @param StatementsBlockBuilder|null $elseBlock - */ - public function __construct(AbstractOperatorBuilder $evalExpr, StatementsBlockBuilder $ifBlock, StatementsBlockBuilder $elseBlock = null) - { - $this->evalExpr = $evalExpr; - $this->ifBlock = $ifBlock; - $this->elseBlock = $elseBlock; + public function __construct( + private AbstractOperatorBuilder $evalExpr, + private StatementsBlockBuilder $ifBlock, + private ?StatementsBlockBuilder $elseBlock = null + ) { } - /** - * Returns a builder definition. - * - * @return array - */ public function get(): array { $expression = [ - 'type' => 'if', - 'expr' => $this->evalExpr->get(), + 'type' => 'if', + 'expr' => $this->evalExpr->get(), 'statements' => $this->ifBlock->get(), ]; diff --git a/Library/Builder/Statements/LetStatementBuilder.php b/src/Builder/Statements/LetStatementBuilder.php similarity index 58% rename from Library/Builder/Statements/LetStatementBuilder.php rename to src/Builder/Statements/LetStatementBuilder.php index faf656e47b..2e92dc76bb 100644 --- a/Library/Builder/Statements/LetStatementBuilder.php +++ b/src/Builder/Statements/LetStatementBuilder.php @@ -13,40 +13,21 @@ namespace Zephir\Builder\Statements; +use function array_merge; + /** * Allows to manually build a 'let' statement AST node */ class LetStatementBuilder extends AbstractStatementBuilder { - /** - * List of assignments - * - * @var array - */ - private array $assignments; - - /** - * Expression - * - * @var mixed - */ - private $expr; - - public function __construct(array $assignments, $expr) + public function __construct(private array $assignments, private mixed $expr) { - $this->assignments = $assignments; - $this->expr = $expr; } - /** - * Returns a builder definition. - * - * @return array - */ public function get(): array { return [ - 'type' => 'let', + 'type' => 'let', 'assignments' => [array_merge(['expr' => $this->expr], $this->assignments)], ]; } diff --git a/Library/Builder/StatementsBlockBuilder.php b/src/Builder/StatementsBlockBuilder.php similarity index 70% rename from Library/Builder/StatementsBlockBuilder.php rename to src/Builder/StatementsBlockBuilder.php index b0a02bfb44..9291e3c43a 100644 --- a/Library/Builder/StatementsBlockBuilder.php +++ b/src/Builder/StatementsBlockBuilder.php @@ -18,21 +18,10 @@ */ class StatementsBlockBuilder { - protected array $statements; - - protected bool $raw; - - public function __construct(array $statements, bool $raw = false) + public function __construct(protected array $statements, protected bool $raw = false) { - $this->statements = $statements; - $this->raw = $raw; } - /** - * Returns a builder definition. - * - * @return array - */ public function get(): array { if ($this->raw) { diff --git a/Library/Cache/ClassEntryCache.php b/src/Cache/ClassEntryCache.php similarity index 86% rename from Library/Cache/ClassEntryCache.php rename to src/Cache/ClassEntryCache.php index b652400c4a..13f4536370 100644 --- a/Library/Cache/ClassEntryCache.php +++ b/src/Cache/ClassEntryCache.php @@ -14,7 +14,7 @@ namespace Zephir\Cache; use Zephir\CompilationContext; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * Classes located in the PHP userland are cached to avoid further relocates @@ -25,12 +25,6 @@ class ClassEntryCache /** * Retrieves/Creates a class entry cache. - * - * @param string $className - * @param bool $dynamic - * @param CompilationContext $compilationContext - * - * @return Variable */ public function get(string $className, bool $dynamic, CompilationContext $compilationContext): Variable { diff --git a/Library/Cache/FunctionCache.php b/src/Cache/FunctionCache.php similarity index 74% rename from Library/Cache/FunctionCache.php rename to src/Cache/FunctionCache.php index e44fa9c884..e2aba14c24 100644 --- a/Library/Cache/FunctionCache.php +++ b/src/Cache/FunctionCache.php @@ -37,31 +37,17 @@ class FunctionCache { protected array $cache = []; - protected ?CallGathererPass $gatherer = null; - - /** - * FunctionCache constructor. - * - * @param CallGathererPass|null $gatherer - */ - public function __construct(CallGathererPass $gatherer = null) + public function __construct(protected ?CallGathererPass $gatherer = null) { - $this->gatherer = $gatherer; } /** * Retrieves/Creates a function cache for a function call. - * - * @param string $functionName - * @param CompilationContext $compilationContext - * @param bool $exists - * - * @return string */ public function get(string $functionName, CompilationContext $compilationContext, bool $exists): string { if (isset($this->cache[$functionName])) { - return $this->cache[$functionName].', '.SlotsCache::getExistingFunctionSlot($functionName); + return $this->cache[$functionName] . ', ' . SlotsCache::getExistingFunctionSlot($functionName); } if (!$exists) { @@ -74,21 +60,24 @@ public function get(string $functionName, CompilationContext $compilationContext if (!$compilationContext->insideCycle && $this->gatherer !== null) { $number = $this->gatherer->getNumberOfFunctionCalls($functionName); if ($number <= 1) { - return 'NULL, '.$cacheSlot; + return 'NULL, ' . $cacheSlot; } } if ($compilationContext->insideCycle || $number > 1) { - $functionCacheVariable = $compilationContext->symbolTable->getTempVariableForWrite('zephir_fcall_cache_entry', $compilationContext); + $functionCacheVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'zephir_fcall_cache_entry', + $compilationContext + ); $functionCacheVariable->setMustInitNull(true); $functionCacheVariable->setReusable(false); - $functionCache = '&'.$functionCacheVariable->getName(); + $functionCache = '&' . $functionCacheVariable->getName(); } else { $functionCache = 'NULL'; } $this->cache[$functionName] = $functionCache; - return $functionCache.', '.$cacheSlot; + return $functionCache . ', ' . $cacheSlot; } } diff --git a/Library/CacheManager.php b/src/Cache/Manager.php similarity index 73% rename from Library/CacheManager.php rename to src/Cache/Manager.php index cd2317308f..143cc9d5a2 100644 --- a/Library/CacheManager.php +++ b/src/Cache/Manager.php @@ -11,58 +11,27 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Cache; -use Zephir\Cache\ClassEntryCache; -use Zephir\Cache\FunctionCache; -use Zephir\Cache\MethodCache; -use Zephir\Cache\StaticMethodCache; use Zephir\Passes\CallGathererPass; /** * Creates and manages function, method and class entries caches */ -class CacheManager +class Manager { - /** - * @var FunctionCache|null - */ + protected ?ClassEntryCache $classEntryCache = null; + protected ?FunctionCache $functionCache = null; - /** - * @var MethodCache|null - */ + protected ?CallGathererPass $gatherer = null; + protected ?MethodCache $methodCache = null; - /** - * @var StaticMethodCache|null - */ protected ?StaticMethodCache $staticMethodCache = null; - /** - * @var ClassEntryCache|null - */ - protected ?ClassEntryCache $classEntryCache = null; - - /** - * @var CallGathererPass|null - */ - protected ?CallGathererPass $gatherer = null; - - /** - * Sets the CallGathererPass. - * - * @param CallGathererPass|null $gatherer - */ - public function setGatherer(?CallGathererPass $gatherer = null) - { - $this->gatherer = $gatherer; - } - /** * Creates or returns an existing class entry cache. - * - * @return ClassEntryCache */ public function getClassEntryCache(): ClassEntryCache { @@ -75,8 +44,6 @@ public function getClassEntryCache(): ClassEntryCache /** * Creates or returns an existing function cache. - * - * @return FunctionCache */ public function getFunctionCache(): ?FunctionCache { @@ -89,8 +56,6 @@ public function getFunctionCache(): ?FunctionCache /** * Creates or returns an existing method cache. - * - * @return MethodCache */ public function getMethodCache(): ?MethodCache { @@ -103,8 +68,6 @@ public function getMethodCache(): ?MethodCache /** * Creates or returns an existing method cache. - * - * @return StaticMethodCache */ public function getStaticMethodCache(): ?StaticMethodCache { @@ -114,4 +77,12 @@ public function getStaticMethodCache(): ?StaticMethodCache return $this->staticMethodCache; } + + /** + * Sets the CallGathererPass. + */ + public function setGatherer(CallGathererPass $gatherer = null): void + { + $this->gatherer = $gatherer; + } } diff --git a/Library/Cache/MethodCache.php b/src/Cache/MethodCache.php similarity index 69% rename from Library/Cache/MethodCache.php rename to src/Cache/MethodCache.php index 66238021c2..ad0f9725cd 100644 --- a/Library/Cache/MethodCache.php +++ b/src/Cache/MethodCache.php @@ -15,11 +15,15 @@ use ReflectionClass; use ReflectionException; -use Zephir\ClassDefinition; +use ReflectionMethod; +use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; -use Zephir\MethodCallWarmUp; use Zephir\Passes\CallGathererPass; -use Zephir\Variable; +use Zephir\Variable\Variable; + +use function count; +use function in_array; +use function is_object; /** * Calls in Zephir implement monomorphic and polymorphic caches to @@ -42,25 +46,13 @@ class MethodCache { protected array $cache = []; - protected ?CallGathererPass $gatherer = null; - - /** - * @param CallGathererPass|null $gatherer - */ - public function __construct(CallGathererPass $gatherer = null) + public function __construct(protected ?CallGathererPass $gatherer = null) { - $this->gatherer = $gatherer; } /** * Retrieves/Creates a function cache for a method call. * - * @param CompilationContext $compilationContext - * @param string $methodName - * @param Variable $caller - * - * @return string - * * @throws ReflectionException */ public function get(CompilationContext $compilationContext, string $methodName, Variable $caller): string @@ -69,7 +61,7 @@ public function get(CompilationContext $compilationContext, string $methodName, $numberPoly = 0; - if ('this' == $caller->getRealName()) { + if ('this' === $caller->getRealName()) { $classDefinition = $compilationContext->classDefinition; if ($classDefinition->hasMethod($methodName)) { ++$numberPoly; @@ -78,7 +70,12 @@ public function get(CompilationContext $compilationContext, string $methodName, } else { $classTypes = $caller->getClassTypes(); foreach ($classTypes as $classType) { - if ($compiler->isClass($classType) || $compiler->isInterface($classType) || $compiler->isBundledClass($classType) || $compiler->isBundledInterface($classType)) { + if ( + $compiler->isClass($classType) || + $compiler->isInterface($classType) || + $compiler->isBundledClass($classType) || + $compiler->isBundledInterface($classType) + ) { if ($compiler->isInterface($classType)) { continue; } @@ -104,15 +101,18 @@ public function get(CompilationContext $compilationContext, string $methodName, if (!$numberPoly) { // Try to generate a cache based on the fact the variable is not modified within the loop block if ($compilationContext->insideCycle && !$caller->isTemporal()) { - if (\count($compilationContext->cycleBlocks) && 'variable' == $caller->getType()) { - $currentBlock = $compilationContext->cycleBlocks[\count($compilationContext->cycleBlocks) - 1]; + if (count($compilationContext->cycleBlocks) && 'variable' == $caller->getType()) { + $currentBlock = $compilationContext->cycleBlocks[count($compilationContext->cycleBlocks) - 1]; if (0 == $currentBlock->getMutateGatherer(true)->getNumberOfMutations($caller->getName())) { - $functionCache = $compilationContext->symbolTable->getTempVariableForWrite('zephir_fcall_cache_entry', $compilationContext); + $functionCache = $compilationContext->symbolTable->getTempVariableForWrite( + 'zephir_fcall_cache_entry', + $compilationContext + ); $functionCache->setMustInitNull(true); $functionCache->setReusable(false); - return '&'.$functionCache->getName().', 0'; + return '&' . $functionCache->getName() . ', 0'; } } } @@ -120,24 +120,35 @@ public function get(CompilationContext $compilationContext, string $methodName, return 'NULL, 0'; } - if (!($method instanceof \ReflectionMethod)) { + if (!($method instanceof ReflectionMethod)) { if ($method->getClassDefinition()->isExternal()) { return 'NULL, 0'; } $completeName = $method->getClassDefinition()->getCompleteName(); if (isset($this->cache[$completeName][$method->getName()])) { - return $this->cache[$completeName][$method->getName()].', '.SlotsCache::getExistingMethodSlot($method); + return $this->cache[$completeName][$method->getName()] + . ', ' + . SlotsCache::getExistingMethodSlot($method); } $gatherer = $this->gatherer; - if (\is_object($gatherer)) { - $number = $gatherer->getNumberOfMethodCalls($method->getClassDefinition()->getCompleteName(), $method->getName()); + if (is_object($gatherer)) { + $number = $gatherer->getNumberOfMethodCalls( + $method->getClassDefinition()->getCompleteName(), + $method->getName() + ); } else { $number = 0; } - $staticCacheable = !$method->getClassDefinition()->isInterface() && ($compilationContext->currentMethod == $method || $method->getClassDefinition()->isFinal() || $method->isFinal() || $method->isPrivate()); + $staticCacheable = !$method->getClassDefinition()->isInterface() && + ( + $compilationContext->currentMethod == $method || + $method->getClassDefinition()->isFinal() || + $method->isFinal() || + $method->isPrivate() + ); if ($number > 1 || $compilationContext->insideCycle) { $cacheable = true; } else { @@ -145,17 +156,10 @@ public function get(CompilationContext $compilationContext, string $methodName, } } else { $staticCacheable = false; - $cacheable = false; - } - - // Recursive methods require warm-up - if ($compilationContext->currentMethod == $method) { - if (!$compilationContext->methodWarmUp) { - $compilationContext->methodWarmUp = new MethodCallWarmUp(); - } + $cacheable = false; } - if ('this_ptr' != $caller->getName()) { + if ('this_ptr' !== $caller->getName()) { $associatedClass = $caller->getAssociatedClass(); if ($this->isClassCacheable($associatedClass)) { $staticCacheable = true; @@ -169,31 +173,34 @@ public function get(CompilationContext $compilationContext, string $methodName, } if ($cacheable) { - $functionCacheVar = $compilationContext->symbolTable->getTempVariableForWrite('zephir_fcall_cache_entry', $compilationContext); + $functionCacheVar = $compilationContext->symbolTable->getTempVariableForWrite( + 'zephir_fcall_cache_entry', + $compilationContext + ); $functionCacheVar->setMustInitNull(true); $functionCacheVar->setReusable(false); - $functionCache = '&'.$functionCacheVar->getName(); + $functionCache = '&' . $functionCacheVar->getName(); } else { $functionCache = 'NULL'; } - if (!($method instanceof \ReflectionMethod)) { + if (!($method instanceof ReflectionMethod)) { $this->cache[$completeName][$method->getName()] = $functionCache; } - return $functionCache.', '.$cacheSlot; + return $functionCache . ', ' . $cacheSlot; } /** * Checks if the class is suitable for caching. * - * @param ClassDefinition|ReflectionClass|null $classDefinition + * @param Definition|ReflectionClass|null $classDefinition * * @return bool */ private function isClassCacheable($classDefinition = null): bool { - if ($classDefinition instanceof ClassDefinition) { + if ($classDefinition instanceof Definition) { return true; } @@ -201,8 +208,8 @@ private function isClassCacheable($classDefinition = null): bool return false; } - return $classDefinition->isInternal() && - $classDefinition->isInstantiable() && - in_array($classDefinition->getExtension()->getName(), ['Reflection', 'Core', 'SPL']); + return $classDefinition->isInternal() + && $classDefinition->isInstantiable() + && in_array($classDefinition->getExtension()->getName(), ['Reflection', 'Core', 'SPL']); } } diff --git a/Library/Cache/SlotsCache.php b/src/Cache/SlotsCache.php similarity index 80% rename from Library/Cache/SlotsCache.php rename to src/Cache/SlotsCache.php index eb211d71d7..7e5374b5ba 100644 --- a/Library/Cache/SlotsCache.php +++ b/src/Cache/SlotsCache.php @@ -13,7 +13,7 @@ namespace Zephir\Cache; -use Zephir\ClassMethod; +use Zephir\Class\Method\Method; /** * In order to reduce memory allocation when calling functions and method_exists @@ -24,11 +24,30 @@ class SlotsCache { public const MAX_SLOTS_NUMBER = 512; - private static int $slot = 1; + private static array $cacheFunctionSlots = []; private static array $cacheMethodSlots = []; - private static array $cacheFunctionSlots = []; + private static int $slot = 1; + + /** + * Returns or creates a cache slot for a function. + */ + public static function getExistingFunctionSlot(string $functionName): int + { + return self::$cacheFunctionSlots[$functionName] ?? 0; + } + + /** + * Returns a cache slot for a method. + */ + public static function getExistingMethodSlot(Method $method): int + { + $className = $method->getClassDefinition()->getCompleteName(); + $methodName = $method->getName(); + + return self::$cacheMethodSlots[$className][$methodName] ?? 0; + } /** * Returns or creates a cache slot for a function. @@ -53,28 +72,12 @@ public static function getFunctionSlot(string $functionName): int return $slot; } - /** - * Returns or creates a cache slot for a function. - * - * @param string $functionName - * - * @return int - */ - public static function getExistingFunctionSlot(string $functionName): int - { - return self::$cacheFunctionSlots[$functionName] ?? 0; - } - /** * Returns or creates a cache slot for a method. - * - * @param ClassMethod $method - * - * @return int */ - public static function getMethodSlot(ClassMethod $method): int + public static function getMethodSlot(Method $method): int { - $className = $method->getClassDefinition()->getCompleteName(); + $className = $method->getClassDefinition()->getCompleteName(); $methodName = $method->getName(); if (isset(self::$cacheMethodSlots[$className][$methodName])) { @@ -90,19 +93,4 @@ public static function getMethodSlot(ClassMethod $method): int return $slot; } - - /** - * Returns a cache slot for a method. - * - * @param ClassMethod $method - * - * @return int - */ - public static function getExistingMethodSlot(ClassMethod $method): int - { - $className = $method->getClassDefinition()->getCompleteName(); - $methodName = $method->getName(); - - return self::$cacheMethodSlots[$className][$methodName] ?? 0; - } } diff --git a/Library/Cache/StaticMethodCache.php b/src/Cache/StaticMethodCache.php similarity index 63% rename from Library/Cache/StaticMethodCache.php rename to src/Cache/StaticMethodCache.php index 6b88dc831a..a61d26ddbf 100644 --- a/Library/Cache/StaticMethodCache.php +++ b/src/Cache/StaticMethodCache.php @@ -9,10 +9,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Cache; use ReflectionMethod; -use Zephir\ClassMethod; use Zephir\CompilationContext; /** @@ -36,16 +37,7 @@ class StaticMethodCache { protected array $cache = []; - /** - * MethodCache. - * - * @param CompilationContext $compilationContext - * @param ClassMethod|ReflectionMethod|null $method - * @param bool $allowNtsCache - * - * @return string - */ - public function get(CompilationContext $compilationContext, $method, bool $allowNtsCache = true): string + public function get(CompilationContext $compilationContext, $method): string { if ($method === null) { return 'NULL, 0'; @@ -62,31 +54,23 @@ public function get(CompilationContext $compilationContext, $method, bool $allow } if (isset($this->cache[$completeName][$method->getName()])) { - return '&'.$this->cache[$completeName][$method->getName()]->getName().', '.SlotsCache::getExistingMethodSlot($method); + return '&' + . $this->cache[$completeName][$method->getName()]->getName() + . ', ' + . SlotsCache::getExistingMethodSlot($method); } } - $mustBeCached = false; - if (!$compilationContext->insideCycle) { - if (!($method instanceof ReflectionMethod)) { - $classDefinition = $method->getClassDefinition(); - if (!$classDefinition->isBundled() && $allowNtsCache) { - $mustBeCached = !$compilationContext->backend->isZE3(); - } else { - if (!$method->isPrivate() && !$method->isFinal()) { - return 'NULL, 0'; - } - } - } else { - if (!$method->isPrivate() && !$method->isFinal()) { - return 'NULL, 0'; - } - } + if (!$compilationContext->insideCycle && !$method->isPrivate() && !$method->isFinal()) { + return 'NULL, 0'; } - $functionCache = $compilationContext->symbolTable->getTempVariableForWrite('zephir_fcall_cache_entry', $compilationContext); + $functionCache = $compilationContext->symbolTable->getTempVariableForWrite( + 'zephir_fcall_cache_entry', + $compilationContext + ); - if ($method->isPrivate() || $method->isFinal() || $mustBeCached) { + if ($method->isPrivate() || $method->isFinal()) { $cacheSlot = SlotsCache::getMethodSlot($method); } else { $cacheSlot = '0'; @@ -99,6 +83,6 @@ public function get(CompilationContext $compilationContext, $method, bool $allow $this->cache[$completeName][$method->getName()] = $functionCache; } - return '&'.$functionCache->getName().', '.$cacheSlot; + return '&' . $functionCache->getName() . ', ' . $cacheSlot; } } diff --git a/Library/Call.php b/src/Call.php similarity index 59% rename from Library/Call.php rename to src/Call.php index 2f1d7a3ce9..8e97d584d2 100644 --- a/Library/Call.php +++ b/src/Call.php @@ -15,6 +15,15 @@ use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; +use Zephir\Variable\Variable; + +use function array_keys; +use function array_merge; +use function count; +use function implode; +use function is_array; +use function is_object; +use function sprintf; /** * Base class for common functionality in functions/calls @@ -27,505 +36,424 @@ class Call * @var Expression|null */ protected ?Expression $expression = null; - /** * @var bool */ - protected bool $mustInit = false; - + protected bool $isExpecting = false; /** - * @var Variable|null + * @var array */ - protected ?Variable $symbolVariable = null; - + protected array $mustCheckForCopy = []; /** * @var bool */ - protected bool $isExpecting = false; - - /** - * @var array - */ - protected array $resolvedParams = []; - + protected bool $mustInit = false; /** * @var mixed|null */ - protected $reflection = null; - + protected $reflection; /** * @var array */ - protected array $resolvedTypes = []; - + protected array $resolvedDynamicTypes = []; /** * @var array */ - protected array $resolvedDynamicTypes = []; - + protected array $resolvedParams = []; /** * @var array */ - protected array $temporalVariables = []; - + protected array $resolvedTypes = []; + /** + * @var Variable|null + */ + protected ?Variable $symbolVariable = null; /** * @var array */ - protected array $mustCheckForCopy = []; + protected array $temporalVariables = []; /** - * Processes the symbol variable that will be used to return - * the result of the symbol call. + * Add the last-call-status flag to the current symbol table. * * @param CompilationContext $compilationContext */ - public function processExpectedReturn(CompilationContext $compilationContext) + public function addCallStatusFlag(CompilationContext $compilationContext): void { - $expr = $this->expression; - $expression = $expr->getExpression(); - - /** - * Create temporary variable if needed. - */ - $symbolVariable = null; - $isExpecting = $expr->isExpectingReturn(); - if ($isExpecting) { - $symbolVariable = $expr->getExpectingVariable(); - if (\is_object($symbolVariable)) { - $readDetector = new ReadDetector(); - if ($readDetector->detect($symbolVariable->getName(), $expression)) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( - 'variable', - $compilationContext, - $expression - ); - } else { - $this->mustInit = true; - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } + if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_LAST_CALL_STATUS')) { + $callStatus = new Variable( + 'int', + 'ZEPHIR_LAST_CALL_STATUS', + $compilationContext->branchManager->getCurrentBranch() + ); + $callStatus->setIsInitialized(true, $compilationContext); + $callStatus->increaseUses(); + $callStatus->setReadOnly(true); + $compilationContext->symbolTable->addRawVariable($callStatus); } - - $this->symbolVariable = $symbolVariable; - $this->isExpecting = $isExpecting; } /** - * Processes the symbol variable that will be used to return - * the result of the symbol call. + * Checks the last call status or make a label jump to the next catch block. * * @param CompilationContext $compilationContext */ - public function processExpectedObservedReturn(CompilationContext $compilationContext): void + public function addCallStatusOrJump(CompilationContext $compilationContext): void { - $expr = $this->expression; - $expression = $expr->getExpression(); + $compilationContext->headersManager->add('kernel/fcall'); + if ($compilationContext->insideTryCatch) { + $compilationContext->codePrinter->output( + 'zephir_check_call_status_or_jump(try_end_' . $compilationContext->currentTryCatch . ');' + ); - /** - * Create temporary variable if needed. - */ - $mustInit = false; - $symbolVariable = null; - $isExpecting = $expr->isExpectingReturn(); - if ($isExpecting) { - $symbolVariable = $expr->getExpectingVariable(); - if (\is_object($symbolVariable)) { - $readDetector = new ReadDetector(); - if ($readDetector->detect($symbolVariable->getName(), $expression)) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); - } else { - $mustInit = true; - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); - } + return; } - $this->mustInit = $mustInit; - $this->symbolVariable = $symbolVariable; - $this->isExpecting = $isExpecting; - } - - /** - * Check if an external expression is expecting the call return a value. - * - * @return bool - */ - public function isExpectingReturn(): bool - { - return $this->isExpecting; - } - - /** - * Returns if the symbol to be returned by the call must be initialized. - * - * @return bool - */ - public function mustInitSymbolVariable(): bool - { - return $this->mustInit; + $compilationContext->codePrinter->output('zephir_check_call_status();'); } /** - * Returns the symbol variable that must be returned by the call. - * - * @param bool $useTemp - * @param CompilationContext|null $compilationContext + * Checks if temporary parameters must be copied or not. * - * @return Variable|null + * @param CompilationContext $compilationContext */ - public function getSymbolVariable(bool $useTemp = false, CompilationContext $compilationContext = null): ?Variable + public function checkTempParameters(CompilationContext $compilationContext): void { - $symbolVariable = $this->symbolVariable; - - if ($useTemp && !\is_object($symbolVariable)) { - return $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); + $compilationContext->headersManager->add('kernel/fcall'); + foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { + $compilationContext->codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); } - - return $symbolVariable; } /** - * Resolves parameters. - * - * @param array $parameters - * @param CompilationContext $compilationContext - * @param array $expression - * @param bool $readOnly - * - * @return CompiledExpression[]|null + * Parameters to check if they must be copied. * - * @throws Exception + * @return array */ - public function getResolvedParamsAsExpr(array $parameters, CompilationContext $compilationContext, array $expression, bool $readOnly = false): ?array + public function getMustCheckForCopyVariables(): array { - if (!$this->resolvedParams) { - $hasParametersByName = false; - foreach ($parameters as $parameter) { - if (isset($parameter['name'])) { - $hasParametersByName = true; - break; - } - } - - /** - * All parameters must be passed by name - */ - if ($hasParametersByName) { - foreach ($parameters as $parameter) { - if (!isset($parameter['name'])) { - throw new CompilerException('All parameters must use named', $parameter); - } - } - } - - if ($hasParametersByName) { - if ($this->reflection) { - $positionalParameters = []; - foreach ($this->reflection->getParameters() as $position => $reflectionParameter) { - if (\is_object($reflectionParameter)) { - $positionalParameters[$reflectionParameter->getName()] = $position; - } else { - $positionalParameters[$reflectionParameter['name']] = $position; - } - } - $orderedParameters = []; - foreach ($parameters as $parameter) { - if (isset($positionalParameters[$parameter['name']])) { - $orderedParameters[$positionalParameters[$parameter['name']]] = $parameter; - } else { - throw new CompilerException('Named parameter "'.$parameter['name'].'" is not a valid parameter name, available: '.implode(', ', array_keys($positionalParameters)), $parameter['parameter']); - } - } - $parameters_count = \count($parameters); - for ($i = 0; $i < $parameters_count; ++$i) { - if (!isset($orderedParameters[$i])) { - $orderedParameters[$i] = ['parameter' => ['type' => 'null']]; - } - } - $parameters = $orderedParameters; - } - } - - $params = []; - foreach ($parameters as $parameter) { - if (\is_array($parameter['parameter'])) { - $paramExpr = new Expression($parameter['parameter']); - - switch ($parameter['parameter']['type']) { - case 'property-access': - case 'array-access': - case 'static-property-access': - $paramExpr->setReadOnly(true); - break; - - default: - $paramExpr->setReadOnly($readOnly); - break; - } - - $params[] = $paramExpr->compile($compilationContext); - continue; - } - - if ($parameter['parameter'] instanceof CompiledExpression) { - $params[] = $parameter['parameter']; - continue; - } - - throw new CompilerException('Invalid expression ', $expression); - } - $this->resolvedParams = $params; - } - - return $this->resolvedParams; + return $this->mustCheckForCopy; } /** - * Resolve parameters getting aware that the target function/method could retain or change - * the parameters. + * Resolve parameters using zvals in the stack and without allocating memory for constants. * * @param array $parameters * @param CompilationContext $compilationContext * @param array $expression - * @param null $calleeDefinition * * @return array * * @throws Exception */ - public function getResolvedParams(array $parameters, CompilationContext $compilationContext, array $expression, $calleeDefinition = null): array - { + public function getReadOnlyResolvedParams( + array $parameters, + CompilationContext $compilationContext, + array $expression + ): array { $codePrinter = $compilationContext->codePrinter; - $exprParams = $this->getResolvedParamsAsExpr($parameters, $compilationContext, $expression); - - /** - * Static typed parameters in final/private methods are promotable to read only parameters - * Recursive calls with static typed methods also also promotable. - */ - $readOnlyParameters = []; - if (\is_object($calleeDefinition)) { - if ($calleeDefinition instanceof ClassMethod) { - if ($calleeDefinition->isFinal() || $calleeDefinition->isPrivate() || $calleeDefinition->isInternal() || $compilationContext->currentMethod === $calleeDefinition) { - foreach ($calleeDefinition->getParameters() as $position => $parameter) { - if (isset($parameter['data-type'])) { - switch ($parameter['data-type']) { - case 'int': - case 'uint': - case 'double': - case 'long': - case 'char': - case 'uchar': - case 'boolean': - case 'bool': - $readOnlyParameters[$position] = true; - break; - } - } - } - } - } - } + $exprParams = $this->getResolvedParamsAsExpr($parameters, $compilationContext, $expression, true); - $params = []; - $types = []; + $params = []; + $types = []; $dynamicTypes = []; - $mustCheck = []; + foreach ($exprParams as $compiledExpression) { $expression = $compiledExpression->getOriginal(); switch ($compiledExpression->getType()) { case 'null': - $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); - $compilationContext->backend->assignNull($parameterVariable, $compilationContext); - $this->temporalVariables[] = $parameterVariable; - $types[] = $compiledExpression->getType(); - $dynamicTypes[] = $compiledExpression->getType(); + $params[] = $compilationContext->backend->resolveValue('null', $compilationContext); + $types[] = 'null'; + $dynamicTypes[] = 'null'; break; case 'int': case 'uint': case 'long': - $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); - $compilationContext->backend->assignLong($parameterVariable, $compiledExpression->getCode(), $compilationContext); + $parameterVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong( + $parameterVariable, + $compiledExpression->getCode(), + $compilationContext + ); $this->temporalVariables[] = $parameterVariable; - $types[] = $compiledExpression->getType(); - $dynamicTypes[] = $compiledExpression->getType(); + $params[] = '&' . $parameterVariable->getName(); + $types[] = $parameterVariable->getType(); + $dynamicTypes[] = $parameterVariable->getType(); break; - case 'double': - $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); - $compilationContext->backend->assignDouble($parameterVariable, $compiledExpression->getCode(), $compilationContext); + case 'char': + case 'uchar': + case 'ulong': + case 'string': + case 'istring': + $parameterVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + + $compilationContext->backend->assignString( + $parameterVariable, + Name::addSlashes($compiledExpression->getCode()), + $compilationContext + ); + $this->temporalVariables[] = $parameterVariable; - $types[] = $compiledExpression->getType(); + $params[] = '&' . $parameterVariable->getName(); + $types[] = $parameterVariable->getType(); + $dynamicTypes[] = $parameterVariable->getType(); break; - case 'bool': - $value = $compiledExpression->getCode(); - if ('true' == $value) { - $value = '1'; - } elseif ('false' == $value) { - $value = '0'; - } - $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); - $compilationContext->backend->assignBool($parameterVariable, $value, $compilationContext); - - $this->temporalVariables[] = $parameterVariable; - $types[] = $compiledExpression->getType(); - $dynamicTypes[] = $compiledExpression->getType(); - break; - - case 'ulong': - case 'string': - case 'istring': - $parameterVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - - $compilationContext->backend->assignString( - $parameterVariable, - add_slashes($compiledExpression->getCode()), + case 'double': + $parameterVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', $compilationContext ); - + $codePrinter->output( + 'ZVAL_DOUBLE(&' . $parameterVariable->getName() . ', ' . $compiledExpression->getCode() . ');' + ); $this->temporalVariables[] = $parameterVariable; - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); - $types[] = $compiledExpression->getType(); - $dynamicTypes[] = $compiledExpression->getType(); + $params[] = '&' . $parameterVariable->getName(); + $types[] = $parameterVariable->getType(); + $dynamicTypes[] = $parameterVariable->getType(); + break; + + case 'bool': + if ('true' == $compiledExpression->getCode()) { + $params[] = $compilationContext->backend->resolveValue('true', $compilationContext); + } else { + if ('false' == $compiledExpression->getCode()) { + $params[] = $compilationContext->backend->resolveValue('false', $compilationContext); + } else { + throw new CompilerException( + 'Unable to resolve parameter using zval', + $expression + ); + } + } + $types[] = 'bool'; + $dynamicTypes[] = 'bool'; break; case 'array': - $parameterVariable = $compilationContext->symbolTable->getVariableForRead($compiledExpression->getCode(), $compilationContext, $expression); - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); - $types[] = $compiledExpression->getType(); - $dynamicTypes[] = $compiledExpression->getType(); + $parameterVariable = $compilationContext->symbolTable->getVariableForRead( + $compiledExpression->getCode(), + $compilationContext, + $expression + ); + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $types[] = $parameterVariable->getType(); + $dynamicTypes[] = $parameterVariable->getType(); break; case 'variable': - $parameterVariable = $compilationContext->symbolTable->getVariableForRead($compiledExpression->getCode(), $compilationContext, $expression); + $parameterVariable = $compilationContext->symbolTable->getVariableForRead( + $compiledExpression->getCode(), + $compilationContext, + $expression + ); switch ($parameterVariable->getType()) { case 'int': case 'uint': case 'long': - /* ulong must be stored in string */ case 'ulong': - $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); - $params[] = $compilationContext->backend->getVariableCode($parameterTempVariable); - $compilationContext->backend->assignLong($parameterTempVariable, $parameterVariable, $compilationContext); + $parameterTempVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $codePrinter->output( + 'ZVAL_LONG(&' . $parameterTempVariable->getName() . ', ' . $compiledExpression->getCode( + ) . ');' + ); + $params[] = '&' . $parameterTempVariable->getName(); + $types[] = $parameterTempVariable->getType(); + $dynamicTypes[] = $parameterTempVariable->getType(); $this->temporalVariables[] = $parameterTempVariable; - $types[] = $parameterVariable->getType(); - $dynamicTypes[] = $parameterVariable->getType(); + break; + + case 'char': + case 'uchar': + $parameterVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + $codePrinter->output( + sprintf( + 'ZVAL_STRINGL(&%s, &%s, 1);', + $parameterVariable->getName(), + $compiledExpression->getCode() + ) + ); + + $this->temporalVariables[] = $parameterVariable; + $params[] = '&' . $parameterVariable->getName(); + $types[] = $parameterVariable->getType(); + $dynamicTypes[] = $parameterVariable->getType(); break; case 'double': - $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); - $compilationContext->backend->assignDouble($parameterTempVariable, $parameterVariable, $compilationContext); - $params[] = $compilationContext->backend->getVariableCode($parameterTempVariable); + $parameterTempVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $codePrinter->output( + 'ZVAL_DOUBLE(&' . $parameterTempVariable->getName( + ) . ', ' . $compiledExpression->getCode() . ');' + ); + $params[] = '&' . $parameterTempVariable->getName(); + $types[] = $parameterTempVariable->getType(); + $dynamicTypes[] = $parameterTempVariable->getType(); $this->temporalVariables[] = $parameterTempVariable; - $types[] = $parameterVariable->getType(); - $dynamicTypes[] = $parameterVariable->getType(); break; case 'bool': - $tempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); - $codePrinter->output('if ('.$parameterVariable->getName().') {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->assignBool($tempVariable, '1', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - $compilationContext->backend->assignBool($tempVariable, '0', $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - $params[] = $compilationContext->backend->getVariableCode($tempVariable); - $types[] = $parameterVariable->getType(); - $dynamicTypes[] = $parameterVariable->getType(); + $parameterTempVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignBool( + $parameterTempVariable, + '(' . $parameterVariable->getName() . ' ? 1 : 0)', + $compilationContext + ); + $params[] = $compilationContext->backend->getVariableCode($parameterTempVariable); + $dynamicTypes[] = $parameterTempVariable->getType(); + $types[] = $parameterTempVariable->getType(); break; case 'string': - case 'array': - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); - $types[] = $parameterVariable->getType(); - $dynamicTypes[] = $parameterVariable->getType(); - break; - case 'variable': case 'mixed': - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); - $types[] = $parameterVariable->getType(); - $dynamicTypes = array_merge( - $dynamicTypes, - array_keys($parameterVariable->getDynamicTypes()) - ); + case 'array': + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $dynamicTypes[] = $parameterVariable->getType(); + $types[] = $parameterVariable->getType(); break; default: - throw new CompilerException( - 'Cannot use variable type: '.$parameterVariable->getType().' as parameter', + throw CompilerException::cannotUseVariableTypeAs( + $parameterVariable, + 'as parameter', $expression ); } break; default: - throw new CompilerException( - 'Cannot use value type: '.$compiledExpression->getType().' as parameter', + throw CompilerException::cannotUseValueTypeAs( + $compiledExpression, + 'parameter', $expression ); } } - $this->resolvedTypes = $types; + $this->resolvedTypes = $types; $this->resolvedDynamicTypes = $dynamicTypes; - $this->mustCheckForCopy = $mustCheck; return $params; } /** - * Resolve parameters using zvals in the stack and without allocating memory for constants. - * - * @param array $parameters - * @param CompilationContext $compilationContext - * @param array $expression + * Return resolved parameter dynamic types. * * @return array + */ + public function getResolvedDynamicTypes(): array + { + return $this->resolvedDynamicTypes; + } + + /** + * Resolve parameters getting aware that the target function/method could retain or change + * the parameters. * * @throws Exception */ - public function getReadOnlyResolvedParams(array $parameters, CompilationContext $compilationContext, array $expression): array - { + public function getResolvedParams( + array $parameters, + CompilationContext $compilationContext, + array $expression, + ): array { $codePrinter = $compilationContext->codePrinter; - $exprParams = $this->getResolvedParamsAsExpr($parameters, $compilationContext, $expression, true); + $exprParams = $this->getResolvedParamsAsExpr($parameters, $compilationContext, $expression); - $params = []; - $types = []; + $params = []; + $types = []; $dynamicTypes = []; - + $mustCheck = []; foreach ($exprParams as $compiledExpression) { $expression = $compiledExpression->getOriginal(); switch ($compiledExpression->getType()) { case 'null': - $params[] = $compilationContext->backend->resolveValue('null', $compilationContext); - $types[] = 'null'; - $dynamicTypes[] = 'null'; + $parameterVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $compilationContext->backend->assignNull($parameterVariable, $compilationContext); + $this->temporalVariables[] = $parameterVariable; + $types[] = $compiledExpression->getType(); + $dynamicTypes[] = $compiledExpression->getType(); break; case 'int': case 'uint': case 'long': - $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); - $compilationContext->backend->assignLong($parameterVariable, $compiledExpression->getCode(), $compilationContext); + $parameterVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $compilationContext->backend->assignLong( + $parameterVariable, + $compiledExpression->getCode(), + $compilationContext + ); $this->temporalVariables[] = $parameterVariable; - $params[] = '&'.$parameterVariable->getName(); - $types[] = $parameterVariable->getType(); - $dynamicTypes[] = $parameterVariable->getType(); + $types[] = $compiledExpression->getType(); + $dynamicTypes[] = $compiledExpression->getType(); + break; + + case 'double': + $parameterVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $compilationContext->backend->assignDouble( + $parameterVariable, + $compiledExpression->getCode(), + $compilationContext + ); + $this->temporalVariables[] = $parameterVariable; + $types[] = $compiledExpression->getType(); + break; + + case 'bool': + $value = $compiledExpression->getCode(); + if ('true' == $value) { + $value = '1'; + } elseif ('false' == $value) { + $value = '0'; + } + $parameterVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $compilationContext->backend->assignBool($parameterVariable, $value, $compilationContext); + + $this->temporalVariables[] = $parameterVariable; + $types[] = $compiledExpression->getType(); + $dynamicTypes[] = $compiledExpression->getType(); break; - case 'char': - case 'uchar': case 'ulong': case 'string': case 'istring': @@ -537,218 +465,381 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext $compilationContext->backend->assignString( $parameterVariable, - add_slashes($compiledExpression->getCode()), + Name::addSlashes($compiledExpression->getCode()), $compilationContext ); $this->temporalVariables[] = $parameterVariable; - $params[] = '&'.$parameterVariable->getName(); - $types[] = $parameterVariable->getType(); - $dynamicTypes[] = $parameterVariable->getType(); - break; - - case 'double': - $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); - $codePrinter->output('ZVAL_DOUBLE(&'.$parameterVariable->getName().', '.$compiledExpression->getCode().');'); - $this->temporalVariables[] = $parameterVariable; - $params[] = '&'.$parameterVariable->getName(); - $types[] = $parameterVariable->getType(); - $dynamicTypes[] = $parameterVariable->getType(); - break; - - case 'bool': - if ('true' == $compiledExpression->getCode()) { - $params[] = $compilationContext->backend->resolveValue('true', $compilationContext); - } else { - if ('false' == $compiledExpression->getCode()) { - $params[] = $compilationContext->backend->resolveValue('false', $compilationContext); - } else { - throw new CompilerException( - 'Unable to resolve parameter using zval', - $expression - ); - } - } - $types[] = 'bool'; - $dynamicTypes[] = 'bool'; + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $types[] = $compiledExpression->getType(); + $dynamicTypes[] = $compiledExpression->getType(); break; case 'array': - $parameterVariable = $compilationContext->symbolTable->getVariableForRead($compiledExpression->getCode(), $compilationContext, $expression); - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); - $types[] = $parameterVariable->getType(); - $dynamicTypes[] = $parameterVariable->getType(); + $parameterVariable = $compilationContext->symbolTable->getVariableForRead( + $compiledExpression->getCode(), + $compilationContext, + $expression + ); + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $types[] = $compiledExpression->getType(); + $dynamicTypes[] = $compiledExpression->getType(); break; case 'variable': - $parameterVariable = $compilationContext->symbolTable->getVariableForRead($compiledExpression->getCode(), $compilationContext, $expression); + $parameterVariable = $compilationContext->symbolTable->getVariableForRead( + $compiledExpression->getCode(), + $compilationContext, + $expression + ); switch ($parameterVariable->getType()) { case 'int': case 'uint': case 'long': + /* ulong must be stored in string */ case 'ulong': - $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); - $codePrinter->output('ZVAL_LONG(&'.$parameterTempVariable->getName().', '.$compiledExpression->getCode().');'); - $params[] = '&'.$parameterTempVariable->getName(); - $types[] = $parameterTempVariable->getType(); - $dynamicTypes[] = $parameterTempVariable->getType(); - $this->temporalVariables[] = $parameterTempVariable; - break; - - case 'char': - case 'uchar': - $parameterVariable = $compilationContext->symbolTable->getTempVariableForWrite( + $parameterTempVariable = $compilationContext->backend->getScalarTempVariable( 'variable', - $compilationContext, - $expression + $compilationContext ); - $codePrinter->output( - sprintf( - 'ZVAL_STRINGL(&%s, &%s, 1);', - $parameterVariable->getName(), - $compiledExpression->getCode() - ) + $params[] = $compilationContext->backend->getVariableCode( + $parameterTempVariable ); - - $this->temporalVariables[] = $parameterVariable; - $params[] = '&'.$parameterVariable->getName(); - $types[] = $parameterVariable->getType(); - $dynamicTypes[] = $parameterVariable->getType(); + $compilationContext->backend->assignLong( + $parameterTempVariable, + $parameterVariable, + $compilationContext + ); + $this->temporalVariables[] = $parameterTempVariable; + $types[] = $parameterVariable->getType(); + $dynamicTypes[] = $parameterVariable->getType(); break; case 'double': - $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); - $codePrinter->output('ZVAL_DOUBLE(&'.$parameterTempVariable->getName().', '.$compiledExpression->getCode().');'); - $params[] = '&'.$parameterTempVariable->getName(); - $types[] = $parameterTempVariable->getType(); - $dynamicTypes[] = $parameterTempVariable->getType(); + $parameterTempVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignDouble( + $parameterTempVariable, + $parameterVariable, + $compilationContext + ); + $params[] = $compilationContext->backend->getVariableCode( + $parameterTempVariable + ); $this->temporalVariables[] = $parameterTempVariable; + $types[] = $parameterVariable->getType(); + $dynamicTypes[] = $parameterVariable->getType(); break; case 'bool': - $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); - $compilationContext->backend->assignBool($parameterTempVariable, '('.$parameterVariable->getName().' ? 1 : 0)', $compilationContext); - $params[] = $compilationContext->backend->getVariableCode($parameterTempVariable); - $dynamicTypes[] = $parameterTempVariable->getType(); - $types[] = $parameterTempVariable->getType(); + $tempVariable = $compilationContext->backend->getScalarTempVariable( + 'variable', + $compilationContext + ); + $codePrinter->output('if (' . $parameterVariable->getName() . ') {'); + $codePrinter->increaseLevel(); + $compilationContext->backend->assignBool($tempVariable, '1', $compilationContext); + $codePrinter->decreaseLevel(); + $codePrinter->output('} else {'); + $codePrinter->increaseLevel(); + $compilationContext->backend->assignBool($tempVariable, '0', $compilationContext); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + $params[] = $compilationContext->backend->getVariableCode($tempVariable); + $types[] = $parameterVariable->getType(); + $dynamicTypes[] = $parameterVariable->getType(); break; case 'string': - case 'variable': - case 'mixed': case 'array': - $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $types[] = $parameterVariable->getType(); $dynamicTypes[] = $parameterVariable->getType(); - $types[] = $parameterVariable->getType(); + break; + + case 'variable': + case 'mixed': + $params[] = $compilationContext->backend->getVariableCode($parameterVariable); + $types[] = $parameterVariable->getType(); + $dynamicTypes = array_merge( + $dynamicTypes, + array_keys($parameterVariable->getDynamicTypes()) + ); break; default: - throw new CompilerException( - 'Cannot use variable type: '.$parameterVariable->getType().' as parameter', + throw CompilerException::cannotUseVariableTypeAs( + $parameterVariable, + 'as parameter', $expression ); } break; default: - throw new CompilerException( - 'Cannot use value type: '.$compiledExpression->getType().' as parameter', + throw CompilerException::cannotUseValueTypeAs( + $compiledExpression, + 'parameter', $expression ); } } - $this->resolvedTypes = $types; + $this->resolvedTypes = $types; $this->resolvedDynamicTypes = $dynamicTypes; + $this->mustCheckForCopy = $mustCheck; return $params; } /** - * Add the last-call-status flag to the current symbol table. + * Resolves parameters. * + * @param array $parameters * @param CompilationContext $compilationContext + * @param array $expression + * @param bool $readOnly + * + * @return CompiledExpression[]|null + * + * @throws Exception */ - public function addCallStatusFlag(CompilationContext $compilationContext): void - { - if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_LAST_CALL_STATUS')) { - $callStatus = new Variable('int', 'ZEPHIR_LAST_CALL_STATUS', $compilationContext->branchManager->getCurrentBranch()); - $callStatus->setIsInitialized(true, $compilationContext); - $callStatus->increaseUses(); - $callStatus->setReadOnly(true); - $compilationContext->symbolTable->addRawVariable($callStatus); + public function getResolvedParamsAsExpr( + array $parameters, + CompilationContext $compilationContext, + array $expression, + bool $readOnly = false + ): ?array { + if (!$this->resolvedParams) { + $hasParametersByName = false; + foreach ($parameters as $parameter) { + if (isset($parameter['name'])) { + $hasParametersByName = true; + break; + } + } + + /** + * All parameters must be passed by name + */ + if ($hasParametersByName) { + foreach ($parameters as $parameter) { + if (!isset($parameter['name'])) { + throw new CompilerException('All parameters must use named', $parameter); + } + } + } + + if ($hasParametersByName) { + if ($this->reflection) { + $positionalParameters = []; + foreach ($this->reflection->getParameters() as $position => $reflectionParameter) { + if (is_object($reflectionParameter)) { + $positionalParameters[$reflectionParameter->getName()] = $position; + } else { + $positionalParameters[$reflectionParameter['name']] = $position; + } + } + $orderedParameters = []; + foreach ($parameters as $parameter) { + if (isset($positionalParameters[$parameter['name']])) { + $orderedParameters[$positionalParameters[$parameter['name']]] = $parameter; + } else { + throw new CompilerException( + 'Named parameter "' + . $parameter['name'] + . '" is not a valid parameter name, available: ' + . implode(', ', array_keys($positionalParameters)), + $parameter['parameter'] + ); + } + } + $parameters_count = count($parameters); + for ($i = 0; $i < $parameters_count; ++$i) { + if (!isset($orderedParameters[$i])) { + $orderedParameters[$i] = ['parameter' => ['type' => 'null']]; + } + } + $parameters = $orderedParameters; + } + } + + $params = []; + foreach ($parameters as $parameter) { + if (is_array($parameter['parameter'])) { + $paramExpr = new Expression($parameter['parameter']); + + switch ($parameter['parameter']['type']) { + case 'property-access': + case 'array-access': + case 'static-property-access': + $paramExpr->setReadOnly(true); + break; + + default: + $paramExpr->setReadOnly($readOnly); + break; + } + + $params[] = $paramExpr->compile($compilationContext); + continue; + } + + if ($parameter['parameter'] instanceof CompiledExpression) { + $params[] = $parameter['parameter']; + continue; + } + + throw new CompilerException('Invalid expression ', $expression); + } + $this->resolvedParams = $params; } + + return $this->resolvedParams; } /** - * Checks the last call status or make a label jump to the next catch block. + * Return resolved parameter types. * - * @param CompilationContext $compilationContext + * @return array */ - public function addCallStatusOrJump(CompilationContext $compilationContext): void + public function getResolvedTypes(): array { - $compilationContext->headersManager->add('kernel/fcall'); - if ($compilationContext->insideTryCatch) { - $compilationContext->codePrinter->output( - 'zephir_check_call_status_or_jump(try_end_'.$compilationContext->currentTryCatch.');' - ); + return $this->resolvedTypes; + } - return; + /** + * Returns the symbol variable that must be returned by the call. + * + * @param bool $useTemp + * @param CompilationContext|null $compilationContext + * + * @return Variable|null + */ + public function getSymbolVariable(bool $useTemp = false, CompilationContext $compilationContext = null): ?Variable + { + $symbolVariable = $this->symbolVariable; + + if ($useTemp && !is_object($symbolVariable)) { + return $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); } - $compilationContext->codePrinter->output('zephir_check_call_status();'); + return $symbolVariable; } /** - * Checks if temporary parameters must be copied or not. + * Returns the temporal variables generated during the parameter resolving. * - * @param CompilationContext $compilationContext + * @return Variable[] */ - public function checkTempParameters(CompilationContext $compilationContext): void + public function getTemporalVariables(): array { - $compilationContext->headersManager->add('kernel/fcall'); - foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $compilationContext->codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); - } + return $this->temporalVariables; } /** - * Return resolved parameter types. + * Check if an external expression is expecting the call return a value. * - * @return array + * @return bool */ - public function getResolvedTypes(): array + public function isExpectingReturn(): bool { - return $this->resolvedTypes; + return $this->isExpecting; } /** - * Return resolved parameter dynamic types. + * Returns if the symbol to be returned by the call must be initialized. * - * @return array + * @return bool */ - public function getResolvedDynamicTypes(): array + public function mustInitSymbolVariable(): bool { - return $this->resolvedDynamicTypes; + return $this->mustInit; } /** - * Returns the temporal variables generated during the parameter resolving. + * Processes the symbol variable that will be used to return + * the result of the symbol call. * - * @return Variable[] + * @param CompilationContext $compilationContext */ - public function getTemporalVariables(): array + public function processExpectedObservedReturn(CompilationContext $compilationContext): void { - return $this->temporalVariables; + $expr = $this->expression; + $expression = $expr->getExpression(); + + /** + * Create temporary variable if needed. + */ + $mustInit = false; + $symbolVariable = null; + $isExpecting = $expr->isExpectingReturn(); + if ($isExpecting) { + $symbolVariable = $expr->getExpectingVariable(); + if (is_object($symbolVariable)) { + $readDetector = new ReadDetector(); + if ($readDetector->detect($symbolVariable->getName(), $expression)) { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( + 'variable', + $compilationContext + ); + } else { + $mustInit = true; + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( + 'variable', + $compilationContext + ); + } + } + + $this->mustInit = $mustInit; + $this->symbolVariable = $symbolVariable; + $this->isExpecting = $isExpecting; } /** - * Parameters to check if they must be copied. + * Processes the symbol variable that will be used to return + * the result of the symbol call. * - * @return array + * @param CompilationContext $compilationContext */ - public function getMustCheckForCopyVariables(): array + public function processExpectedReturn(CompilationContext $compilationContext): void { - return $this->mustCheckForCopy; + $expr = $this->expression; + $expression = $expr->getExpression(); + + /** + * Create temporary variable if needed. + */ + $symbolVariable = null; + $isExpecting = $expr->isExpectingReturn(); + if ($isExpecting) { + $symbolVariable = $expr->getExpectingVariable(); + if (is_object($symbolVariable)) { + $readDetector = new ReadDetector(); + if ($readDetector->detect($symbolVariable->getName(), $expression)) { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } else { + $this->mustInit = true; + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } + } + + $this->symbolVariable = $symbolVariable; + $this->isExpecting = $isExpecting; } } diff --git a/Library/ClassConstant.php b/src/Class/Constant.php similarity index 59% rename from Library/ClassConstant.php rename to src/Class/Constant.php index 6626ff1714..032d0bac69 100644 --- a/Library/ClassConstant.php +++ b/src/Class/Constant.php @@ -11,62 +11,70 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Class; -use Zephir\Exception\CompilerException; +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Expression\Constants; use Zephir\Expression\StaticConstantAccess; /** * Represents a class constant */ -class ClassConstant +class Constant { - /** - * @var string - */ - protected string $name; - - /** - * @var array - */ - protected array $value = []; + public function __construct( + protected string $name, + protected array $value, + protected ?string $docblock = null, + ) { + } /** - * @var string|null + * Produce the code to register a class constant. + * + * @throws Exception + * @throws ReflectionException */ - protected ?string $docblock = null; + public function compile(CompilationContext $compilationContext): void + { + $this->processValue($compilationContext); + $constantValue = $this->value['value'] ?? null; + $compilationContext->backend->declareConstant( + $this->value['type'], + $this->getName(), + $constantValue, + $compilationContext + ); + } /** - * ClassConstant constructor. - * - * @param string $name - * @param array $value - * @param string|null $docBlock + * Returns the docblock related to the constant. */ - public function __construct(string $name, array $value, ?string $docBlock = null) + public function getDocBlock(): ?string { - $this->name = $name; - $this->value = $value; - $this->docblock = $docBlock; + return $this->docblock; } /** * Returns the constant's name. - * - * @return string */ public function getName(): string { return $this->name; } + /** + * Get type of class constant. + */ + public function getType(): string + { + return $this->value['type']; + } + /** * Returns the constant's value. - * - * TODO: Rewrite name - * - * @return array */ public function getValue(): array { @@ -75,8 +83,6 @@ public function getValue(): array /** * Get the type of the value of the constant. - * - * @return string */ public function getValueType(): string { @@ -85,49 +91,25 @@ public function getValueType(): string /** * Get value of the value of the constant. - * - * @return mixed - */ - public function getValueValue() - { - return $this->value['value'] ?? false; - } - - /** - * Returns the docblock related to the constant. - * - * @return string|null */ - public function getDocBlock(): ?string + public function getValueValue(): mixed { - return $this->docblock; - } - - /** - * Get type of class constant. - * - * @return string - */ - public function getType(): string - { - return $this->value['type']; + return $this->value['value'] ?? null; } /** * Process the value of the class constant if needed. * - * @param CompilationContext $compilationContext - * * @throws Exception + * @throws ReflectionException */ - public function processValue(CompilationContext $compilationContext) + public function processValue(CompilationContext $compilationContext): void { if ('constant' === $this->value['type']) { - $constant = new Constants(); - $compiledExpression = $constant->compile($this->value, $compilationContext); + $compiledExpression = (new Constants())->compile($this->value, $compilationContext); $this->value = [ - 'type' => $compiledExpression->getType(), + 'type' => $compiledExpression->getType(), 'value' => $compiledExpression->getCode(), ]; @@ -135,35 +117,12 @@ public function processValue(CompilationContext $compilationContext) } if ('static-constant-access' === $this->value['type']) { - $staticConstantAccess = new StaticConstantAccess(); - $compiledExpression = $staticConstantAccess->compile($this->value, $compilationContext); + $compiledExpression = (new StaticConstantAccess())->compile($this->value, $compilationContext); $this->value = [ - 'type' => $compiledExpression->getType(), + 'type' => $compiledExpression->getType(), 'value' => $compiledExpression->getCode(), ]; } } - - /** - * Produce the code to register a class constant. - * - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * @throws Exception - */ - public function compile(CompilationContext $compilationContext): void - { - $this->processValue($compilationContext); - - $constantValue = $this->value['value'] ?? null; - - $compilationContext->backend->declareConstant( - $this->value['type'], - $this->getName(), - $constantValue, - $compilationContext - ); - } } diff --git a/Library/AbstractClassDefinition.php b/src/Class/Definition/AbstractDefinition.php similarity index 71% rename from Library/AbstractClassDefinition.php rename to src/Class/Definition/AbstractDefinition.php index d6750ccb03..f36fc47dd3 100644 --- a/Library/AbstractClassDefinition.php +++ b/src/Class/Definition/AbstractDefinition.php @@ -11,22 +11,15 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Class\Definition; -abstract class AbstractClassDefinition +abstract class AbstractDefinition { /** * Class name - * - * @var string */ protected string $name; - /** - * Returns the class name. - * - * @return string - */ public function getName(): string { return $this->name; diff --git a/Library/ClassDefinition.php b/src/Class/Definition/Definition.php similarity index 72% rename from Library/ClassDefinition.php rename to src/Class/Definition/Definition.php index 52a24656f6..6865fbb3d9 100644 --- a/Library/ClassDefinition.php +++ b/src/Class/Definition/Definition.php @@ -11,813 +11,778 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Class\Definition; use ReflectionClass; use ReflectionException; -use Zephir\Classes\Entry; +use Zephir\AliasManager; +use Zephir\Class\Constant; +use Zephir\Class\Entry; +use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Property; +use Zephir\Code\ArgInfoDefinition; +use Zephir\Code\Printer; +use Zephir\CompilationContext; +use Zephir\Compiler; use Zephir\Documentation\Docblock; use Zephir\Documentation\DocblockParser; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Exception\InvalidArgumentException; +use Zephir\HeadersManager; +use Zephir\StatementsBlock; + use function count; +use function explode; use function gettype; use function is_array; +use function ltrim; +use function metaphone; +use function method_exists; +use function sprintf; +use function str_replace; +use function strtolower; + use const DIRECTORY_SEPARATOR; /** - * Class Definition - * * Represents a class/interface and their properties and methods. */ -final class ClassDefinition extends AbstractClassDefinition +final class Definition extends AbstractDefinition { - public const TYPE_CLASS = 'class'; + public const TYPE_CLASS = 'class'; public const TYPE_INTERFACE = 'interface'; /** - * Class namespace - * - * @var string + * Contains "abstract" in the definition */ - protected string $namespace; - + protected bool $abstract = false; /** - * Class short name - * - * If didn't specified, then equals to $name - * - * @var string - * - * @see ClassDefinition::name + * @var AliasManager|null */ - protected string $shortName; - + protected ?AliasManager $aliasManager = null; /** - * Definition type - * - * @var string + * @var Compiler */ - protected string $type = self::TYPE_CLASS; - + protected Compiler $compiler; /** - * Name of inherited class - * - * @var string|null + * @var Constant[] */ - protected ?string $extendsClass = null; - + protected array $constants = []; /** - * List of implemented interfaces of current class - * - * @var array + * @var int */ - protected array $interfaces = []; - + protected int $dependencyRank = 0; /** - * Contains "final" in the definition - * - * @var bool + * @var string */ - protected bool $final = false; - + protected string $docBlock = ''; /** - * Contains "abstract" in the definition - * - * @var bool + * Name of inherited class */ - protected bool $abstract = false; - + protected ?string $extendsClass = null; + /** + * Definition object of inherited class + */ + protected ?AbstractDefinition $extendsClassDefinition = null; /** * When class is from external dependency - * - * @var bool */ protected bool $external = false; - /** - * Definition object of inherited class - * - * @var AbstractClassDefinition|null + * Contains "final" in the definition */ - protected ?AbstractClassDefinition $extendsClassDefinition = null; - + protected bool $final = false; /** - * @var AbstractClassDefinition[] + * @var array */ protected array $implementedInterfaceDefinitions = []; - /** - * @var ClassProperty[] + * List of implemented interfaces of current class */ - protected array $properties = []; - + protected array $interfaces = []; /** - * @var ClassConstant[] + * @var bool */ - protected array $constants = []; - + protected bool $isBundled = false; /** - * @var ClassMethod[] + * @var Method[] */ protected array $methods = []; - - /** - * @var string - */ - protected string $docBlock = ''; - - /** - * @var Docblock|null - */ - protected ?Docblock $parsedDocblock = null; - - /** - * @var int - */ - protected int $dependencyRank = 0; - /** * @var array */ protected array $originalNode = []; - /** - * @var EventsManager + * @var Docblock|null */ - protected EventsManager $eventsManager; - + protected ?Docblock $parsedDocblock = null; /** - * @var bool + * @var Property[] */ - protected bool $isBundled = false; - + protected array $properties = []; /** - * @var AliasManager|null + * Class short name + * + * If didn't specify, then equals to $name + * + * @see Definition::name */ - protected ?AliasManager $aliasManager = null; - + protected string $shortName; /** - * @var Compiler + * Definition type */ - protected Compiler $compiler; + protected string $type = self::TYPE_CLASS; - /** - * ClassDefinition. - * - * @param string $namespace - * @param string $name - * @param string|null $shortName - */ - public function __construct(string $namespace, string $name, ?string $shortName = null) + public function __construct(protected string $namespace, string $name, string $shortName = null) { - $this->namespace = $namespace; - $this->name = $name; + $this->name = $name; $this->shortName = $shortName ?: $name; - - $this->eventsManager = new EventsManager(); } /** - * Sets if the class is internal or not. + * Adds a constant to the definition. * - * @param bool $isBundled + * @throws CompilerException */ - public function setIsBundled(bool $isBundled): void + public function addConstant(Constant $constant): void { - $this->isBundled = $isBundled; - } + if (isset($this->constants[$constant->getName()])) { + throw new CompilerException("Constant '" . $constant->getName() . "' was defined more than one time"); + } - /** - * Returns whether the class is bundled or not. - * - * @return bool - */ - public function isBundled(): bool - { - return $this->isBundled; + $this->constants[$constant->getName()] = $constant; } /** - * Sets whether the class is external or not. - * - * @param bool $isExternal + * Creates the initialization method. */ - public function setIsExternal(bool $isExternal): void + public function addInitMethod(StatementsBlock $statementsBlock): void { - $this->external = $isExternal; - } + if ($statementsBlock->isEmpty()) { + return; + } - /** - * Returns whether the class is internal or not. - * - * @return bool - */ - public function isExternal(): bool - { - return $this->external; - } + $initClassName = $this->getCNamespace() . '_' . $this->getName(); + $classMethod = new Method( + $this, + ['internal'], + 'zephir_init_properties_' . $initClassName, + null, + $statementsBlock + ); - /** - * Get eventsManager for class definition. - * - * @return EventsManager - */ - public function getEventsManager(): EventsManager - { - return $this->eventsManager; + $classMethod->setIsInitializer(true); + $this->addMethod($classMethod); } /** - * Set the class' type (class/interface). + * Adds a method to the class definition. * - * @param string $type + * @throws CompilerException */ - public function setType(string $type): void + public function addMethod(Method $method, array $statement = null): void { - $this->type = $type; - } + $methodName = strtolower($method->getName()); + if (isset($this->methods[$methodName])) { + throw new CompilerException( + "Method '" . $method->getName() . "' was defined more than one time", + $statement + ); + } - /** - * Returns the class type. - * - * @return string - */ - public function getType(): string - { - return $this->type; + $this->methods[$methodName] = $method; } /** - * Returns the class name without namespace. + * Adds a property to the definition. * - * @return string + * @throws CompilerException */ - public function getShortName(): string + public function addProperty(Property $property): void { - return $this->shortName; - } + if (isset($this->properties[$property->getName()])) { + throw new CompilerException( + "Property '" . $property->getName() . "' was defined more than one time", + $property->getOriginal() + ); + } - /** - * Check if the class definition correspond to an interface. - * - * @return bool - */ - public function isInterface(): bool - { - return 'interface' === $this->type; + $this->properties[$property->getName()] = $property; } /** - * Sets if the class is final. - * - * @param bool $final + * Creates the static initialization method. */ - public function setIsFinal(bool $final): void + public function addStaticInitMethod(StatementsBlock $statementsBlock): void { - $this->final = $final; - } + $initClassName = $this->getCNamespace() . '_' . $this->getName(); - /** - * Sets if the class is final. - * - * @param bool $abstract - */ - public function setIsAbstract(bool $abstract): void - { - $this->abstract = $abstract; - } + $classMethod = new Method( + $this, + ['internal'], + 'zephir_init_static_properties_' . $initClassName, + null, + $statementsBlock + ); - /** - * Checks whether the class is abstract or not. - * - * @return bool - */ - public function isAbstract(): bool - { - return $this->abstract; + $classMethod->setIsInitializer(true); + $classMethod->setIsStatic(true); + $this->addMethod($classMethod); } /** - * Checks whether the class is abstract or not. - * - * @return bool + * Builds a class definition from reflection. */ - public function isFinal(): bool + public static function buildFromReflection(ReflectionClass $class): self { - return $this->final; - } + $classDefinition = new self($class->getNamespaceName(), $class->getName(), $class->getShortName()); - /** - * Returns the class name including its namespace. - * - * @return string - */ - public function getCompleteName(): string - { - return $this->namespace.'\\'.$this->shortName; - } + foreach ($class->getMethods() as $method) { + $parameters = []; - /** - * Return the class namespace. - * - * @return string - */ - public function getNamespace(): string - { - return $this->namespace; - } + foreach ($method->getParameters() as $row) { + $params = [ + 'type' => 'parameter', + 'name' => $row->getName(), + 'const' => 0, + 'data-type' => 'variable', + 'mandatory' => !$row->isOptional(), + ]; - /** - * Set the original node where the class was declared. - * - * @param array $originalNode - */ - public function setOriginalNode(array $originalNode): void - { - $this->originalNode = $originalNode; - } + if (!$params['mandatory']) { + try { + $params['default'] = $row->getDefaultValue(); + } catch (ReflectionException $e) { + // TODO: dummy default value + $params['default'] = true; + } + } - /** - * Sets the extended class. - * - * @param string $extendsClass - */ - public function setExtendsClass(string $extendsClass): void - { - $this->extendsClass = $extendsClass; - } + $parameters[] = $params; + } - /** - * Sets the implemented interfaces. - * - * @param array $implementedInterfaces - */ - public function setImplementsInterfaces(array $implementedInterfaces): void - { - $this->interfaces = []; - foreach ($implementedInterfaces as $implementedInterface) { - $this->interfaces[] = $implementedInterface['value']; + $classMethod = new Method( + $classDefinition, + [], + $method->getName(), + new Parameters($parameters) + ); + $classMethod->setIsStatic($method->isStatic()); + $classMethod->setIsBundled(true); + $classDefinition->addMethod($classMethod); } - } - /** - * Returns the extended class. - * - * @return string|null - */ - public function getExtendsClass(): ?string - { - return $this->extendsClass; - } + foreach ($class->getConstants() as $constantName => $constantValue) { + $type = self::convertPhpConstantType(gettype($constantValue)); + $classConstant = new Constant($constantName, ['value' => $constantValue, 'type' => $type], null); + $classDefinition->addConstant($classConstant); + } - /** - * Returns the implemented interfaces. - * - * @return array - */ - public function getImplementedInterfaces(): array - { - return $this->interfaces; - } + foreach ($class->getProperties() as $property) { + $visibility = []; - /** - * Sets the class definition for the extended class. - * - * @param AbstractClassDefinition $classDefinition - */ - public function setExtendsClassDefinition(AbstractClassDefinition $classDefinition): void - { - $this->extendsClassDefinition = $classDefinition; - } + if ($property->isPublic()) { + $visibility[] = 'public'; + } - /** - * Returns the class definition related to the extended class. - * - * @return AbstractClassDefinition|null - */ - public function getExtendsClassDefinition(): ?AbstractClassDefinition - { - if (!$this->extendsClassDefinition && $this->extendsClass && $this->compiler) { - $this->setExtendsClassDefinition($this->compiler->getClassDefinition($this->extendsClass)); + if ($property->isPrivate()) { + $visibility[] = 'private'; + } + + if ($property->isProtected()) { + $visibility[] = 'protected'; + } + + if ($property->isStatic()) { + $visibility[] = 'static'; + } + + $classProperty = new Property( + $classDefinition, + $visibility, + $property->getName(), + null, + null, + null + ); + $classDefinition->addProperty($classProperty); } - return $this->extendsClassDefinition; - } + $classDefinition->setIsBundled(true); - /** - * Sets the class definition for the implemented interfaces. - * - * @param AbstractClassDefinition[] $implementedInterfaceDefinitions - */ - public function setImplementedInterfaceDefinitions(array $implementedInterfaceDefinitions) - { - $this->implementedInterfaceDefinitions = $implementedInterfaceDefinitions; + return $classDefinition; } /** - * Returns the class definition for the implemented interfaces. + * Checks if a class implements an interface. * - * @return AbstractClassDefinition[] + * @throws CompilerException */ - public function getImplementedInterfaceDefinitions(): array + public function checkInterfaceImplements(self $classDefinition, self $interfaceDefinition): void { - return $this->implementedInterfaceDefinitions; - } + foreach ($interfaceDefinition->getMethods() as $method) { + if (!$classDefinition->hasMethod($method->getName())) { + throw new CompilerException( + sprintf( + 'Class %s must implement a method called: "%s" as requirement of interface: "%s"', + $classDefinition->getCompleteName(), + $method->getName(), + $interfaceDefinition->getCompleteName() + ) + ); + } - /** - * Calculate the dependency rank of the class based on its dependencies. - * - * @return AbstractClassDefinition[] - */ - public function getDependencies(): array - { - $dependencies = []; - if ($this->extendsClassDefinition && $this->extendsClassDefinition instanceof self) { - $dependencies[] = $this->extendsClassDefinition; - } + if (!$method->hasParameters()) { + continue; + } - foreach ($this->implementedInterfaceDefinitions as $interfaceDefinition) { - if ($interfaceDefinition instanceof self) { - $dependencies[] = $interfaceDefinition; + $implementedMethod = $classDefinition->getMethod($method->getName()); + if ( + $implementedMethod->getNumberOfRequiredParameters() > $method->getNumberOfRequiredParameters() || + $implementedMethod->getNumberOfParameters() < $method->getNumberOfParameters() + ) { + throw new CompilerException( + sprintf( + 'Method %s::%s() does not have the same number of required parameters in interface: "%s"', + $classDefinition->getCompleteName(), + $method->getName(), + $interfaceDefinition->getCompleteName() + ) + ); } } - - return $dependencies; } /** - * A class definition calls this method to mark this class as a dependency of another. + * Compiles a class/interface. * - * @param int $rank + * @throws Exception + * @throws ReflectionException */ - public function increaseDependencyRank(int $rank): void + public function compile(CompilationContext $compilationContext): void { - $this->dependencyRank += $rank + 1; - } + $this->compiler = $compilationContext->compiler; - /** - * Returns the dependency rank for this class. - * - * @return int - */ - public function getDependencyRank(): int - { - return $this->dependencyRank; - } + /** + * Sets the current object as global class definition + */ + $compilationContext->classDefinition = $this; - /** - * Sets the class/interface docBlock. - * - * @param string $docBlock - */ - public function setDocBlock(string $docBlock): void - { - $this->docBlock = $docBlock; - } + /** + * Get the global codePrinter. + */ + $codePrinter = $compilationContext->codePrinter; - /** - * Returns the class/interface docBlock. - * - * @return string - */ - public function getDocBlock(): string - { - return $this->docBlock; - } + /** + * The ZEPHIR_INIT_CLASS defines properties and constants exported by the class. + */ + $initClassName = $this->getCNamespace() . '_' . $this->getName(); + $codePrinter->output('ZEPHIR_INIT_CLASS(' . $initClassName . ')'); + $codePrinter->output('{'); + $codePrinter->increaseLevel(); - /** - * Returns the parsed docBlock. - * - * @return DocBlock|null - */ - public function getParsedDocBlock(): ?DocBlock - { - if ($this->parsedDocblock instanceof Docblock) { - return $this->parsedDocblock; - } + /** + * Method entry. + */ + $methods = &$this->methods; + $initMethod = $this->getLocalOrParentInitMethod(); - if ($this->docBlock === '') { - return null; + if (count($methods) > 0 || $initMethod) { + $methodEntry = strtolower($this->getCNamespace()) . '_' . strtolower($this->getName()) . '_method_entry'; + } else { + $methodEntry = 'NULL'; } - $this->parsedDocblock = (new DocblockParser('/'.$this->docBlock.'/'))->parse(); - - return $this->parsedDocblock; - } - - /** - * Adds a property to the definition. - * - * @param ClassProperty $property - * - * @throws CompilerException - */ - public function addProperty(ClassProperty $property): void - { - if (isset($this->properties[$property->getName()])) { - throw new CompilerException("Property '".$property->getName()."' was defined more than one time", $property->getOriginal()); + foreach ($methods as $method) { + $method->setupOptimized($compilationContext); } - $this->properties[$property->getName()] = $property; - } + $namespace = str_replace('\\', '_', $compilationContext->config->get('namespace')); - /** - * Adds a constant to the definition. - * - * @param ClassConstant $constant - * - * @throws CompilerException - */ - public function addConstant(ClassConstant $constant) - { - if (isset($this->constants[$constant->getName()])) { - throw new CompilerException("Constant '".$constant->getName()."' was defined more than one time"); + $flags = '0'; + if ($this->isAbstract()) { + $flags = 'ZEND_ACC_EXPLICIT_ABSTRACT_CLASS'; } - $this->constants[$constant->getName()] = $constant; - } + if ($this->isFinal()) { + if ('0' === $flags) { + $flags = 'ZEND_ACC_FINAL_CLASS'; + } else { + $flags .= '|ZEND_ACC_FINAL_CLASS'; + } + } - /** - * Checks if a class definition has a property. - * - * @param string $name - * - * @return bool - */ - public function hasProperty(string $name): bool - { - if (isset($this->properties[$name])) { - return true; - } - - $extendsClassDefinition = $this->getExtendsClassDefinition(); - - return $extendsClassDefinition instanceof self && $extendsClassDefinition->hasProperty($name); - } - - /** - * Returns a method definition by its name. - * - * @param string $propertyName - * - * @return ClassProperty|null - */ - public function getProperty(string $propertyName): ?ClassProperty - { - if (isset($this->properties[$propertyName])) { - return $this->properties[$propertyName]; - } - - $extendsClassDefinition = $this->getExtendsClassDefinition(); - if ($extendsClassDefinition instanceof self) { - return $extendsClassDefinition->getProperty($propertyName); - } - - return null; - } + /** + * Register the class with extends + interfaces. + */ + $classExtendsDefinition = null; + if ($this->extendsClass) { + $classExtendsDefinition = $this->extendsClassDefinition; + if ($classExtendsDefinition instanceof self && !$classExtendsDefinition->isBundled()) { + $classEntry = $classExtendsDefinition->getClassEntry($compilationContext); + } else { + $className = method_exists( + $classExtendsDefinition, + 'getCompleteName' + ) ? $classExtendsDefinition->getCompleteName() : $classExtendsDefinition->getName(); + $classEntry = (new Entry('\\' . ltrim($className, '\\'), $compilationContext))->get(); + } - /** - * Checks if class definition has a property. - * - * @param string $name - * - * @return bool - */ - public function hasConstant(string $name): bool - { - if (isset($this->constants[$name])) { - return true; + if (self::TYPE_CLASS === $this->getType()) { + $codePrinter->output( + 'ZEPHIR_REGISTER_CLASS_EX(' . $this->getNCNamespace() . ', ' . $this->getName( + ) . ', ' . $namespace . ', ' . strtolower( + $this->getSCName($namespace) + ) . ', ' . $classEntry . ', ' . $methodEntry . ', ' . $flags . ');' + ); + } else { + $codePrinter->output( + 'ZEPHIR_REGISTER_INTERFACE_EX(' . $this->getNCNamespace() . ', ' . $this->getName( + ) . ', ' . $namespace . ', ' . strtolower( + $this->getSCName($namespace) + ) . ', ' . $classEntry . ', ' . $methodEntry . ');' + ); + } + } else { + if (self::TYPE_CLASS === $this->getType()) { + $codePrinter->output( + 'ZEPHIR_REGISTER_CLASS(' . $this->getNCNamespace() . ', ' . $this->getName( + ) . ', ' . $namespace . ', ' . strtolower( + $this->getSCName($namespace) + ) . ', ' . $methodEntry . ', ' . $flags . ');' + ); + } else { + $codePrinter->output( + 'ZEPHIR_REGISTER_INTERFACE(' . $this->getNCNamespace() . ', ' . $this->getName( + ) . ', ' . $namespace . ', ' . strtolower($this->getSCName($namespace)) . ', ' . $methodEntry . ');' + ); + } } - $extendsClassDefinition = $this->getExtendsClassDefinition(); - if ($extendsClassDefinition instanceof self && $extendsClassDefinition->hasConstant($name)) { - return true; - } + $codePrinter->outputBlankLine(); /** - * Check if constant is defined in interfaces + * Compile properties. */ - return $this->hasConstantFromInterfaces($name); - } + foreach ($this->getProperties() as $property) { + $docBlock = $property->getDocBlock(); + if ($docBlock) { + $codePrinter->outputDocBlock($docBlock); + } - /** - * Returns a constant definition by its name. - * - * @param string $constantName - * - * @return ClassConstant|null - * - * @throws InvalidArgumentException - */ - public function getConstant(string $constantName): ?ClassConstant - { - if (isset($this->constants[$constantName])) { - return $this->constants[$constantName]; + $property->compile($compilationContext); + $codePrinter->outputBlankLine(); } - $extendsClassDefinition = $this->getExtendsClassDefinition(); - if ($extendsClassDefinition instanceof self && $extendsClassDefinition->hasConstant($constantName)) { - return $extendsClassDefinition->getConstant($constantName); + $initMethod = $this->getInitMethod(); + if ($initMethod) { + $codePrinter->output( + $namespace . '_' . strtolower( + $this->getSCName($namespace) + ) . '_ce->create_object = ' . $initMethod->getName() . ';' + ); } /** - * Gets constant from interfaces + * Compile constants. */ - return $this->getConstantFromInterfaces($constantName); - } + foreach ($this->getConstants() as $constant) { + $docBlock = $constant->getDocBlock(); + if ($docBlock) { + $codePrinter->outputDocBlock($docBlock); + } - /** - * Adds a method to the class definition. - * - * @param ClassMethod $method - * @param array|null $statement - * - * @throws CompilerException - */ - public function addMethod(ClassMethod $method, ?array $statement = null) - { - $methodName = strtolower($method->getName()); - if (isset($this->methods[$methodName])) { - throw new CompilerException("Method '".$method->getName()."' was defined more than one time", $statement); + $constant->compile($compilationContext); + $codePrinter->outputBlankLine(); } - $this->methods[$methodName] = $method; - } - - /** - * Updates an existing method definition. - * - * @param ClassMethod $method - * @param array|null $statement - * - * @throws CompilerException - */ - public function updateMethod(ClassMethod $method, ?array $statement = null): void - { - $methodName = strtolower($method->getName()); - if (!isset($this->methods[$methodName])) { - throw new CompilerException("Method '".$method->getName()."' does not exist", $statement); - } + /** + * Implemented interfaces. + */ + $interfaces = $this->interfaces; + $compiler = $compilationContext->compiler; - $this->methods[$methodName] = $method; - } + if (is_array($interfaces)) { + $codePrinter->outputBlankLine(true); - /** - * Returns all properties defined in the class. - * - * @return ClassProperty[] - */ - public function getProperties(): array - { - return $this->properties; - } + foreach ($interfaces as $interface) { + /** + * Try to find the interface. + */ + $classEntry = null; - /** - * Returns all constants defined in the class. - * - * @return ClassConstant[] - */ - public function getConstants(): array - { - return $this->constants; - } + if ($compiler->isInterface($interface)) { + $classInterfaceDefinition = $compiler->getClassDefinition($interface); + $classEntry = $classInterfaceDefinition->getClassEntry($compilationContext); + } elseif ($compiler->isBundledInterface($interface)) { + $classInterfaceDefinition = $compiler->getInternalClassDefinition($interface); + $classEntry = (new Entry( + '\\' . $classInterfaceDefinition->getName(), + $compilationContext + ))->get(); + } - /** - * Returns all methods defined in the class. - * - * @return ClassMethod[] - */ - public function getMethods(): array - { - return $this->methods; - } + if (!$classEntry) { + if ($compiler->isClass($interface)) { + throw new CompilerException( + sprintf( + 'Cannot locate interface %s when implementing interfaces on %s. ' . + '%s is currently a class', + $interface, + $this->getCompleteName(), + $interface + ), + $this->originalNode + ); + } else { + throw new CompilerException( + sprintf( + 'Cannot locate interface %s when implementing interfaces on %s', + $interface, + $this->getCompleteName() + ), + $this->originalNode + ); + } + } - /** - * Checks if the class implements an specific name. - * - * @param string $methodName - * - * @return bool - */ - public function hasMethod(string $methodName): bool - { - $methodNameLower = strtolower($methodName); - foreach ($this->methods as $name => $method) { - if ($methodNameLower === $name) { - return true; - } - } + /** + * We don't check if abstract classes implement the methods in their interfaces + */ + if (!$this->isAbstract() && !$this->isInterface()) { + $this->checkInterfaceImplements($this, $classInterfaceDefinition); + } - $extendsClassDefinition = $this->getExtendsClassDefinition(); - if ($extendsClassDefinition instanceof ClassDefinitionRuntime) { - try { - $extendsClassDefinition = $this->compiler->getInternalClassDefinition( - $extendsClassDefinition->getName() + $codePrinter->output( + sprintf( + 'zend_class_implements(%s, 1, %s);', + $this->getClassEntry(), + $classEntry + ) ); - } catch (ReflectionException $e) { - // Do nothing - return false; } } - while ($extendsClassDefinition instanceof self) { - if ($extendsClassDefinition->hasMethod($methodName)) { - return true; - } + if (!$this->isAbstract() && !$this->isInterface()) { + /** + * Interfaces in extended classes may have + */ + if ($classExtendsDefinition instanceof self && !$classExtendsDefinition->isBundled()) { + $interfaces = $classExtendsDefinition->getImplementedInterfaces(); + foreach ($interfaces as $interface) { + $classInterfaceDefinition = null; + if ($compiler->isInterface($interface)) { + $classInterfaceDefinition = $compiler->getClassDefinition($interface); + } elseif ($compiler->isBundledInterface($interface)) { + $classInterfaceDefinition = $compiler->getInternalClassDefinition($interface); + } - $extendsClassDefinition = $extendsClassDefinition->getExtendsClassDefinition(); + if ($classInterfaceDefinition !== null) { + $this->checkInterfaceImplements($this, $classInterfaceDefinition); + } + } + } } - return false; - } + $codePrinter->output('return SUCCESS;'); + $codePrinter->decreaseLevel(); - /** - * Returns a method by its name. - * - * @param string $methodName - * @param bool $checkExtends - * - * @return ClassMethod|null - */ - public function getMethod(string $methodName, bool $checkExtends = true): ?ClassMethod - { - $methodNameLower = strtolower($methodName); - foreach ($this->methods as $name => $method) { - if ($methodNameLower === $name) { - return $method; + $codePrinter->output('}'); + $codePrinter->outputBlankLine(); + + /** + * Compile methods + */ + foreach ($methods as $method) { + $docBlock = $method->getDocBlock(); + if ($docBlock) { + $codePrinter->outputDocBlock($docBlock); } - } - if (!$checkExtends) { - return null; + if (self::TYPE_CLASS === $this->getType()) { + if (!$method->isInternal()) { + $codePrinter->output( + 'PHP_METHOD(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName( + ) . ')' + ); + } else { + $codePrinter->output( + $compilationContext->backend->getInternalSignature($method, $compilationContext) + ); + } + $codePrinter->output('{'); + + if (!$method->isAbstract()) { + $method->compile($compilationContext); + } + + $codePrinter->output('}'); + $codePrinter->outputBlankLine(); + } else { + $codePrinter->output( + 'ZEPHIR_DOC_METHOD(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName( + ) . ');' + ); + } } - $extendsClassDefinition = $this->getExtendsClassDefinition(); - if ($extendsClassDefinition instanceof self) { - if ($extendsClassDefinition->hasMethod($methodName)) { - return $extendsClassDefinition->getMethod($methodName); + /** + * Check whether classes must be exported. + */ + $exportClasses = $compilationContext->config->get('export-classes', 'extra'); + $exportAPI = $exportClasses ? 'extern ZEPHIR_API' : 'extern'; + + /** + * Create a code printer for the header file. + */ + $codePrinter = new Printer(); + + $codePrinter->outputBlankLine(); + $codePrinter->output($exportAPI . ' zend_class_entry *' . $this->getClassEntry() . ';'); + $codePrinter->outputBlankLine(); + + $codePrinter->output('ZEPHIR_INIT_CLASS(' . $this->getCNamespace() . '_' . $this->getName() . ');'); + $codePrinter->outputBlankLine(); + + if (self::TYPE_CLASS === $this->getType() && count($methods) > 0) { + foreach ($methods as $method) { + if (!$method->isInternal()) { + $codePrinter->output( + 'PHP_METHOD(' . $this->getCNamespace() . '_' . $this->getName() . ', ' . $method->getName( + ) . ');' + ); + } else { + $internalSignature = $compilationContext->backend->getInternalSignature( + $method, + $compilationContext + ); + $codePrinter->output($internalSignature . ';'); + } } + $codePrinter->outputBlankLine(); } - return null; - } + /** + * Specifying Argument Information + */ + foreach ($methods as $method) { + $argInfo = new ArgInfoDefinition( + $method->getArgInfoName($this), + $method, + $codePrinter, + $compilationContext + ); - /** - * Set a method and its body. - * - * @param string $methodName - * @param ClassMethod $method - */ - public function setMethod(string $methodName, ClassMethod $method): void - { - $this->methods[$methodName] = $method; + $argInfo->setBooleanDefinition('_IS_BOOL'); + $argInfo->setRichFormat(true); + + $argInfo->render(); + } + + if (count($methods) > 0) { + $codePrinter->output( + sprintf( + 'ZEPHIR_INIT_FUNCS(%s_%s_method_entry) {', + strtolower($this->getCNamespace()), + strtolower($this->getName()) + ) + ); + + foreach ($methods as $method) { + if (self::TYPE_CLASS === $this->getType()) { + if (!$method->isInternal()) { + $richFormat = $method->isReturnTypesHintDetermined() && $method->areReturnTypesCompatible(); + + if ($richFormat || $method->hasParameters()) { + $codePrinter->output( + sprintf( + // TODO: Rename to ZEND_ME + "\tPHP_ME(%s_%s, %s, %s, %s)", + $this->getCNamespace(), + $this->getName(), + $method->getName(), + $method->getArgInfoName($this), + $method->getModifiers() + ) + ); + } else { + $codePrinter->output( + sprintf( + // TODO: Rename to ZEND_ME + 'PHP_ME(%s_%s, %s, %s, %s)', + $this->getCNamespace(), + $this->getName(), + $method->getName(), + $method->getArgInfoName($this), + $method->getModifiers() + ) + ); + } + } + } else { + $richFormat = $method->isReturnTypesHintDetermined() && $method->areReturnTypesCompatible(); + + if ($method->isStatic()) { + if ($richFormat || $method->hasParameters()) { + $codePrinter->output( + sprintf( + "\tZEND_FENTRY(%s, NULL, %s, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)", + $method->getName(), + $method->getArgInfoName($this) + ) + ); + } else { + $codePrinter->output( + sprintf( + 'ZEND_FENTRY(%s, NULL, %s, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)', + $method->getName(), + $method->getArgInfoName($this) + ) + ); + } + } else { + $isInterface = $method->getClassDefinition()->isInterface(); + $codePrinter->output( + sprintf( + "\tPHP_ABSTRACT_ME(%s_%s, %s, %s)", + $this->getCNamespace(), + $this->getName(), + $method->getName(), + $isInterface ? $method->getArgInfoName($this) : 'NULL' + ) + ); + } + } + } + + $codePrinter->output("\t" . 'PHP_FE_END'); + $codePrinter->output('};'); // ZEPHIR_INIT_FUNCS + } + + $compilationContext->headerPrinter = $codePrinter; } - /** - * Sets class methods externally. - * - * @param array $methods - */ - public function setMethods(array $methods): void + public function getAliasManager(): ?AliasManager { - $this->methods = $methods; + return $this->aliasManager; } /** - * Tries to find the most similar name. - * - * @param string $methodName - * - * @return string|null + * Returns a valid namespace to be used in C-sources. */ - public function getPossibleMethodName(string $methodName): ?string + public function getCNamespace(): string { - $methodNameLower = strtolower($methodName); - - foreach ($this->methods as $name => $method) { - if (metaphone($methodNameLower) === metaphone($name)) { - return $method->getName(); - } - } - - if ($this->extendsClassDefinition instanceof self) { - return $this->extendsClassDefinition->getPossibleMethodName($methodName); - } - - return null; + return str_replace('\\', '_', $this->namespace); } /** * Returns the name of the zend_class_entry according to the class name. * - * @param CompilationContext|null $compilationContext - * * @throws Exception - * - * @return string */ - public function getClassEntry(?CompilationContext $compilationContext = null): string + public function getClassEntry(CompilationContext $compilationContext = null): string { if ($this->external) { if ($compilationContext === null) { @@ -832,146 +797,150 @@ public function getClassEntry(?CompilationContext $compilationContext = null): s $compilationContext->headersManager->add($this->getExternalHeader(), HeadersManager::POSITION_LAST); } - return strtolower(str_replace('\\', '_', $this->namespace).'_'.$this->name).'_ce'; + return strtolower(str_replace('\\', '_', $this->namespace) . '_' . $this->name) . '_ce'; } /** - * Returns a valid namespace to be used in C-sources. - * - * @return string + * Returns the class name including its namespace. */ - public function getCNamespace(): string + public function getCompleteName(): string { - return str_replace('\\', '_', $this->namespace); + return $this->namespace . '\\' . $this->shortName; } /** - * Returns a valid namespace to be used in C-sources. + * Returns a constant definition by its name. * - * @return string + * @throws InvalidArgumentException */ - public function getNCNamespace(): string + public function getConstant(string $constantName): ?Constant { - return str_replace('\\', '\\\\', $this->namespace); + if (isset($this->constants[$constantName])) { + return $this->constants[$constantName]; + } + + $extendsClassDefinition = $this->getExtendsClassDefinition(); + if ($extendsClassDefinition instanceof self && $extendsClassDefinition->hasConstant($constantName)) { + return $extendsClassDefinition->getConstant($constantName); + } + + /** + * Gets constant from interfaces + */ + return $this->getConstantFromInterfaces($constantName); } /** - * Class name without namespace prefix for class registration. - * - * @param string $namespace + * Returns all constants defined in the class. * - * @return string + * @return Constant[] */ - public function getSCName(string $namespace): string + public function getConstants(): array { - return str_replace($namespace.'_', '', strtolower(str_replace('\\', '_', $this->namespace).'_'.$this->name)); + return $this->constants; } /** - * Returns an absolute location to the class header. - * - * @return string + * Calculate the dependency rank of the class based on its dependencies. */ - public function getExternalHeader(): string + public function getDependencies(): array { - $parts = explode('\\', $this->namespace); + $dependencies = []; + if ($this->extendsClassDefinition instanceof self) { + $dependencies[] = $this->extendsClassDefinition; + } + + foreach ($this->implementedInterfaceDefinitions as $interfaceDefinition) { + if ($interfaceDefinition instanceof self) { + $dependencies[] = $interfaceDefinition; + } + } - return 'ext/'.strtolower($parts[0].DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $this->namespace).DIRECTORY_SEPARATOR.$this->name).'.zep'; + return $dependencies; } /** - * Checks if a class implements an interface. - * - * @param ClassDefinition $classDefinition - * @param ClassDefinition $interfaceDefinition - * - * @throws CompilerException + * Returns the dependency rank for this class. */ - public function checkInterfaceImplements(self $classDefinition, self $interfaceDefinition) + public function getDependencyRank(): int { - foreach ($interfaceDefinition->getMethods() as $method) { - if (!$classDefinition->hasMethod($method->getName())) { - throw new CompilerException( - sprintf( - 'Class %s must implement a method called: "%s" as requirement of interface: "%s"', - $classDefinition->getCompleteName(), - $method->getName(), - $interfaceDefinition->getCompleteName() - ) - ); - } - - if (!$method->hasParameters()) { - continue; - } + return $this->dependencyRank; + } - $implementedMethod = $classDefinition->getMethod($method->getName()); - if ($implementedMethod->getNumberOfRequiredParameters() > $method->getNumberOfRequiredParameters() || - $implementedMethod->getNumberOfParameters() < $method->getNumberOfParameters() - ) { - throw new CompilerException( - sprintf( - 'Method %s::%s() does not have the same number of required parameters in interface: "%s"', - $classDefinition->getCompleteName(), - $method->getName(), - $interfaceDefinition->getCompleteName() - ) - ); - } - } + /** + * Returns the class/interface docBlock. + */ + public function getDocBlock(): string + { + return $this->docBlock; } /** - * Pre-compiles a class/interface gathering method information required by other methods. - * - * @param CompilationContext $compilationContext - * - * @throws CompilerException + * Returns the extended class. */ - public function preCompile(CompilationContext $compilationContext) + public function getExtendsClass(): ?string { - $this->compiler = $compilationContext->compiler; + return $this->extendsClass; + } - /** - * Pre-Compile methods - */ - foreach ($this->methods as $method) { - if (self::TYPE_CLASS === $this->getType() && !$method->isAbstract()) { - $method->preCompile($compilationContext); - } + /** + * Returns the class definition related to the extended class. + */ + public function getExtendsClassDefinition(): ?AbstractDefinition + { + if (!$this->extendsClassDefinition && $this->extendsClass && $this->compiler) { + $this->setExtendsClassDefinition($this->compiler->getClassDefinition($this->extendsClass)); } + + return $this->extendsClassDefinition; } /** - * Returns the initialization method if any does exist. - * - * @return ClassMethod|null + * Returns an absolute location to the class header. + */ + public function getExternalHeader(): string + { + $parts = explode('\\', $this->namespace); + + return 'ext/' . strtolower( + $parts[0] . DIRECTORY_SEPARATOR . str_replace( + '\\', + DIRECTORY_SEPARATOR, + $this->namespace + ) . DIRECTORY_SEPARATOR . $this->name + ) . '.zep'; + } + + /** + * Returns the class definition for the implemented interfaces. */ - public function getInitMethod(): ?ClassMethod + public function getImplementedInterfaceDefinitions(): array { - $initClassName = $this->getCNamespace().'_'.$this->getName(); + return $this->implementedInterfaceDefinitions; + } - return $this->getMethod('zephir_init_properties_'.$initClassName); + /** + * Returns the implemented interfaces. + */ + public function getImplementedInterfaces(): array + { + return $this->interfaces; } /** * Returns the initialization method if any does exist. - * - * @return ClassMethod|null */ - public function getStaticInitMethod(): ?ClassMethod + public function getInitMethod(): ?Method { - $initClassName = $this->getCNamespace().'_'.$this->getName(); + $initClassName = $this->getCNamespace() . '_' . $this->getName(); - return $this->getMethod('zephir_init_static_properties_'.$initClassName); + return $this->getMethod('zephir_init_properties_' . $initClassName); } /** * Returns the initialization method if any does exist. - * - * @return ClassMethod|null */ - public function getLocalOrParentInitMethod(): ?ClassMethod + public function getLocalOrParentInitMethod(): ?Method { $method = $this->getInitMethod(); if ($method === null) { @@ -981,7 +950,7 @@ public function getLocalOrParentInitMethod(): ?ClassMethod $parentClassDefinition = $this->getExtendsClassDefinition(); if ($parentClassDefinition instanceof self) { $method = $parentClassDefinition->getInitMethod(); - if ($method instanceof ClassMethod) { + if ($method instanceof Method) { $this->addInitMethod($method->getStatementsBlock()); } } @@ -990,581 +959,449 @@ public function getLocalOrParentInitMethod(): ?ClassMethod } /** - * Creates the initialization method. - * - * @param StatementsBlock $statementsBlock + * Returns a method by its name. */ - public function addInitMethod(StatementsBlock $statementsBlock): void + public function getMethod(string $methodName, bool $checkExtends = true): ?Method { - if ($statementsBlock->isEmpty()) { - return; + $methodNameLower = strtolower($methodName); + foreach ($this->methods as $name => $method) { + if ($methodNameLower === $name) { + return $method; + } } - $initClassName = $this->getCNamespace().'_'.$this->getName(); - $classMethod = new ClassMethod( - $this, - ['internal'], - 'zephir_init_properties_'.$initClassName, - null, - $statementsBlock - ); + if (!$checkExtends) { + return null; + } - $classMethod->setIsInitializer(true); - $this->addMethod($classMethod); + $extendsClassDefinition = $this->getExtendsClassDefinition(); + if ($extendsClassDefinition instanceof self) { + if ($extendsClassDefinition->hasMethod($methodName)) { + return $extendsClassDefinition->getMethod($methodName); + } + } + + return null; } /** - * Creates the static initialization method. + * Returns all methods defined in the class. * - * @param StatementsBlock $statementsBlock + * @return Method[] */ - public function addStaticInitMethod(StatementsBlock $statementsBlock): void + public function getMethods(): array { - $initClassName = $this->getCNamespace().'_'.$this->getName(); + return $this->methods; + } - $classMethod = new ClassMethod( - $this, - ['internal'], - 'zephir_init_static_properties_'.$initClassName, - null, - $statementsBlock - ); + /** + * Returns a valid namespace to be used in C-sources. + */ + public function getNCNamespace(): string + { + return str_replace('\\', '\\\\', $this->namespace); + } - $classMethod->setIsInitializer(true); - $classMethod->setIsStatic(true); - $this->addMethod($classMethod); + /** + * Return the class namespace. + */ + public function getNamespace(): string + { + return $this->namespace; } /** - * Compiles a class/interface. - * - * @param CompilationContext $compilationContext - * - * @throws Exception - * @throws ReflectionException + * Returns the parsed docBlock. */ - public function compile(CompilationContext $compilationContext): void + public function getParsedDocBlock(): ?DocBlock { - $this->compiler = $compilationContext->compiler; + if ($this->parsedDocblock instanceof Docblock) { + return $this->parsedDocblock; + } - /** - * Sets the current object as global class definition - */ - $compilationContext->classDefinition = $this; + if ($this->docBlock === '') { + return null; + } - /** - * Get the global codePrinter. - */ - $codePrinter = $compilationContext->codePrinter; + $this->parsedDocblock = (new DocblockParser('/' . $this->docBlock . '/'))->parse(); - /** - * The ZEPHIR_INIT_CLASS defines properties and constants exported by the class. - */ - $initClassName = $this->getCNamespace().'_'.$this->getName(); - $codePrinter->output('ZEPHIR_INIT_CLASS('.$initClassName.')'); - $codePrinter->output('{'); - $codePrinter->increaseLevel(); + return $this->parsedDocblock; + } - /** - * Method entry. - */ - $methods = &$this->methods; - $initMethod = $this->getLocalOrParentInitMethod(); + /** + * Tries to find the most similar name. + */ + public function getPossibleMethodName(string $methodName): ?string + { + $methodNameLower = strtolower($methodName); - if (count($methods) > 0 || $initMethod) { - $methodEntry = strtolower($this->getCNamespace()).'_'.strtolower($this->getName()).'_method_entry'; - } else { - $methodEntry = 'NULL'; + foreach ($this->methods as $name => $method) { + if (metaphone($methodNameLower) === metaphone($name)) { + return $method->getName(); + } } - foreach ($methods as $method) { - $method->setupOptimized($compilationContext); + if ($this->extendsClassDefinition instanceof self) { + return $this->extendsClassDefinition->getPossibleMethodName($methodName); } - $namespace = str_replace('\\', '_', $compilationContext->config->get('namespace')); + return null; + } - $flags = '0'; - if ($this->isAbstract()) { - $flags = 'ZEND_ACC_EXPLICIT_ABSTRACT_CLASS'; + /** + * Returns all properties defined in the class. + * + * @return Property[] + */ + public function getProperties(): array + { + return $this->properties; + } + + /** + * Returns a method definition by its name. + * + * @param string $propertyName + * + * @return Property|null + */ + public function getProperty(string $propertyName): ?Property + { + if (isset($this->properties[$propertyName])) { + return $this->properties[$propertyName]; } - if ($this->isFinal()) { - if ('0' === $flags) { - $flags = 'ZEND_ACC_FINAL_CLASS'; - } else { - $flags .= '|ZEND_ACC_FINAL_CLASS'; - } + $extendsClassDefinition = $this->getExtendsClassDefinition(); + if ($extendsClassDefinition instanceof self) { + return $extendsClassDefinition->getProperty($propertyName); } - /** - * Register the class with extends + interfaces. - */ - $classExtendsDefinition = null; - if ($this->extendsClass) { - $classExtendsDefinition = $this->extendsClassDefinition; - if ($classExtendsDefinition instanceof self && !$classExtendsDefinition->isBundled()) { - $classEntry = $classExtendsDefinition->getClassEntry($compilationContext); - } else { - $className = method_exists($classExtendsDefinition, 'getCompleteName') ? $classExtendsDefinition->getCompleteName() : $classExtendsDefinition->getName(); - $classEntry = (new Entry('\\'.ltrim($className, '\\'), $compilationContext))->get(); - } + return null; + } - if (self::TYPE_CLASS === $this->getType()) { - $codePrinter->output('ZEPHIR_REGISTER_CLASS_EX('.$this->getNCNamespace().', '.$this->getName().', '.$namespace.', '.strtolower($this->getSCName($namespace)).', '.$classEntry.', '.$methodEntry.', '.$flags.');'); - } else { - $codePrinter->output('ZEPHIR_REGISTER_INTERFACE_EX('.$this->getNCNamespace().', '.$this->getName().', '.$namespace.', '.strtolower($this->getSCName($namespace)).', '.$classEntry.', '.$methodEntry.');'); - } - } else { - if (self::TYPE_CLASS === $this->getType()) { - $codePrinter->output('ZEPHIR_REGISTER_CLASS('.$this->getNCNamespace().', '.$this->getName().', '.$namespace.', '.strtolower($this->getSCName($namespace)).', '.$methodEntry.', '.$flags.');'); - } else { - $codePrinter->output('ZEPHIR_REGISTER_INTERFACE('.$this->getNCNamespace().', '.$this->getName().', '.$namespace.', '.strtolower($this->getSCName($namespace)).', '.$methodEntry.');'); - } - } + /** + * Class name without namespace prefix for class registration. + */ + public function getSCName(string $namespace): string + { + return str_replace( + $namespace . '_', + '', + strtolower(str_replace('\\', '_', $this->namespace) . '_' . $this->name) + ); + } - $codePrinter->outputBlankLine(); + /** + * Returns the class name without namespace. + */ + public function getShortName(): string + { + return $this->shortName; + } - /** - * Compile properties. - */ - foreach ($this->getProperties() as $property) { - $docBlock = $property->getDocBlock(); - if ($docBlock) { - $codePrinter->outputDocBlock($docBlock); - } + /** + * Returns the initialization method if any does exist. + */ + public function getStaticInitMethod(): ?Method + { + $initClassName = $this->getCNamespace() . '_' . $this->getName(); - $property->compile($compilationContext); - $codePrinter->outputBlankLine(); - } + return $this->getMethod('zephir_init_static_properties_' . $initClassName); + } - $initMethod = $this->getInitMethod(); - if ($initMethod) { - $codePrinter->output($namespace.'_'.strtolower($this->getSCName($namespace)).'_ce->create_object = '.$initMethod->getName().';'); - } - - /** - * Compile constants. - */ - foreach ($this->getConstants() as $constant) { - $docBlock = $constant->getDocBlock(); - if ($docBlock) { - $codePrinter->outputDocBlock($docBlock); - } - - $constant->compile($compilationContext); - $codePrinter->outputBlankLine(); - } - - /** - * Implemented interfaces. - */ - $interfaces = $this->interfaces; - $compiler = $compilationContext->compiler; - - if (is_array($interfaces)) { - $codePrinter->outputBlankLine(true); - - foreach ($interfaces as $interface) { - /** - * Try to find the interface. - */ - $classEntry = null; - - if ($compiler->isInterface($interface)) { - $classInterfaceDefinition = $compiler->getClassDefinition($interface); - $classEntry = $classInterfaceDefinition->getClassEntry($compilationContext); - } elseif ($compiler->isBundledInterface($interface)) { - $classInterfaceDefinition = $compiler->getInternalClassDefinition($interface); - $classEntry = (new Entry('\\'.$classInterfaceDefinition->getName(), $compilationContext))->get(); - } - - if (!$classEntry) { - if ($compiler->isClass($interface)) { - throw new CompilerException( - sprintf( - 'Cannot locate interface %s when implementing interfaces on %s. '. - '%s is currently a class', - $interface, - $this->getCompleteName(), - $interface - ), - $this->originalNode - ); - } else { - throw new CompilerException( - sprintf( - 'Cannot locate interface %s when implementing interfaces on %s', - $interface, - $this->getCompleteName() - ), - $this->originalNode - ); - } - } - - /** - * We don't check if abstract classes implement the methods in their interfaces - */ - if (!$this->isAbstract() && !$this->isInterface()) { - $this->checkInterfaceImplements($this, $classInterfaceDefinition); - } - - $codePrinter->output(sprintf( - 'zend_class_implements(%s, 1, %s);', - $this->getClassEntry(), - $classEntry - )); - } - } - - if (!$this->isAbstract() && !$this->isInterface()) { - /** - * Interfaces in extended classes may have - */ - if ($classExtendsDefinition instanceof self && !$classExtendsDefinition->isBundled()) { - $interfaces = $classExtendsDefinition->getImplementedInterfaces(); - foreach ($interfaces as $interface) { - $classInterfaceDefinition = null; - if ($compiler->isInterface($interface)) { - $classInterfaceDefinition = $compiler->getClassDefinition($interface); - } elseif ($compiler->isBundledInterface($interface)) { - $classInterfaceDefinition = $compiler->getInternalClassDefinition($interface); - } - - if ($classInterfaceDefinition !== null) { - $this->checkInterfaceImplements($this, $classInterfaceDefinition); - } - } - } - } - - $codePrinter->output('return SUCCESS;'); - $codePrinter->decreaseLevel(); - - $codePrinter->output('}'); - $codePrinter->outputBlankLine(); - - /** - * Compile methods - */ - foreach ($methods as $method) { - $docBlock = $method->getDocBlock(); - if ($docBlock) { - $codePrinter->outputDocBlock($docBlock); - } - - if (self::TYPE_CLASS === $this->getType()) { - if (!$method->isInternal()) { - $codePrinter->output('PHP_METHOD('.$this->getCNamespace().'_'.$this->getName().', '.$method->getName().')'); - } else { - $codePrinter->output($compilationContext->backend->getInternalSignature($method, $compilationContext)); - } - $codePrinter->output('{'); - - if (!$method->isAbstract()) { - $method->compile($compilationContext); - } + /** + * Returns the class type. + */ + public function getType(): string + { + return $this->type; + } - $codePrinter->output('}'); - $codePrinter->outputBlankLine(); - } else { - $codePrinter->output('ZEPHIR_DOC_METHOD('.$this->getCNamespace().'_'.$this->getName().', '.$method->getName().');'); - } + /** + * Checks if class definition has a property. + */ + public function hasConstant(string $name): bool + { + if (isset($this->constants[$name])) { + return true; } - /** - * Check whether classes must be exported. - */ - $exportClasses = $compilationContext->config->get('export-classes', 'extra'); - $exportAPI = $exportClasses ? 'extern ZEPHIR_API' : 'extern'; - - /** - * Create a code printer for the header file. - */ - $codePrinter = new CodePrinter(); - - $codePrinter->outputBlankLine(); - $codePrinter->output($exportAPI.' zend_class_entry *'.$this->getClassEntry().';'); - $codePrinter->outputBlankLine(); - - $codePrinter->output('ZEPHIR_INIT_CLASS('.$this->getCNamespace().'_'.$this->getName().');'); - $codePrinter->outputBlankLine(); - - if (self::TYPE_CLASS === $this->getType() && count($methods) > 0) { - foreach ($methods as $method) { - if (!$method->isInternal()) { - $codePrinter->output('PHP_METHOD('.$this->getCNamespace().'_'.$this->getName().', '.$method->getName().');'); - } else { - $internalSignature = $compilationContext->backend->getInternalSignature($method, $compilationContext); - $codePrinter->output($internalSignature.';'); - } - } - $codePrinter->outputBlankLine(); + $extendsClassDefinition = $this->getExtendsClassDefinition(); + if ($extendsClassDefinition instanceof self && $extendsClassDefinition->hasConstant($name)) { + return true; } /** - * Specifying Argument Information + * Check if constant is defined in interfaces */ - foreach ($methods as $method) { - $argInfo = new ArgInfoDefinition( - $method->getArgInfoName($this), - $method, - $codePrinter, - $compilationContext - ); - - $argInfo->setBooleanDefinition($this->compiler->backend->isZE3() ? '_IS_BOOL' : 'IS_BOOL'); - $argInfo->setRichFormat($this->compiler->backend->isZE3()); - - $argInfo->render(); - } - - if (count($methods) > 0) { - $codePrinter->output( - sprintf( - 'ZEPHIR_INIT_FUNCS(%s_%s_method_entry) {', - strtolower($this->getCNamespace()), - strtolower($this->getName()) - ) - ); - - foreach ($methods as $method) { - if (self::TYPE_CLASS === $this->getType()) { - if (!$method->isInternal()) { - $richFormat = $this->compiler->backend->isZE3() && - $method->isReturnTypesHintDetermined() && - $method->areReturnTypesCompatible(); - - if ($richFormat || $method->hasParameters()) { - $codePrinter->output( - sprintf( - // TODO: Rename to ZEND_ME - "\tPHP_ME(%s_%s, %s, %s, %s)", - $this->getCNamespace(), - $this->getName(), - $method->getName(), - $method->getArgInfoName($this), - $method->getModifiers() - ) - ); - } else { - $codePrinter->output('#if PHP_VERSION_ID >= 80000'); - $codePrinter->output( - sprintf( - // TODO: Rename to ZEND_ME - "\tPHP_ME(%s_%s, %s, %s, %s)", - $this->getCNamespace(), - $this->getName(), - $method->getName(), - $method->getArgInfoName($this), - $method->getModifiers() - ) - ); - $codePrinter->output('#else'); - $codePrinter->output( - sprintf( - // TODO: Rename to ZEND_ME - "\tPHP_ME(%s_%s, %s, NULL, %s)", - $this->getCNamespace(), - $this->getName(), - $method->getName(), - $method->getModifiers() - ) - ); - $codePrinter->output('#endif'); - } - } - } else { - $richFormat = $this->compiler->backend->isZE3() && - $method->isReturnTypesHintDetermined() && - $method->areReturnTypesCompatible(); + return $this->hasConstantFromInterfaces($name); + } - if ($method->isStatic()) { - if ($richFormat || $method->hasParameters()) { - $codePrinter->output( - sprintf( - "\tZEND_FENTRY(%s, NULL, %s, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)", - $method->getName(), - $method->getArgInfoName($this) - ) - ); - } else { - $codePrinter->output('#if PHP_VERSION_ID >= 80000'); - $codePrinter->output( - sprintf( - "\tZEND_FENTRY(%s, NULL, %s, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)", - $method->getName(), - $method->getArgInfoName($this) - ) - ); - $codePrinter->output('#else'); - $codePrinter->output( - sprintf( - "\tZEND_FENTRY(%s, NULL, NULL, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)", - $method->getName() - ) - ); - $codePrinter->output('#endif'); - } - } else { - $isInterface = $method->getClassDefinition()->isInterface(); - $codePrinter->output( - sprintf( - "\tPHP_ABSTRACT_ME(%s_%s, %s, %s)", - $this->getCNamespace(), - $this->getName(), - $method->getName(), - $isInterface ? $method->getArgInfoName($this) : 'NULL' - ) - ); - } - } + /** + * Checks if the class implements a specific name. + * + * @param string $methodName + * + * @return bool + */ + public function hasMethod(string $methodName): bool + { + $methodNameLower = strtolower($methodName); + foreach ($this->methods as $name => $method) { + if ($methodNameLower === $name) { + return true; } + } - $codePrinter->output("\t".'PHP_FE_END'); - $codePrinter->output('};'); // ZEPHIR_INIT_FUNCS + $extendsClassDefinition = $this->getExtendsClassDefinition(); + if ($extendsClassDefinition instanceof DefinitionRuntime) { + try { + $extendsClassDefinition = $this->compiler->getInternalClassDefinition( + $extendsClassDefinition->getName() + ); + } catch (ReflectionException $e) { + // Do nothing + return false; + } } - $compilationContext->headerPrinter = $codePrinter; + while ($extendsClassDefinition instanceof self) { + if ($extendsClassDefinition->hasMethod($methodName)) { + return true; + } + + $extendsClassDefinition = $extendsClassDefinition->getExtendsClassDefinition(); + } + + return false; } /** - * @return AliasManager|null + * Checks if a class definition has a property. */ - public function getAliasManager(): ?AliasManager + public function hasProperty(string $name): bool { - return $this->aliasManager; + if (isset($this->properties[$name])) { + return true; + } + + $extendsClassDefinition = $this->getExtendsClassDefinition(); + + return $extendsClassDefinition instanceof self && $extendsClassDefinition->hasProperty($name); } /** - * @param AliasManager $aliasManager + * A class definition calls this method to mark this class as a dependency of another. + * + * @param int $rank */ - public function setAliasManager(AliasManager $aliasManager): void + public function increaseDependencyRank(int $rank): void { - $this->aliasManager = $aliasManager; + $this->dependencyRank += $rank + 1; } /** - * Builds a class definition from reflection. - * - * @param ReflectionClass $class - * - * @return ClassDefinition + * Checks whether the class is abstract or not. */ - public static function buildFromReflection(ReflectionClass $class): self + public function isAbstract(): bool { - $classDefinition = new self($class->getNamespaceName(), $class->getName(), $class->getShortName()); + return $this->abstract; + } - foreach ($class->getMethods() as $method) { - $parameters = []; + /** + * Returns whether the class is bundled or not. + */ + public function isBundled(): bool + { + return $this->isBundled; + } - foreach ($method->getParameters() as $row) { - $params = [ - 'type' => 'parameter', - 'name' => $row->getName(), - 'const' => 0, - 'data-type' => 'variable', - 'mandatory' => !$row->isOptional(), - ]; + /** + * Returns whether the class is internal or not. + */ + public function isExternal(): bool + { + return $this->external; + } - if (!$params['mandatory']) { - try { - $params['default'] = $row->getDefaultValue(); - } catch (ReflectionException $e) { - // TODO: dummy default value - $params['default'] = true; - } - } + /** + * Checks whether the class is abstract or not. + */ + public function isFinal(): bool + { + return $this->final; + } - $parameters[] = $params; - } + /** + * Check if the class definition correspond to an interface. + */ + public function isInterface(): bool + { + return Definition::TYPE_INTERFACE === $this->type; + } - $classMethod = new ClassMethod( - $classDefinition, - [], - $method->getName(), - new ClassMethodParameters($parameters) - ); - $classMethod->setIsStatic($method->isStatic()); - $classMethod->setIsBundled(true); - $classDefinition->addMethod($classMethod); - } + /** + * Pre-compiles a class/interface gathering method information required by other methods. + * + * @throws CompilerException + */ + public function preCompile(CompilationContext $compilationContext): void + { + $this->compiler = $compilationContext->compiler; - foreach ($class->getConstants() as $constantName => $constantValue) { - $type = self::convertPhpConstantType(gettype($constantValue)); - $classConstant = new ClassConstant($constantName, ['value' => $constantValue, 'type' => $type], null); - $classDefinition->addConstant($classConstant); + /** + * Pre-Compile methods + */ + foreach ($this->methods as $method) { + if (self::TYPE_CLASS === $this->getType() && !$method->isAbstract()) { + $method->preCompile($compilationContext); + } } + } - foreach ($class->getProperties() as $property) { - $visibility = []; + public function setAliasManager(AliasManager $aliasManager): void + { + $this->aliasManager = $aliasManager; + } - if ($property->isPublic()) { - $visibility[] = 'public'; - } + /** + * Sets the class/interface docBlock. + */ + public function setDocBlock(string $docBlock): void + { + $this->docBlock = $docBlock; + } - if ($property->isPrivate()) { - $visibility[] = 'private'; - } + /** + * Sets the extended class. + */ + public function setExtendsClass(string $extendsClass): void + { + $this->extendsClass = $extendsClass; + } - if ($property->isProtected()) { - $visibility[] = 'protected'; - } + /** + * Sets the class definition for the extended class. + */ + public function setExtendsClassDefinition(AbstractDefinition $classDefinition): void + { + $this->extendsClassDefinition = $classDefinition; + } - if ($property->isStatic()) { - $visibility[] = 'static'; - } + /** + * Sets the class definition for the implemented interfaces. + */ + public function setImplementedInterfaceDefinitions(array $implementedInterfaceDefinitions): void + { + $this->implementedInterfaceDefinitions = $implementedInterfaceDefinitions; + } - $classProperty = new ClassProperty( - $classDefinition, - $visibility, - $property->getName(), - null, - null, - null - ); - $classDefinition->addProperty($classProperty); + /** + * Sets the implemented interfaces. + */ + public function setImplementsInterfaces(array $implementedInterfaces): void + { + $this->interfaces = []; + foreach ($implementedInterfaces as $implementedInterface) { + $this->interfaces[] = $implementedInterface['value']; } + } - $classDefinition->setIsBundled(true); + /** + * Sets if the class is final. + */ + public function setIsAbstract(bool $abstract): void + { + $this->abstract = $abstract; + } - return $classDefinition; + /** + * Sets if the class is internal or not. + */ + public function setIsBundled(bool $isBundled): void + { + $this->isBundled = $isBundled; + } + + /** + * Sets whether the class is external or not. + */ + public function setIsExternal(bool $isExternal): void + { + $this->external = $isExternal; + } + + /** + * Sets if the class is final. + */ + public function setIsFinal(bool $final): void + { + $this->final = $final; + } + + /** + * Set a method and its body. + */ + public function setMethod(string $methodName, Method $method): void + { + $this->methods[$methodName] = $method; + } + + /** + * Set the original node where the class was declared. + */ + public function setOriginalNode(array $originalNode): void + { + $this->originalNode = $originalNode; } /** - * @param string $name + * Set the class' type (class/interface). + */ + public function setType(string $type): void + { + $this->type = $type; + } + + /** + * Updates an existing method definition. * - * @return bool + * @throws CompilerException */ - protected function hasConstantFromInterfaces(string $name): bool + public function updateMethod(Method $method, array $statement = null): void + { + $methodName = strtolower($method->getName()); + if (!isset($this->methods[$methodName])) { + throw new CompilerException("Method '" . $method->getName() . "' does not exist", $statement); + } + + $this->methods[$methodName] = $method; + } + + protected function getConstantFromInterfaces(string $name): ?Constant { if ($interfaces = $this->getImplementedInterfaceDefinitions()) { foreach ($interfaces as $interface) { if ($interface instanceof self && $interface->hasConstant($name)) { - return true; + return $interface->getConstant($name); } } } - return false; + return null; } - /** - * @param string $name - * - * @return ClassConstant|null - */ - protected function getConstantFromInterfaces(string $name): ?ClassConstant + protected function hasConstantFromInterfaces(string $name): bool { if ($interfaces = $this->getImplementedInterfaceDefinitions()) { foreach ($interfaces as $interface) { if ($interface instanceof self && $interface->hasConstant($name)) { - return $interface->getConstant($name); + return true; } } } - return null; + return false; } private static function convertPhpConstantType(string $phpType): string @@ -1572,9 +1409,9 @@ private static function convertPhpConstantType(string $phpType): string $map = [ 'boolean' => 'bool', 'integer' => 'int', - 'double' => 'double', - 'string' => 'string', - 'NULL' => 'null', + 'double' => 'double', + 'string' => 'string', + 'NULL' => 'null', ]; if (!isset($map[$phpType])) { diff --git a/Library/ClassDefinitionRuntime.php b/src/Class/Definition/DefinitionRuntime.php similarity index 81% rename from Library/ClassDefinitionRuntime.php rename to src/Class/Definition/DefinitionRuntime.php index c2679ad3ff..9ebaab64bd 100644 --- a/Library/ClassDefinitionRuntime.php +++ b/src/Class/Definition/DefinitionRuntime.php @@ -11,12 +11,12 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Class\Definition; /** * Represents a class/interface that only exists in runtime. */ -final class ClassDefinitionRuntime extends AbstractClassDefinition +final class DefinitionRuntime extends AbstractDefinition { public function __construct(string $name) { diff --git a/Library/Classes/Entry.php b/src/Class/Entry.php similarity index 60% rename from Library/Classes/Entry.php rename to src/Class/Entry.php index 2b1466cea2..5e055cdf8a 100644 --- a/Library/Classes/Entry.php +++ b/src/Class/Entry.php @@ -11,59 +11,46 @@ declare(strict_types=1); -namespace Zephir\Classes; +namespace Zephir\Class; use ReflectionClass; -use ReflectionException; -use Zephir\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; use Zephir\Exception; +use function array_pop; +use function class_exists; +use function end; +use function explode; +use function implode; +use function interface_exists; +use function preg_match; +use function sprintf; +use function str_replace; +use function strtolower; + +use const DIRECTORY_SEPARATOR; + /** * Zend Class Entry detector */ class Entry { public const NAMESPACE_SEPARATOR = '\\'; - - /** - * Class name - * - * As it was passed: partially or fully. - * - * @var string - */ - private string $classname; - - /** - * @var CompilationContext - */ - private CompilationContext $compilationContext; - - /** - * @var bool - */ - private bool $isInternal = false; - /** * Loaded via config/class-entries.php - * - * @var array */ private array $classEntries; - /** - * Entry constructor. - * - * @param string $className - * @param CompilationContext $compilationContext + * As it was passed: partially or fully. */ - public function __construct(string $className, CompilationContext $compilationContext) - { - $this->compilationContext = $compilationContext; - $this->classname = $this->compilationContext->getFullName($className); + private string $classname; + private bool $isInternal = false; - $this->classEntries = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; + public function __construct(string $className, private CompilationContext $compilationContext) + { + $this->classname = $this->compilationContext->getFullName($className); + $this->classEntries = require __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config/class-entries.php'; foreach ($this->classEntries as $key => $val) { unset($this->classEntries[$key]); @@ -72,10 +59,15 @@ public function __construct(string $className, CompilationContext $compilationCo } /** - * @return string - * + * Prepares a class name to be used as a C-string. + */ + public static function escape(string $className): string + { + return str_replace(static::NAMESPACE_SEPARATOR, '\\\\', $className); + } + + /** * @throws Exception - * @throws ReflectionException */ public function get(): string { @@ -100,7 +92,7 @@ public function get(): string if (class_exists($this->classname) || interface_exists($this->classname)) { $reflection = new ReflectionClass($this->classname); - $className = $reflection->getName(); + $className = $reflection->getName(); /** * Check if class is defined internally by an extension, or the core. @@ -108,13 +100,17 @@ public function get(): string if ($reflection->isInternal()) { return sprintf( 'zephir_get_internal_ce(SL("%s"))', - str_replace(self::NAMESPACE_SEPARATOR, self::NAMESPACE_SEPARATOR.self::NAMESPACE_SEPARATOR, strtolower($reflection->getName())), + str_replace( + self::NAMESPACE_SEPARATOR, + self::NAMESPACE_SEPARATOR . self::NAMESPACE_SEPARATOR, + strtolower($reflection->getName()) + ), ); } - $classNamespace = explode(self::NAMESPACE_SEPARATOR, $reflection->getNamespaceName()); + $classNamespace = explode(self::NAMESPACE_SEPARATOR, $reflection->getName()); } else { - $className = $this->classname; + $className = $this->classname; $classNamespace = explode(self::NAMESPACE_SEPARATOR, $className); } @@ -122,7 +118,11 @@ public function get(): string * External class, we don't know its ClassEntry in C world. */ if ($classNamespace[0] === '' || !$this->isInternalClass($classNamespace[0])) { - $className = str_replace(self::NAMESPACE_SEPARATOR, self::NAMESPACE_SEPARATOR.self::NAMESPACE_SEPARATOR, strtolower($className)); + $className = str_replace( + self::NAMESPACE_SEPARATOR, + self::NAMESPACE_SEPARATOR . self::NAMESPACE_SEPARATOR, + strtolower($className) + ); return sprintf( 'zephir_get_internal_ce(SL("%s"))', @@ -134,7 +134,7 @@ public function get(): string array_pop($classNamespace); $namespace = implode(self::NAMESPACE_SEPARATOR, $classNamespace); - return (new ClassDefinition($namespace, $className))->getClassEntry(); + return (new Definition($namespace, $className))->getClassEntry(); } public function isInternal(): bool @@ -143,16 +143,14 @@ public function isInternal(): bool } /** - * Detect if start of namespace class - * belongs to project namespace. - * - * @param string $className - * - * @return bool + * Detect if start of namespace class belongs to project namespace. */ private function isInternalClass(string $className): bool { - $this->isInternal = preg_match('/^'.$className.'/', $this->compilationContext->classDefinition->getNamespace()) === 1; + $this->isInternal = preg_match( + '/^' . $className . '/', + $this->compilationContext->classDefinition->getNamespace() + ) === 1; return $this->isInternal; } diff --git a/Library/ClassMethod.php b/src/Class/Method/Method.php similarity index 70% rename from Library/ClassMethod.php rename to src/Class/Method/Method.php index 6071068c4c..29eb09245c 100644 --- a/Library/ClassMethod.php +++ b/src/Class/Method/Method.php @@ -11,2509 +11,2421 @@ declare(strict_types=1); -namespace Zephir; - -use Zephir\Classes\Entry as ClassEntry; +namespace Zephir\Class\Method; + +use ReflectionException; +use Zephir\Branch; +use Zephir\BranchManager; +use Zephir\Cache\Manager; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Entry as ClassEntry; +use Zephir\Code\Printer; +use Zephir\CompilationContext; use Zephir\Detectors\WriteDetector; use Zephir\Documentation\Docblock; use Zephir\Documentation\DocblockParser; +use Zephir\Exception; use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\Name; use Zephir\Passes\CallGathererPass; use Zephir\Passes\LocalContextPass; use Zephir\Passes\StaticTypeInference; +use Zephir\StatementsBlock; +use Zephir\SymbolTable; +use Zephir\Variable\Variable; +use function array_diff; +use function array_key_exists; +use function array_keys; use function count; +use function implode; use function in_array; use function is_array; +use function is_object; +use function json_decode; +use function json_encode; +use function preg_replace; +use function sprintf; +use function str_replace; +use function strtolower; + +use const PHP_EOL; /** * Represents a class method */ -class ClassMethod +class Method { public bool $optimizable = true; - /** - * @var ClassDefinition|null + * Call Gatherer Pass. */ - protected ?ClassDefinition $classDefinition = null; - + protected ?CallGathererPass $callGathererPass = null; + protected ?Definition $classDefinition = null; /** - * @var array + * Whether the method is abstract or not. */ - protected array $visibility = []; - + protected bool $isAbstract = false; /** - * @var string + * Whether the method is bundled with PHP or not. */ - protected string $name; - + protected bool $isBundled = false; /** - * @var ClassMethodParameters|null + * Whether the method is final or not. */ - protected ?ClassMethodParameters $parameters = null; - + protected bool $isFinal = false; /** - * @var StatementsBlock|null + * Whether the method is an initializer or not. */ - protected ?StatementsBlock $statements = null; - + protected bool $isInitializer = false; /** - * @var string|null + * Whether the method is internal or not. */ - protected ?string $docblock = null; - + protected bool $isInternal = false; /** - * @var Docblock|null + * Whether the method is public or not. */ - protected ?Docblock $parsedDocblock = null; + protected bool $isPublic = true; /** - * Types returned by the method. - * - * @var array + * Whether the method is static or not. */ - protected array $returnTypes = []; - + protected bool $isStatic = false; + protected ?LocalContextPass $localContext = null; /** * Zend MAY_BE_* types. - * - * @var array|string[] */ protected array $mayBeArgTypes = [ - 'int' => 'MAY_BE_LONG', + 'int' => 'MAY_BE_LONG', 'false' => 'MAY_BE_FALSE', ]; - - /** - * Raw-types returned by the method. - * - * @var array|null - */ - protected ?array $returnTypesRaw = null; - - /** - * Class type hints returned by the method. - */ - protected array $returnClassTypes = []; - - /** - * Whether the variable is void. - * - * @var bool - */ - protected bool $void = false; - /** * Whether the variable is mixed. * * Only for PHP >= 8.0 - * - * @var bool - */ - protected bool $mixed = false; - - /** - * Whether the method is public or not. - * - * @var bool - */ - protected bool $isPublic = true; - - /** - * Whether the method is static or not. - * - * @var bool - */ - protected bool $isStatic = false; - - /** - * Whether the method is final or not. - * - * @var bool - */ - protected bool $isFinal = false; - - /** - * Whether the method is abstract or not. - * - * @var bool - */ - protected bool $isAbstract = false; - - /** - * Whether the method is internal or not. - * - * @var bool - */ - protected bool $isInternal = false; - - /** - * Whether the method is bundled with PHP or not. - * - * @var bool - */ - protected bool $isBundled = false; - - /** - * Whether the method is an initializer or not. - * - * @var bool */ - protected bool $isInitializer = false; - + protected bool $mixed = false; + protected ?Docblock $parsedDocblock = null; /** - * @var array|null + * Class type hints returned by the method. */ - protected ?array $expression = null; - + protected array $returnClassTypes = []; /** - * @var array|null + * Types returned by the method. */ - protected ?array $staticVariables = null; - + protected array $returnTypes = []; /** - * LocalContextPass. - * - * @var LocalContextPass|null + * Raw-types returned by the method. */ - protected ?LocalContextPass $localContext = null; - + protected ?array $returnTypesRaw = null; + protected array $staticVariables = []; /** * Static Type Inference Pass. - * - * @var StaticTypeInference|null */ protected ?StaticTypeInference $typeInference = null; - /** - * Call Gatherer Pass. - * - * @var CallGathererPass|null + * Whether the variable is void. */ - protected ?CallGathererPass $callGathererPass = null; + protected bool $void = false; - /** - * ClassMethod constructor. - * - * @param ClassDefinition $classDefinition - * @param array $visibility - * @param string $name - * @param ClassMethodParameters|null $parameters - * @param StatementsBlock|null $statements - * @param string|null $docblock - * @param array|null $returnType - * @param array|null $expression - * @param array|null $staticVariables - */ public function __construct( - ClassDefinition $classDefinition, - array $visibility, - string $name, - ?ClassMethodParameters $parameters = null, - ?StatementsBlock $statements = null, - ?string $docblock = null, - ?array $returnType = null, - ?array $expression = null, - ?array $staticVariables = null + Definition $classDefinition, + protected array $visibility, + protected string $name, + protected ?Parameters $parameters = null, + protected ?StatementsBlock $statements = null, + protected ?string $docblock = null, + array $returnType = null, + protected ?array $expression = [], + array $staticVariables = [], ) { - $this->checkVisibility($visibility, $name, $expression); - $this->classDefinition = $classDefinition; - $this->visibility = $visibility; - $this->name = $name; - $this->parameters = $parameters; - $this->statements = $statements; - $this->docblock = $docblock; - $this->expression = $expression; $this->staticVariables = $staticVariables; + $this->checkVisibility($visibility, $name, $expression); $this->setReturnTypes($returnType); } /** - * Process RAW return types structure. - * - * Example: - * - * ``` - * $returnType = [ - * 'type' => 'return-type', - * 'list' => [ - * [ - * 'type' => 'return-type-parameter', - * 'cast' => [ - * 'type' => 'variable', - * 'value' => '\StdClass', - * 'file' => './stubs.zep', - * 'line' => 21, - * 'char' => 48 - * ], - * 'collection' => 1, - * 'file' => './stubs.zep', - * 'line' => 21, - * 'char' => 48 - * ], - * [ - * 'type' => 'return-type-parameter', - * 'data-type' => 'bool', - * 'mandatory' => 0, - * 'file' => './stubs.zep', - * 'line' => 22, - * 'char' => 5 - * ] - * ], - * 'void' => 0, - * 'file' => './stubs.zep', - * 'line' => 22, - * 'char' => 5 - * ]; - * ``` - * - * @param array|null $returnType + * Checks whether at least one return type hint is bool compatible. */ - public function setReturnTypes(?array $returnType = null): void + public function areReturnTypesBoolCompatible(): bool { - $this->returnTypesRaw = $returnType; - if (null === $returnType) { - return; - } - - if (isset($returnType['void']) && $returnType['void']) { - $this->void = true; - - return; - } + return isset($this->returnTypes['bool']); + } - if (!isset($returnType['list'])) { - return; + /** + * Checks if the method have compatible return types. + */ + public function areReturnTypesCompatible(): bool + { + // void + if ($this->isVoid()) { + return true; } - $types = []; - $castTypes = []; - - foreach ($returnType['list'] as $returnTypeItem) { - /** - * We continue the loop, because it only works for PHP >= 8.0. - */ - if (isset($returnTypeItem['data-type']) && $returnTypeItem['data-type'] === 'mixed') { - $this->mixed = true; - } - - if (!isset($returnTypeItem['cast'])) { - $types[$returnTypeItem['data-type']] = $returnTypeItem; - continue; - } - - if (isset($returnTypeItem['cast']['collection'])) { - continue; - } + $totalTypes = count($this->returnTypes); - if (isset($returnTypeItem['collection']) && $returnTypeItem['collection']) { - $types['array'] = [ - 'type' => 'return-type-parameter', - 'data-type' => 'array', - 'mandatory' => 0, - 'file' => $returnTypeItem['cast']['file'], - 'line' => $returnTypeItem['cast']['line'], - 'char' => $returnTypeItem['cast']['char'], - ]; - } else { - $castTypes[$returnTypeItem['cast']['value']] = $returnTypeItem['cast']['value']; + // union types + if ($totalTypes > 1) { + $diff = array_diff(array_keys($this->returnTypes), array_keys($this->mayBeArgTypes)); + if (count($diff) === 0) { + return true; } } - if (count($castTypes) > 0) { - $types['object'] = []; - $this->returnClassTypes = $castTypes; + // T1 | T2 + if (2 === $totalTypes && !isset($this->returnTypes['null'])) { + return false; } - if (count($types) > 0) { - $this->returnTypes = $types; + // null | T1 | T2 + if ($totalTypes > 2) { + return false; } + + return true; } /** - * @return array + * Checks whether at least one return type hint is double compatible. */ - public function getReturnTypesRaw(): array + public function areReturnTypesDoubleCompatible(): bool { - return $this->returnTypesRaw; + return isset($this->returnTypes['double']); } - public function hasReturnTypesRaw(): bool + /** + * Checks whether at least one return type hint is false compatible. + */ + public function areReturnTypesFalseCompatible(): bool { - return !empty($this->returnTypesRaw); + return isset($this->returnTypes['false']); } /** - * Getter for statements block. - * - * @return StatementsBlock $statements Statements block + * Checks whether at least one return type hint is integer compatible. */ - public function getStatementsBlock(): StatementsBlock + public function areReturnTypesIntCompatible(): bool { - return $this->statements; + $types = ['int', 'uint', 'char', 'uchar', 'long', 'ulong']; + + foreach ($this->returnTypes as $returnType => $definition) { + if (in_array($returnType, $types)) { + return true; + } + } + + return false; } /** - * Setter for statements block. - * - * @param StatementsBlock $statementsBlock + * Checks whether at least one return type hint is null compatible. */ - public function setStatementsBlock(StatementsBlock $statementsBlock): void + public function areReturnTypesNullCompatible(): bool { - $this->statements = $statementsBlock; + return isset($this->returnTypes['null']); + } + + public function areReturnTypesObjectCompatible(): bool + { + return isset($this->returnTypes['object']); } /** - * Checks whether the method is empty. - * - * @return bool + * Checks whether at least one return type hint is string compatible. */ - public function isEmpty(): bool + public function areReturnTypesStringCompatible(): bool { - return $this->statements->isEmpty(); + return isset($this->returnTypes['string']); } /** - * Checks for visibility congruence. - * - * @param array $visibility - * @param string $name - * @param array $original + * Assigns a default value. * - * @throws CompilerException + * @throws Exception + * @throws ReflectionException */ - public function checkVisibility(array $visibility, string $name, array $original = null): void + public function assignDefaultValue(array $parameter, CompilationContext $compilationContext): string { - if (count($visibility) > 1) { - if (in_array('public', $visibility) && in_array('protected', $visibility)) { - throw new CompilerException("Method '$name' cannot be 'public' and 'protected' at the same time", $original); + /** + * Class-Hinted parameters only can be null? + */ + if (isset($parameter['cast'])) { + if ('null' !== $parameter['default']['type']) { + throw new CompilerException( + 'Class-Hinted parameters only can have "null" as default parameter', + $parameter + ); } + } - if (in_array('public', $visibility) && in_array('private', $visibility)) { - throw new CompilerException("Method '$name' cannot be 'public' and 'private' at the same time", $original); - } + $oldCodePrinter = $compilationContext->codePrinter; + $codePrinter = new Printer(); + $codePrinter->increaseLevel(); + $codePrinter->increaseLevel(); + $compilationContext->codePrinter = $codePrinter; - if (in_array('private', $visibility) && in_array('protected', $visibility)) { - throw new CompilerException("Method '$name' cannot be 'protected' and 'private' at the same time", $original); - } + $paramVariable = $compilationContext->symbolTable->getVariableForWrite($parameter['name'], $compilationContext); - if (in_array('private', $visibility) && in_array('internal', $visibility)) { - throw new CompilerException("Method '$name' cannot be 'internal' and 'private' at the same time", $original); - } + /** + * TODO: Refactoring this place, move to one - static-constant-access + */ + $dataType = $this->getParamDataType($parameter); + switch ($dataType) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + switch ($parameter['default']['type']) { + case 'static-constant-access': + /** + * Now I can write code for easy use on Expression because code in this method don't write with codePrinter ;(. + * + * TODO: Rewrite all to codePrinter + */ + $symbolVariable = $compilationContext->symbolTable->getVariableForWrite( + $parameter['name'], + $compilationContext, + $parameter['default'] + ); + $expression = new Expression($parameter['default']); + $expression->setExpectReturn(true, $symbolVariable); + $compiledExpression = $expression->compile($compilationContext); - if (in_array('protected', $visibility) && in_array('internal', $visibility)) { - throw new CompilerException("Method '$name' cannot be 'internal' and 'protected' at the same time", $original); - } + if ('int' != $compiledExpression->getType()) { + throw new CompilerException( + 'Default parameter value type: ' + . $compiledExpression->getType() + . ' cannot be assigned to variable(int)', + $parameter + ); + } - if (in_array('public', $visibility) && in_array('internal', $visibility)) { - throw new CompilerException("Method '$name' cannot be 'internal' and 'public' at the same time", $original); - } - } + $parameter['default']['type'] = $compiledExpression->getType(); + $parameter['default']['value'] = $compiledExpression->getCode(); - if ('__construct' === $name) { - if (in_array('static', $visibility)) { - throw new CompilerException("Constructors cannot be 'static'", $original); - } - } elseif ('__destruct' === $name) { - if (in_array('static', $visibility)) { - throw new CompilerException("Destructors cannot be 'static'", $original); - } - } + $compilationContext->codePrinter = $oldCodePrinter; - $this->isAbstract = in_array('abstract', $visibility); - $this->isStatic = in_array('static', $visibility); - $this->isFinal = in_array('final', $visibility); - $this->isPublic = in_array('public', $visibility); - $this->isInternal = in_array('internal', $visibility); - } + return $this->assignDefaultValue($parameter, $compilationContext); - /** - * Sets if the method is internal or not. - * - * @param bool $static - */ - public function setIsStatic(bool $static): void - { - $this->isStatic = $static; - } + case 'null': + $codePrinter->output($parameter['name'] . ' = 0;'); + break; - /** - * Sets if the method is internal or not. - * - * @param bool $internal - */ - public function setIsInternal(bool $internal): void - { - $this->isInternal = $internal; - } + case 'int': + case 'uint': + case 'long': + $codePrinter->output($parameter['name'] . ' = ' . $parameter['default']['value'] . ';'); + break; - /** - * Sets if the method is bundled or not. - * - * @param bool $bundled - */ - public function setIsBundled(bool $bundled): void - { - $this->isBundled = $bundled; - } + case 'double': + $codePrinter->output($parameter['name'] . ' = (int) ' . $parameter['default']['value'] . ';'); + break; - /** - * Sets if the method is an initializer or not. - * - * @param bool $initializer - */ - public function setIsInitializer(bool $initializer): void - { - $this->isInitializer = $initializer; - } + default: + throw new CompilerException( + 'Default parameter value type: ' . $parameter['default']['type'] . ' cannot be assigned to variable(int)', + $parameter + ); + } + break; - /** - * Returns the class definition where the method was declared. - * - * @return ClassDefinition|null - */ - public function getClassDefinition(): ?ClassDefinition - { - return $this->classDefinition; - } + case 'double': + switch ($parameter['default']['type']) { + case 'static-constant-access': + return $this->processStaticConstantAccess( + $compilationContext, + $parameter, + $oldCodePrinter, + 'double' + ); - /** - * Generate internal method's based on the equivalent PHP methods, - * allowing bypassing php userspace for internal method calls. - * - * @param CompilationContext $compilationContext - * - * @return $this - */ - public function setupOptimized(CompilationContext $compilationContext): self - { - if (!$compilationContext->config->get('internal-call-transformation', 'optimizations')) { - return $this; - } + case 'null': + $codePrinter->output($parameter['name'] . ' = 0;'); + break; - $classDefinition = $this->getClassDefinition(); + case 'int': + case 'uint': + case 'long': + $codePrinter->output( + $parameter['name'] . ' = (double) ' . $parameter['default']['value'] . ';' + ); + break; - /** - * Skip for closures - */ - if ('__invoke' === $this->getName() || $classDefinition->isInterface()) { - return $this; - } + case 'double': + $codePrinter->output($parameter['name'] . ' = ' . $parameter['default']['value'] . ';'); + break; - if (!$this->isInternal() && !$classDefinition->isBundled()) { - /* Not supported for now */ - if ($this->getNumberOfRequiredParameters() != $this->getNumberOfParameters()) { - return $this; - } + default: + throw new CompilerException( + 'Default parameter value type: ' . $parameter['default']['type'] . ' cannot be assigned to variable(double)', + $parameter + ); + } + break; - if ($this->isConstructor()) { - return $this; - } + case 'bool': + switch ($parameter['default']['type']) { + case 'static-constant-access': + /** + * Now I can write code for easy use on Expression because code in this method don't write with codePrinter ;(. + * + * TODO: Rewrite all to codePrinter + */ + $symbolVariable = $compilationContext->symbolTable->getVariableForWrite( + $parameter['name'], + $compilationContext, + $parameter['default'] + ); + $expression = new Expression($parameter['default']); + $expression->setExpectReturn(true, $symbolVariable); + $compiledExpression = $expression->compile($compilationContext); - $optimizedName = $this->getName().'_zephir_internal_call'; + if ('bool' !== $compiledExpression->getType()) { + throw new CompilerException( + 'Default parameter value type: ' + . $compiledExpression->getType() + . ' cannot be assigned to variable(bool)', + $parameter + ); + } - $visibility = ['internal']; + $parameter['default']['type'] = $compiledExpression->getType(); + $parameter['default']['value'] = $compiledExpression->getCode(); - $statements = null; - if ($this->statements) { - $statements = new StatementsBlock(json_decode(json_encode($this->statements->getStatements()), true)); - } + $compilationContext->codePrinter = $oldCodePrinter; - $optimizedMethod = new self( - $classDefinition, - $visibility, - $optimizedName, - $this->parameters, - $statements, - $this->docblock, - null, - $this->expression - ); - $optimizedMethod->typeInference = $this->typeInference; - $optimizedMethod->setReturnTypes($this->returnTypes); - $classDefinition->addMethod($optimizedMethod); - } + return $this->assignDefaultValue($parameter, $compilationContext); - return $this; - } + case 'null': + $codePrinter->output($parameter['name'] . ' = 0;'); + break; - public function getOptimizedMethod(): self - { - $optimizedName = $this->getName().'_zephir_internal_call'; - $optimizedMethod = $this->classDefinition->getMethod($optimizedName, false); - if (!$optimizedMethod || !$this->optimizable) { - return $this; - } + case 'bool': + if ('true' === $parameter['default']['value']) { + $codePrinter->output($parameter['name'] . ' = 1;'); + } else { + $codePrinter->output($parameter['name'] . ' = 0;'); + } + break; - return $optimizedMethod; - } + default: + throw new CompilerException( + 'Default parameter value type: ' + . $parameter['default']['type'] + . ' cannot be assigned to variable(bool)', + $parameter + ); + } + break; - /** - * Sets the method name. - * - * @param string $name - */ - public function setName(string $name) - { - $this->name = $name; - } + case 'string': + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/memory'); - /** - * Returns the method name. - * - * @return string - */ - public function getName(): string - { - return $this->name; - } + switch ($parameter['default']['type']) { + case 'static-constant-access': + return $this->processStaticConstantAccess( + $compilationContext, + $parameter, + $oldCodePrinter, + 'string' + ); - /** - * Returns the raw docblock. - * - * @return string - */ - public function getDocBlock(): ?string - { - return $this->docblock; - } + case 'null': + $compilationContext->backend->initVar($paramVariable, $compilationContext); + $compilationContext->backend->assignString($paramVariable, null, $compilationContext); + break; - /** - * Returns the parsed docblock. - * - * @return Docblock|null - */ - public function getParsedDocBlock(): ?Docblock - { - if ($this->parsedDocblock) { - return $this->parsedDocblock; - } + case 'string': + $compilationContext->backend->initVar($paramVariable, $compilationContext); + $compilationContext->backend->assignString( + $paramVariable, + Name::addSlashes($parameter['default']['value']), + $compilationContext + ); + break; - if ($this->docblock === null) { - return null; - } + default: + throw new CompilerException( + sprintf( + 'Default parameter value type: %s cannot be assigned to variable(string)', + $parameter['default']['type'] + ), + $parameter + ); + } + break; - $parser = new DocblockParser('/'.$this->docblock.'/'); - $this->parsedDocblock = $parser->parse(); + case 'array': + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/memory'); + switch ($parameter['default']['type']) { + case 'null': + $compilationContext->backend->initVar($paramVariable, $compilationContext); + break; - return $this->parsedDocblock; - } + case 'empty-array': + case 'array': + $compilationContext->backend->initVar($paramVariable, $compilationContext); + $compilationContext->backend->initArray($paramVariable, $compilationContext); + break; - /** - * the starting line of the method in the source file. - * - * @return mixed - */ - public function getLine() - { - return $this->expression['line']; - } + default: + throw new CompilerException( + 'Default parameter value type: ' + . $parameter['default']['type'] + . ' cannot be assigned to variable(array)', + $parameter + ); + } + break; - /** - * the ending line of the method in the source file. - * - * @return mixed - */ - public function getLastLine() - { - return $this->expression['last-line']; - } + case 'variable': + $symbolVariable = $compilationContext->symbolTable->getVariableForWrite( + $parameter['name'], + $compilationContext, + $parameter['default'] + ); + switch ($parameter['default']['type']) { + case 'static-constant-access': + /** + * Now I can write code for easy use on Expression because code in this method don't write with codePrinter ;(. + * + * TODO: Rewrite all to codePrinter + */ + $expression = new Expression($parameter['default']); + $expression->setExpectReturn(true, $symbolVariable); + $compiledExpression = $expression->compile($compilationContext); - /** - * Returns the parameters. - * - * @return ClassMethodParameters|null - */ - public function getParameters(): ?ClassMethodParameters - { - return $this->parameters; - } + $parameter['default']['type'] = $compiledExpression->getType(); + $parameter['default']['value'] = $compiledExpression->getCode(); - /** - * Checks if the method has return-type or cast hints. - * - * @return bool - */ - public function hasReturnTypes(): bool - { - return count($this->returnTypes) || count($this->returnClassTypes); - } + $compilationContext->codePrinter = $oldCodePrinter; - /** - * Checks whether at least one return type hint is null compatible. - * - * @return bool - */ - public function areReturnTypesNullCompatible(): bool - { - return isset($this->returnTypes['null']); - } + return $this->assignDefaultValue($parameter, $compilationContext); - /** - * Checks whether at least one return type hint is integer compatible. - * - * @return bool - */ - public function areReturnTypesIntCompatible(): bool - { - $types = ['int', 'uint', 'char', 'uchar', 'long', 'ulong']; + case 'int': + case 'uint': + case 'long': + case 'ulong': + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->backend->initVar($symbolVariable, $compilationContext); + $compilationContext->backend->assignLong( + $symbolVariable, + $parameter['default']['value'], + $compilationContext + ); + break; - foreach ($this->returnTypes as $returnType => $definition) { - if (in_array($returnType, $types)) { - return true; - } + case 'double': + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->backend->initVar($symbolVariable, $compilationContext); + $compilationContext->backend->assignDouble( + $symbolVariable, + $parameter['default']['value'], + $compilationContext + ); + break; + + case 'string': + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->backend->initVar($symbolVariable, $compilationContext); + $compilationContext->backend->assignString( + $paramVariable, + Name::addSlashes($parameter['default']['value']), + $compilationContext + ); + break; + + case 'bool': + $expectedMutations = $compilationContext->symbolTable->getExpectedMutations($parameter['name']); + if ($expectedMutations < 2) { + if ('true' == $parameter['default']['value']) { + $compilationContext->backend->assignZval( + $paramVariable, + $compilationContext->backend->resolveValue('true', $compilationContext), + $compilationContext + ); + } else { + $compilationContext->backend->assignZval( + $paramVariable, + $compilationContext->backend->resolveValue('false', $compilationContext), + $compilationContext + ); + } + } else { + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/memory'); + if ('true' == $parameter['default']['value']) { + $compilationContext->backend->copyOnWrite( + $paramVariable, + $compilationContext->backend->resolveValue('true', $compilationContext), + $compilationContext + ); + } else { + $compilationContext->backend->copyOnWrite( + $paramVariable, + $compilationContext->backend->resolveValue('false', $compilationContext), + $compilationContext + ); + } + } + break; + + case 'null': + $expectedMutations = $compilationContext->symbolTable->getExpectedMutations($parameter['name']); + if ($expectedMutations < 2) { + $compilationContext->backend->assignZval( + $symbolVariable, + $compilationContext->backend->resolveValue('null', $compilationContext), + $compilationContext + ); + } else { + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->backend->copyOnWrite( + $paramVariable, + $compilationContext->backend->resolveValue('null', $compilationContext), + $compilationContext + ); + } + break; + + case 'empty-array': + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->backend->initVar($symbolVariable, $compilationContext); + $compilationContext->backend->initArray($symbolVariable, $compilationContext); + break; + + default: + throw new CompilerException( + 'Default parameter value type: ' . $parameter['default']['type'] . ' cannot be assigned to variable(variable)', + $parameter + ); + } + break; + + default: + throw new CompilerException('Default parameter type: ' . $dataType, $parameter); } - return false; + $compilationContext->codePrinter = $oldCodePrinter; + + return $codePrinter->getOutput(); } /** - * Checks whether at least one return type hint is double compatible. + * Assigns a zval value to a static low-level type. * - * @return bool + * @throws CompilerException */ - public function areReturnTypesDoubleCompatible(): bool + public function assignZvalValue(array $parameter, CompilationContext $compilationContext): string { - return isset($this->returnTypes['double']); + $dataType = $this->getParamDataType($parameter); + + if (in_array($dataType, ['variable', 'callable', 'object', 'resource', 'mixed'])) { + return ''; + } + + $compilationContext->headersManager->add('kernel/operators'); + $parameterVariable = $compilationContext->symbolTable->getVariableForWrite( + $parameter['name'] . '_param', + $compilationContext + ); + $parameterCode = $compilationContext->backend->getVariableCode($parameterVariable); + $inputParamVar = $compilationContext->symbolTable->getVariableForWrite( + $parameter['name'], + $compilationContext + ); + $inputParamCode = $compilationContext->backend->getVariableCode($inputParamVar); + + switch ($dataType) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + // Value already passed in `Z_PARAM_LONG()` + return ''; + + case 'char': + return "\t" . $parameter['name'] . ' = zephir_get_charval(' . $parameterCode . ');' . PHP_EOL; + + case 'bool': + //return "\t" . $parameter['name'] . ' = zephir_get_boolval(' . $parameterCode . ');' . PHP_EOL; + return ''; + + case 'double': + return "\t" . $parameter['name'] . ' = zephir_get_doubleval(' . $parameterCode . ');' . PHP_EOL; + + case 'string': + $compilationContext->symbolTable->mustGrownStack(true); + + return "\t" . 'zephir_get_strval(' . $inputParamCode . ', ' . $parameterCode . ');' . PHP_EOL; + + case 'array': + $compilationContext->symbolTable->mustGrownStack(true); + + return "\t" . 'zephir_get_arrval(' . $inputParamCode . ', ' . $parameterCode . ');' . PHP_EOL; + + default: + throw new CompilerException('Parameter type: ' . $dataType, $parameter); + } } /** - * Checks whether at least one return type hint is bool compatible. + * Assigns a zval value to a static low-level type. + * + * TODO: rewrite this to build ifs and throw from builders * - * @return bool + * @throws CompilerException */ - public function areReturnTypesBoolCompatible(): bool + public function checkStrictType(array $parameter, CompilationContext $compilationContext): string { - return isset($this->returnTypes['bool']); + $dataType = $this->getParamDataType($parameter); + + $compilationContext->headersManager->add('ext/spl/spl_exceptions'); + $compilationContext->headersManager->add('kernel/exception'); + + $codePrinter = new Printer(); + $codePrinter->increaseLevel(); + $oldCodePrinter = $compilationContext->codePrinter; + $compilationContext->codePrinter = $codePrinter; + $compilationContext->backend->checkStrictType($dataType, $parameter, $compilationContext); + + $compilationContext->codePrinter = $oldCodePrinter; + + return $codePrinter->getOutput(); } /** - * Checks whether at least one return type hint is false compatible. + * Checks for visibility congruence. * - * @return bool + * @throws CompilerException */ - public function areReturnTypesFalseCompatible(): bool - { - return isset($this->returnTypes['false']); - } - - /** - * Checks whether at least one return type hint is string compatible. - * - * @return bool - */ - public function areReturnTypesStringCompatible(): bool - { - return isset($this->returnTypes['string']); - } - - public function areReturnTypesObjectCompatible(): bool - { - return isset($this->returnTypes['object']); - } - - /** - * Returned type hints by the method. - * - * @return array - */ - public function getReturnTypes(): array - { - return $this->returnTypes; - } - - /** - * Returned class-type hints by the method. - * - * @return array - */ - public function getReturnClassTypes(): array + public function checkVisibility(array $visibility, string $name, array $original = null): void { - return $this->returnClassTypes; - } + if (count($visibility) > 1) { + if (in_array('public', $visibility) && in_array('protected', $visibility)) { + throw new CompilerException( + "Method '$name' cannot be 'public' and 'protected' at the same time", + $original + ); + } - /** - * Returns the number of parameters the method has. - * - * @return bool - */ - public function hasParameters(): bool - { - return $this->parameters instanceof ClassMethodParameters && $this->parameters->count() > 0; - } + if (in_array('public', $visibility) && in_array('private', $visibility)) { + throw new CompilerException( + "Method '$name' cannot be 'public' and 'private' at the same time", + $original + ); + } - /** - * Returns the number of parameters the method has. - * - * @return int - */ - public function getNumberOfParameters(): int - { - if ($this->parameters instanceof ClassMethodParameters) { - return $this->parameters->count(); - } + if (in_array('private', $visibility) && in_array('protected', $visibility)) { + throw new CompilerException( + "Method '$name' cannot be 'protected' and 'private' at the same time", + $original + ); + } - return 0; - } + if (in_array('private', $visibility) && in_array('internal', $visibility)) { + throw new CompilerException( + "Method '$name' cannot be 'internal' and 'private' at the same time", + $original + ); + } - /** - * Returns the number of required parameters the method has. - * - * @return int - */ - public function getNumberOfRequiredParameters(): int - { - if ($this->parameters === null) { - return 0; - } + if (in_array('protected', $visibility) && in_array('internal', $visibility)) { + throw new CompilerException( + "Method '$name' cannot be 'internal' and 'protected' at the same time", + $original + ); + } - $required = 0; - foreach ($this->parameters->getParameters() as $parameter) { - if (!isset($parameter['default'])) { - ++$required; + if (in_array('public', $visibility) && in_array('internal', $visibility)) { + throw new CompilerException( + "Method '$name' cannot be 'internal' and 'public' at the same time", + $original + ); } } - return $required; - } - - /** - * Returns the number of required parameters the method has. - * - * @return string - */ - public function getInternalParameters(): string - { - if ($this->parameters === null) { - return ''; + if ('__construct' === $name) { + if (in_array('static', $visibility)) { + throw new CompilerException("Constructors cannot be 'static'", $original); + } + } elseif ('__destruct' === $name) { + if (in_array('static', $visibility)) { + throw new CompilerException("Destructors cannot be 'static'", $original); + } } - return $this->parameters->count().', ...'; - } - - /** - * Checks whether the method has a specific modifier. - * - * @param string $modifier - * - * @return bool - */ - public function hasModifier(string $modifier): bool - { - return in_array($modifier, $this->visibility); - } - - /** - * Returns method visibility modifiers. - * - * @return array - */ - public function getVisibility(): array - { - return $this->visibility; - } - - public function isDeprecated(): bool - { - return !empty($this->visibility) && in_array('deprecated', $this->visibility, true); + $this->isAbstract = in_array('abstract', $visibility); + $this->isStatic = in_array('static', $visibility); + $this->isFinal = in_array('final', $visibility); + $this->isPublic = in_array('public', $visibility); + $this->isInternal = in_array('internal', $visibility); } /** - * Returns the C-modifier flags. + * Compiles the method. * * @throws Exception - * - * @return string + * @throws ReflectionException */ - public function getModifiers(): string + public function compile(CompilationContext $compilationContext): void { - $modifiers = []; - foreach ($this->visibility as $visibility) { - switch ($visibility) { - case 'public': - $modifiers['ZEND_ACC_PUBLIC'] = $visibility; - break; - - case 'protected': - $modifiers['ZEND_ACC_PROTECTED'] = $visibility; - break; + /** + * Set the method currently being compiled + */ + $compilationContext->currentMethod = $this; - case 'private': - $modifiers['ZEND_ACC_PRIVATE'] = $visibility; - break; + /** + * Assign pre-made compilation passes. + */ + $typeInference = $this->typeInference; + $callGathererPass = $this->callGathererPass; - case 'static': - $modifiers['ZEND_ACC_STATIC'] = $visibility; - break; + /** + * Initialization of parameters happens in a fictitious external branch. + */ + $branch = new Branch(); + $branch->setType(Branch::TYPE_EXTERNAL); - case 'final': - $modifiers['ZEND_ACC_FINAL'] = $visibility; - break; + /** + * BranchManager helps to create graphs of conditional/loop/root/jump branches. + */ + $branchManager = new BranchManager(); + $branchManager->addBranch($branch); - case 'abstract': - $modifiers['ZEND_ACC_ABSTRACT'] = $visibility; - break; + $compilationContext->branchManager = $branchManager; - case 'deprecated': - $modifiers['ZEND_ACC_DEPRECATED'] = $visibility; - break; + /** + * Every method has its own symbol table. + */ + $symbolTable = new SymbolTable($compilationContext); + if ($this->localContext instanceof LocalContextPass) { + $symbolTable->setLocalContext($this->localContext); + } - case 'inline': - case 'scoped': - case 'internal': - break; + foreach ($this->staticVariables as $var) { + $localVar = clone $var; + $localVar->setIsExternal(true); + $localVar->setLocalOnly(true); + $localVar->setDynamicTypes($localVar->getType()); + $localVar->setType('variable'); + $localVar->setIsDoublePointer(false); + $symbolTable->addRawVariable($localVar); + } - default: - throw new Exception('Unknown modifier "'.$visibility.'"'); + /** + * Parameters has an additional extra mutation. + */ + if ($this->localContext instanceof LocalContextPass && $this->parameters instanceof Parameters) { + foreach ($this->parameters->getParameters() as $parameter) { + $this->localContext->increaseMutations($parameter['name']); } } - if ('__construct' === $this->name) { - $modifiers['ZEND_ACC_CTOR'] = true; - } elseif ('__destruct' === $this->name) { - $modifiers['ZEND_ACC_DTOR'] = true; - } + /** + * Cache Manager manages function calls, method calls and class entries caches. + */ + $cacheManager = new Manager(); + $cacheManager->setGatherer($callGathererPass); - return implode('|', array_keys($modifiers)); - } + $compilationContext->cacheManager = $cacheManager; + $compilationContext->typeInference = $typeInference; + $compilationContext->symbolTable = $symbolTable; - /** - * Checks if the method must not return any value. - * - * @return bool - */ - public function isVoid(): bool - { - return $this->void; - } + $oldCodePrinter = $compilationContext->codePrinter; - /** - * Checks if the methods return type is `mixed`. - * - * @return bool - */ - public function isMixed(): bool - { - return $this->mixed; - } + /** + * Change the code printer to a single method instance. + */ + $codePrinter = new Printer(); + $compilationContext->codePrinter = $codePrinter; - /** - * Checks if the method is inline. - * - * @return bool - */ - public function isInline(): bool - { - return in_array('inline', $this->visibility); - } + /** + * Set an empty function cache + */ + $compilationContext->functionCache = null; - /** - * Checks if the method is private. - * - * @return bool - */ - public function isPrivate(): bool - { - return in_array('private', $this->visibility); - } + /** + * Reset try/catch and loop counter + */ + $compilationContext->insideCycle = 0; + $compilationContext->insideTryCatch = 0; + $compilationContext->currentTryCatch = 0; - /** - * Checks if the method is protected. - * - * @return bool - */ - public function isProtected(): bool - { - return in_array('protected', $this->visibility); - } - - /** - * Checks if the method is public. - * - * @return bool - */ - public function isPublic(): bool - { - return $this->isPublic; - } - - /** - * Checks is abstract method? - * - * @return bool - */ - public function isAbstract(): bool - { - return $this->isAbstract; - } - - /** - * Checks whether the method is static. - * - * @return bool - */ - public function isStatic(): bool - { - return $this->isStatic; - } - - /** - * Checks whether the method is final. - * - * @return bool - */ - public function isFinal(): bool - { - return $this->isFinal; - } - - /** - * Checks whether the method is internal. - * - * @return bool - */ - public function isInternal(): bool - { - return $this->isInternal; - } - - /** - * Checks whether the method is bundled. - * - * @return bool - */ - public function isBundled(): bool - { - return $this->isBundled; - } - - /** - * Checks whether the method is an initializer. - * - * @return bool - */ - public function isInitializer(): bool - { - return $this->isInitializer; - } - - /** - * Check whether the current method is a constructor. - * - * @return bool - */ - public function isConstructor(): bool - { - return '__construct' === $this->name; - } - - /** - * Checks if method is a shortcut. - * - * @return bool - */ - public function isShortcut(): bool - { - return $this->expression && 'shortcut' === $this->expression['type']; - } - - /** - * @return array|string[] - */ - public function getMayBeArgTypes(): array - { - return $this->mayBeArgTypes; - } - - /** - * Return shortcut method name. - * - * @return mixed - */ - public function getShortcutName() - { - return $this->expression['name']; - } - - /** - * Returns the local context pass information. - * - * @return LocalContextPass - */ - public function getLocalContextPass(): LocalContextPass - { - return $this->localContext; - } - - /** - * Returns the static type inference pass information. - * - * @return StaticTypeInference - */ - public function getStaticTypeInferencePass(): StaticTypeInference - { - return $this->typeInference; - } - - /** - * Returns the call gatherer pass information. - * - * @return CallGathererPass - */ - public function getCallGathererPass(): CallGathererPass - { - return $this->callGathererPass; - } - - /** - * Replace macros. - * - * @param SymbolTable $symbolTable - * @param string $containerCode - * - * @return string - */ - public function removeMemoryStackReferences(SymbolTable $symbolTable, string $containerCode): string - { - if ($symbolTable->getMustGrownStack()) { - return $containerCode; - } - - $containerCode = str_replace('ZEPHIR_THROW_EXCEPTION_STR', 'ZEPHIR_THROW_EXCEPTION_STRW', $containerCode); - $containerCode = str_replace('ZEPHIR_THROW_EXCEPTION_DEBUG_STR', 'ZEPHIR_THROW_EXCEPTION_DEBUG_STRW', $containerCode); - $containerCode = str_replace('ZEPHIR_THROW_EXCEPTION_ZVAL', 'ZEPHIR_THROW_EXCEPTION_ZVALW', $containerCode); - $containerCode = str_replace('RETURN_THIS', 'RETURN_THISW', $containerCode); - $containerCode = str_replace('RETURN_LCTOR', 'RETURN_LCTORW', $containerCode); - $containerCode = str_replace('RETURN_CTOR', 'RETURN_CTORW', $containerCode); - $containerCode = str_replace('RETURN_NCTOR', 'RETURN_NCTORW', $containerCode); - $containerCode = str_replace('RETURN_CCTOR', 'RETURN_CCTORW', $containerCode); - $containerCode = str_replace('RETURN_MM_NULL', 'RETURN_NULL', $containerCode); - $containerCode = str_replace('RETURN_MM_BOOL', 'RETURN_BOOL', $containerCode); - $containerCode = str_replace('RETURN_MM_FALSE', 'RETURN_FALSE', $containerCode); - $containerCode = str_replace('RETURN_MM_TRUE', 'RETURN_TRUE', $containerCode); - $containerCode = str_replace('RETURN_MM_STRING', 'RETURN_STRING', $containerCode); - $containerCode = str_replace('RETURN_MM_LONG', 'RETURN_LONG', $containerCode); - $containerCode = str_replace('RETURN_MM_DOUBLE', 'RETURN_DOUBLE', $containerCode); - $containerCode = str_replace('RETURN_MM_FALSE', 'RETURN_FALSE', $containerCode); - $containerCode = str_replace('RETURN_MM_EMPTY_STRING', 'RETURN_MM_EMPTY_STRING', $containerCode); - $containerCode = str_replace('RETURN_MM_EMPTY_ARRAY', 'RETURN_EMPTY_ARRAY', $containerCode); - $containerCode = str_replace('RETURN_MM_MEMBER', 'RETURN_MEMBER', $containerCode); - $containerCode = str_replace('RETURN_MM()', 'return', $containerCode); - $containerCode = preg_replace('/[ \t]+ZEPHIR_MM_RESTORE\(\);'.PHP_EOL.'/s', '', $containerCode); - - return $containerCode; - } - - /** - * Assigns a default value. - * - * @param array $parameter - * @param CompilationContext $compilationContext - * - * @return string - * - * @throws Exception - */ - public function assignDefaultValue(array $parameter, CompilationContext $compilationContext): string - { - /** - * Class-Hinted parameters only can be null? - */ - if (isset($parameter['cast'])) { - if ('null' !== $parameter['default']['type']) { - throw new CompilerException('Class-Hinted parameters only can have "null" as default parameter', $parameter); - } - } - - $oldCodePrinter = $compilationContext->codePrinter; - $codePrinter = new CodePrinter(); - $codePrinter->increaseLevel(); - $codePrinter->increaseLevel(); - $compilationContext->codePrinter = $codePrinter; - - $paramVariable = $compilationContext->symbolTable->getVariableForWrite($parameter['name'], $compilationContext); - - /** - * TODO: Refactoring this place, move to one - static-constant-access - */ - $dataType = $this->getParamDataType($parameter); - switch ($dataType) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - switch ($parameter['default']['type']) { - case 'static-constant-access': - /** - * Now I can write code for easy use on Expression because code in this method don't write with codePrinter ;(. - * - * TODO: Rewrite all to codePrinter - */ - $symbolVariable = $compilationContext->symbolTable->getVariableForWrite($parameter['name'], $compilationContext, $parameter['default']); - $expression = new Expression($parameter['default']); - $expression->setExpectReturn(true, $symbolVariable); - $compiledExpression = $expression->compile($compilationContext); - - if ('int' != $compiledExpression->getType()) { - throw new CompilerException('Default parameter value type: '.$compiledExpression->getType().' cannot be assigned to variable(int)', $parameter); - } - - $parameter['default']['type'] = $compiledExpression->getType(); - $parameter['default']['value'] = $compiledExpression->getCode(); - - $compilationContext->codePrinter = $oldCodePrinter; - - return $this->assignDefaultValue($parameter, $compilationContext); - - case 'null': - $codePrinter->output($parameter['name'].' = 0;'); - break; + if ($this->parameters instanceof Parameters) { + /** + * Round 1. Create variables in parameters in the symbol table. + */ + $substituteVars = []; + foreach ($this->parameters->getParameters() as $parameter) { + $symbolParam = null; - case 'int': - case 'uint': - case 'long': - $codePrinter->output($parameter['name'].' = '.$parameter['default']['value'].';'); - break; + if (isset($parameter['data-type'])) { + switch ($parameter['data-type']) { + case 'object': + case 'callable': + case 'resource': + case 'variable': + case 'mixed': + $symbol = $symbolTable->addVariable( + $parameter['data-type'], + $parameter['name'], + $compilationContext + ); + /* TODO: Move this to the respective backend, which requires refactoring how this works */ + $symbol->setIsDoublePointer(true); + $substituteVars[$parameter['name']] = $symbolTable->addVariable( + 'variable', + $parameter['name'] . '_sub', + $compilationContext + ); + break; - case 'double': - $codePrinter->output($parameter['name'].' = (int) '.$parameter['default']['value'].';'); - break; + default: + $symbol = $symbolTable->addVariable( + $parameter['data-type'], + $parameter['name'], + $compilationContext + ); + $symbolParam = $symbolTable->addVariable( + 'variable', + $parameter['name'] . '_param', + $compilationContext + ); + /* TODO: Move this to the respective backend, which requires refactoring how this works */ + $symbolParam->setIsDoublePointer(true); - default: - throw new CompilerException('Default parameter value type: '.$parameter['default']['type'].' cannot be assigned to variable(int)', $parameter); + if ('string' == $parameter['data-type'] || 'array' == $parameter['data-type']) { + $symbol->setMustInitNull(true); + } + break; + } + } else { + $symbol = $symbolTable->addVariable('variable', $parameter['name'], $compilationContext); } - break; - - case 'double': - switch ($parameter['default']['type']) { - case 'static-constant-access': - /** - * Now I can write code for easy use on Expression because code in this method don't write with codePrinter ;(. - * - * TODO: Rewrite all to codePrinter - */ - $symbolVariable = $compilationContext->symbolTable->getVariableForWrite($parameter['name'], $compilationContext, $parameter['default']); - $expression = new Expression($parameter['default']); - $expression->setExpectReturn(true, $symbolVariable); - $compiledExpression = $expression->compile($compilationContext); - - if ('double' != $compiledExpression->getType()) { - throw new CompilerException('Default parameter value type: '.$compiledExpression->getType().' cannot be assigned to variable(double)', $parameter); - } - - $parameter['default']['type'] = $compiledExpression->getType(); - $parameter['default']['value'] = $compiledExpression->getCode(); - - $compilationContext->codePrinter = $oldCodePrinter; - - return $this->assignDefaultValue($parameter, $compilationContext); - - case 'null': - $codePrinter->output($parameter['name'].' = 0;'); - break; - case 'int': - case 'uint': - case 'long': - $codePrinter->output($parameter['name'].' = (double) '.$parameter['default']['value'].';'); - break; - - case 'double': - $codePrinter->output($parameter['name'].' = '.$parameter['default']['value'].';'); - break; - - default: - throw new CompilerException('Default parameter value type: '.$parameter['default']['type'].' cannot be assigned to variable(double)', $parameter); + /** + * ZE3 only + */ + if (isset($substituteVars[$parameter['name']])) { + $substituteVar = $substituteVars[$parameter['name']]; + $substituteVar->increaseUses(); } - break; - - case 'bool': - switch ($parameter['default']['type']) { - case 'static-constant-access': - /** - * Now I can write code for easy use on Expression because code in this method don't write with codePrinter ;(. - * - * TODO: Rewrite all to codePrinter - */ - $symbolVariable = $compilationContext->symbolTable->getVariableForWrite($parameter['name'], $compilationContext, $parameter['default']); - $expression = new Expression($parameter['default']); - $expression->setExpectReturn(true, $symbolVariable); - $compiledExpression = $expression->compile($compilationContext); - - if ('bool' !== $compiledExpression->getType()) { - throw new CompilerException('Default parameter value type: '.$compiledExpression->getType().' cannot be assigned to variable(bool)', $parameter); - } - $parameter['default']['type'] = $compiledExpression->getType(); - $parameter['default']['value'] = $compiledExpression->getCode(); + /** + * Some parameters can be read-only + */ + if (!empty($parameter['const'])) { + $symbol->setReadOnly(true); + if (is_object($symbolParam)) { + $symbolParam->setReadOnly(true); + } + } - $compilationContext->codePrinter = $oldCodePrinter; + if (is_object($symbolParam)) { + /** + * Parameters are marked as 'external' + */ + $symbolParam->setIsExternal(true); - return $this->assignDefaultValue($parameter, $compilationContext); + /** + * Assuming they're initialized + */ + $symbolParam->setIsInitialized(true, $compilationContext); - case 'null': - $codePrinter->output($parameter['name'].' = 0;'); - break; + /** + * Initialize auxiliary parameter zvals to null + */ + $symbolParam->setMustInitNull(true); - case 'bool': - if ('true' === $parameter['default']['value']) { - $codePrinter->output($parameter['name'].' = 1;'); + /** + * Increase uses + */ + $symbolParam->increaseUses(); + } else { + if (isset($parameter['default'])) { + if (isset($parameter['data-type'])) { + if ('variable' === $parameter['data-type']) { + $symbol->setMustInitNull(true); + } } else { - $codePrinter->output($parameter['name'].' = 0;'); + $symbol->setMustInitNull(true); } - break; - - default: - throw new CompilerException('Default parameter value type: '.$parameter['default']['type'].' cannot be assigned to variable(bool)', $parameter); + } } - break; - - case 'string': - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/memory'); - - switch ($parameter['default']['type']) { - case 'static-constant-access': - /** - * Now I can write code for easy use on Expression because code in this method don't write with codePrinter ;(. - * - * TODO: Rewrite all to codePrinter - */ - $symbolVariable = $compilationContext->symbolTable->getVariableForWrite($parameter['name'], $compilationContext, $parameter['default']); - $expression = new Expression($parameter['default']); - $expression->setExpectReturn(true, $symbolVariable); - $compiledExpression = $expression->compile($compilationContext); - - if ('string' != $compiledExpression->getType()) { - throw new CompilerException('Default parameter value type: '.$compiledExpression->getType().' cannot be assigned to variable(string)', $parameter); - } - - $parameter['default']['type'] = $compiledExpression->getType(); - $parameter['default']['value'] = $compiledExpression->getCode(); - - $compilationContext->codePrinter = $oldCodePrinter; - - return $this->assignDefaultValue($parameter, $compilationContext); - case 'null': - $compilationContext->backend->initVar($paramVariable, $compilationContext); - $compilationContext->backend->assignString($paramVariable, null, $compilationContext); - break; - - case 'string': - $compilationContext->backend->initVar($paramVariable, $compilationContext); - $compilationContext->backend->assignString( - $paramVariable, - add_slashes($parameter['default']['value']), - $compilationContext - ); - break; - - default: - throw new CompilerException( - sprintf( - 'Default parameter value type: %s cannot be assigned to variable(string)', - $parameter['default']['type'] - ), - $parameter - ); - } - break; + /** + * Original node where the variable was declared + */ + $symbol->setOriginal($parameter); - case 'array': - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/memory'); - switch ($parameter['default']['type']) { - case 'null': - $compilationContext->backend->initVar($paramVariable, $compilationContext); - break; + /** + * Parameters are marked as 'external' + */ + $symbol->setIsExternal(true); - case 'empty-array': - case 'array': - $compilationContext->backend->initVar($paramVariable, $compilationContext); - $compilationContext->backend->initArray($paramVariable, $compilationContext, null); - break; + /** + * Assuming they're initialized + */ + $symbol->setIsInitialized(true, $compilationContext); - default: - throw new CompilerException('Default parameter value type: '.$parameter['default']['type'].' cannot be assigned to variable(array)', $parameter); + /** + * Variables with class/type must be objects across the execution + */ + if (isset($parameter['cast'])) { + $symbol->setDynamicTypes('object'); + $symbol->setClassTypes($compilationContext->getFullName($parameter['cast']['value'])); + } else { + if (isset($parameter['data-type'])) { + if ('variable' === $parameter['data-type']) { + $symbol->setDynamicTypes('undefined'); + } + } else { + $symbol->setDynamicTypes('undefined'); + } } - break; + } + } - case 'variable': - $symbolVariable = $compilationContext->symbolTable->getVariableForWrite($parameter['name'], $compilationContext, $parameter['default']); - switch ($parameter['default']['type']) { - case 'static-constant-access': - /** - * Now I can write code for easy use on Expression because code in this method don't write with codePrinter ;(. - * - * TODO: Rewrite all to codePrinter - */ - $expression = new Expression($parameter['default']); - $expression->setExpectReturn(true, $symbolVariable); - $compiledExpression = $expression->compile($compilationContext); + $compilationContext->backend->onPreCompile($this, $compilationContext); - $parameter['default']['type'] = $compiledExpression->getType(); - $parameter['default']['value'] = $compiledExpression->getCode(); + /** + * Compile the block of statements if any + */ + if (is_object($this->statements)) { + $compilationContext->staticContext = $this->hasModifier('static'); - $compilationContext->codePrinter = $oldCodePrinter; + /** + * Compile the statements block as a 'root' branch + */ + $this->statements->compile($compilationContext, false, Branch::TYPE_ROOT); + } - return $this->assignDefaultValue($parameter, $compilationContext); + /** + * Initialize variable default values. + */ + $initVarCode = $compilationContext->backend->initializeVariableDefaults( + $symbolTable->getVariables(), + $compilationContext + ); - case 'int': - case 'uint': - case 'long': - case 'ulong': - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->backend->initVar($symbolVariable, $compilationContext); - $compilationContext->backend->assignLong($symbolVariable, $parameter['default']['value'], $compilationContext); - break; + /** + * Fetch parameters from vm-top. + */ + $initCode = ''; + $code = ''; + $requiredParams = []; + $optionalParams = []; + if ($this->parameters instanceof Parameters) { + /** + * Round 2. Fetch the parameters in the method. + */ + $params = $this->parameters->fetchParameters($this->isInternal); + $numberRequiredParams = $this->parameters->countRequiredParameters(); + $numberOptionalParams = $this->parameters->countOptionalParameters(); + $requiredParams = $this->parameters->getRequiredParameters(); + $optionalParams = $this->parameters->getOptionalParameters(); - case 'double': - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->backend->initVar($symbolVariable, $compilationContext); - $compilationContext->backend->assignDouble($symbolVariable, $parameter['default']['value'], $compilationContext); - break; + /** + * Pass the write detector to the method statement block to check if the parameter + * variable is modified so as do the proper separation. + */ + $parametersToSeparate = []; + if (is_object($this->statements)) { + if (!$this->localContext instanceof LocalContextPass) { + $writeDetector = new WriteDetector(); + } - case 'string': - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->backend->initVar($symbolVariable, $compilationContext); - $compilationContext->backend->assignString( - $paramVariable, - add_slashes($parameter['default']['value']), - $compilationContext - ); - break; + foreach ($this->parameters->getParameters() as $parameter) { + $dataType = $parameter['data-type'] ?? 'variable'; - case 'bool': - $expectedMutations = $compilationContext->symbolTable->getExpectedMutations($parameter['name']); - if ($expectedMutations < 2) { - if ('true' == $parameter['default']['value']) { - $compilationContext->backend->assignZval($paramVariable, $compilationContext->backend->resolveValue('true', $compilationContext), $compilationContext); - } else { - $compilationContext->backend->assignZval($paramVariable, $compilationContext->backend->resolveValue('false', $compilationContext), $compilationContext); - } - } else { - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/memory'); - if ('true' == $parameter['default']['value']) { - $compilationContext->backend->copyOnWrite($paramVariable, $compilationContext->backend->resolveValue('true', $compilationContext), $compilationContext); + switch ($dataType) { + case 'variable': + case 'string': + case 'array': + case 'resource': + case 'object': + case 'callable': + $name = $parameter['name']; + if (!$this->localContext instanceof LocalContextPass) { + if ($writeDetector->detect($name, $this->statements->getStatements())) { + $parametersToSeparate[$name] = true; + } } else { - $compilationContext->backend->copyOnWrite($paramVariable, $compilationContext->backend->resolveValue('false', $compilationContext), $compilationContext); + if ($this->localContext->getNumberOfMutations($name) > 1) { + $parametersToSeparate[$name] = true; + } } - } - break; - - case 'null': - $expectedMutations = $compilationContext->symbolTable->getExpectedMutations($parameter['name']); - if ($expectedMutations < 2) { - $compilationContext->backend->assignZval($symbolVariable, $compilationContext->backend->resolveValue('null', $compilationContext), $compilationContext); - } else { - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->backend->copyOnWrite($paramVariable, $compilationContext->backend->resolveValue('null', $compilationContext), $compilationContext); - } - break; - - case 'empty-array': - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->backend->initVar($symbolVariable, $compilationContext); - $compilationContext->backend->initArray($symbolVariable, $compilationContext, null); - break; - - default: - throw new CompilerException('Default parameter value type: '.$parameter['default']['type'].' cannot be assigned to variable(variable)', $parameter); + break; + } } - break; - - default: - throw new CompilerException('Default parameter type: '.$dataType, $parameter); - } - - $compilationContext->codePrinter = $oldCodePrinter; + } - return $codePrinter->getOutput(); - } + /** + * Initialize required parameters + */ + foreach ($requiredParams as $parameter) { + $mandatory = $parameter['mandatory'] ?? 0; + $dataType = $this->getParamDataType($parameter); - /** - * Assigns a zval value to a static low-level type. - * - * TODO: rewrite this to build ifs and throw from builders - * - * @param array $parameter - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * - * @return string - */ - public function checkStrictType(array $parameter, CompilationContext $compilationContext): string - { - $dataType = $this->getParamDataType($parameter); + if ('variable' !== $dataType) { + /** + * Assign value from zval to low level type + */ + if ($mandatory) { + $initCode .= $this->checkStrictType($parameter, $compilationContext); + } else { + $initCode .= $this->assignZvalValue($parameter, $compilationContext); + } + } - $compilationContext->headersManager->add('ext/spl/spl_exceptions'); - $compilationContext->headersManager->add('kernel/exception'); + switch ($dataType) { + case 'variable': + case 'resource': + case 'object': + case 'callable': + if (isset($parametersToSeparate[$parameter['name']])) { + $symbolTable->mustGrownStack(true); + $initCode .= "\t" . 'ZEPHIR_SEPARATE_PARAM(' . $parameter['name'] . ');' . PHP_EOL; + } + break; + } + } - $codePrinter = new CodePrinter(); - $codePrinter->increaseLevel(); - $oldCodePrinter = $compilationContext->codePrinter; - $compilationContext->codePrinter = $codePrinter; - $compilationContext->backend->checkStrictType($dataType, $parameter, $compilationContext); + /** + * Initialize optional parameters + */ + foreach ($optionalParams as $parameter) { + $mandatory = $parameter['mandatory'] ?? 0; + $dataType = $this->getParamDataType($parameter); - $compilationContext->codePrinter = $oldCodePrinter; + $name = match ($dataType) { + 'object', + 'callable', + 'resource', + 'variable', + 'mixed' => $parameter['name'], + default => $parameter['name'] . '_param', + }; - return $codePrinter->getOutput(); - } + /** + * Assign the default value according to the variable's type. + */ + $targetVar = $compilationContext->symbolTable->getVariableForWrite($name, $compilationContext); + $initCode .= "\t" . $compilationContext->backend->ifVariableValueUndefined( + $targetVar, + $compilationContext, + false, + false + ) . PHP_EOL; + + if ($targetVar->isDoublePointer() && isset($substituteVars[$parameter['name']])) { + $substituteVar = $substituteVars[$parameter['name']]; + $initCode .= "\t\t" + . $targetVar->getName() + . ' = &' + . $substituteVar->getName() + . ';' + . PHP_EOL; + } + $initCode .= $this->assignDefaultValue($parameter, $compilationContext); - /** - * Assigns a zval value to a static low-level type. - * - * @param array $parameter - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * - * @return string - */ - public function assignZvalValue(array $parameter, CompilationContext $compilationContext): string - { - $dataType = $this->getParamDataType($parameter); + if (isset($parametersToSeparate[$name]) || 'variable' !== $dataType) { + $initCode .= "\t" . '} else {' . PHP_EOL; - if (in_array($dataType, ['variable', 'callable', 'object', 'resource', 'mixed'])) { - return ''; - } + if (isset($parametersToSeparate[$name])) { + $initCode .= "\t\t" . 'ZEPHIR_SEPARATE_PARAM(' . $name . ');' . PHP_EOL; + } else { + if ($mandatory) { + $initCode .= $this->checkStrictType($parameter, $compilationContext); + } else { + $initCode .= "\t" . $this->assignZvalValue($parameter, $compilationContext); + } + } + } - $compilationContext->headersManager->add('kernel/operators'); - $parameterVariable = $compilationContext->symbolTable->getVariableForWrite($parameter['name'].'_param', $compilationContext); - $parameterCode = $compilationContext->backend->getVariableCode($parameterVariable); - $inputParamVar = $compilationContext->symbolTable->getVariableForWrite($parameter['name'], $compilationContext); - $inputParamCode = $compilationContext->backend->getVariableCode($inputParamVar); + $initCode .= "\t" . '}' . PHP_EOL; + } - switch ($dataType) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - return "\t".$parameter['name'].' = zephir_get_intval('.$parameterCode.');'.PHP_EOL; + /** + * Fetch the parameters to zval pointers + */ + $codePrinter->preOutputBlankLine(); - case 'char': - return "\t".$parameter['name'].' = zephir_get_charval('.$parameterCode.');'.PHP_EOL; + if (!$this->isInternal()) { + $compilationContext->headersManager->add('kernel/memory'); + if ($symbolTable->getMustGrownStack()) { + $code .= "\t" + . 'zephir_fetch_params(1, ' + . $numberRequiredParams + . ', ' + . $numberOptionalParams + . ', ' + . implode(', ', $params) + . ');' + . PHP_EOL; + } else { + $code .= "\t" + . 'zephir_fetch_params_without_memory_grow(' + . $numberRequiredParams + . ', ' + . $numberOptionalParams + . ', ' + . implode(', ', $params) + . ');' + . PHP_EOL; + } + } else { + foreach ($params as $param) { + /* TODO: Migrate all this code to codeprinter, get rid of temp code printer */ + $tempCodePrinter = new Printer(); + $realCodePrinter = $compilationContext->codePrinter; + $compilationContext->codePrinter = $tempCodePrinter; + $paramVar = $compilationContext->symbolTable->getVariableForRead( + $param, + $compilationContext + ); + $compilationContext->backend->assignZval($paramVar, $param . '_ext', $compilationContext); + $code .= "\t" . $tempCodePrinter->getOutput() . PHP_EOL; + $compilationContext->codePrinter = $realCodePrinter; + } + } + } - case 'bool': - return "\t".$parameter['name'].' = zephir_get_boolval('.$parameterCode.');'.PHP_EOL; + $code .= $initCode . $initVarCode; + $codePrinter->preOutput($code); - case 'double': - return "\t".$parameter['name'].' = zephir_get_doubleval('.$parameterCode.');'.PHP_EOL; + $compilationContext->headersManager->add('kernel/object'); - case 'string': - $compilationContext->symbolTable->mustGrownStack(true); + /** + * Fetch used superglobals + */ + foreach ($symbolTable->getVariables() as $name => $variable) { + if ($variable->isSuperGlobal()) { + $globalVar = $symbolTable->getVariable($name); + $codePrinter->preOutput( + "\t" . $compilationContext->backend->fetchGlobal($globalVar, $compilationContext, false) + ); + } - return "\t".'zephir_get_strval('.$inputParamCode.', '.$parameterCode.');'.PHP_EOL; + if ($variable->isLocalStatic()) { + $staticVar = $symbolTable->getVariable($name); - case 'array': - $compilationContext->symbolTable->mustGrownStack(true); + $codePrinter->preOutput( + sprintf( + "\t" . 'zephir_read_static_property_ce(&%s, %s, SL("%s"), PH_NOISY_CC%s);', + $staticVar->getName(), + $this->classDefinition->getClassEntry(), + $staticVar->getName(), + '' + ) + ); + } + } - return "\t".'zephir_get_arrval('.$inputParamCode.', '.$parameterCode.');'.PHP_EOL; + /** + * Grow the stack if needed + */ + if ($symbolTable->getMustGrownStack()) { + $compilationContext->headersManager->add('kernel/memory'); + if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_METHOD_GLOBALS_PTR')) { + $methodGlobals = new Variable('zephir_method_globals', 'ZEPHIR_METHOD_GLOBALS_PTR', $compilationContext->branchManager->getCurrentBranch()); + $methodGlobals->setMustInitNull(true); + $methodGlobals->increaseUses(); + $methodGlobals->setReusable(false); + $methodGlobals->setReadOnly(true); + $methodGlobals->setUsed(true); + $compilationContext->symbolTable->addRawVariable($methodGlobals); + } - default: - throw new CompilerException('Parameter type: '.$dataType, $parameter); + // #define ZEPHIR_MM_GROW() + $codePrinter->preOutput("\t" . 'zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__);'); + $codePrinter->preOutput("\t" . 'ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0);'); } - } - /** - * Pre-compiles the method making compilation pass data (static inference, local-context-pass) available to other methods. - * - * @param CompilationContext $compilationContext - * - * @throws CompilerException - */ - public function preCompile(CompilationContext $compilationContext): void - { - $localContext = null; - $typeInference = null; - $callGathererPass = null; + /** + * Check if there are unused variables. + */ + $usedVariables = []; + $completeName = $this->getClassDefinition()?->getCompleteName() ?: '[unknown]'; + $thisUnused = false; - if (\is_object($this->statements)) { - $compilationContext->currentMethod = $this; + foreach ($symbolTable->getVariables() as $variable) { + if ($variable->getNumberUses() <= 0) { + if (!$variable->isExternal()) { + $compilationContext->logger->warning( + 'Variable "' + . $variable->getName() + . '" declared but not used in ' + . $completeName + . '::' + . $this->getName(), + ['unused-variable', $variable->getOriginal()] + ); + continue; + } - /** - * This pass checks for zval variables than can be potentially - * used without allocating memory and track it - * these variables are stored in the stack - */ - if ($compilationContext->config->get('local-context-pass', 'optimizations')) { - $localContext = new LocalContextPass(); - $localContext->pass($this->statements); + $compilationContext->logger->warning( + 'Variable "' + . $variable->getName() + . '" declared but not used in ' + . $completeName + . '::' + . $this->getName(), + ['unused-variable-external', $variable->getOriginal()] + ); } - /** - * This pass tries to infer types for dynamic variables - * replacing them by low level variables - */ - if ($compilationContext->config->get('static-type-inference', 'optimizations')) { - $typeInference = new StaticTypeInference(); - $typeInference->pass($this->statements); - if ($compilationContext->config->get('static-type-inference-second-pass', 'optimizations')) { - $typeInference->reduce(); - $typeInference->pass($this->statements); + if ( + 'this_ptr' !== $variable->getName() && + 'return_value' !== $variable->getName() && + 'return_value_ptr' !== $variable->getName() + ) { + $type = $variable->getType(); + if (!isset($usedVariables[$type])) { + $usedVariables[$type] = []; } + + $usedVariables[$type][] = $variable; } - /** - * This pass counts how many times a specific - */ - if ($compilationContext->config->get('call-gatherer-pass', 'optimizations')) { - $callGathererPass = new CallGathererPass($compilationContext); - $callGathererPass->pass($this->statements); + if ('this_ptr' === $variable->getName() && !$variable->isUsed()) { + $thisUnused = true; } } - $this->localContext = $localContext; - $this->typeInference = $typeInference; - $this->callGathererPass = $callGathererPass; - } - - /** - * Compiles the method. - * - * @param CompilationContext $compilationContext - * - * @throws Exception - */ - public function compile(CompilationContext $compilationContext): void - { /** - * Set the method currently being compiled + * Check if there are assigned but not used variables + * Warn whenever a variable is unused aside from its declaration. */ - $compilationContext->currentMethod = $this; + foreach ($symbolTable->getVariables() as $variable) { + if ($variable->isExternal() || $variable->isTemporal()) { + continue; + } - /** - * Initialize the method warm-up to null - */ - $compilationContext->methodWarmUp = null; + if ( + 'this_ptr' === $variable->getName() || + 'return_value' === $variable->getName() || + 'return_value_ptr' === $variable->getName() || + 'ZEPHIR_LAST_CALL_STATUS' === $variable->getName() + ) { + continue; + } - /** - * Assign pre-made compilation passes. - */ - $typeInference = $this->typeInference; - $callGathererPass = $this->callGathererPass; + if (!$variable->isUsed()) { + $node = $variable->getLastUsedNode(); + if (is_array($node)) { + $expression = $node['expr'] ?? $node; + $compilationContext->logger->warning( + 'Variable "' + . $variable->getName() + . '" assigned but not used in ' + . $completeName + . '::' + . $this->getName(), + ['unused-variable', $expression] + ); + } else { + $compilationContext->logger->warning( + 'Variable "' + . $variable->getName() + . '" assigned but not used in ' + . $completeName + . '::' + . $this->getName(), + ['unused-variable', $variable->getOriginal()] + ); + } + } + } + + if (count($usedVariables)) { + $codePrinter->preOutputBlankLine(); + } /** - * Initialization of parameters happens in a fictitious external branch. + * ZEND_PARSE_PARAMETERS */ - $branch = new Branch(); - $branch->setType(Branch::TYPE_EXTERNAL); + $tempCodePrinter = new Printer(); + if ($this->parameters instanceof Parameters && $this->parameters->count() > 0) { + // Do not declare variable when it is not needed. + if ($this->parameters->hasNullableParameters()) { + $tempCodePrinter->output("\t" . 'bool is_null_true = 1;'); + } + + $tempCodePrinter->output( + sprintf( + "\t" . 'ZEND_PARSE_PARAMETERS_START(%d, %d)', + $this->parameters->countRequiredParameters(), + $this->parameters->count() + ) + ); + + foreach ($requiredParams as $requiredParam) { + $tempCodePrinter->output("\t\t" . $this->detectParam($requiredParam, $compilationContext)); + } + + if (!empty($optionalParams)) { + $tempCodePrinter->output("\t\t" . 'Z_PARAM_OPTIONAL'); + + foreach ($optionalParams as $optionalParam) { + $tempCodePrinter->output("\t\t" . $this->detectParam($optionalParam, $compilationContext)); + } + } + + $tempCodePrinter->output("\t" . 'ZEND_PARSE_PARAMETERS_END();'); + } + + $codePrinter->preOutput($tempCodePrinter->getOutput()); /** - * BranchManager helps to create graphs of conditional/loop/root/jump branches. + * Generate the variable definition for variables used. */ - $branchManager = new BranchManager(); - $branchManager->addBranch($branch); + $initCode = sprintf( + "\t%s", + implode( + PHP_EOL . "\t", + $compilationContext->backend->declareVariables( + $this, + $usedVariables + ) + ) + ); - $compilationContext->branchManager = $branchManager; + $codePrinter->preOutput($initCode); /** - * Every method has its own symbol table. + * Finalize the method compilation */ - $symbolTable = new SymbolTable($compilationContext); - if ($this->localContext instanceof LocalContextPass) { - $symbolTable->setLocalContext($this->localContext); - } + if (is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { + /** + * If the last statement is not a 'return' or 'throw' we need to + * restore the memory stack if needed. + */ + $lastType = $this->statements->getLastStatementType(); + + if ( + 'return' !== $lastType && + 'throw' !== $lastType && + !$this->hasChildReturnStatementType($statement) + ) { + if ($symbolTable->getMustGrownStack()) { + $compilationContext->headersManager->add('kernel/memory'); + $codePrinter->output("\t" . 'ZEPHIR_MM_RESTORE();'); + } - if ($this->staticVariables !== null) { - foreach ($this->staticVariables as $var) { - $localVar = clone $var; - $localVar->setIsExternal(true); - $localVar->setLocalOnly(true); - $localVar->setDynamicTypes($localVar->getType()); - $localVar->setType('variable'); - $localVar->setIsDoublePointer(false); - $symbolTable->addRawVariable($localVar); + /** + * If a method has return-type hints we need to ensure the last + * statement is a 'return' statement + */ + if ($this->hasReturnTypes()) { + throw new CompilerException( + 'Reached end of the method without returning a valid type specified in the return-type hints', + $this->expression['return-type'] + ); + } } } + $compilationContext->backend->onPostCompile($this, $compilationContext); + /** - * Parameters has an additional extra mutation. + * Remove macros that grow/restore the memory frame stack if it wasn't used. */ - if ($this->localContext instanceof LocalContextPass && $this->parameters instanceof ClassMethodParameters) { - foreach ($this->parameters->getParameters() as $parameter) { - $this->localContext->increaseMutations($parameter['name']); - } - } + $code = $this->removeMemoryStackReferences($symbolTable, $codePrinter->getOutput()); /** - * Cache Manager manages function calls, method calls and class entries caches. + * Remove unused this_ptr variable. */ - $cacheManager = new CacheManager(); - $cacheManager->setGatherer($callGathererPass); - - $compilationContext->cacheManager = $cacheManager; - $compilationContext->typeInference = $typeInference; - $compilationContext->symbolTable = $symbolTable; + if ($thisUnused) { + $code = str_replace("\t" . 'zval *this_ptr = getThis();' . PHP_EOL, '', $code); + } - $oldCodePrinter = $compilationContext->codePrinter; + $code = preg_replace("/(\R){3,}/", "$1", $code); /** - * Change the code printer to a single method instance. + * Restore the compilation context */ - $codePrinter = new CodePrinter(); - $compilationContext->codePrinter = $codePrinter; + $oldCodePrinter->output($code, false); + $compilationContext->codePrinter = $oldCodePrinter; - /** - * Set an empty function cache - */ - $compilationContext->functionCache = null; + $compilationContext->branchManager = null; + $compilationContext->cacheManager = null; + $compilationContext->typeInference = null; + + $codePrinter->clear(); + } + + /** + * Determine Z_PARAM_* + * + * @throws Exception + */ + public function detectParam(array $parameter, CompilationContext $compilationContext): string + { + $name = $parameter['name']; + if (!isset($parameter['data-type'])) { + return sprintf('Z_PARAM_ZVAL(%s)', $name); + } /** - * Reset try/catch and loop counter + * In case of unknown type, just return generic param type. */ - $compilationContext->insideCycle = 0; - $compilationContext->insideTryCatch = 0; - $compilationContext->currentTryCatch = 0; - - if ($this->parameters instanceof ClassMethodParameters) { - /** - * Round 1. Create variables in parameters in the symbol table. - */ - $classCastChecks = []; - $substituteVars = []; - foreach ($this->parameters->getParameters() as $parameter) { - $symbolParam = null; + $hasDefaultNull = isset($parameter['default']['type']) && $parameter['default']['type'] === 'null'; + if ($hasDefaultNull) { + $param = sprintf('Z_PARAM_ZVAL_OR_NULL(%s)', $name); + } else { + $param = sprintf('Z_PARAM_ZVAL(%s)', $name); + } - if (isset($parameter['data-type'])) { - switch ($parameter['data-type']) { - case 'object': - case 'callable': - case 'resource': - case 'variable': - case 'mixed': - $symbol = $symbolTable->addVariable($parameter['data-type'], $parameter['name'], $compilationContext); - /* TODO: Move this to the respective backend, which requires refactoring how this works */ - if ($compilationContext->backend->isZE3()) { - $symbol->setIsDoublePointer(true); - $substituteVars[$parameter['name']] = $symbolTable->addVariable('variable', $parameter['name'].'_sub', $compilationContext); - } - break; + switch ($parameter['data-type']) { + case 'array': + if ($hasDefaultNull) { + $param = sprintf('Z_PARAM_ARRAY_OR_NULL(%s)', $name); + } else { + $param = sprintf('Z_PARAM_ARRAY(%s)', $name); + } - default: - $symbol = $symbolTable->addVariable($parameter['data-type'], $parameter['name'], $compilationContext); - $symbolParam = $symbolTable->addVariable('variable', $parameter['name'].'_param', $compilationContext); - /* TODO: Move this to the respective backend, which requires refactoring how this works */ - if ($compilationContext->backend->isZE3()) { - $symbolParam->setIsDoublePointer(true); - } + break; - if ('string' == $parameter['data-type'] || 'array' == $parameter['data-type']) { - $symbol->setMustInitNull(true); - } - break; - } + case 'bool': + if ($hasDefaultNull) { + $param = sprintf('Z_PARAM_BOOL_OR_NULL(%s, is_null_true)', $name); } else { - $symbol = $symbolTable->addVariable('variable', $parameter['name'], $compilationContext); + $param = sprintf('Z_PARAM_BOOL(%s)', $name); } - /** - * ZE3 only - */ - if (isset($substituteVars[$parameter['name']])) { - $substituteVar = $substituteVars[$parameter['name']]; - $substituteVar->increaseUses(); - } + break; - /** - * Some parameters can be read-only - */ - if (!empty($parameter['const'])) { - $symbol->setReadOnly(true); - if (\is_object($symbolParam)) { - $symbolParam->setReadOnly(true); - } + case 'float': + if ($hasDefaultNull) { + $param = sprintf('Z_PARAM_DOUBLE_OR_NULL(%s, is_null_true)', $name); + } else { + $param = sprintf('Z_PARAM_DOUBLE(%s)', $name); } - if (\is_object($symbolParam)) { - /** - * Parameters are marked as 'external' - */ - $symbolParam->setIsExternal(true); + break; - /** - * Assuming they're initialized - */ - $symbolParam->setIsInitialized(true, $compilationContext); + case 'int': + case 'uint': + case 'long': + if ($hasDefaultNull) { + $param = sprintf('Z_PARAM_LONG_OR_NULL(%s, is_null_true)', $name); + } else { + $param = sprintf('Z_PARAM_LONG(%s)', $name); + } - /** - * Initialize auxiliary parameter zvals to null - */ - $symbolParam->setMustInitNull(true); + break; - /** - * Increase uses - */ - $symbolParam->increaseUses(); + case 'object': + if ($hasDefaultNull) { + $param = sprintf('Z_PARAM_OBJECT_OF_CLASS_OR_NULL(%s)', $name); } else { - if (isset($parameter['default'])) { - if (isset($parameter['data-type'])) { - if ('variable' === $parameter['data-type']) { - $symbol->setMustInitNull(true); - } - } else { - $symbol->setMustInitNull(true); - } - } + $param = sprintf('Z_PARAM_OBJECT(%s)', $name); } - /** - * Original node where the variable was declared - */ - $symbol->setOriginal($parameter); + break; - /** - * Parameters are marked as 'external' - */ - $symbol->setIsExternal(true); + case 'resource': + if ($hasDefaultNull) { + $param = sprintf('Z_PARAM_RESOURCE_OR_NULL(%s)', $name); + } else { + $param = sprintf('Z_PARAM_RESOURCE(%s)', $name); + } - /** - * Assuming they're initialized - */ - $symbol->setIsInitialized(true, $compilationContext); + break; - /** - * Variables with class/type must be objects across the execution - */ - if (isset($parameter['cast'])) { - $symbol->setDynamicTypes('object'); - $symbol->setClassTypes($compilationContext->getFullName($parameter['cast']['value'])); - $classCastChecks[] = [$symbol, $parameter]; + case 'string': + if ($hasDefaultNull) { + $param = sprintf('Z_PARAM_STR_OR_NULL(%s)', $name); } else { - if (isset($parameter['data-type'])) { - if ('variable' === $parameter['data-type']) { - $symbol->setDynamicTypes('undefined'); - } + $param = sprintf('Z_PARAM_STR(%s)', $name); + } + + break; + + case 'variable': + if ( + isset($parameter['cast']) && + $parameter['cast']['type'] === 'variable' && + $parameter['cast']['value'] && + $this->classDefinition !== null + ) { + $classEntry = (new ClassEntry($parameter['cast']['value'], $compilationContext))->get(); + if ($hasDefaultNull) { + $param = sprintf('Z_PARAM_OBJECT_OF_CLASS_OR_NULL(%s, %s)', $name, $classEntry); } else { - $symbol->setDynamicTypes('undefined'); + $param = sprintf('Z_PARAM_OBJECT_OF_CLASS(%s, %s)', $name, $classEntry); } } + + break; + } + + return $param; + } + + /** + * Returns arginfo name for current method. + */ + public function getArgInfoName(Definition $classDefinition = null): string + { + if ($classDefinition instanceof Definition) { + return sprintf( + 'arginfo_%s_%s_%s', + strtolower($classDefinition->getCNamespace()), + strtolower($classDefinition->getName()), + strtolower($this->getName()) + ); + } + + return sprintf('arginfo_%s', strtolower($this->getInternalName())); + } + + /** + * Returns the call gatherer pass information. + */ + public function getCallGathererPass(): CallGathererPass + { + return $this->callGathererPass; + } + + /** + * Returns the class definition where the method was declared. + */ + public function getClassDefinition(): ?Definition + { + return $this->classDefinition; + } + + /** + * Returns the raw docblock. + */ + public function getDocBlock(): ?string + { + return $this->docblock; + } + + public function getInternalName(): string + { + $classDefinition = $this->getClassDefinition(); + + return 'zep_' . $classDefinition->getCNamespace() . '_' . $classDefinition->getName() . '_' . $this->getName(); + } + + /** + * the starting line of the method in the source file. + */ + public function getLine(): mixed + { + return $this->expression['line']; + } + + public function getMayBeArgTypes(): array + { + return $this->mayBeArgTypes; + } + + /** + * Returns the C-modifier flags. + * + * @throws Exception + */ + public function getModifiers(): string + { + $modifiers = []; + foreach ($this->visibility as $visibility) { + switch ($visibility) { + case 'public': + $modifiers['ZEND_ACC_PUBLIC'] = $visibility; + break; + + case 'protected': + $modifiers['ZEND_ACC_PROTECTED'] = $visibility; + break; + + case 'private': + $modifiers['ZEND_ACC_PRIVATE'] = $visibility; + break; + + case 'static': + $modifiers['ZEND_ACC_STATIC'] = $visibility; + break; + + case 'final': + $modifiers['ZEND_ACC_FINAL'] = $visibility; + break; + + case 'abstract': + $modifiers['ZEND_ACC_ABSTRACT'] = $visibility; + break; + + case 'deprecated': + $modifiers['ZEND_ACC_DEPRECATED'] = $visibility; + break; + + case 'inline': + case 'scoped': + case 'internal': + break; + + default: + throw new Exception('Unknown modifier "' . $visibility . '"'); } } - $compilationContext->backend->onPreCompile($this, $compilationContext); + if ('__construct' === $this->name) { + $modifiers['ZEND_ACC_CTOR'] = true; + } elseif ('__destruct' === $this->name) { + $modifiers['ZEND_ACC_DTOR'] = true; + } - /** - * Compile the block of statements if any - */ - if (\is_object($this->statements)) { - $compilationContext->staticContext = $this->hasModifier('static'); + return implode('|', array_keys($modifiers)); + } - /** - * Compile the statements block as a 'root' branch - */ - $this->statements->compile($compilationContext, false, Branch::TYPE_ROOT); + /** + * Returns the method name. + */ + public function getName(): string + { + return $this->name; + } + + /** + * Returns the number of parameters the method has. + */ + public function getNumberOfParameters(): int + { + if ($this->parameters instanceof Parameters) { + return $this->parameters->count(); } - /** - * Initialize variable default values. - */ - $initVarCode = $compilationContext->backend->initializeVariableDefaults( - $symbolTable->getVariables(), - $compilationContext - ); + return 0; + } - /** - * Fetch parameters from vm-top. - */ - $initCode = ''; - $code = ''; - $requiredParams = []; - $optionalParams = []; - if ($this->parameters instanceof ClassMethodParameters) { - /** - * Round 2. Fetch the parameters in the method. - */ - $params = $this->parameters->fetchParameters($this->isInternal); - $numberRequiredParams = $this->parameters->countRequiredParameters(); - $numberOptionalParams = $this->parameters->countOptionalParameters(); - $requiredParams = $this->parameters->getRequiredParameters(); - $optionalParams = $this->parameters->getOptionalParameters(); + /** + * Returns the number of required parameters the method has. + */ + public function getNumberOfRequiredParameters(): int + { + if ($this->parameters === null) { + return 0; + } - /** - * Pass the write detector to the method statement block to check if the parameter - * variable is modified so as do the proper separation. - */ - $parametersToSeparate = []; - if (\is_object($this->statements)) { - if (!$this->localContext instanceof LocalContextPass) { - $writeDetector = new WriteDetector(); - } + $required = 0; + foreach ($this->parameters->getParameters() as $parameter) { + if (!isset($parameter['default'])) { + ++$required; + } + } - foreach ($this->parameters->getParameters() as $parameter) { - $dataType = $parameter['data-type'] ?? 'variable'; + return $required; + } - switch ($dataType) { - case 'variable': - case 'string': - case 'array': - case 'resource': - case 'object': - case 'callable': - $name = $parameter['name']; - if (!$this->localContext instanceof LocalContextPass) { - if ($writeDetector->detect($name, $this->statements->getStatements())) { - $parametersToSeparate[$name] = true; - } - } else { - if ($this->localContext->getNumberOfMutations($name) > 1) { - $parametersToSeparate[$name] = true; - } - } - break; - } - } - } + public function getOptimizedMethod(): self + { + $optimizedName = $this->getName() . '_zephir_internal_call'; + $optimizedMethod = $this->classDefinition->getMethod($optimizedName, false); + if (!$optimizedMethod || !$this->optimizable) { + return $this; + } - /** - * Initialize required parameters - */ - foreach ($requiredParams as $parameter) { - $mandatory = $parameter['mandatory'] ?? 0; - $dataType = $this->getParamDataType($parameter); + return $optimizedMethod; + } - if ('variable' !== $dataType) { - /** - * Assign value from zval to low level type - */ - if ($mandatory) { - $initCode .= $this->checkStrictType($parameter, $compilationContext); - } else { - $initCode .= $this->assignZvalValue($parameter, $compilationContext); - } - } + /** + * Returns the parameters. + */ + public function getParameters(): ?Parameters + { + return $this->parameters; + } - switch ($dataType) { - case 'variable': - case 'resource': - case 'object': - case 'callable': - if (isset($parametersToSeparate[$parameter['name']])) { - $symbolTable->mustGrownStack(true); - $initCode .= "\t".'ZEPHIR_SEPARATE_PARAM('.$parameter['name'].');'.PHP_EOL; - } - break; - } - } + /** + * Returns the parsed docblock. + */ + public function getParsedDocBlock(): ?Docblock + { + if ($this->parsedDocblock) { + return $this->parsedDocblock; + } - /** - * Initialize optional parameters - */ - foreach ($optionalParams as $parameter) { - $mandatory = $parameter['mandatory'] ?? 0; - $dataType = $this->getParamDataType($parameter); + if ($this->docblock === null) { + return null; + } - switch ($dataType) { - case 'object': - case 'callable': - case 'resource': - case 'variable': - case 'mixed': - $name = $parameter['name']; - break; + $parser = new DocblockParser('/' . $this->docblock . '/'); + $this->parsedDocblock = $parser->parse(); - default: - $name = $parameter['name'].'_param'; - break; - } + return $this->parsedDocblock; + } - /** - * Assign the default value according to the variable's type. - */ - $targetVar = $compilationContext->symbolTable->getVariableForWrite($name, $compilationContext); - $initCode .= "\t".$compilationContext->backend->ifVariableValueUndefined($targetVar, $compilationContext, false, false).PHP_EOL; + /** + * Returned class-type hints by the method. + */ + public function getReturnClassTypes(): array + { + return $this->returnClassTypes; + } - if ($compilationContext->backend->isZE3()) { - if ($targetVar->isDoublePointer() && isset($substituteVars[$parameter['name']])) { - $substituteVar = $substituteVars[$parameter['name']]; - $initCode .= "\t\t".$targetVar->getName().' = &'.$substituteVar->getName().';'.PHP_EOL; - } - } - $initCode .= $this->assignDefaultValue($parameter, $compilationContext); + /** + * Returned type hints by the method. + */ + public function getReturnTypes(): array + { + return $this->returnTypes; + } - if (isset($parametersToSeparate[$name]) || 'variable' !== $dataType) { - $initCode .= "\t".'} else {'.PHP_EOL; + public function getReturnTypesRaw(): array + { + return $this->returnTypesRaw; + } - if (isset($parametersToSeparate[$name])) { - $initCode .= "\t\t".'ZEPHIR_SEPARATE_PARAM('.$name.');'.PHP_EOL; - } else { - if ($mandatory) { - $initCode .= $this->checkStrictType($parameter, $compilationContext, $mandatory); - } else { - $initCode .= "\t".$this->assignZvalValue($parameter, $compilationContext); - } - } - } + /** + * Return shortcut method name. + */ + public function getShortcutName(): mixed + { + return $this->expression['name']; + } - $initCode .= "\t".'}'.PHP_EOL; - } + /** + * Getter for statements block. + */ + public function getStatementsBlock(): StatementsBlock + { + return $this->statements; + } - /** - * Fetch the parameters to zval pointers - */ - $codePrinter->preOutputBlankLine(); + /** + * Returns method visibility modifiers. + */ + public function getVisibility(): array + { + return $this->visibility; + } - if (!$this->isInternal()) { - $compilationContext->headersManager->add('kernel/memory'); - if ($symbolTable->getMustGrownStack()) { - $code .= "\t".'zephir_fetch_params(1, '.$numberRequiredParams.', '.$numberOptionalParams.', '.implode(', ', $params).');'.PHP_EOL; + /** + * Simple method to check if one of the paths are returning the right expected type. + */ + public function hasChildReturnStatementType(array $statement): bool + { + if (!isset($statement['statements']) || !is_array($statement['statements'])) { + return false; + } + + if ('if' === $statement['type']) { + $ret = false; + + $statements = $statement['statements']; + foreach ($statements as $item) { + $type = $item['type'] ?? null; + if ('return' === $type || 'throw' === $type) { + $ret = true; } else { - $code .= "\t".'zephir_fetch_params_without_memory_grow('.$numberRequiredParams.', '.$numberOptionalParams.', '.implode(', ', $params).');'.PHP_EOL; - } - } else { - foreach ($params as $param) { - /* TODO: Migrate all this code to codeprinter, get rid of temp code printer */ - $tempCodePrinter = new CodePrinter(); - $realCodePrinter = $compilationContext->codePrinter; - $compilationContext->codePrinter = $tempCodePrinter; - $paramVar = $compilationContext->symbolTable->getVariableForRead($param, $compilationContext); - $compilationContext->backend->assignZval($paramVar, $param.'_ext', $compilationContext); - $code .= "\t".$tempCodePrinter->getOutput().PHP_EOL; - $compilationContext->codePrinter = $realCodePrinter; + $ret = $this->hasChildReturnStatementType($item); } } - } - - $code .= $initCode.$initVarCode; - $codePrinter->preOutput($code); - - $compilationContext->headersManager->add('kernel/object'); - /** - * Fetch used superglobals - */ - foreach ($symbolTable->getVariables() as $name => $variable) { - if ($variable->isSuperGlobal()) { - $globalVar = $symbolTable->getVariable($name); - $codePrinter->preOutput("\t".$compilationContext->backend->fetchGlobal($globalVar, $compilationContext, false)); + if (!$ret || !isset($statement['else_statements'])) { + return false; } - if ($variable->isLocalStatic()) { - $staticVar = $symbolTable->getVariable($name); - - $codePrinter->preOutput(sprintf( - "\t".'zephir_read_static_property_ce(&%s, %s, SL("%s"), PH_NOISY_CC%s);', - $staticVar->getName(), - $this->classDefinition->getClassEntry(), - $staticVar->getName(), - '' - )); - } + $statements = $statement['else_statements']; + } else { + $statements = $statement['statements']; } - /** - * Grow the stack if needed - */ - if ($symbolTable->getMustGrownStack()) { - $compilationContext->headersManager->add('kernel/memory'); - if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_METHOD_GLOBALS_PTR')) { - $methodGlobals = new Variable('zephir_method_globals', 'ZEPHIR_METHOD_GLOBALS_PTR', $compilationContext->branchManager->getCurrentBranch()); - $methodGlobals->setMustInitNull(true); - $methodGlobals->increaseUses(); - $methodGlobals->setReusable(false); - $methodGlobals->setReadOnly(true); - $compilationContext->symbolTable->addRawVariable($methodGlobals); + foreach ($statements as $item) { + $type = $item['type'] ?? null; + if ('return' === $type || 'throw' === $type) { + return true; } - $codePrinter->preOutput("\t".'ZEPHIR_MM_GROW();'); - } - /** - * Check if there are unused variables. - */ - $usedVariables = []; - $classDefinition = $this->getClassDefinition(); - if ($classDefinition) { - $completeName = $classDefinition->getCompleteName(); - } else { - $completeName = '[unknown]'; + return $this->hasChildReturnStatementType($item); } - foreach ($symbolTable->getVariables() as $variable) { - if ($variable->getNumberUses() <= 0) { - if (false == $variable->isExternal()) { - $compilationContext->logger->warning( - 'Variable "'.$variable->getName().'" declared but not used in '.$completeName.'::'.$this->getName(), - ['unused-variable', $variable->getOriginal()] - ); - continue; - } + return false; + } - $compilationContext->logger->warning( - 'Variable "'.$variable->getName().'" declared but not used in '.$completeName.'::'.$this->getName(), - ['unused-variable-external', $variable->getOriginal()] - ); - } + /** + * Checks whether the method has a specific modifier. + */ + public function hasModifier(string $modifier): bool + { + return in_array($modifier, $this->visibility); + } - if ('this_ptr' !== $variable->getName() && 'return_value' !== $variable->getName() && 'return_value_ptr' !== $variable->getName()) { - $type = $variable->getType(); - if (!isset($usedVariables[$type])) { - $usedVariables[$type] = []; - } + /** + * Returns the number of parameters the method has. + */ + public function hasParameters(): bool + { + return $this->parameters instanceof Parameters && $this->parameters->count() > 0; + } - $usedVariables[$type][] = $variable; - } - } + /** + * Checks if the method has return-type or cast hints. + */ + public function hasReturnTypes(): bool + { + return count($this->returnTypes) || count($this->returnClassTypes); + } - /** - * Check if there are assigned but not used variables - * Warn whenever a variable is unused aside from its declaration. - */ - foreach ($symbolTable->getVariables() as $variable) { - if ($variable->isExternal() || $variable->isTemporal()) { - continue; - } + public function hasReturnTypesRaw(): bool + { + return !empty($this->returnTypesRaw); + } - if ('this_ptr' === $variable->getName() || 'return_value' === $variable->getName() || 'return_value_ptr' === $variable->getName() || 'ZEPHIR_LAST_CALL_STATUS' === $variable->getName()) { - continue; - } + /** + * Checks is abstract method? + */ + public function isAbstract(): bool + { + return $this->isAbstract; + } - if (!$variable->isUsed()) { - $node = $variable->getLastUsedNode(); - if (is_array($node)) { - $expression = $node['expr'] ?? $node; - $compilationContext->logger->warning( - 'Variable "'.$variable->getName().'" assigned but not used in '.$completeName.'::'.$this->getName(), - ['unused-variable', $expression] - ); - } else { - $compilationContext->logger->warning( - 'Variable "'.$variable->getName().'" assigned but not used in '.$completeName.'::'.$this->getName(), - ['unused-variable', $variable->getOriginal()] - ); - } - } - } + /** + * Checks whether the method is bundled. + */ + public function isBundled(): bool + { + return $this->isBundled; + } - if (count($usedVariables)) { - $codePrinter->preOutputBlankLine(); - } + /** + * Check whether the current method is a constructor. + */ + public function isConstructor(): bool + { + return '__construct' === $this->name; + } - /** - * ZEND_PARSE_PARAMETERS - */ - $tempCodePrinter = new CodePrinter(); - if ($this->parameters instanceof ClassMethodParameters && $this->parameters->count() > 0) { - $tempCodePrinter->output('#if PHP_VERSION_ID >= 80000'); - $tempCodePrinter->output("\t".'bool is_null_true = 1;'); + public function isDeprecated(): bool + { + return !empty($this->visibility) && in_array('deprecated', $this->visibility, true); + } - $tempCodePrinter->output(sprintf( - "\t".'ZEND_PARSE_PARAMETERS_START(%d, %d)', - $this->parameters->countRequiredParameters(), - $this->parameters->count() - )); + /** + * Checks whether the method is empty. + */ + public function isEmpty(): bool + { + return $this->statements->isEmpty(); + } - foreach ($requiredParams as $requiredParam) { - $tempCodePrinter->output("\t"."\t".$this->detectParam($requiredParam, $compilationContext)); - } + /** + * Checks whether the method is final. + */ + public function isFinal(): bool + { + return $this->isFinal; + } - if (!empty($optionalParams)) { - $tempCodePrinter->output("\t"."\t".'Z_PARAM_OPTIONAL'); + /** + * Checks whether the method is an initializer. + */ + public function isInitializer(): bool + { + return $this->isInitializer; + } - foreach ($optionalParams as $optionalParam) { - $tempCodePrinter->output("\t"."\t".$this->detectParam($optionalParam, $compilationContext)); - } - } + /** + * Checks whether the method is internal. + */ + public function isInternal(): bool + { + return $this->isInternal; + } - $tempCodePrinter->output("\t".'ZEND_PARSE_PARAMETERS_END();'); - $tempCodePrinter->output('#endif'); - } + /** + * Checks if the methods return type is `mixed`. + */ + public function isMixed(): bool + { + return $this->mixed; + } - $codePrinter->preOutput($tempCodePrinter->getOutput()); + /** + * Checks if the method is private. + */ + public function isPrivate(): bool + { + return in_array('private', $this->visibility); + } - /** - * Generate the variable definition for variables used. - */ - $initCode = sprintf( - "\t%s", - implode( - PHP_EOL."\t", - $compilationContext->backend->declareVariables( - $this, - $usedVariables, - $compilationContext - ) - ) - ); + /** + * Checks if the method is protected. + */ + public function isProtected(): bool + { + return in_array('protected', $this->visibility); + } + + /** + * Checks if the method is public. + */ + public function isPublic(): bool + { + return $this->isPublic; + } + + /** + * Checks if method's return type is nullable object `?object`. + */ + public function isReturnTypeNullableObject(): bool + { + return count($this->returnTypes) === 2 + && isset($this->returnTypes['object']) + && isset($this->returnTypes['null']); + } + + /** + * Checks if method's return type is object `object`. + */ + public function isReturnTypeObject(): bool + { + return count($this->returnTypes) === 1 && isset($this->returnTypes['object']); + } + + /** + * Is method have determined return type hint. + * + * This method is used to generate: + * + * - ZEND_BEGIN_ARG_INFO_EX + * - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX + * + * Examples: + * + * - TRUE: function foo() -> void; + * - TRUE: function foo() -> null; + * - TRUE: function foo() -> bool|string|...; + * - TRUE: function foo() -> <\stdClass>; + * - FALSE: function foo(); + * - FALSE: function foo() -> var; + * - FALSE: function foo() -> resource|callable; + */ + public function isReturnTypesHintDetermined(): bool + { + if ($this->isVoid()) { + return true; + } - $codePrinter->preOutput($initCode); + if (0 === count($this->returnTypes)) { + return false; + } - /** - * Finalize the method compilation - */ - if (\is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { - /** - * If the last statement is not a 'return' or 'throw' we need to - * restore the memory stack if needed. - */ - $lastType = $this->statements->getLastStatementType(); + foreach ($this->returnTypes as $returnType => $definition) { + switch ($returnType) { + case 'variable': + case 'callable': + case 'resource': + return false; + } - if ('return' !== $lastType && 'throw' !== $lastType && !$this->hasChildReturnStatementType($statement)) { - if ($symbolTable->getMustGrownStack()) { - $compilationContext->headersManager->add('kernel/memory'); - $codePrinter->output("\t".'ZEPHIR_MM_RESTORE();'); + if (isset($definition['type']) && 'return-type-annotation' === $definition['type']) { + if ( + $this->areReturnTypesBoolCompatible() || + $this->areReturnTypesDoubleCompatible() || + $this->areReturnTypesIntCompatible() || + $this->areReturnTypesNullCompatible() || + $this->areReturnTypesStringCompatible() || + $this->areReturnTypesFalseCompatible() || + $this->areReturnTypesObjectCompatible() || + array_key_exists('array', $this->getReturnTypes()) + ) { + continue; } /** - * If a method has return-type hints we need to ensure the last statement is a 'return' statement + * TODO: Probably we should detect return type more more carefully. + * It is hard to process return type from the annotations at this time. + * Thus we just return false here. */ - if ($this->hasReturnTypes()) { - throw new CompilerException( - 'Reached end of the method without returning a valid type specified in the return-type hints', - $this->expression['return-type'] - ); - } + return false; } } - $compilationContext->backend->onPostCompile($this, $compilationContext); - - /** - * Remove macros that grow/restore the memory frame stack if it wasn't used. - */ - $code = $this->removeMemoryStackReferences($symbolTable, $codePrinter->getOutput()); + return true; + } - /** - * Restore the compilation context - */ - $oldCodePrinter->output($code, false); - $compilationContext->codePrinter = $oldCodePrinter; + /** + * Checks if method is a shortcut. + */ + public function isShortcut(): bool + { + return $this->expression && 'shortcut' === $this->expression['type']; + } - $compilationContext->branchManager = null; - $compilationContext->cacheManager = null; - $compilationContext->typeInference = null; + /** + * Checks whether the method is static. + */ + public function isStatic(): bool + { + return $this->isStatic; + } - $codePrinter->clear(); + /** + * Checks if the method must not return any value. + */ + public function isVoid(): bool + { + return $this->void; } /** - * Simple method to check if one of the paths are returning the right expected type. - * - * @param array $statement + * Pre-compiles the method making compilation pass data (static inference, local-context-pass) available to other + * methods. * - * @return bool + * @throws CompilerException */ - public function hasChildReturnStatementType(array $statement): bool + public function preCompile(CompilationContext $compilationContext): void { - if (!isset($statement['statements']) || !is_array($statement['statements'])) { - return false; - } + $localContext = null; + $typeInference = null; + $callGathererPass = null; - if ('if' === $statement['type']) { - $ret = false; + if (is_object($this->statements)) { + $compilationContext->currentMethod = $this; - $statements = $statement['statements']; - foreach ($statements as $item) { - $type = $item['type'] ?? null; - if ('return' === $type || 'throw' === $type) { - $ret = true; - } else { - $ret = $this->hasChildReturnStatementType($item); - } + /** + * This pass checks for zval variables than can be potentially + * used without allocating memory and track it + * these variables are stored in the stack + */ + if ($compilationContext->config->get('local-context-pass', 'optimizations')) { + $localContext = new LocalContextPass(); + $localContext->pass($this->statements); } - if (!$ret || !isset($statement['else_statements'])) { - return false; + /** + * This pass tries to infer types for dynamic variables + * replacing them by low level variables + */ + if ($compilationContext->config->get('static-type-inference', 'optimizations')) { + $typeInference = new StaticTypeInference(); + $typeInference->pass($this->statements); + if ($compilationContext->config->get('static-type-inference-second-pass', 'optimizations')) { + $typeInference->reduce(); + $typeInference->pass($this->statements); + } } - $statements = $statement['else_statements']; - } else { - $statements = $statement['statements']; + /** + * This pass counts how many times a specific + */ + if ($compilationContext->config->get('call-gatherer-pass', 'optimizations')) { + $callGathererPass = new CallGathererPass($compilationContext); + $callGathererPass->pass($this->statements); + } } - foreach ($statements as $item) { - $type = $item['type'] ?? null; - if ('return' === $type || 'throw' === $type) { - return true; - } + $this->localContext = $localContext; + $this->typeInference = $typeInference; + $this->callGathererPass = $callGathererPass; + } - return $this->hasChildReturnStatementType($item); + /** + * Replace macros. + * + * @deprecated + */ + public function removeMemoryStackReferences(SymbolTable $symbolTable, string $containerCode): string + { + if ($symbolTable->getMustGrownStack()) { + return $containerCode; } - return false; + $containerCode = str_replace('ZEPHIR_THROW_EXCEPTION_STR', 'ZEPHIR_THROW_EXCEPTION_STRW', $containerCode); + $containerCode = str_replace( + 'ZEPHIR_THROW_EXCEPTION_DEBUG_STR', + 'ZEPHIR_THROW_EXCEPTION_DEBUG_STRW', + $containerCode + ); + $containerCode = str_replace('ZEPHIR_THROW_EXCEPTION_ZVAL', 'ZEPHIR_THROW_EXCEPTION_ZVALW', $containerCode); + $containerCode = str_replace('RETURN_THIS', 'RETURN_THISW', $containerCode); + $containerCode = str_replace('RETURN_LCTOR', 'RETURN_LCTORW', $containerCode); + $containerCode = str_replace('RETURN_CTOR', 'RETURN_CTORW', $containerCode); + $containerCode = str_replace('RETURN_NCTOR', 'RETURN_NCTORW', $containerCode); + $containerCode = str_replace('RETURN_CCTOR', 'RETURN_CCTORW', $containerCode); + $containerCode = str_replace('RETURN_MM_NULL', 'RETURN_NULL', $containerCode); + $containerCode = str_replace('RETURN_MM_BOOL', 'RETURN_BOOL', $containerCode); + $containerCode = str_replace('RETURN_MM_FALSE', 'RETURN_FALSE', $containerCode); + $containerCode = str_replace('RETURN_MM_TRUE', 'RETURN_TRUE', $containerCode); + $containerCode = str_replace('RETURN_MM_STRING', 'RETURN_STRING', $containerCode); + $containerCode = str_replace('RETURN_MM_LONG', 'RETURN_LONG', $containerCode); + $containerCode = str_replace('RETURN_MM_DOUBLE', 'RETURN_DOUBLE', $containerCode); + $containerCode = str_replace('RETURN_MM_FALSE', 'RETURN_FALSE', $containerCode); + $containerCode = str_replace('RETURN_MM_EMPTY_STRING', 'RETURN_MM_EMPTY_STRING', $containerCode); + $containerCode = str_replace('RETURN_MM_EMPTY_ARRAY', 'RETURN_EMPTY_ARRAY', $containerCode); + $containerCode = str_replace('RETURN_MM_MEMBER', 'RETURN_MEMBER', $containerCode); + $containerCode = str_replace('RETURN_MM()', 'return', $containerCode); + + return preg_replace('/[ \t]+ZEPHIR_MM_RESTORE\(\);' . PHP_EOL . '/s', '', $containerCode); } /** - * @return string + * Sets if the method is bundled or not. */ - public function getInternalName(): string + public function setIsBundled(bool $bundled): void { - $classDefinition = $this->getClassDefinition(); + $this->isBundled = $bundled; + } - return 'zep_'.$classDefinition->getCNamespace().'_'.$classDefinition->getName().'_'.$this->getName(); + /** + * Sets if the method is an initializer or not. + */ + public function setIsInitializer(bool $initializer): void + { + $this->isInitializer = $initializer; } /** - * Returns arginfo name for current method. - * - * @param ClassDefinition|null $classDefinition - * - * @return string + * Sets if the method is internal or not. */ - public function getArgInfoName(?ClassDefinition $classDefinition = null): string + public function setIsStatic(bool $static): void { - if ($classDefinition instanceof ClassDefinition) { - return sprintf( - 'arginfo_%s_%s_%s', - strtolower($classDefinition->getCNamespace()), - strtolower($classDefinition->getName()), - strtolower($this->getName()) - ); - } + $this->isStatic = $static; + } - return sprintf('arginfo_%s', strtolower($this->getInternalName())); + /** + * Sets the method name. + */ + public function setName(string $name): void + { + $this->name = $name; } /** - * Is method have determined return type hint. - * - * This method is used to generate: - * - * - ZEND_BEGIN_ARG_INFO_EX - * - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX + * Process RAW return types structure. * - * Examples: + * Example: * - * - TRUE: function foo() -> void; - * - TRUE: function foo() -> null; - * - TRUE: function foo() -> bool|string|..; - * - TRUE: function foo() -> <\stdClass>; - * - FALSE: function foo(); - * - FALSE: function foo() -> var; - * - FALSE: function foo() -> resource|callable; + * ``` + * $returnType = [ + * 'type' => 'return-type', + * 'list' => [ + * [ + * 'type' => 'return-type-parameter', + * 'cast' => [ + * 'type' => 'variable', + * 'value' => '\StdClass', + * 'file' => './stubs.zep', + * 'line' => 21, + * 'char' => 48 + * ], + * 'collection' => 1, + * 'file' => './stubs.zep', + * 'line' => 21, + * 'char' => 48 + * ], + * [ + * 'type' => 'return-type-parameter', + * 'data-type' => 'bool', + * 'mandatory' => 0, + * 'file' => './stubs.zep', + * 'line' => 22, + * 'char' => 5 + * ] + * ], + * 'void' => 0, + * 'file' => './stubs.zep', + * 'line' => 22, + * 'char' => 5 + * ]; + * ``` * - * @return bool + * @param array|null $returnType */ - public function isReturnTypesHintDetermined(): bool - { - if ($this->isVoid()) { - return true; - } - - if (0 === count($this->returnTypes)) { - return false; + public function setReturnTypes(array $returnType = null): void + { + $this->returnTypesRaw = $returnType; + if (null === $returnType) { + return; } - foreach ($this->returnTypes as $returnType => $definition) { - switch ($returnType) { - case 'variable': - case 'callable': - case 'resource': - return false; - } - - if (isset($definition['type']) && 'return-type-annotation' === $definition['type']) { - if ($this->areReturnTypesBoolCompatible() || - $this->areReturnTypesDoubleCompatible() || - $this->areReturnTypesIntCompatible() || - $this->areReturnTypesNullCompatible() || - $this->areReturnTypesStringCompatible() || - $this->areReturnTypesFalseCompatible() || - $this->areReturnTypesObjectCompatible() || - \array_key_exists('array', $this->getReturnTypes()) - ) { - continue; - } + if (isset($returnType['void']) && $returnType['void']) { + $this->void = true; - /* - * TODO: Probable we should detect return type more more carefully. - * It is hard to process return type from the annotations at this time. - * Thus we just return false here. - */ - return false; - } + return; } - return true; - } + if (!isset($returnType['list'])) { + return; + } - /** - * Checks if method's return type is nullable object `?object`. - * - * @return bool - */ - public function isReturnTypeNullableObject(): bool - { - return count($this->returnTypes) === 2 && isset($this->returnTypes['object']) && isset($this->returnTypes['null']); - } + $types = []; + $castTypes = []; - /** - * Checks if method's return type is object `object`. - * - * @return bool - */ - public function isReturnTypeObject(): bool - { - return count($this->returnTypes) === 1 && isset($this->returnTypes['object']); - } + foreach ($returnType['list'] as $returnTypeItem) { + /** + * We continue the loop, because it only works for PHP >= 8.0. + */ + if (isset($returnTypeItem['data-type']) && $returnTypeItem['data-type'] === 'mixed') { + $this->mixed = true; + } - /** - * Checks if the method have compatible return types. - * - * @return bool - */ - public function areReturnTypesCompatible(): bool - { - // void - if ($this->isVoid()) { - return true; - } + if (!isset($returnTypeItem['cast'])) { + $types[$returnTypeItem['data-type']] = $returnTypeItem; + continue; + } - $totalTypes = count($this->returnTypes); + if (isset($returnTypeItem['cast']['collection'])) { + continue; + } - // union types - if ($totalTypes > 1) { - $diff = array_diff(array_keys($this->returnTypes), array_keys($this->mayBeArgTypes)); - if (count($diff) === 0) { - return true; + if (isset($returnTypeItem['collection']) && $returnTypeItem['collection']) { + $types['array'] = [ + 'type' => 'return-type-parameter', + 'data-type' => 'array', + 'mandatory' => 0, + 'file' => $returnTypeItem['cast']['file'], + 'line' => $returnTypeItem['cast']['line'], + 'char' => $returnTypeItem['cast']['char'], + ]; + } else { + $castTypes[$returnTypeItem['cast']['value']] = $returnTypeItem['cast']['value']; } } - // T1 | T2 - if (2 === $totalTypes && !isset($this->returnTypes['null'])) { - return false; + if (count($castTypes) > 0) { + $types['object'] = []; + $this->returnClassTypes = $castTypes; } - // null | T1 | T2 - if ($totalTypes > 2) { - return false; + if (count($types) > 0) { + $this->returnTypes = $types; } + } - return true; + /** + * Setter for statements block. + */ + public function setStatementsBlock(StatementsBlock $statementsBlock): void + { + $this->statements = $statementsBlock; } /** - * Determine Z_PARAM_* - * - * @param array $parameter - * @param CompilationContext $compilationContext - * - * @return string - * - * @throws Exception + * Generate internal method's based on the equivalent PHP methods, + * allowing bypassing php userspace for internal method calls. */ - public function detectParam(array $parameter, CompilationContext $compilationContext): string + public function setupOptimized(CompilationContext $compilationContext): self { - $name = $parameter['name']; - if (!isset($parameter['data-type'])) { - return sprintf('Z_PARAM_ZVAL(%s)', $name); + if (!$compilationContext->config->get('internal-call-transformation', 'optimizations')) { + return $this; } + $classDefinition = $this->getClassDefinition(); + /** - * In case of unknown type, just return generic param type. + * Skip for closures */ - $hasDefaultNull = isset($parameter['default']['type']) && $parameter['default']['type'] === 'null'; - if ($hasDefaultNull) { - $param = sprintf('Z_PARAM_ZVAL_OR_NULL(%s)', $name); - } else { - $param = sprintf('Z_PARAM_ZVAL(%s)', $name); + if ('__invoke' === $this->getName() || $classDefinition->isInterface()) { + return $this; } - switch ($parameter['data-type']) { - case 'array': - if ($hasDefaultNull) { - $param = sprintf('Z_PARAM_ARRAY_OR_NULL(%s)', $name); - } else { - $param = sprintf('Z_PARAM_ARRAY(%s)', $name); - } - - break; - - case 'bool': - if ($hasDefaultNull) { - $param = sprintf('Z_PARAM_BOOL_OR_NULL(%s, is_null_true)', $name); - } else { - $param = sprintf('Z_PARAM_BOOL(%s)', $name); - } - - break; - - case 'float': - if ($hasDefaultNull) { - $param = sprintf('Z_PARAM_DOUBLE_OR_NULL(%s, is_null_true)', $name); - } else { - $param = sprintf('Z_PARAM_DOUBLE(%s)', $name); - } - - break; - - case 'int': - case 'uint': - case 'long': - if ($hasDefaultNull) { - $param = sprintf('Z_PARAM_LONG_OR_NULL(%s, is_null_true)', $name); - } else { - $param = sprintf('Z_PARAM_LONG(%s)', $name); - } - - break; - - case 'object': - if ($hasDefaultNull) { - $param = sprintf('Z_PARAM_OBJECT_OF_CLASS_OR_NULL(%s)', $name); - } else { - $param = sprintf('Z_PARAM_OBJECT(%s)', $name); - } - - break; - - case 'resource': - if ($hasDefaultNull) { - $param = sprintf('Z_PARAM_RESOURCE_OR_NULL(%s)', $name); - } else { - $param = sprintf('Z_PARAM_RESOURCE(%s)', $name); - } + if (!$this->isInternal() && !$classDefinition->isBundled()) { + /* Not supported for now */ + if ($this->getNumberOfRequiredParameters() != $this->getNumberOfParameters()) { + return $this; + } - break; + if ($this->isConstructor()) { + return $this; + } - case 'string': - if ($hasDefaultNull) { - $param = sprintf('Z_PARAM_STR_OR_NULL(%s)', $name); - } else { - $param = sprintf('Z_PARAM_STR(%s)', $name); - } + $optimizedName = $this->getName() . '_zephir_internal_call'; - break; + $visibility = ['internal']; - case 'variable': - if (isset($parameter['cast']) && - $parameter['cast']['type'] === 'variable' && - $parameter['cast']['value'] && - $this->classDefinition !== null - ) { - $classEntry = (new ClassEntry($parameter['cast']['value'], $compilationContext))->get(); - if ($hasDefaultNull) { - $param = sprintf('Z_PARAM_OBJECT_OF_CLASS_OR_NULL(%s, %s)', $name, $classEntry); - } else { - $param = sprintf('Z_PARAM_OBJECT_OF_CLASS(%s, %s)', $name, $classEntry); - } - } + $statements = null; + if ($this->statements) { + $statements = new StatementsBlock(json_decode(json_encode($this->statements->getStatements()), true)); + } - break; + $optimizedMethod = new self( + $classDefinition, + $visibility, + $optimizedName, + $this->parameters, + $statements, + $this->docblock, + null, + $this->expression + ); + $optimizedMethod->typeInference = $this->typeInference; + $optimizedMethod->setReturnTypes($this->returnTypes); + $classDefinition->addMethod($optimizedMethod); } - return $param; + return $this; } /** * Get data type of method's parameter - * - * @param array $parameter - * - * @return string */ private function getParamDataType(array $parameter): string { return $parameter['data-type'] ?? 'variable'; } + + /** + * @param CompilationContext $compilationContext + * @param array $parameter + * @param Printer $oldCodePrinter + * @param string $type + * + * @return string + * @throws Exception + * @throws ReflectionException + */ + private function processStaticConstantAccess( + CompilationContext $compilationContext, + array $parameter, + Printer $oldCodePrinter, + string $type + ): string { + /** + * Now I can write code for easy use on Expression because + * code in this method don't write with codePrinter ;(. + * + * TODO: Rewrite all to codePrinter + */ + $symbolVariable = $compilationContext->symbolTable->getVariableForWrite( + $parameter['name'], + $compilationContext, + $parameter['default'] + ); + $expression = new Expression($parameter['default']); + $expression->setExpectReturn(true, $symbolVariable); + $compiledExpression = $expression->compile($compilationContext); + + if ($type !== $compiledExpression->getType()) { + throw new CompilerException( + 'Default parameter value type: ' + . $compiledExpression->getType() + . ' cannot be assigned to variable(' . $type . ')', + $parameter + ); + } + + $parameter['default']['type'] = $compiledExpression->getType(); + $parameter['default']['value'] = $compiledExpression->getCode(); + + $compilationContext->codePrinter = $oldCodePrinter; + + return $this->assignDefaultValue($parameter, $compilationContext); + } } diff --git a/Library/ClassMethodParameters.php b/src/Class/Method/Parameters.php similarity index 63% rename from Library/ClassMethodParameters.php rename to src/Class/Method/Parameters.php index 9337d68128..1ce1913743 100644 --- a/Library/ClassMethodParameters.php +++ b/src/Class/Method/Parameters.php @@ -11,80 +11,58 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Class\Method; use ArrayAccess; use Countable; use Iterator; use Zephir\Exception\CompilerException; +use Zephir\Types\Types; use function count; /** - * Class Method Parameters - * * Represents the parameters defined in a method. */ -class ClassMethodParameters implements Countable, Iterator, ArrayAccess +class Parameters implements Countable, Iterator, ArrayAccess { /** - * List of all method's parameters - * - * @var array + * List of Optional parameters (with default value) */ - private array $parameters = []; - - private int $position = 0; - + private array $optionalParameters = []; + private int $position = 0; /** * List of Required parameters - * - * @var array */ private array $requiredParameters = []; /** - * List of Optional parameters (with default value) - * - * @var array - */ - private array $optionalParameters = []; - - /** - * ClassMethodParameters constructor. - * - * @param array $parameters - * * @throws CompilerException */ - public function __construct(array $parameters) + public function __construct(private array $parameters) { foreach ($parameters as $parameter) { if (isset($parameter['reference']) && $parameter['reference']) { throw new CompilerException( - 'Zephir not support reference parameters for now. '. + 'Zephir not support reference parameters for now. ' . 'Stay tuned for https://github.com/zephir-lang/zephir/issues/203', $parameter ); } } - - $this->parameters = $parameters; } /** - * Return internal parameters. - * - * @return array + * @return int */ - public function getParameters(): array + public function count(): int { - return $this->parameters; + return count($this->parameters); } - public function getRequiredParameters(): array + public function countOptionalParameters(): int { - return $this->requiredParameters; + return count($this->optionalParameters); } public function countRequiredParameters(): int @@ -92,14 +70,9 @@ public function countRequiredParameters(): int return count($this->requiredParameters); } - public function getOptionalParameters(): array + public function current(): mixed { - return $this->optionalParameters; - } - - public function countOptionalParameters(): int - { - return count($this->optionalParameters); + return $this->parameters[$this->position]; } public function fetchParameters(bool $isMethodInternal): array @@ -107,22 +80,17 @@ public function fetchParameters(bool $isMethodInternal): array $parameters = []; foreach ($this->parameters as $parameter) { - $name = $parameter['name']; + $name = $parameter['name']; $dataType = $parameter['data-type'] ?? 'variable'; - switch ($dataType) { - case 'object': - case 'callable': - case 'resource': - case 'variable': - case 'mixed': - $parameters[] = $isMethodInternal ? $name : '&'.$name; - break; - - default: - $parameters[] = ($isMethodInternal ? $name : '&'.$name).'_param'; - break; - } + $parameters[] = match ($dataType) { + Types::T_OBJECT, + Types::T_CALLABLE, + Types::T_RESOURCE, + Types::T_VARIABLE, + Types::T_MIXED => $isMethodInternal ? $name : '&' . $name, + default => ($isMethodInternal ? $name : '&' . $name) . '_param', + }; if (isset($parameter['default'])) { $this->optionalParameters[] = $parameter; @@ -134,65 +102,72 @@ public function fetchParameters(bool $isMethodInternal): array return $parameters; } - /** - * @return int - */ - public function count(): int + public function getOptionalParameters(): array { - return count($this->parameters); + return $this->optionalParameters; } - #[\ReturnTypeWillChange] - public function rewind() + /** + * Return internal parameters. + */ + public function getParameters(): array { - $this->position = 0; + return $this->parameters; } - #[\ReturnTypeWillChange] - public function key() + public function getRequiredParameters(): array { - return $this->position; + return $this->requiredParameters; } - #[\ReturnTypeWillChange] - public function valid() + public function hasNullableParameters(): bool { - return isset($this->parameters[$this->position]); + foreach ($this->optionalParameters as $parameter) { + if (isset($parameter['default']['type']) && $parameter['default']['type'] === 'null') { + return true; + } + } + + return false; } - #[\ReturnTypeWillChange] - public function current() + public function key(): int { - return $this->parameters[$this->position]; + return $this->position; } - #[\ReturnTypeWillChange] - public function next() + public function next(): void { ++$this->position; } - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists(mixed $offset): bool { return isset($this->parameters[$offset]); } - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset): mixed { return $this->parameters[$offset]; } - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet(mixed $offset, mixed $value): void { $this->parameters[$offset] = $value; } - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset(mixed $offset): void { unset($this->parameters[$offset]); } + + public function rewind(): void + { + $this->position = 0; + } + + public function valid(): bool + { + return isset($this->parameters[$this->position]); + } } diff --git a/Library/ClassProperty.php b/src/Class/Property.php similarity index 60% rename from Library/ClassProperty.php rename to src/Class/Property.php index a4a0ee9436..66c7ce127a 100644 --- a/Library/ClassProperty.php +++ b/src/Class/Property.php @@ -9,95 +9,144 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir; +declare(strict_types=1); +namespace Zephir\Class; + +use ReflectionException; +use Zephir\Class\Definition\Definition; +use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Exception\CompilerException; +use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; use Zephir\Expression\Builder\Operators\BinaryOperator; -use Zephir\Expression\Builder\Statements\LetStatement as ExpressionLetStatement; +use Zephir\Name; +use Zephir\StatementsBlock; +use Zephir\Types\Types; + +use function array_keys; +use function implode; +use function in_array; +use function is_array; +use function is_object; +use function sprintf; /** * Represents a property class */ -class ClassProperty +class Property { - /** - * @var ClassDefinition - */ - protected ClassDefinition $classDefinition; - - protected $visibility; - - protected $name; - - protected $defaultValue; + public function __construct( + protected Definition $classDefinition, + protected array $visibility, + protected string $name, + protected ?array $defaultValue, + protected ?string $docBlock = null, + protected ?array $original = null, + ) { + $this->checkVisibility($visibility, $name, $original); - protected $docblock; + if (!is_array($this->defaultValue)) { + $this->defaultValue = []; + $this->defaultValue['type'] = 'null'; + $this->defaultValue['value'] = null; + } + } - protected $original; + /** + * Checks for visibility congruence. + */ + public function checkVisibility(array $visibility, string $name, array $original = null): void + { + if (in_array('public', $visibility) && in_array('protected', $visibility)) { + throw new CompilerException( + "Property '$name' cannot be 'public' and 'protected' at the same time", + $original + ); + } + if (in_array('public', $visibility) && in_array('private', $visibility)) { + throw new CompilerException( + "Property '$name' cannot be 'public' and 'private' at the same time", + $original + ); + } + if (in_array('private', $visibility) && in_array('protected', $visibility)) { + throw new CompilerException( + "Property '$name' cannot be 'protected' and 'private' at the same time", + $original + ); + } + } /** - * @param ClassDefinition $classDefinition - * @param array $visibility - * @param string $name - * @param mixed $defaultValue - * @param string $docBlock - * @param array $original + * Produce the code to register a property. + * + * @throws Exception + * @throws ReflectionException */ - public function __construct(ClassDefinition $classDefinition, $visibility, $name, $defaultValue, $docBlock, $original) + public function compile(CompilationContext $compilationContext): void { - $this->checkVisibility($visibility, $name, $original); + switch ($this->defaultValue['type']) { + case 'long': + case 'int': + case 'string': + case 'double': + case 'bool': + $this->declareProperty($compilationContext, $this->defaultValue['type'], $this->defaultValue['value']); + break; - $this->classDefinition = $classDefinition; - $this->visibility = $visibility; - $this->name = $name; - $this->defaultValue = $defaultValue; - $this->docblock = $docBlock; - $this->original = $original; + case 'array': + case 'empty-array': + $this->initializeArray(); + // no break + case 'null': + $this->declareProperty($compilationContext, $this->defaultValue['type'], null); + break; - if (!\is_array($this->defaultValue)) { - $this->defaultValue = []; - $this->defaultValue['type'] = 'null'; - $this->defaultValue['value'] = null; + case 'static-constant-access': + $expression = new Expression($this->defaultValue); + $compiledExpression = $expression->compile($compilationContext); + + $this->declareProperty( + $compilationContext, + $compiledExpression->getType(), + $compiledExpression->getCode() + ); + break; + + default: + throw new CompilerException('Unknown default type: ' . $this->defaultValue['type'], $this->original); } } /** * Returns the class definition where the method was declared. - * - * @return ClassDefinition */ - public function getClassDefinition() + public function getClassDefinition(): Definition { return $this->classDefinition; } /** - * Returns the property name. - * - * @return string + * Returns the docblock related to the property. */ - public function getName() + public function getDocBlock(): ?string { - return $this->name; + return $this->docBlock; } /** - * @return mixed + * Returns the property name. */ - public function getValue() + public function getName(): string { - if ('array' == $this->defaultValue['type']) { - $result = []; - - foreach ($this->original['default']['left'] as $key) { - $result[] = $key['value']['value']; - } - - $this->defaultValue['value'] = $result; - } + return $this->name; + } - return $this->defaultValue['value']; + public function getOriginal(): ?array + { + return $this->original; } public function getType() @@ -105,44 +154,27 @@ public function getType() return $this->defaultValue['type']; } - /** - * @return mixed - */ - public function getOriginal() + public function getValue(): mixed { - return $this->original; - } + if ('array' == $this->defaultValue['type']) { + $result = []; - /** - * Checks for visibility congruence. - * - * @param array $visibility - * @param string $name - * @param array $original - * - * @throws CompilerException - */ - public function checkVisibility($visibility, $name, $original) - { - if (\in_array('public', $visibility) && \in_array('protected', $visibility)) { - throw new CompilerException("Property '$name' cannot be 'public' and 'protected' at the same time", $original); - } - if (\in_array('public', $visibility) && \in_array('private', $visibility)) { - throw new CompilerException("Property '$name' cannot be 'public' and 'private' at the same time", $original); - } - if (\in_array('private', $visibility) && \in_array('protected', $visibility)) { - throw new CompilerException("Property '$name' cannot be 'protected' and 'private' at the same time", $original); + foreach ($this->original['default']['left'] as $key) { + $result[] = $key['value']['value']; + } + + $this->defaultValue['value'] = $result; } + + return $this->defaultValue['value']; } /** * Returns the C-visibility accessors for the model. * * @throws Exception - * - * @return string */ - public function getVisibilityAccessor() + public function getVisibilityAccessor(): string { $modifiers = []; @@ -165,180 +197,43 @@ public function getVisibilityAccessor() break; default: - throw new Exception('Unknown modifier '.$visibility); + throw new Exception('Unknown modifier ' . $visibility); } } return implode('|', array_keys($modifiers)); } - /** - * Returns the docblock related to the property. - * - * @return string - */ - public function getDocBlock() - { - return $this->docblock; - } - - /** - * Checks whether the variable is static. - * - * @return bool - */ - public function isStatic() - { - return \in_array('static', $this->visibility); - } - - /** - * Checks whether the variable is public. - * - * @return bool - */ - public function isPublic() - { - return \in_array('public', $this->visibility); - } - - /** - * Checks whether the variable is protected. - * - * @return bool - */ - public function isProtected() - { - return \in_array('protected', $this->visibility); - } - /** * Checks whether the variable is private. - * - * @return bool */ - public function isPrivate() + public function isPrivate(): bool { - return \in_array('private', $this->visibility); + return in_array('private', $this->visibility); } /** - * Produce the code to register a property. - * - * @param CompilationContext $compilationContext - * - * @throws CompilerException + * Checks whether the variable is protected. */ - public function compile(CompilationContext $compilationContext) + public function isProtected(): bool { - switch ($this->defaultValue['type']) { - case 'long': - case 'int': - case 'string': - case 'double': - case 'bool': - $this->declareProperty($compilationContext, $this->defaultValue['type'], $this->defaultValue['value']); - break; - - case 'array': - case 'empty-array': - $this->initializeArray($compilationContext); - // no break - case 'null': - $this->declareProperty($compilationContext, $this->defaultValue['type'], null); - break; - - case 'static-constant-access': - $expression = new Expression($this->defaultValue); - $compiledExpression = $expression->compile($compilationContext); - - $this->declareProperty($compilationContext, $compiledExpression->getType(), $compiledExpression->getCode()); - break; - - default: - throw new CompilerException('Unknown default type: '.$this->defaultValue['type'], $this->original); - } + return in_array('protected', $this->visibility); } /** - * Removes all initialization statements related to this property. - * - * @param array $statements + * Checks whether the variable is public. */ - protected function removeInitializationStatements(&$statements) + public function isPublic(): bool { - foreach ($statements as $index => $statement) { - if (!$this->isStatic()) { - if ($statement['expr']['left']['right']['value'] == $this->name) { - unset($statements[$index]); - } - } else { - if ($statement['assignments'][0]['property'] == $this->name) { - unset($statements[$index]); - } - } - } + return in_array('public', $this->visibility); } /** - * @return $this|ExpressionLetStatement - */ - protected function getLetStatement() - { - $exprBuilder = BuilderFactory::getInstance(); - - if ($this->isStatic()) { - $className = '\\'.$this->classDefinition->getCompleteName(); - $expr = $exprBuilder->raw($this->original['default']); - - return $exprBuilder->statements()->let([ - $exprBuilder->operators() - ->assignStaticProperty($className, $this->name, $expr) - ->setFile($this->original['default']['file']) - ->setLine($this->original['default']['line']) - ->setChar($this->original['default']['char']), - ]); - } - - $lsb = $exprBuilder->statements()->let([ - $exprBuilder->operators() - ->assignProperty('this', $this->name, $exprBuilder->raw($this->original['default'])) - ->setFile($this->original['default']['file']) - ->setLine($this->original['default']['line']) - ->setChar($this->original['default']['char']), - ]); - - return $exprBuilder->statements()->ifX() - ->setCondition( - $exprBuilder->operators()->binary( - BinaryOperator::OPERATOR_EQUALS, - $exprBuilder->operators()->binary( - BinaryOperator::OPERATOR_ACCESS_PROPERTY, - $exprBuilder->variable('this'), - $exprBuilder->literal(Types::T_STRING, $this->name) - ), - $exprBuilder->literal(Types::T_NULL) - ) - ) - ->setStatements($exprBuilder->statements()->block([$lsb])); - } - - /** - * @param $value - * - * @return bool|string + * Checks whether the variable is static. */ - protected function getBooleanCode($value) + public function isStatic(): bool { - if ($value && ('true' == $value || true === $value)) { - return '1'; - } else { - if ('false' == $value || false === $value) { - return '0'; - } - } - - return (bool) $value; + return in_array('static', $this->visibility); } /** @@ -346,16 +241,16 @@ protected function getBooleanCode($value) * * @param CompilationContext $compilationContext * @param string $type - * @param $value + * @param $value * * @throws Exception * @throws CompilerException */ - protected function declareProperty(CompilationContext $compilationContext, $type, $value) + protected function declareProperty(CompilationContext $compilationContext, $type, $value): void { $codePrinter = $compilationContext->codePrinter; - if (\is_object($value)) { + if (is_object($value)) { return; } @@ -409,7 +304,7 @@ protected function declareProperty(CompilationContext $compilationContext, $type 'zend_declare_property_string(%s, SL("%s"), "%s", %s);', $classEntry, $this->getName(), - add_slashes($value), + Name::addSlashes($value), $this->getVisibilityAccessor() ), false @@ -431,27 +326,99 @@ protected function declareProperty(CompilationContext $compilationContext, $type break; default: - throw new CompilerException('Unknown default type: '.$type, $this->original); + throw new CompilerException('Unknown default type: ' . $type, $this->original); } } - private function initializeArray($compilationContext) + protected function getBooleanCode($value): bool | string { - $classDefinition = $this->classDefinition; + if ('true' == $value || true === $value) { + return '1'; + } + + if ('false' == $value || false === $value) { + return '0'; + } + + return (bool)$value; + } + + protected function getLetStatement() + { + $exprBuilder = BuilderFactory::getInstance(); + + if ($this->isStatic()) { + $className = '\\' . $this->classDefinition->getCompleteName(); + $expr = $exprBuilder->raw($this->original['default']); + + return $exprBuilder->statements()->let([ + $exprBuilder->operators() + ->assignStaticProperty($className, $this->name, $expr) + ->setFile($this->original['default']['file']) + ->setLine($this->original['default']['line']) + ->setChar($this->original['default']['char']), + ]); + } + + $lsb = $exprBuilder->statements()->let([ + $exprBuilder->operators() + ->assignProperty('this', $this->name, $exprBuilder->raw($this->original['default'])) + ->setFile($this->original['default']['file']) + ->setLine($this->original['default']['line']) + ->setChar($this->original['default']['char']), + ]); + + return $exprBuilder->statements()->ifX() + ->setCondition( + $exprBuilder->operators()->binary( + BinaryOperator::OPERATOR_EQUALS, + $exprBuilder->operators()->binary( + BinaryOperator::OPERATOR_ACCESS_PROPERTY, + $exprBuilder->variable('this'), + $exprBuilder->literal(Types::T_STRING, $this->name) + ), + $exprBuilder->literal(Types::T_NULL) + ) + ) + ->setStatements($exprBuilder->statements()->block([$lsb])) + ; + } + + /** + * Removes all initialization statements related to this property. + */ + protected function removeInitializationStatements(array &$statements): void + { + foreach ($statements as $index => $statement) { + if (!$this->isStatic()) { + if ($statement['expr']['left']['right']['value'] == $this->name) { + unset($statements[$index]); + } + } else { + if ($statement['assignments'][0]['property'] == $this->name) { + unset($statements[$index]); + } + } + } + } + + private function initializeArray(): void + { + $classDefinition = $this->classDefinition; $parentClassDefinition = $classDefinition->getExtendsClassDefinition(); if (!$this->isStatic()) { - $constructParentMethod = $parentClassDefinition ? $parentClassDefinition->getInitMethod() : null; - $constructMethod = $classDefinition->getInitMethod(); + $constructParentMethod = $parentClassDefinition?->getInitMethod(); + $constructMethod = $classDefinition->getInitMethod(); } else { - $constructParentMethod = $parentClassDefinition ? $parentClassDefinition->getStaticInitMethod() : null; - $constructMethod = $classDefinition->getStaticInitMethod(); + $constructParentMethod = $parentClassDefinition?->getStaticInitMethod(); + $constructMethod = $classDefinition->getStaticInitMethod(); } if ($constructMethod) { $statementsBlock = $constructMethod->getStatementsBlock(); if ($statementsBlock) { - $statements = $statementsBlock->getStatements(); + $statements = $statementsBlock->getStatements(); $letStatement = $this->getLetStatement()->build(); $needLetStatementAdded = true; @@ -464,13 +431,7 @@ private function initializeArray($compilationContext) $this->removeInitializationStatements($statements); if ($needLetStatementAdded) { - $newStatements = []; - - /* - * Start from let statement - */ - $newStatements[] = $letStatement; - + $newStatements = [$letStatement]; foreach ($statements as $statement) { $newStatements[] = $statement; } @@ -481,7 +442,8 @@ private function initializeArray($compilationContext) } } else { $statementsBlockBuilder = BuilderFactory::getInstance()->statements() - ->block([$this->getLetStatement()]); + ->block([$this->getLetStatement()]) + ; $constructMethod->setStatementsBlock(new StatementsBlock($statementsBlockBuilder->build())); $classDefinition->updateMethod($constructMethod); } @@ -491,7 +453,7 @@ private function initializeArray($compilationContext) $statements = $constructParentMethod->getStatementsBlock()->getStatements(); } $this->removeInitializationStatements($statements); - $statements[] = $this->getLetStatement()->build(); + $statements[] = $this->getLetStatement()->build(); $statementsBlock = new StatementsBlock($statements); if ($this->isStatic()) { diff --git a/Library/ArgInfoDefinition.php b/src/Code/ArgInfoDefinition.php similarity index 66% rename from Library/ArgInfoDefinition.php rename to src/Code/ArgInfoDefinition.php index 6454d0e674..9c6c9ebc4b 100644 --- a/Library/ArgInfoDefinition.php +++ b/src/Code/ArgInfoDefinition.php @@ -11,85 +11,37 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Code; + +use Zephir\Class\Entry; +use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\CompilationContext; +use Zephir\Exception; use function array_key_exists; +use function array_merge; use function count; +use function implode; +use function is_array; +use function key; +use function sprintf; +use function str_replace; class ArgInfoDefinition { - /** - * @var bool - */ - private bool $returnByRef; - - /** - * @var ClassMethod|FunctionDefinition - */ - private $functionLike; - - /** - * @var string - */ - private string $name; - - /** - * @var ClassMethodParameters|null - */ - private ?ClassMethodParameters $parameters; - - /** - * @var CodePrinter - */ - private CodePrinter $codePrinter; + private string $booleanDefinition = '_IS_BOOL'; + private ?Parameters $parameters; + private bool $richFormat = true; - /** - * @var CompilationContext - */ - private CompilationContext $compilationContext; - - /** - * @var string - */ - private string $booleanDefinition = '_IS_BOOL'; - - /** - * @var bool - */ - private bool $richFormat = true; - - /** - * @param string $name - * @param ClassMethod $functionLike - * @param CodePrinter $codePrinter - * @param CompilationContext $compilationContext - * @param bool $returnByRef - */ public function __construct( - string $name, - ClassMethod $functionLike, - CodePrinter $codePrinter, - CompilationContext $compilationContext, - bool $returnByRef = false + private string $name, + private Method $functionLike, + private Printer $codePrinter, + private CompilationContext $compilationContext, + private bool $returnByRef = false ) { - $this->functionLike = $functionLike; - $this->codePrinter = $codePrinter; - $this->compilationContext = $compilationContext; - - $this->name = $name; $this->parameters = $this->functionLike->getParameters(); - - $this->returnByRef = $returnByRef; - } - - public function setBooleanDefinition(string $definition): void - { - $this->booleanDefinition = $definition; - } - - public function setRichFormat(bool $flag): void - { - $this->richFormat = $flag; } /** @@ -105,7 +57,8 @@ public function render(): void return; } - if ($this->richFormat && + if ( + $this->richFormat && $this->functionLike->isReturnTypesHintDetermined() && $this->functionLike->areReturnTypesCompatible() ) { @@ -120,33 +73,21 @@ public function render(): void sprintf( 'ZEND_BEGIN_ARG_INFO_EX(%s, 0, %d, %d)', $this->name, - (int) $this->returnByRef, + (int)$this->returnByRef, $this->functionLike->getNumberOfRequiredParameters() ) ); } else { if ($this->functionLike->getName() === '__toString') { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); $this->codePrinter->output( sprintf( 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, IS_STRING, %d)', $this->name, - (int) $this->returnByRef, + (int)$this->returnByRef, $this->functionLike->getNumberOfRequiredParameters(), - (int) $this->functionLike->areReturnTypesNullCompatible() - ) - ); - - $this->codePrinter->output('#else'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_INFO_EX(%s, 0, %d, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters() + (int)$this->functionLike->areReturnTypesNullCompatible() ) ); - $this->codePrinter->output('#endif'); } else { $this->codePrinter->output( sprintf('ZEND_BEGIN_ARG_INFO_EX(%s, 0, 0, 0)', $this->name) @@ -165,175 +106,90 @@ public function render(): void } } - private function richRenderStart(): void + public function setBooleanDefinition(string $definition): void { - if (array_key_exists('object', $this->functionLike->getReturnTypes()) && 1 === count($this->functionLike->getReturnClassTypes())) { - $class = key($this->functionLike->getReturnClassTypes()); - $class = escape_class($this->compilationContext->getFullName($class)); + $this->booleanDefinition = $definition; + } - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(%s, %d, %d, %s, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - $class, - (int) $this->functionLike->areReturnTypesNullCompatible() - ) - ); + public function setRichFormat(bool $flag): void + { + $this->richFormat = $flag; + } - return; + private function allowNull(array $parameter): bool + { + if (!isset($parameter['default']) || !is_array($parameter['default'])) { + return false; } - if ($this->functionLike->isVoid()) { - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - $this->getReturnType(), - (int) $this->functionLike->areReturnTypesNullCompatible() - ) - ); - - if (!$this->hasParameters()) { - $this->codePrinter->output('ZEND_END_ARG_INFO()'); - } + if ('null' === $parameter['default']['type']) { + return true; + } - $this->codePrinter->outputBlankLine(); + return false; + } - return; + private function defaultArrayValue(array $parameter): string + { + if ($parameter['default']['type'] === 'empty-array') { + return '"[]"'; } - if ($this->functionLike->isMixed()) { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, IS_MIXED, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - (int) $this->functionLike->areReturnTypesNullCompatible() - ) - ); - $this->codePrinter->output('#else'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_INFO_EX(%s, 0, %d, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - ) - ); - $this->codePrinter->output('#endif'); + // TODO: Come back later + /** + * It seems that it is impossible to pass default array with some data inside. + * Only empty array, even if manually specify not empty array - it will be ignored, + * for example: + * + * `ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someDefaultData, IS_ARRAY, 0, "[\"key\" => \"value\"]")` + * + * Output of default value will be `[]` during method call. + */ + return '"[]"'; + } - return; - } + private function getReturnType(): string + { + // TODO: Come back here when PHP7.4 is deprecated. + /*if (array_key_exists('mixed', $this->functionLike->getReturnTypes())) { + return 'IS_MIXED'; + }*/ - if ($this->functionLike->isReturnTypeNullableObject()) { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - 'MAY_BE_NULL|MAY_BE_OBJECT', - ) - ); - $this->codePrinter->output('#else'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - 'IS_OBJECT', - 1, - ) - ); - $this->codePrinter->output('#endif'); + if ($this->functionLike->areReturnTypesIntCompatible()) { + return 'IS_LONG'; + } - return; + if ($this->functionLike->areReturnTypesDoubleCompatible()) { + return 'IS_DOUBLE'; } - if ($this->functionLike->isReturnTypeObject()) { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - 'MAY_BE_OBJECT', - ) - ); - $this->codePrinter->output('#else'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - 'IS_OBJECT', - 0, - ) - ); - $this->codePrinter->output('#endif'); + if ($this->functionLike->areReturnTypesBoolCompatible()) { + return '_IS_BOOL'; + } - return; + if ($this->functionLike->areReturnTypesStringCompatible()) { + return 'IS_STRING'; } - if (count($this->functionLike->getReturnTypes()) > 1) { - $types = []; - $mayBeTypes = $this->functionLike->getMayBeArgTypes(); - foreach ($this->functionLike->getReturnTypes() as $type => $typeInfo) { - if (!isset($mayBeTypes[$type])) { - continue; - } + if ($this->functionLike->isVoid()) { + return 'IS_VOID'; + } - $types[] = $mayBeTypes[$type]; - } + if (array_key_exists('array', $this->functionLike->getReturnTypes())) { + return 'IS_ARRAY'; + } - if (count($types) > 1) { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - implode('|', $types) - ) - ); - $this->codePrinter->output('#else'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - $this->getReturnType(), - (int) $this->functionLike->areReturnTypesNullCompatible() - ) - ); - $this->codePrinter->output('#endif'); + return 'IS_NULL'; + } - return; - } - } + private function hasParameters(): bool + { + return null !== $this->parameters && count($this->parameters->getParameters()) > 0; + } - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - $this->getReturnType(), - (int) $this->functionLike->areReturnTypesNullCompatible() - ) - ); + private function passByReference(array $parameter) + { + return $parameter['reference'] ?? 0; } private function renderEnd(): void @@ -341,7 +197,7 @@ private function renderEnd(): void $flag = $this->richFormat ? '1' : '0'; foreach ($this->parameters->getParameters() as $parameter) { - switch ("{$flag}:".$parameter['data-type']) { + switch ("{$flag}:" . $parameter['data-type']) { case '0:array': case '1:array': if (!isset($parameter['default'])) { @@ -350,31 +206,19 @@ private function renderEnd(): void "\tZEND_ARG_ARRAY_INFO(%d, %s, %d)", $this->passByReference($parameter), $parameter['name'], - (int) $this->allowNull($parameter) + (int)$this->allowNull($parameter) ) ); } else { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); $this->codePrinter->output( sprintf( - "\tZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(%d, %s, IS_ARRAY, %d, %s)", + 'ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(%d, %s, IS_ARRAY, %d, %s)', $this->passByReference($parameter), $parameter['name'], - (int) $this->allowNull($parameter), + (int)$this->allowNull($parameter), $this->defaultArrayValue($parameter), ) ); - $this->codePrinter->output('#else'); - // `ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE` does not exist in PHP 7.4 - $this->codePrinter->output( - sprintf( - "\tZEND_ARG_ARRAY_INFO(%d, %s, %d)", - $this->passByReference($parameter), - $parameter['name'], - (int) $this->allowNull($parameter) - ) - ); - $this->codePrinter->output('#endif'); } break; case '0:variable': @@ -389,8 +233,8 @@ private function renderEnd(): void "\tZEND_ARG_OBJ_INFO(%d, %s, %s, %d)", $this->passByReference($parameter), $parameter['name'], - escape_class($this->compilationContext->getFullName($parameter['cast']['value'])), - (int) $this->allowNull($parameter) + Entry::escape($this->compilationContext->getFullName($parameter['cast']['value'])), + (int)$this->allowNull($parameter) ) ); } else { @@ -412,7 +256,7 @@ private function renderEnd(): void $this->passByReference($parameter), $parameter['name'], $this->booleanDefinition, - (int) $this->allowNull($parameter) + (int)$this->allowNull($parameter) ) ); break; @@ -426,7 +270,7 @@ private function renderEnd(): void "\tZEND_ARG_TYPE_INFO(%d, %s, IS_LONG, %d)", $this->passByReference($parameter), $parameter['name'], - (int) $this->allowNull($parameter) + (int)$this->allowNull($parameter) ) ); break; @@ -436,7 +280,7 @@ private function renderEnd(): void "\tZEND_ARG_TYPE_INFO(%d, %s, IS_DOUBLE, %d)", $this->passByReference($parameter), $parameter['name'], - (int) $this->allowNull($parameter) + (int)$this->allowNull($parameter) ) ); break; @@ -447,7 +291,7 @@ private function renderEnd(): void "\tZEND_ARG_TYPE_INFO(%d, %s, IS_STRING, %d)", $this->passByReference($parameter), $parameter['name'], - (int) $this->allowNull($parameter) + (int)$this->allowNull($parameter) ) ); break; @@ -464,82 +308,6 @@ private function renderEnd(): void } } - private function hasParameters(): bool - { - return null !== $this->parameters && count($this->parameters->getParameters()) > 0; - } - - private function defaultArrayValue(array $parameter): string - { - if ($parameter['default']['type'] === 'empty-array') { - return '"[]"'; - } - - // TODO: Come back later - /** - * It seems that it is impossible to pass default array with some data inside. - * Only empty array, even if manually specify not empty array - it will be ignored, - * for example: - * - * `ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someDefaultData, IS_ARRAY, 0, "[\"key\" => \"value\"]")` - * - * Output of default value will be `[]` during method call. - */ - return '"[]"'; - } - - private function allowNull(array $parameter): bool - { - if (!isset($parameter['default']) || !\is_array($parameter['default'])) { - return false; - } - - if ('null' === $parameter['default']['type']) { - return true; - } - - return false; - } - - private function passByReference(array $parameter) - { - return $parameter['reference'] ?? 0; - } - - private function getReturnType(): string - { - // TODO: Come back here when PHP7.4 is deprecated. - /*if (array_key_exists('mixed', $this->functionLike->getReturnTypes())) { - return 'IS_MIXED'; - }*/ - - if ($this->functionLike->areReturnTypesIntCompatible()) { - return 'IS_LONG'; - } - - if ($this->functionLike->areReturnTypesDoubleCompatible()) { - return 'IS_DOUBLE'; - } - - if ($this->functionLike->areReturnTypesBoolCompatible()) { - return '_IS_BOOL'; - } - - if ($this->functionLike->areReturnTypesStringCompatible()) { - return 'IS_STRING'; - } - - if ($this->functionLike->isVoid()) { - return 'IS_VOID'; - } - - if (array_key_exists('array', $this->functionLike->getReturnTypes())) { - return 'IS_ARRAY'; - } - - return 'IS_NULL'; - } - /** * Find from $compatibilityClasses and render specific * hardcoded arg info for with specific PHP version @@ -547,16 +315,16 @@ private function getReturnType(): string * * This is temporary solution designed specifically for Phalcon project. * + * @return bool * @deprecated used as MVP solution for cross PHP versions support * - * @return bool */ private function renderPhalconCompatible(): bool { - $compatibilityClasses = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/phalcon-compatibility-headers.php'; - $classDefinition = $this->functionLike->getClassDefinition(); + $compatibilityClasses = require_once __DIR__ . '/../../config/phalcon-compatibility-headers.php'; + $classDefinition = $this->functionLike->getClassDefinition(); $implementedInterfaces = $classDefinition !== null ? $classDefinition->getImplementedInterfaces() : []; - $extendsClass = $classDefinition !== null ? $classDefinition->getExtendsClass() : null; + $extendsClass = $classDefinition?->getExtendsClass(); if (empty($implementedInterfaces) && $extendsClass === null) { return false; @@ -588,4 +356,128 @@ private function renderPhalconCompatible(): bool return $found; } + + private function richRenderStart(): void + { + if ( + array_key_exists('object', $this->functionLike->getReturnTypes()) && + 1 === count($this->functionLike->getReturnClassTypes()) + ) { + $class = key($this->functionLike->getReturnClassTypes()); + $class = Entry::escape($this->compilationContext->getFullName($class)); + + $this->codePrinter->output( + sprintf( + 'ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(%s, %d, %d, %s, %d)', + $this->name, + (int)$this->returnByRef, + $this->functionLike->getNumberOfRequiredParameters(), + $class, + (int)$this->functionLike->areReturnTypesNullCompatible() + ) + ); + + return; + } + + if ($this->functionLike->isVoid()) { + $this->codePrinter->output( + sprintf( + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', + $this->name, + (int)$this->returnByRef, + $this->functionLike->getNumberOfRequiredParameters(), + $this->getReturnType(), + (int)$this->functionLike->areReturnTypesNullCompatible() + ) + ); + + if (!$this->hasParameters()) { + $this->codePrinter->output('ZEND_END_ARG_INFO()'); + } + + $this->codePrinter->outputBlankLine(); + + return; + } + + if ($this->functionLike->isMixed()) { + $this->codePrinter->output( + sprintf( + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, IS_MIXED, %d)', + $this->name, + (int)$this->returnByRef, + $this->functionLike->getNumberOfRequiredParameters(), + (int)$this->functionLike->areReturnTypesNullCompatible() + ) + ); + + return; + } + + if ($this->functionLike->isReturnTypeNullableObject()) { + $this->codePrinter->output( + sprintf( + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)', + $this->name, + (int)$this->returnByRef, + $this->functionLike->getNumberOfRequiredParameters(), + 'MAY_BE_NULL|MAY_BE_OBJECT', + ) + ); + + return; + } + + if ($this->functionLike->isReturnTypeObject()) { + $this->codePrinter->output( + sprintf( + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)', + $this->name, + (int)$this->returnByRef, + $this->functionLike->getNumberOfRequiredParameters(), + 'MAY_BE_OBJECT', + ) + ); + + return; + } + + if (count($this->functionLike->getReturnTypes()) > 1) { + $types = []; + $mayBeTypes = $this->functionLike->getMayBeArgTypes(); + foreach ($this->functionLike->getReturnTypes() as $type => $typeInfo) { + if (!isset($mayBeTypes[$type])) { + continue; + } + + $types[] = $mayBeTypes[$type]; + } + + if (count($types) > 1) { + $this->codePrinter->output( + sprintf( + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)', + $this->name, + (int)$this->returnByRef, + $this->functionLike->getNumberOfRequiredParameters(), + implode('|', $types) + ) + ); + + return; + } + } + + $this->codePrinter->output( + sprintf( + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', + $this->name, + (int)$this->returnByRef, + $this->functionLike->getNumberOfRequiredParameters(), + $this->getReturnType(), + (int)$this->functionLike->areReturnTypesNullCompatible() + ) + ); + } } diff --git a/src/Code/Builder/Struct.php b/src/Code/Builder/Struct.php new file mode 100644 index 0000000000..7128eb4e53 --- /dev/null +++ b/src/Code/Builder/Struct.php @@ -0,0 +1,165 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Code\Builder; + +use Zephir\Exception\InvalidArgumentException; +use Zephir\Exception\RuntimeException; +use Zephir\Types\Types; + +use function sprintf; +use function substr; + +use const PHP_EOL; + +/** + * Represents an internal extension global structure + */ +class Struct +{ + /** + * Struct members definition + * + * ```c + * struct Name { + * key value; + * } + * ``` + */ + protected array $properties = []; + + public function __construct(protected string $name, protected string $simpleName) + { + if (empty($name)) { + throw new InvalidArgumentException('Struct name must not be empty'); + } + } + + public function __toString(): string + { + $code = 'typedef struct ' . $this->name . ' { ' . PHP_EOL; + + foreach ($this->properties as $name => $type) { + $code .= sprintf("\t%s %s;%s", $type, $name, PHP_EOL); + } + + return $code . '} ' . substr($this->name, 1) . ';' . PHP_EOL; + } + + /** + * @param string $field + * @param string $type + * + * @throws InvalidArgumentException + */ + public function addProperty(string $field, string $type): void + { + if (isset($this->properties[$field])) { + throw new InvalidArgumentException('Property was defined more than once'); + } + + $this->properties[$field] = $this->convertToCType($type); + } + + /** + * Returns the C code that initializes the extension global. + * + * @param string $name + * @param array $global + * @param string $namespace + * + * @return string + * + * @throws RuntimeException + * @throws InvalidArgumentException + */ + public function getCDefault(string $name, array $global, string $namespace): string + { + if (!isset($global['default'])) { + throw new RuntimeException('Field "' . $name . '" does not have a default value'); + } + + return match ($global['type']) { + Types::T_BOOL, + Types::T_BOOLEAN => '', + Types::T_STRING => "\t" . $namespace + . '_globals->' . $this->simpleName . '.' . $name + . ' = ZSTR_VAL(zend_string_init(ZEND_STRL("' . $global['default'] . '"), 0));', + Types::T_INT, + Types::T_UINT, + Types::T_LONG, + Types::T_DOUBLE, + Types::T_HASH => "\t" . $namespace + . '_globals->' . $this->simpleName . '.' . $name + . ' = ' . $global['default'] . ';', + default => throw new InvalidArgumentException( + 'Unknown global type: ' . $global['type'] + ), + }; + } + + /** + * Process Globals for phpinfo() page. + * + * @see https://docs.zephir-lang.com/latest/en/globals + * + * @param string $name - global-name + * @param array $global - global structure (type, default...) + * @param string $namespace - global namespace + * + * @return string + */ + public function getInitEntry(string $name, array $global, string $namespace): string + { + $structName = $this->simpleName . '.' . $name; + $iniEntry = $global['ini-entry'] ?? []; + $iniName = $iniEntry['name'] ?? $namespace . '.' . $structName; + $scope = $iniEntry['scope'] ?? 'PHP_INI_ALL'; + + return match ($global['type']) { + Types::T_BOOLEAN, + Types::T_BOOL => 'STD_PHP_INI_BOOLEAN("' . $iniName . '", "' + . (int)(true === $global['default']) . '", ' . $scope + . ', OnUpdateBool, ' . $structName . ', zend_' . $namespace + . '_globals, ' . $namespace . '_globals)', + Types::T_STRING => sprintf( + 'STD_PHP_INI_ENTRY(%s, %s, %s, NULL, %s, %s, %s)', + '"' . $iniName . '"', + '"' . $global['default'] . '"', + $scope, + $structName, + 'zend_' . $namespace . '_globals', + $namespace . '_globals', + ), + default => '', + }; + } + + /** + * Generates the internal c-type according to the php's type. + * + * @throws InvalidArgumentException + */ + protected function convertToCType(string $type): string + { + return match ($type) { + 'boolean', 'bool' => 'zend_bool', + 'hash' => 'HashTable* ', + 'string' => 'zend_string* ', + 'int', 'uint', 'long', 'char', 'uchar', 'double' => $type, + default => throw new InvalidArgumentException( + 'Unknown global type: ' . $type + ), + }; + } +} diff --git a/Library/CodePrinter.php b/src/Code/Printer.php similarity index 54% rename from Library/CodePrinter.php rename to src/Code/Printer.php index 0c4aa3a25b..becefca803 100644 --- a/Library/CodePrinter.php +++ b/src/Code/Printer.php @@ -11,228 +11,157 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Code; + +use function explode; +use function preg_replace; +use function str_repeat; +use function trim; + +use const PHP_EOL; /** * Buffers code, making it look pretty */ -class CodePrinter +class Printer { - protected string $code = ''; - - protected string $lastLine = ''; - - protected int $level = 0; - - protected int $currentPrints = 0; + protected string $code = ''; + protected int $currentPrints = 0; + protected string $lastLine = ''; + protected int $level = 0; /** - * Adds a line to the output without the automatic line feed. - * - * @param string $code + * Frees memory used within the code. */ - public function outputNoLineFeed(string $code): void + public function clear(): void { - $this->lastLine = $code; - $this->code .= str_repeat("\t", $this->level).$code; + $this->code = ''; + $this->lastLine = ''; + $this->level = 0; } /** - * Add code to the output at the beginning. - * - * @param string $code + * Decrease the indentation level. */ - public function preOutput(string $code): void + public function decreaseLevel(): void { - $this->lastLine = $code; - $this->code = str_repeat("\t", $this->level).$code.PHP_EOL.$this->code; - ++$this->currentPrints; + --$this->level; } /** - * Adds a line to the output without the automatic line feed. - * - * @param string $code + * Returns an approximate number of lines printed by the CodePrinter. */ - public function preOutputNoLineFeed(string $code): void + public function getNumberPrints(): int { - $this->lastLine = $code; - $this->code = str_repeat("\t", $this->level).$code.$this->code; + return $this->currentPrints; } /** - * Adds code to the output without the indentation level. - * - * @param string $code + * Returns the output in the buffer. */ - public function preOutputNoLevel(string $code): void + public function getOutput(): string { - $this->lastLine = $code; - $this->code = $code.PHP_EOL.$this->code; - ++$this->currentPrints; + return $this->code; } /** - * Add code to the output without indentation. - * - * @param string $code + * Increase the indentation level. */ - public function outputNoIndent(string $code): void + public function increaseLevel(): void { - $this->lastLine = $code; - $this->code .= $code.PHP_EOL; - ++$this->currentPrints; + ++$this->level; } /** * Add code to the output. - * - * @param string $code - * @param bool $appendEOL */ public function output(string $code, bool $appendEOL = true): void { $this->lastLine = $code; - $this->code .= str_repeat("\t", $this->level).$code.($appendEOL ? PHP_EOL : ''); + $this->code .= str_repeat("\t", $this->level) . $code . ($appendEOL ? PHP_EOL : ''); ++$this->currentPrints; } + /** + * Adds a blank line to the output + * Optionally controlling if the blank link must be added if the + * previous line added isn't one blank line too. + */ + public function outputBlankLine(bool $ifPrevNotBlank = false): void + { + if (!$ifPrevNotBlank) { + $this->code .= PHP_EOL; + $this->lastLine = PHP_EOL; + ++$this->currentPrints; + } else { + if (trim($this->lastLine)) { + $this->code .= PHP_EOL; + $this->lastLine = PHP_EOL; + ++$this->currentPrints; + } + } + } + /** * Adds a comment to the output with indentation level. - * - * @param $docblock - * @param bool $replaceTab */ public function outputDocBlock($docblock, bool $replaceTab = true): void { - $code = ''; - $docblock = '/'.$docblock.'/'; + $code = ''; + $docblock = '/' . $docblock . '/'; foreach (explode("\n", $docblock) as $line) { if ($replaceTab) { - $code .= str_repeat("\t", $this->level).preg_replace('/^[ \t]+/', ' ', $line).PHP_EOL; + $code .= str_repeat("\t", $this->level) . preg_replace('/^[ \t]+/', ' ', $line) . PHP_EOL; } else { - $code .= $line.PHP_EOL; + $code .= $line . PHP_EOL; } } $this->lastLine = $code; - $this->code .= $code; + $this->code .= $code; ++$this->currentPrints; } /** - * Adds code to the output without the indentation level. - * - * @param string $code + * Add code to the output without indentation. */ - public function outputNoLevel(string $code): void + public function outputNoIndent(string $code): void { $this->lastLine = $code; - $this->code .= $code.PHP_EOL; + $this->code .= $code . PHP_EOL; ++$this->currentPrints; } /** - * Adds a blank line to the output - * Optionally controlling if the blank link must be added if the - * previous line added isn't one blank line too. + * Add code to the output at the beginning. * - * @param bool $ifPrevNotBlank + * @param string $code */ - public function preOutputBlankLine(bool $ifPrevNotBlank = false): void + public function preOutput(string $code): void { - if (!$ifPrevNotBlank) { - $this->code = PHP_EOL.$this->code; - $this->lastLine = PHP_EOL; - ++$this->currentPrints; - } else { - if (trim($this->lastLine)) { - $this->code = PHP_EOL.$this->code; - $this->lastLine = PHP_EOL; - ++$this->currentPrints; - } - } + $this->lastLine = $code; + $this->code = str_repeat("\t", $this->level) . $code . PHP_EOL . $this->code; + ++$this->currentPrints; } /** * Adds a blank line to the output * Optionally controlling if the blank link must be added if the * previous line added isn't one blank line too. - * - * @param bool $ifPrevNotBlank */ - public function outputBlankLine(bool $ifPrevNotBlank = false): void + public function preOutputBlankLine(bool $ifPrevNotBlank = false): void { if (!$ifPrevNotBlank) { - $this->code .= PHP_EOL; + $this->code = PHP_EOL . $this->code; $this->lastLine = PHP_EOL; ++$this->currentPrints; } else { if (trim($this->lastLine)) { - $this->code .= PHP_EOL; + $this->code = PHP_EOL . $this->code; $this->lastLine = PHP_EOL; ++$this->currentPrints; } } } - - /** - * Increase the indentation level. - */ - public function increaseLevel(): void - { - ++$this->level; - } - - /** - * Decrease the indentation level. - */ - public function decreaseLevel(): void - { - --$this->level; - } - - public function setLevel(int $level): void - { - $this->level = $level; - } - - /** - * Returns the output in the buffer. - * - * @return string - */ - public function getOutput(): string - { - return $this->code; - } - - /** - * Returns an approximate number of lines printed by the CodePrinter. - * - * @return int - */ - public function getNumberPrints(): int - { - return $this->currentPrints; - } - - /** - * Frees memory used within the code. - */ - public function clear(): void - { - $this->code = ''; - $this->lastLine = ''; - $this->level = 0; - } - - public function duplicate(): self - { - $printer = new self(); - $printer->setLevel($this->level); - - return $printer; - } } diff --git a/Library/CompilationContext.php b/src/CompilationContext.php similarity index 58% rename from Library/CompilationContext.php rename to src/CompilationContext.php index db3b7d1622..b189e607be 100644 --- a/Library/CompilationContext.php +++ b/src/CompilationContext.php @@ -14,227 +14,135 @@ namespace Zephir; use Psr\Log\LoggerInterface; +use Zephir\Backend\Backend; use Zephir\Cache\FunctionCache; +use Zephir\Cache\Manager; +use Zephir\Class\Definition\AbstractDefinition; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; +use Zephir\Code\Printer; use Zephir\Exception\CompilerException; use Zephir\Passes\StaticTypeInference; +use function in_array; +use function sprintf; + /** * This class encapsulates important entities required during compilation */ class CompilationContext { /** - * @var EventsManager|null - */ - public ?EventsManager $eventsManager = null; - - /** - * Compiler. - * - * @var Compiler|null - */ - public ?Compiler $compiler = null; - - /** - * Current code printer. - * - * @var CodePrinter|null + * Manages class renaming using keyword 'use'. */ - public ?CodePrinter $codePrinter = null; - - /** - * Whether the current method is static or not. - * - * @var bool - */ - public bool $staticContext = false; - + public ?AliasManager $aliasManager = null; /** - * Code printer for the header. - * - * @var CodePrinter|null + * The current backend. */ - public ?CodePrinter $headerPrinter = null; - + public ?Backend $backend = null; /** - * Current symbol table. - * - * @var SymbolTable|null + * Helps to create graphs of conditional/jump branches in a specific method. */ - public ?SymbolTable $symbolTable = null; - + public ?BranchManager $branchManager = null; /** - * Type inference data. - * - * @var StaticTypeInference|null + * Manages both function and method call caches. */ - public ?StaticTypeInference $typeInference = null; - + public ?Manager $cacheManager = null; /** * Represents the class currently being compiled. - * - * @var ClassDefinition|null - */ - public ?ClassDefinition $classDefinition = null; - - /** - * Current method or function that being compiled. - * - * @var ClassMethod|FunctionDefinition|null */ - public ?ClassMethod $currentMethod = null; - + public ?Definition $classDefinition = null; /** - * Methods warm-up. - * - * @var MethodCallWarmUp|null + * Current code printer. */ - public ?MethodCallWarmUp $methodWarmUp = null; - + public ?Printer $codePrinter = null; + public ?Compiler $compiler = null; /** - * Represents the c-headers added to the file. - * - * @var HeadersManager|null - */ - public ?HeadersManager $headersManager = null; - - /** - * Represents interned strings and concatenations made in the project. - * - * @var StringsManager|null + * Global config. */ - public ?StringsManager $stringsManager = null; - + public ?Config $config = null; /** - * Tells if the the compilation is being made inside a cycle/loop. - * - * @var int + * The current branch, variables declared in conditional branches + * must be market if they're used out of those branches. */ - public int $insideCycle = 0; - + public int $currentBranch = 0; /** - * Tells if the the compilation is being made inside a try/catch block. - * - * @var int + * Current method or function that being compiled. */ - public int $insideTryCatch = 0; - + public ?Method $currentMethod = null; /** - * Tells if the the compilation is being made inside a switch. - * - * @var int + * Global consecutive for try/catch blocks. */ - public int $insideSwitch = 0; - + public int $currentTryCatch = 0; /** * Current cycle/loop block. - * - * @var array */ public array $cycleBlocks = []; - /** - * The current branch, variables declared in conditional branches - * must be market if they're used out of those branches. - */ - public int $currentBranch = 0; - - /** - * Global consecutive for try/catch blocks. - * - * @var int + * Function Cache. */ - public int $currentTryCatch = 0; - + public ?FunctionCache $functionCache = null; /** - * Helps to create graphs of conditional/jump branches in a specific method. - * - * @var BranchManager|null + * Code printer for the header. */ - public ?BranchManager $branchManager = null; - + public ?Printer $headerPrinter = null; /** - * Manages both function and method call caches. - * - * @var CacheManager|null + * Represents the c-headers added to the file. */ - public ?CacheManager $cacheManager = null; - + public ?HeadersManager $headersManager = null; /** - * Manages class renamings using keyword 'use'. - * - * @var AliasManager|null + * Tells if the compilation is being made inside a cycle/loop. */ - public ?AliasManager $aliasManager = null; - + public int $insideCycle = 0; /** - * Function Cache. - * - * @var FunctionCache|null + * Tells if the compilation is being made inside a switch. */ - public ?FunctionCache $functionCache = null; - + public int $insideSwitch = 0; /** - * Global config. - * - * @var Config|null + * Tells if the compilation is being made inside a try/catch block. */ - public ?Config $config = null; - + public int $insideTryCatch = 0; /** * Global logger. - * - * @var LoggerInterface|null */ public ?LoggerInterface $logger = null; - /** - * The current backend. - * - * @var BaseBackend|null + * Whether the current method is static or not. */ - public ?BaseBackend $backend = null; - + public bool $staticContext = false; /** - * Transform class/interface name to FQN format. - * - * @param string $className - * - * @return string + * Represents interned strings and concatenations made in the project. */ - public function getFullName(string $className): string - { - $isFunction = $this->currentMethod && $this->currentMethod instanceof FunctionDefinition; - $namespace = $isFunction ? $this->currentMethod->getNamespace() : $this->classDefinition->getNamespace(); - - return fqcn($className, $namespace, $this->aliasManager); - } + public ?StringsManager $stringsManager = null; + /** + * Current symbol table. + */ + public ?SymbolTable $symbolTable = null; + /** + * Type inference data. + */ + public ?StaticTypeInference $typeInference = null; /** * Lookup a class from a given class name. - * - * @param string $className - * @param array|null $statement - * - * @return ClassDefinition */ - public function classLookup(string $className, array $statement = null): ClassDefinition + public function classLookup(string $className, array $statement = null): AbstractDefinition { - if (!\in_array($className, ['self', 'static', 'parent'])) { + if (!in_array($className, ['self', 'static', 'parent'])) { $className = $this->getFullName($className); if ($this->compiler->isClass($className)) { return $this->compiler->getClassDefinition($className); } - throw new CompilerException("Cannot locate class '{$className}'", $statement); + throw new CompilerException("Cannot locate class '$className'", $statement); } - if (\in_array($className, ['self', 'static'])) { + if (in_array($className, ['self', 'static'])) { return $this->classDefinition; } $parent = $this->classDefinition->getExtendsClass(); - if (!$parent instanceof ClassDefinition) { + if (!$parent instanceof Definition) { throw new CompilerException( sprintf( 'Cannot access parent:: because class %s does not extend any class', @@ -246,4 +154,15 @@ public function classLookup(string $className, array $statement = null): ClassDe return $this->classDefinition->getExtendsClassDefinition(); } + + /** + * Transform class/interface name to FQN format. + */ + public function getFullName(string $className): string + { + $isFunction = $this->currentMethod instanceof FunctionDefinition; + $namespace = $isFunction ? $this->currentMethod->getNamespace() : $this->classDefinition->getNamespace(); + + return Name::fetchFQN($className, $namespace, $this->aliasManager); + } } diff --git a/Library/CompiledExpression.php b/src/CompiledExpression.php similarity index 68% rename from Library/CompiledExpression.php rename to src/CompiledExpression.php index 46442c1b60..88eb2ea9f0 100644 --- a/Library/CompiledExpression.php +++ b/src/CompiledExpression.php @@ -15,54 +15,44 @@ use Closure; +use function in_array; + /** * This represents a compiled expression, the object can be used to check * if the expression type is able to used in certain types of the application. */ class CompiledExpression implements TypeAwareInterface { - protected string $type; - - protected ?string $code; - - protected ?array $originalExpr; - - /** - * @param string $type - * @param string|null $code - * @param array|null $originalExpr - */ - public function __construct(string $type, ?string $code, ?array $originalExpr = null) + public function __construct(protected string $type, protected mixed $code, protected ?array $originalExpr = null) { - $this->type = $type; - $this->code = $code; - $this->originalExpr = $originalExpr; } /** - * Returns the type of the compiled expression. - * - * @return string + * Returns a C representation for a boolean constant. */ - public function getType(): string + public function getBooleanCode(): mixed { - return $this->type; + if ('true' === $this->code || true === $this->code) { + return '1'; + } + + if ('false' === $this->code || false === $this->code) { + return '0'; + } + + return $this->code; } /** * Returns the code produced by the compiled expression. - * - * @return string|null */ - public function getCode(): ?string + public function getCode(): mixed { return $this->code; } /** * Original AST code that produced the code. - * - * @return array|null */ public function getOriginal(): ?array { @@ -70,54 +60,27 @@ public function getOriginal(): ?array } /** - * Returns a C representation for a boolean constant. - * - * @return string + * Returns the type of the compiled expression. */ - public function getBooleanCode(): string + public function getType(): string { - if ($this->code && ('true' == $this->code || true === $this->code)) { - return '1'; - } - - if ('false' === $this->code || false === $this->code) { - return '0'; - } - - return $this->code; + return $this->type; } /** * Checks if the compiled expression is an integer or compatible type. - * - * @return bool */ public function isIntCompatibleType(): bool { return in_array($this->type, ['int', 'uint', 'long', 'ulong', 'char', 'uchar'], true); } - /** - * Checks if the compiled expression is a char or compatible type. - * - * @return bool - */ - public function isCharCompatibleType(): bool - { - return in_array($this->type, ['char', 'uchar'], true); - } - /** * Resolves an expression * * Some code cannot be directly pushed into the generated source * because it's missing some bound parts, this method resolves the missing parts * returning the generated code. - * - * @param string|null $result - * @param CompilationContext $compilationContext - * - * @return string */ public function resolve(?string $result, CompilationContext $compilationContext): string { diff --git a/Library/Compiler.php b/src/Compiler.php similarity index 70% rename from Library/Compiler.php rename to src/Compiler.php index 601465ecf7..4c691e2be0 100644 --- a/Library/Compiler.php +++ b/src/Compiler.php @@ -18,8 +18,15 @@ use Psr\Log\NullLogger; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; +use ReflectionClass; use ReflectionException; +use Zephir\Backend\Backend; +use Zephir\Backend\FcallManagerInterface; +use Zephir\Backend\StringsManager; +use Zephir\Class\Definition\Definition; +use Zephir\Code\ArgInfoDefinition; use Zephir\Code\Builder\Struct; +use Zephir\Code\Printer; use Zephir\Compiler\CompilerFileFactory; use Zephir\Compiler\FileInterface; use Zephir\Exception\CompilerException; @@ -28,257 +35,156 @@ use Zephir\Exception\NotImplementedException; use Zephir\Exception\ParseException; use Zephir\Exception\RuntimeException; -use Zephir\Fcall\FcallManagerInterface; use Zephir\FileSystem\FileSystemInterface; - +use Zephir\FileSystem\HardDisk; +use Zephir\Parser\Manager; + +use function array_filter; +use function array_map; +use function array_merge; +use function array_unique; +use function asort; +use function basename; +use function call_user_func; +use function chmod; +use function class_exists; use function count; +use function defined; use function dirname; +use function exec; +use function explode; use function extension_loaded; +use function file; +use function file_exists; +use function file_get_contents; +use function file_put_contents; +use function filemtime; +use function fwrite; +use function getcwd; +use function getenv; +use function htmlentities; +use function implode; +use function in_array; +use function interface_exists; use function is_array; +use function is_dir; +use function is_readable; use function is_string; +use function krsort; +use function md5; +use function md5_file; +use function mkdir; +use function ob_get_clean; +use function ob_start; +use function phpinfo; +use function preg_match; +use function preg_replace; +use function realpath; +use function sprintf; +use function str_replace; +use function strcasecmp; +use function strip_tags; +use function strlen; +use function strpos; +use function strtolower; +use function strtoupper; +use function substr; +use function trim; +use function ucfirst; +use function unlink; +use function version_compare; use const DIRECTORY_SEPARATOR; +use const INFO_GENERAL; +use const PHP_EOL; +use const PHP_INT_SIZE; +use const ZEND_THREAD_SAFE; +use const SORT_STRING; +use const STDERR; final class Compiler { use LoggerAwareTrait; - /** - * @var BaseBackend - */ - public BaseBackend $backend; - /** * @var FunctionDefinition[] */ - public array $functionDefinitions = []; - - /** - * @var CompilerFile[] - */ - private array $files = []; - - /** - * @var string[] - */ - private array $anonymousFiles = []; - - /** - * Additional initializer code. - * Used for static property initialization. - * - * @var array - */ - private array $internalInitializers = []; - + public array $functionDefinitions = []; + private array $anonymousFiles = []; + private array $compiledFiles = []; + private array $constants = []; /** - * @var ClassDefinition[] + * @var Definition[] */ - private array $definitions = []; - + private array $definitions = []; + private array $externalDependencies = []; + private array $extraFiles = []; + private FcallManagerInterface $fcallManager; /** - * @var string[] + * @var CompilerFile[] */ - private array $compiledFiles = []; - - private array $constants = []; - + private array $files = []; private array $globals = []; - - private array $externalDependencies = []; - /** - * @var ClassDefinition[] + * @var Definition[] */ private static array $internalDefinitions = []; - - /** - * @var bool - */ - private static bool $loadedPrototypes = false; - - /** - * @var array - */ - private array $extraFiles = []; - /** - * @var Config - */ - private Config $config; - - /** - * @var Parser\Manager - */ - private Parser\Manager $parserManager; - - /** - * @var StringsManager + * Additional initializer code. + * Used for static property initialization. */ + private array $internalInitializers = []; + private static bool $loadedPrototypes = false; + private ?string $optimizersPath; + private ?string $prototypesPath; private StringsManager $stringManager; + private ?string $templatesPath; - /** - * @var FcallManagerInterface - */ - private FcallManagerInterface $fcallManager; - - /** - * @var string|null - */ - private ?string $prototypesPath; - - /** - * @var string|null - */ - private ?string $optimizersPath; - - /** - * @var string|null - */ - private ?string $templatesPath; - - /** - * @var FileSystemInterface - */ - private FileSystemInterface $filesystem; - - /** - * @var CompilerFileFactory - */ - private CompilerFileFactory $compilerFileFactory; - - /** - * Compiler constructor. - * - * @param Config $config - * @param BaseBackend $backend - * @param Parser\Manager $manager - * @param FileSystemInterface $filesystem - * @param CompilerFileFactory $compilerFileFactory - * - * @throws RuntimeException - */ public function __construct( - Config $config, - BaseBackend $backend, - Parser\Manager $manager, - FileSystemInterface $filesystem, - CompilerFileFactory $compilerFileFactory + private Config $config, + public Backend $backend, + private Manager $parserManager, + private FileSystemInterface $filesystem, + private CompilerFileFactory $compilerFileFactory, ) { - $this->config = $config; - $this->backend = $backend; - $this->parserManager = $manager; - $this->filesystem = $filesystem; - $this->compilerFileFactory = $compilerFileFactory; - $this->logger = new NullLogger(); - - $this->stringManager = $this->backend->getStringsManager(); - $this->fcallManager = $this->backend->getFcallManager(); + $this->logger = new NullLogger(); + $this->stringManager = new StringsManager(); + $this->fcallManager = $this->backend->getFcallManager(); try { $this->assertRequiredExtensionsIsPresent(); } catch (RuntimeException $e) { - fwrite(STDERR, trim($e->getMessage()).PHP_EOL); + fwrite(STDERR, trim($e->getMessage()) . PHP_EOL); exit(1); } } /** - * @param string $prototypesPath - */ - public function setPrototypesPath(string $prototypesPath): void - { - $this->prototypesPath = $prototypesPath; - } - - /** - * Resolves path to the internal prototypes. - * - * @return string - * - * @throws IllegalStateException in case of absence internal prototypes directory - */ - private function resolvePrototypesPath(): ?string - { - $prototypesPath = $this->prototypesPath; - - // fallback - if (empty($prototypesPath)) { - $prototypesPath = dirname(__DIR__).'/prototypes'; - } - - if (!is_dir($prototypesPath) || !is_readable($prototypesPath)) { - throw new IllegalStateException('Unable to resolve internal prototypes directory.'); - } - - return $prototypesPath; - } - - /** - * @param string $optimizersPath - */ - public function setOptimizersPath(string $optimizersPath): void - { - $this->optimizersPath = $optimizersPath; - } - - /** - * Resolves path to the internal optimizers. - * - * @return string - * - * @throws IllegalStateException in case of absence internal optimizers directory - */ - private function resolveOptimizersPath(): ?string - { - $optimizersPath = $this->optimizersPath; - - // fallback - if (empty($optimizersPath)) { - $optimizersPath = __DIR__.'/Optimizers'; - } - - if (!is_dir($optimizersPath) || !is_readable($optimizersPath)) { - throw new IllegalStateException('Unable to resolve internal optimizers directory.'); - } - - return $optimizersPath; - } - - /** - * @param string $templatesPath + * Inserts an anonymous class definition in the compiler. */ - public function setTemplatesPath(string $templatesPath): void + public function addClassDefinition(CompilerFileAnonymous $file, Definition $classDefinition): void { - $this->templatesPath = $templatesPath; + $this->definitions[$classDefinition->getCompleteName()] = $classDefinition; + $this->anonymousFiles[$classDefinition->getCompleteName()] = $file; } /** - * Gets the Zephir Parser Manager. - * - * @deprecated - * - * @return Parser\Manager + * Adds an external dependency to the compiler. */ - public function getParserManager(): Parser\Manager + public function addExternalDependency(string $namespace, string $location): void { - return $this->parserManager; + $this->externalDependencies[$namespace] = $location; } /** * Adds a function to the function definitions. - * - * @param FunctionDefinition $func - * @param array|null $statement - * - * @throws CompilerException */ - public function addFunction(FunctionDefinition $func, array $statement = []) + public function addFunction(FunctionDefinition $func, array $statement = []): void { $funcName = strtolower($func->getInternalName()); if (isset($this->functionDefinitions[$funcName])) { throw new CompilerException( - "Function '".$func->getCompleteName()."' was defined more than one time", + "Function '" . $func->getCompleteName() . "' was defined more than one time", $statement ); } @@ -287,1867 +193,1864 @@ public function addFunction(FunctionDefinition $func, array $statement = []) } /** - * Loads a class definition in an external dependency. - * - * @param string $className - * @param string $location - * - * @return bool + * Generate a HTML API. * - * @throws CompilerException - * @throws IllegalStateException - * @throws ParseException + * @throws ConfigException + * @throws Exception + * @throws ReflectionException */ - public function loadExternalClass(string $className, string $location): bool + public function api(array $options = [], bool $fromGenerate = false): void { - $filePath = $location.DIRECTORY_SEPARATOR.strtolower(str_replace('\\', DIRECTORY_SEPARATOR, $className)).'.zep'; - - /** - * Fix the class name. - */ - $className = implode('\\', array_map('ucfirst', explode('\\', $className))); - - if (isset($this->files[$className])) { - return true; - } - - if (!file_exists($filePath)) { - return false; + if (!$fromGenerate) { + $this->generate(); } - /** @var CompilerFile|CompilerFileAnonymous $compilerFile */ - $compilerFile = $this->compilerFileFactory->create($className, $filePath); - $compilerFile->setIsExternal(true); - $compilerFile->preCompile($this); + $templatesPath = $this->templatesPath ?: dirname(__DIR__) . '/templates'; - $this->files[$className] = $compilerFile; - $this->definitions[$className] = $compilerFile->getClassDefinition(); + $documentator = new Documentation($this->files, $this->config, $templatesPath, $options); + $documentator->setLogger($this->logger); - return true; + $this->logger->info('Generating API into ' . $documentator->getOutputDirectory()); + $documentator->build(); } - /** - * Allows to check if a class is part of the compiled extension. - * - * @param string $className - * - * @return bool - */ - public function isClass(string $className): bool + public function calculateDependencies(array $files, $_dependency = null): void { - foreach ($this->definitions as $key => $value) { - if (!strcasecmp($key, $className) && 'class' === $value->getType()) { - return true; - } - } - /** - * Try to autoload the class from an external dependency + * Classes are ordered according to a dependency ranking + * Classes with higher rank, need to be initialized first + * We first build a dependency tree and then set the rank accordingly */ - foreach ($this->externalDependencies as $namespace => $location) { - if (preg_match('#^'.$namespace.'\\\\#i', $className)) { - return $this->loadExternalClass($className, $location); + if (null === $_dependency) { + $dependencyTree = []; + foreach ($files as $file) { + if (!$file->isExternal()) { + $classDefinition = $file->getClassDefinition(); + $dependencyTree[$classDefinition->getCompleteName()] = $classDefinition->getDependencies(); + } } - } - - return false; - } - /** - * Allows checking if an interface is part of the compiled extension. - * - * @param string $className - * - * @return bool - * - * @throws CompilerException - * @throws IllegalStateException - * @throws ParseException - */ - public function isInterface(string $className): bool - { - foreach ($this->definitions as $key => $value) { - if (!strcasecmp($key, $className) && 'interface' === $value->getType()) { - return true; + // Make sure the dependencies are loaded first (recursively) + foreach ($dependencyTree as $dependencies) { + foreach ($dependencies as $dependency) { + $dependency->increaseDependencyRank(0); + $this->calculateDependencies($dependencyTree, $dependency); + } } + + return; } - /** - * Try to autoload the class from an external dependency - */ - foreach ($this->externalDependencies as $namespace => $location) { - if (preg_match('#^'.$namespace.'\\\\#i', $className)) { - return $this->loadExternalClass($className, $location); + $dependencyTree = $files; + if (isset($dependencyTree[$_dependency->getCompleteName()])) { + foreach ($dependencyTree[$_dependency->getCompleteName()] as $dependency) { + $dependency->increaseDependencyRank(0); + $this->calculateDependencies($dependencyTree, $dependency); } } - - return false; } /** - * Allows checking if a class is part of PHP. - * - * @param string $className + * Check if the project must be phpized again. * * @return bool */ - public function isBundledClass(string $className): bool + public function checkIfPhpized(): bool { - return class_exists($className, false); + return !file_exists('ext/Makefile'); } /** - * Allows checking if an interface is part of PHP. + * Compiles the extension without installing it. * - * @param string $className + * @param bool $development + * @param int|null $jobs * - * @return bool + * @throws Exception */ - public function isBundledInterface(string $className): bool + public function compile(bool $development = false, int $jobs = null): void { - return interface_exists($className, false); - } + $jobs = $jobs ?: 2; - /** - * Returns class the class definition from a given class name. - * - * @param string $className - * - * @return ClassDefinition|false returns false if no class definition is found - */ - public function getClassDefinition(string $className) - { - foreach ($this->definitions as $key => $value) { - if (!strcasecmp($key, $className)) { - return $value; - } + /** + * Get global namespace. + */ + $namespace = str_replace('\\', '_', $this->checkDirectory()); + $extensionName = $this->config->get('extension-name'); + if (empty($extensionName) || !is_string($extensionName)) { + $extensionName = $namespace; } - return false; - } - - /** - * Inserts an anonymous class definition in the compiler. - * - * @param CompilerFileAnonymous $file - * @param ClassDefinition $classDefinition - */ - public function addClassDefinition(CompilerFileAnonymous $file, ClassDefinition $classDefinition) - { - $this->definitions[$classDefinition->getCompleteName()] = $classDefinition; - $this->anonymousFiles[$classDefinition->getCompleteName()] = $file; - } - - /** - * Returns class the class definition from a given class name. - * - * @param string $className - * - * @return ClassDefinition - * - * @throws ReflectionException - */ - public function getInternalClassDefinition(string $className): ClassDefinition - { - if (!isset(self::$internalDefinitions[$className])) { - $reflection = new \ReflectionClass($className); - self::$internalDefinitions[$className] = ClassDefinition::buildFromReflection($reflection); + $currentDir = getcwd(); + if (file_exists("$currentDir/compile.log")) { + unlink("$currentDir/compile.log"); } - return self::$internalDefinitions[$className]; - } - - /** - * Checks if $name is a Zephir constant. - * - * @param string $name - * - * @return bool - */ - public function isConstant(string $name): bool - { - return isset($this->constants[$name]); - } - - /** - * Returns a Zephir Constant by its name. - * - * @param string $name - * - * @return mixed - */ - public function getConstant(string $name) - { - return $this->constants[$name]; - } - - /** - * Sets extensions globals. - * - * @param array $globals - */ - public function setExtensionGlobals(array $globals) - { - foreach ($globals as $key => $value) { - $this->globals[$key] = $value; + if (file_exists("$currentDir/compile-errors.log")) { + unlink("$currentDir/compile-errors.log"); } - } - /** - * Checks if a specific extension global is defined. - * - * @param string $name - * - * @return bool - */ - public function isExtensionGlobal(string $name): bool - { - return isset($this->globals[$name]); - } - - /** - * Returns a extension global by its name. - * - * @param string $name - * - * @return array - */ - public function getExtensionGlobal(string $name): array - { - return $this->globals[$name]; - } - - /** - * Returns GCC flags for current compilation. - * - * @param bool $development - * - * @return string - */ - public function getGccFlags(bool $development = false): string - { - if (is_windows()) { - // TODO - return ''; + if (file_exists("$currentDir/ext/modules/{$namespace}.so")) { + unlink("$currentDir/ext/modules/{$namespace}.so"); } - $gccFlags = getenv('CFLAGS'); + if (Os::isWindows()) { + // TODO(klay): Make this better. Looks like it is non standard Env. Var + exec('cd ext && %PHP_DEVPACK%\\phpize --clean', $output, $exit); - if (!is_string($gccFlags)) { - if (false === $development) { - $gccVersion = $this->getGccVersion(); - if (version_compare($gccVersion, '4.6.0', '>=')) { - $gccFlags = '-O2 -fvisibility=hidden -Wparentheses -flto -DZEPHIR_RELEASE=1'; - } else { - $gccFlags = '-O2 -fvisibility=hidden -Wparentheses -DZEPHIR_RELEASE=1'; - } - } else { - $gccFlags = '-O0 -g3'; + $releaseFolder = $this->getWindowsReleaseDir(); + if (file_exists($releaseFolder)) { + exec('rd /s /q ' . $releaseFolder, $output, $exit); } - } - return $gccFlags; - } + $this->logger->info('Preparing for PHP compilation...'); + // TODO(klay): Make this better. Looks like it is non standard Env. Var + exec('cd ext && %PHP_DEVPACK%\\phpize', $output, $exit); - /** - * Returns the php include directories returned by php-config. - * - * @return string - */ - public function getPhpIncludeDirs(): string - { - $this->filesystem->system('php-config --includes', 'stdout', 'php-includes'); + /** + * fix until patch hits all supported PHP builds. + * + * @see https://github.com/php/php-src/commit/9a3af83ee2aecff25fd4922ef67c1fb4d2af6201 + */ + $fixMarker = '/* zephir_phpize_fix */'; - return trim($this->filesystem->read('php-includes')); - } + $configureFile = file_get_contents('ext\\configure.js'); + $configureFix = ["var PHP_ANALYZER = 'disabled';", "var PHP_PGO = 'no';", "var PHP_PGI = 'no';"]; + $hasChanged = false; - /** - * Pre-compile headers to speed up compilation. - */ - public function preCompileHeaders() - { - if (is_windows()) { - // TODO: Add Windows support - return; - } + if (!str_contains($configureFile, $fixMarker)) { + $configureFile = $fixMarker . PHP_EOL . implode(PHP_EOL, $configureFix) . PHP_EOL . $configureFile; + $hasChanged = true; + } - $phpIncludes = $this->getPhpIncludeDirs(); + /* fix php's broken phpize patching ... */ + $marker = 'var build_dir = (dirname ? dirname : "").replace(new RegExp("^..\\\\\\\\"), "");'; + $pos = strpos($configureFile, $marker); + if (false !== $pos) { + $spMarker = 'if (MODE_PHPIZE) {'; + $sp = strpos($configureFile, $spMarker, $pos - 200); + if (false === $sp) { + throw new CompilerException('outofdate... phpize seems broken again'); + } + $configureFile = substr($configureFile, 0, $sp) . + 'if (false) {' . substr($configureFile, $sp + strlen($spMarker)); + $hasChanged = true; + } - /** @var DirectoryIterator $file */ - foreach (new DirectoryIterator('ext/kernel') as $file) { - if ($file->isDir() || $file->getExtension() !== 'h') { - continue; + if ($hasChanged) { + file_put_contents('ext\\configure.js', $configureFile); } - $command = sprintf( - 'cd ext && gcc -c kernel/%s -I. %s -o kernel/%s.gch', - $file->getBaseName(), - $phpIncludes, - $file->getBaseName() + $this->logger->info('Preparing configuration file...'); + exec('cd ext && configure --enable-' . $extensionName); + } else { + exec('cd ext && make clean && phpize --clean', $output, $exit); + $this->logger->info('Preparing for PHP compilation...'); + exec('cd ext && phpize', $output, $exit); + $this->logger->info('Preparing configuration file...'); + + exec( + 'cd ext && export CC="gcc" && export CFLAGS="' . + $this->getGccFlags($development) . + '" && ./configure --enable-' . + $extensionName ); + } - $path = $file->getRealPath(); - if (!file_exists($path.'.gch') || filemtime($path) > filemtime($path.'.gch')) { - $this->filesystem->system($command, 'stdout', 'compile-header'); - } + $currentDir = getcwd(); + $this->logger->info('Compiling...'); + if (Os::isWindows()) { + exec( + 'cd ext && nmake 2>' . $currentDir . '\compile-errors.log 1>' . + $currentDir . '\compile.log', + $output, + $exit + ); + } else { + $this->preCompileHeaders(); + exec( + 'cd ext && (make -s -j' . $jobs . ' 2>' . $currentDir . '/compile-errors.log 1>' . + $currentDir . + '/compile.log)', + $output, + $exit + ); } } /** - * Generates the C sources from Zephir without compiling them. - * - * @param bool $fromGenerate + * Create config.m4 and config.w32 for the extension. * - * @return bool + * TODO: move this to backend? * * @throws Exception - * @throws ReflectionException */ - public function generate(bool $fromGenerate = false): bool + public function createConfigFiles(string $project): bool { + $contentM4 = $this->backend->getTemplateFileContents('config.m4'); + if (empty($contentM4)) { + throw new Exception("Template config.m4 doesn't exist"); + } + + $contentW32 = $this->backend->getTemplateFileContents('config.w32'); + if (empty($contentW32)) { + throw new Exception("Template config.w32 doesn't exist"); + } + + $safeProject = 'zend' === $project ? 'zend_' : $project; + + $compiledFiles = array_map(fn($file) => str_replace('.c', '.zep.c', $file), $this->compiledFiles); + /** - * Get global namespace. + * If export-classes is enabled all headers are copied to include/php/ext. */ - $namespace = $this->checkDirectory(); + $exportClasses = $this->config->get('export-classes', 'extra'); + if ($exportClasses) { + $compiledHeaders = array_map(fn($file) => str_replace('.c', '.zep.h', $file), $this->compiledFiles); + } else { + $compiledHeaders = ['php_' . strtoupper($project) . '.h']; + } /** - * Check whether there are external dependencies. + * Check extra-libs, extra-cflags, package-dependencies exists */ - $externalDependencies = $this->config->get('external-dependencies'); - if (is_array($externalDependencies)) { - foreach ($externalDependencies as $dependencyNs => $location) { - if (!file_exists($location)) { - throw new CompilerException( - sprintf( - 'Location of dependency "%s" does not exist. Check the config.json for more information.', - $dependencyNs - ) - ); - } + $extraLibs = (string)$this->config->get('extra-libs'); + $extraCflags = (string)$this->config->get('extra-cflags'); + $contentM4 = $this->generatePackageDependenciesM4($contentM4); - $this->addExternalDependency($dependencyNs, $location); + $buildDirs = []; + + foreach ($compiledFiles as $file) { + $dir = dirname($file); + + if (!in_array($dir, $buildDirs)) { + $buildDirs[] = $dir; } } - /** - * Round 1. pre-compile all files in memory - */ - $this->recursivePreCompile(str_replace('\\', DIRECTORY_SEPARATOR, $namespace)); - if (!count($this->files)) { - throw new Exception( - "Zephir files to compile couldn't be found. Did you add a first class to the extension?" - ); - } + asort($buildDirs); /** - * Round 2. Check 'extends' and 'implements' dependencies + * Generate config.m4. */ - foreach ($this->files as $compileFile) { - $compileFile->checkDependencies($this); + $toReplace = [ + '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), + '%PROJECT_LOWER%' => strtolower($project), + '%PROJECT_UPPER%' => strtoupper($project), + '%PROJECT_CAMELIZE%' => ucfirst($project), + '%FILES_COMPILED%' => implode("\n\t", $this->toUnixPaths($compiledFiles)), + '%HEADERS_COMPILED%' => implode(' ', $this->toUnixPaths($compiledHeaders)), + '%EXTRA_FILES_COMPILED%' => implode("\n\t", $this->toUnixPaths($this->extraFiles)), + '%PROJECT_EXTRA_LIBS%' => $extraLibs, + '%PROJECT_EXTRA_CFLAGS%' => $extraCflags, + '%PROJECT_BUILD_DIRS%' => implode(' ', $buildDirs), + ]; + + foreach ($toReplace as $mark => $replace) { + $contentM4 = str_replace($mark, $replace, $contentM4); } + HardDisk::persistByHash($contentM4, 'ext/config.m4'); + /** - * Sort the files by dependency ranking. + * Generate config.w32. */ - $files = []; - $rankedFiles = []; - $this->calculateDependencies($this->files); - - foreach ($this->files as $rankFile) { - $rank = $rankFile->getClassDefinition()->getDependencyRank(); - $rankedFiles[$rank][] = $rankFile; - } + $toReplace = [ + '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), + '%PROJECT_LOWER%' => strtolower($project), + '%PROJECT_UPPER%' => strtoupper($project), + '%FILES_COMPILED%' => implode( + "\r\n\t", + $this->processAddSources($compiledFiles, strtolower($project)) + ), + '%EXTRA_FILES_COMPILED%' => implode( + "\r\n\t", + $this->processAddSources($this->extraFiles, strtolower($project)) + ), + ]; - krsort($rankedFiles); - foreach ($rankedFiles as $rankFiles) { - $files = array_merge($files, $rankFiles); + foreach ($toReplace as $mark => $replace) { + $contentW32 = str_replace($mark, $replace, $contentW32); } - $this->files = $files; - /** - * Convert C-constants into PHP constants. - */ - $constantsSources = $this->config->get('constants-sources'); - if (is_array($constantsSources)) { - $this->loadConstantsSources($constantsSources); - } + $needConfigure = HardDisk::persistByHash($contentW32, 'ext/config.w32'); /** - * Set extension globals. + * php_ext.h. */ - $globals = $this->config->get('globals'); - if (is_array($globals)) { - $this->setExtensionGlobals($globals); + $content = $this->backend->getTemplateFileContents('php_ext.h'); + if (empty($content)) { + throw new Exception("Template php_ext.h doesn't exist"); } - /** - * Load function optimizers - */ - if (false === self::$loadedPrototypes) { - $optimizersPath = $this->resolveOptimizersPath(); - FunctionCall::addOptimizerDir("{$optimizersPath}/FunctionCall"); - - $customOptimizersPaths = $this->config->get('optimizer-dirs'); - if (is_array($customOptimizersPaths)) { - foreach ($customOptimizersPaths as $directory) { - FunctionCall::addOptimizerDir(realpath($directory)); - } - } - - /** - * Load additional extension prototypes. - */ - $prototypesPath = $this->resolvePrototypesPath(); - foreach (new DirectoryIterator($prototypesPath) as $file) { - if ($file->isDir() || $file->isDot()) { - continue; - } - - // Do not use $file->getRealPath() because it does not work inside phar - $realPath = "{$file->getPath()}/{$file->getFilename()}"; - $extension = $file->getBasename(".{$file->getExtension()}"); - - if (!extension_loaded($extension)) { - require_once $realPath; - } - } - - /** - * Load customer additional extension prototypes. - */ - $prototypeDirs = $this->config->get('prototype-dir'); - if (is_array($prototypeDirs)) { - foreach ($prototypeDirs as $prototype => $prototypeDir) { - /** - * Check if the extension is installed - */ - if (!extension_loaded($prototype)) { - $prototypeRealpath = realpath($prototypeDir); - if ($prototypeRealpath) { - foreach (new RecursiveDirectoryIterator($prototypeRealpath) as $file) { - if ($file->isDir()) { - continue; - } - - require_once $file->getRealPath(); - } - } - } - } - } + $toReplace = [ + '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), + ]; - self::$loadedPrototypes = true; + foreach ($toReplace as $mark => $replace) { + $content = str_replace($mark, $replace, $content); } + HardDisk::persistByHash($content, 'ext/php_ext.h'); + /** - * Round 3. Compile all files to C sources. + * ext.h. */ - $files = []; - - $hash = ''; - foreach ($this->files as $compileFile) { - /** - * Only compile classes in the local extension, ignore external classes - */ - if (!$compileFile->isExternal()) { - $compileFile->compile($this, $this->stringManager); - $compiledFile = $compileFile->getCompiledFile(); - - $methods = []; - $classDefinition = $compileFile->getClassDefinition(); - foreach ($classDefinition->getMethods() as $method) { - $methods[] = '['.$method->getName().':'.implode('-', $method->getVisibility()).']'; - if ($method->isInitializer() && $method->isStatic()) { - $this->internalInitializers[] = "\t".$method->getName().'();'; - } - } + $content = $this->backend->getTemplateFileContents('ext.h'); + if (empty($content)) { + throw new Exception("Template ext.h doesn't exist"); + } - $files[] = $compiledFile; + $toReplace = [ + '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), + ]; - $hash .= '|'.$compiledFile.':'.$classDefinition->getClassEntry().'['.implode('|', $methods).']'; - } + foreach ($toReplace as $mark => $replace) { + $content = str_replace($mark, $replace, $content); } + HardDisk::persistByHash($content, 'ext/ext.h'); + /** - * Round 3.2. Compile anonymous classes + * ext_config.h. */ - foreach ($this->anonymousFiles as $compileFile) { - $compileFile->compile($this, $this->stringManager); - $compiledFile = $compileFile->getCompiledFile(); - - $methods = []; - $classDefinition = $compileFile->getClassDefinition(); - foreach ($classDefinition->getMethods() as $method) { - $methods[] = '['.$method->getName().':'.implode('-', $method->getVisibility()).']'; - } + $content = $this->backend->getTemplateFileContents('ext_config.h'); + if (empty($content)) { + throw new Exception("Template ext_config.h doesn't exist"); + } - $files[] = $compiledFile; + $toReplace = [ + '%PROJECT_LOWER%' => strtolower($project), + ]; - $hash .= '|'.$compiledFile.':'.$classDefinition->getClassEntry().'['.implode('|', $methods).']'; + foreach ($toReplace as $mark => $replace) { + $content = str_replace($mark, $replace, $content); } - $hash = md5($hash); - $this->compiledFiles = $files; + HardDisk::persistByHash($content, 'ext/ext_config.h'); /** - * Round 3.3. Load extra C-sources. + * ext_clean. */ - $extraSources = $this->config->get('extra-sources'); - if (is_array($extraSources)) { - $this->extraFiles = $extraSources; - } else { - $this->extraFiles = []; + $content = $this->backend->getTemplateFileContents('clean'); + if (empty($content)) { + throw new Exception("Clean file doesn't exist"); } - /** - * Round 3.4. Load extra classes sources. - */ - $extraClasses = $this->config->get('extra-classes'); - if (is_array($extraClasses)) { - foreach ($extraClasses as $value) { - if (isset($value['source'])) { - $this->extraFiles[] = $value['source']; - } - } + if (HardDisk::persistByHash($content, 'ext/clean')) { + chmod('ext/clean', 0755); } /** - * Round 4. Create config.m4 and config.w32 files / Create project.c and project.h files. + * ext_install. */ - $namespace = str_replace('\\', '_', $namespace); - $extensionName = $this->config->get('extension-name'); - if (empty($extensionName) || !is_string($extensionName)) { - $extensionName = $namespace; + $content = $this->backend->getTemplateFileContents('install'); + if (empty($content)) { + throw new Exception("Install file doesn't exist"); } - $needConfigure = $this->createConfigFiles($extensionName); - $needConfigure |= $this->createProjectFiles($extensionName); - $needConfigure |= $this->checkIfPhpized(); - // Bitwise returns `int` instead of `bool`. - $needConfigure = (bool) $needConfigure; + $toReplace = [ + '%PROJECT_LOWER%' => strtolower($project), + ]; - /** - * When a new file is added or removed we need to run configure again - */ - if (!$fromGenerate) { - if (false === $this->filesystem->exists('compiled-files-sum')) { - $needConfigure = true; - $this->filesystem->write('compiled-files-sum', $hash); - } else { - if ($this->filesystem->read('compiled-files-sum') != $hash) { - $needConfigure = true; - $this->filesystem->delete('compiled-files-sum'); - $this->filesystem->write('compiled-files-sum', $hash); - } - } + foreach ($toReplace as $mark => $replace) { + $content = str_replace($mark, $replace, $content); } - /** - * Round 5. Generate concatenation functions - */ - $this->stringManager->genConcatCode(); - $this->fcallManager->genFcallCode(); - - if ($this->config->get('stubs-run-after-generate', 'stubs')) { - $this->stubs($fromGenerate); + if (HardDisk::persistByHash($content, 'ext/install')) { + chmod('ext/install', 0755); } - return $needConfigure; + return (bool)$needConfigure; } /** - * Compiles the extension without installing it. + * Create project.c and project.h according to the current extension. * - * @param bool $development - * @param int|null $jobs + * TODO: Move the part of the logic which depends on templates (backend-specific) to backend? * * @throws Exception */ - public function compile(bool $development = false, ?int $jobs = null): void + public function createProjectFiles(string $project): bool { - $jobs = $jobs ?: 2; + $needConfigure = $this->checkKernelFiles(); /** - * Get global namespace. + * project.c. */ - $namespace = str_replace('\\', '_', $this->checkDirectory()); - $extensionName = $this->config->get('extension-name'); - if (empty($extensionName) || !is_string($extensionName)) { - $extensionName = $namespace; + $content = $this->backend->getTemplateFileContents('project.c'); + if (empty($content)) { + throw new Exception("Template project.c doesn't exist"); } - $currentDir = getcwd(); - if (file_exists("{$currentDir}/compile.log")) { - unlink("{$currentDir}/compile.log"); - } + $includes = ''; + $reqInitializers = ''; + $reqDestructors = ''; + $prqDestructors = ''; + $modInitializers = ''; + $modDestructors = ''; + $glbInitializers = ''; + $glbDestructors = ''; + $files = array_merge($this->files, $this->anonymousFiles); - if (file_exists("{$currentDir}/compile-errors.log")) { - unlink("{$currentDir}/compile-errors.log"); - } + /** + * Round 1. Calculate the dependency rank + */ + $this->calculateDependencies($files); - if (file_exists("{$currentDir}/ext/modules/{$namespace}.so")) { - unlink("{$currentDir}/ext/modules/{$namespace}.so"); - } + $classEntries = []; + $classInits = []; - if (is_windows()) { - // TODO(klay): Make this better. Looks like it is non standard Env. Var - exec('cd ext && %PHP_DEVPACK%\\phpize --clean', $output, $exit); + $interfaceEntries = []; + $interfaceInits = []; - $releaseFolder = windows_release_dir(); - if (file_exists($releaseFolder)) { - exec('rd /s /q '.$releaseFolder, $output, $exit); + /** + * Round 2. Generate the ZEPHIR_INIT calls according to the dependency rank + */ + /** @var FileInterface $file */ + foreach ($files as $file) { + if ($file->isExternal()) { + continue; } - $this->logger->info('Preparing for PHP compilation...'); - // TODO(klay): Make this better. Looks like it is non standard Env. Var - exec('cd ext && %PHP_DEVPACK%\\phpize', $output, $exit); - - /** - * fix until patch hits all supported PHP builds. - * - * @see https://github.com/php/php-src/commit/9a3af83ee2aecff25fd4922ef67c1fb4d2af6201 - */ - $fixMarker = '/* zephir_phpize_fix */'; - - $configureFile = file_get_contents('ext\\configure.js'); - $configureFix = ["var PHP_ANALYZER = 'disabled';", "var PHP_PGO = 'no';", "var PHP_PGI = 'no';"]; - $hasChanged = false; - - if (false === strpos($configureFile, $fixMarker)) { - $configureFile = $fixMarker.PHP_EOL.implode(PHP_EOL, $configureFix).PHP_EOL.$configureFile; - $hasChanged = true; - } - - /* fix php's broken phpize patching ... */ - $marker = 'var build_dir = (dirname ? dirname : "").replace(new RegExp("^..\\\\\\\\"), "");'; - $pos = strpos($configureFile, $marker); - if (false !== $pos) { - $spMarker = 'if (MODE_PHPIZE) {'; - $sp = strpos($configureFile, $spMarker, $pos - 200); - if (false === $sp) { - throw new CompilerException('outofdate... phpize seems broken again'); - } - $configureFile = substr($configureFile, 0, $sp). - 'if (false) {'.substr($configureFile, $sp + \strlen($spMarker)); - $hasChanged = true; + $classDefinition = $file->getClassDefinition(); + if ($classDefinition === null) { + continue; } - if ($hasChanged) { - file_put_contents('ext\\configure.js', $configureFile); + $dependencyRank = $classDefinition->getDependencyRank(); + if ('class' === $classDefinition->getType()) { + $classEntries[$dependencyRank][] = 'zend_class_entry *' . $classDefinition->getClassEntry() . ';'; + $classInits[$dependencyRank][] = 'ZEPHIR_INIT(' + . $classDefinition->getCNamespace() + . '_' + . $classDefinition->getName() + . ');'; + } else { + $interfaceEntries[$dependencyRank][] = 'zend_class_entry *' . $classDefinition->getClassEntry() . ';'; + $interfaceInits[$dependencyRank][] = 'ZEPHIR_INIT(' + . $classDefinition->getCNamespace() + . '_' + . $classDefinition->getName() + . ');'; } + } - $this->logger->info('Preparing configuration file...'); - exec('cd ext && configure --enable-'.$extensionName); - } else { - exec('cd ext && make clean && phpize --clean', $output, $exit); - $this->logger->info('Preparing for PHP compilation...'); - exec('cd ext && phpize', $output, $exit); - $this->logger->info('Preparing configuration file...'); + krsort($classInits); + krsort($classEntries); + krsort($interfaceInits); + krsort($interfaceEntries); - exec( - 'cd ext && export CC="gcc" && export CFLAGS="'. - $this->getGccFlags($development). - '" && ./configure --enable-'. - $extensionName - ); + $completeInterfaceInits = []; + foreach ($interfaceInits as $rankInterfaceInits) { + asort($rankInterfaceInits, SORT_STRING); + $completeInterfaceInits = array_merge($completeInterfaceInits, $rankInterfaceInits); } - $currentDir = getcwd(); - $this->logger->info('Compiling...'); - if (is_windows()) { - exec( - 'cd ext && nmake 2>'.$currentDir.'\compile-errors.log 1>'. - $currentDir.'\compile.log', - $output, - $exit - ); - } else { - $this->preCompileHeaders(); - exec( - 'cd ext && (make -s -j'.$jobs.' 2>'.$currentDir.'/compile-errors.log 1>'. - $currentDir. - '/compile.log)', - $output, - $exit - ); + $completeInterfaceEntries = []; + foreach ($interfaceEntries as $rankInterfaceEntries) { + asort($rankInterfaceEntries, SORT_STRING); + $completeInterfaceEntries = array_merge($completeInterfaceEntries, $rankInterfaceEntries); } - } - /** - * Generate a HTML API. - * - * @param array $options - * @param bool $fromGenerate - * - * @throws ConfigException - * @throws Exception - * @throws ReflectionException - */ - public function api(array $options = [], bool $fromGenerate = false): void - { - if (!$fromGenerate) { - $this->generate(); + $completeClassInits = []; + foreach ($classInits as $rankClassInits) { + asort($rankClassInits, SORT_STRING); + $completeClassInits = array_merge($completeClassInits, $rankClassInits); } - $templatesPath = $this->templatesPath ?: dirname(__DIR__).'/templates'; - - $documentator = new Documentation($this->files, $this->config, $templatesPath, $options); - $documentator->setLogger($this->logger); - - $this->logger->info('Generating API into '.$documentator->getOutputDirectory()); - $documentator->build(); - } - - /** - * Generate IDE stubs. - * - * @param bool $fromGenerate - * - * @throws Exception - * @throws ReflectionException - */ - public function stubs(bool $fromGenerate = false): void - { - if (!$fromGenerate) { - $this->generate(); + $completeClassEntries = []; + foreach ($classEntries as $rankClassEntries) { + asort($rankClassEntries, SORT_STRING); + $completeClassEntries = array_merge($completeClassEntries, $rankClassEntries); } - $this->logger->info('Generating stubs...'); + /** + * Round 3. Process extension globals + */ + [$globalCode, $globalStruct, $globalsDefault, $initEntries] = $this->processExtensionGlobals($project); + if ('zend' == $project) { + $safeProject = 'zend_'; + } else { + $safeProject = $project; + } - $path = str_replace( - [ - '%version%', - '%namespace%', - ], - [ - $this->config->get('version'), - ucfirst($this->config->get('namespace')), - ], - $this->config->get('path', 'stubs') - ); + /** + * Round 4. Process extension info. + */ + $phpInfo = $this->processExtensionInfo(); - (new Stubs\Generator($this->files))->generate( - $this->config->get('namespace'), - $path, - $this->config->get('indent', 'extra'), - $this->config->get('banner', 'stubs') ?? '' - ); - } + /** + * Round 5. Generate Function entries (FE) + */ + [$feHeader, $feEntries] = $this->generateFunctionInformation(); - /** - * Compiles and installs the extension. - * - * @param bool $development - * - * @throws Exception - * @throws NotImplementedException - * @throws CompilerException - */ - public function install(bool $development = false): void - { - // Get global namespace - $namespace = str_replace('\\', '_', $this->checkDirectory()); - $currentDir = getcwd(); + /** + * Check if there are module/request/global destructors. + */ + $destructors = $this->config->get('destructors'); + if (is_array($destructors)) { + $invokeRequestDestructors = $this->processCodeInjection($destructors, 'request'); + $includes .= PHP_EOL . $invokeRequestDestructors[0]; + $reqDestructors = $invokeRequestDestructors[1]; - if (is_windows()) { - throw new NotImplementedException('Installation is not implemented for Windows yet. Aborting.'); - } + $invokePostRequestDestructors = $this->processCodeInjection($destructors, 'post-request'); + $includes .= PHP_EOL . $invokePostRequestDestructors[0]; + $prqDestructors = $invokePostRequestDestructors[1]; - $this->logger->info('Installing...'); - $gccFlags = $this->getGccFlags($development); + $invokeModuleDestructors = $this->processCodeInjection($destructors, 'module'); + $includes .= PHP_EOL . $invokeModuleDestructors[0]; + $modDestructors = $invokeModuleDestructors[1]; - $command = strtr( - // TODO: Sort out with sudo - 'cd ext && export CC="gcc" && export CFLAGS=":cflags" && '. - 'make 2>> ":stderr" 1>> ":stdout" && '. - 'sudo make install 2>> ":stderr" 1>> ":stdout"', - [ - ':cflags' => $gccFlags, - ':stderr' => "{$currentDir}/compile-errors.log", - ':stdout' => "{$currentDir}/compile.log", - ] - ); + $invokeGlobalsDestructors = $this->processCodeInjection($destructors, 'globals'); + $includes .= PHP_EOL . $invokeGlobalsDestructors[0]; + $glbDestructors = $invokeGlobalsDestructors[1]; + } - array_map(function ($entry) { - if (!empty($entry)) { - $this->logger->debug(trim($entry)); - } - }, explode('&&', $command)); + /** + * Check if there are module/request/global initializers. + */ + $initializers = $this->config->get('initializers'); + if (is_array($initializers)) { + $invokeRequestInitializers = $this->processCodeInjection($initializers, 'request'); + $includes .= PHP_EOL . $invokeRequestInitializers[0]; + $reqInitializers = $invokeRequestInitializers[1]; - exec($command, $output, $exit); - $fileName = $this->config->get('extension-name') ?: $namespace; + $invokeModuleInitializers = $this->processCodeInjection($initializers, 'module'); + $includes .= PHP_EOL . $invokeModuleInitializers[0]; + $modInitializers = $invokeModuleInitializers[1]; - if (false === file_exists("{$currentDir}/ext/modules/{$fileName}.so")) { - throw new CompilerException( - 'Internal extension compilation failed. Check compile-errors.log for more information.' - ); + $invokeGlobalsInitializers = $this->processCodeInjection($initializers, 'globals'); + $includes .= PHP_EOL . $invokeGlobalsInitializers[0]; + $glbInitializers = $invokeGlobalsInitializers[1]; } - } - /** - * Create config.m4 and config.w32 for the extension. - * - * TODO: move this to backend? - * - * @param string $project - * - * @return bool true if we need to run configure - * - * @throws Exception - */ - public function createConfigFiles(string $project): bool - { - $contentM4 = $this->backend->getTemplateFileContents('config.m4'); - if (empty($contentM4)) { - throw new Exception("Template config.m4 doesn't exist"); - } + /** + * Append extra details. + */ + $extraClasses = $this->config->get('extra-classes'); + if (is_array($extraClasses)) { + foreach ($extraClasses as $value) { + if (isset($value['init'])) { + $completeClassInits[] = 'ZEPHIR_INIT(' . $value['init'] . ')'; + } - $contentW32 = $this->backend->getTemplateFileContents('config.w32'); - if (empty($contentW32)) { - throw new Exception("Template config.w32 doesn't exist"); + if (isset($value['entry'])) { + $completeClassEntries[] = 'zend_class_entry *' . $value['entry'] . ';'; + } + } } - $safeProject = 'zend' === $project ? 'zend_' : $project; + $modRequires = array_map( + fn($mod) => sprintf('ZEND_MOD_REQUIRED("%s")', strtolower($mod)), + $this->config->get('extensions', 'requires') ?: [] + ); - $compiledFiles = array_map(function ($file) { - return str_replace('.c', '.zep.c', $file); - }, $this->compiledFiles); + $toReplace = [ + '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), + '%PROJECT_LOWER%' => strtolower($project), + '%PROJECT_UPPER%' => strtoupper($project), + '%PROJECT_CAMELIZE%' => ucfirst($project), + '%CLASS_ENTRIES%' => implode( + PHP_EOL, + array_merge($completeInterfaceEntries, $completeClassEntries) + ), + '%CLASS_INITS%' => implode( + PHP_EOL . "\t", + array_merge($completeInterfaceInits, $completeClassInits) + ), + '%INIT_GLOBALS%' => implode( + PHP_EOL . "\t", + array_merge((array)$globalsDefault[0], [$glbInitializers]) + ), + '%INIT_MODULE_GLOBALS%' => $globalsDefault[1], + '%DESTROY_GLOBALS%' => $glbDestructors, + '%EXTENSION_INFO%' => $phpInfo, + '%EXTRA_INCLUDES%' => implode( + PHP_EOL, + array_unique(explode(PHP_EOL, $includes)) + ), + '%MOD_INITIALIZERS%' => $modInitializers, + '%MOD_DESTRUCTORS%' => $modDestructors, + '%REQ_INITIALIZERS%' => implode( + PHP_EOL . "\t", + array_merge($this->internalInitializers, [$reqInitializers]) + ), + '%REQ_DESTRUCTORS%' => $reqDestructors, + '%POSTREQ_DESTRUCTORS%' => empty($prqDestructors) ? '' : implode( + PHP_EOL, + [ + '#define ZEPHIR_POST_REQUEST 1', + 'static PHP_PRSHUTDOWN_FUNCTION(' . strtolower($project) . ')', + '{', + "\t" . implode( + PHP_EOL . "\t", + explode(PHP_EOL, $prqDestructors) + ), + '}', + ] + ), + '%FE_HEADER%' => $feHeader, + '%FE_ENTRIES%' => $feEntries, + '%PROJECT_INI_ENTRIES%' => implode(PHP_EOL . "\t", $initEntries), + '%PROJECT_DEPENDENCIES%' => implode(PHP_EOL . "\t", $modRequires), + ]; + foreach ($toReplace as $mark => $replace) { + $content = str_replace($mark, $replace, $content); + } /** - * If export-classes is enabled all headers are copied to include/php/ext. + * Round 5. Generate and place the entry point of the project */ - $exportClasses = $this->config->get('export-classes', 'extra'); - if ($exportClasses) { - $compiledHeaders = array_map(function ($file) { - return str_replace('.c', '.zep.h', $file); - }, $this->compiledFiles); - } else { - $compiledHeaders = ['php_'.strtoupper($project).'.h']; - } + HardDisk::persistByHash($content, 'ext/' . $safeProject . '.c'); + unset($content); /** - * Check extra-libs, extra-cflags, package-dependencies exists + * Round 6. Generate the project main header. */ - $extraLibs = (string) $this->config->get('extra-libs'); - $extraCflags = (string) $this->config->get('extra-cflags'); - $contentM4 = $this->generatePackageDependenciesM4($contentM4); - - $buildDirs = []; - - foreach ($compiledFiles as $file) { - $dir = dirname($file); + $content = $this->backend->getTemplateFileContents('project.h'); + if (empty($content)) { + throw new Exception("Template project.h doesn't exists"); + } - if (!in_array($dir, $buildDirs)) { - $buildDirs[] = $dir; + $includeHeaders = []; + foreach ($this->compiledFiles as $file) { + if ($file) { + $fileH = str_replace('.c', '.zep.h', $file); + $include = '#include "' . $fileH . '"'; + $includeHeaders[] = $include; } } - asort($buildDirs); - /** - * Generate config.m4. + * Append extra headers. */ + $extraClasses = $this->config->get('extra-classes'); + if (is_array($extraClasses)) { + foreach ($extraClasses as $value) { + if (isset($value['header'])) { + $include = '#include "' . $value['header'] . '"'; + $includeHeaders[] = $include; + } + } + } + $toReplace = [ - '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), - '%PROJECT_LOWER%' => strtolower($project), - '%PROJECT_UPPER%' => strtoupper($project), - '%PROJECT_CAMELIZE%' => ucfirst($project), - '%FILES_COMPILED%' => implode("\n\t", $this->toUnixPaths($compiledFiles)), - '%HEADERS_COMPILED%' => implode(' ', $this->toUnixPaths($compiledHeaders)), - '%EXTRA_FILES_COMPILED%' => implode("\n\t", $this->toUnixPaths($this->extraFiles)), - '%PROJECT_EXTRA_LIBS%' => $extraLibs, - '%PROJECT_EXTRA_CFLAGS%' => $extraCflags, - '%PROJECT_BUILD_DIRS%' => implode(' ', $buildDirs), + '%INCLUDE_HEADERS%' => implode(PHP_EOL, $includeHeaders), ]; foreach ($toReplace as $mark => $replace) { - $contentM4 = str_replace($mark, $replace, $contentM4); + $content = str_replace($mark, $replace, $content); } - file_put_contents_ex($contentM4, 'ext/config.m4'); + HardDisk::persistByHash($content, 'ext/' . $safeProject . '.h'); + unset($content); /** - * Generate config.w32. + * Round 7. Create php_project.h. */ + $content = $this->backend->getTemplateFileContents('php_project.h'); + if (empty($content)) { + throw new Exception("Template php_project.h doesn't exist"); + } + $toReplace = [ - '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), - '%PROJECT_LOWER%' => strtolower($project), - '%PROJECT_UPPER%' => strtoupper($project), - '%FILES_COMPILED%' => implode( - "\r\n\t", - $this->processAddSources($compiledFiles, strtolower($project)) - ), - '%EXTRA_FILES_COMPILED%' => implode( - "\r\n\t", - $this->processAddSources($this->extraFiles, strtolower($project)) + '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), + '%PROJECT_LOWER%' => strtolower($project), + '%PROJECT_UPPER%' => strtoupper($project), + '%PROJECT_EXTNAME%' => strtolower($project), + '%PROJECT_NAME%' => mb_convert_encoding($this->config->get('name'), 'ISO-8859-1', 'UTF-8'), + '%PROJECT_AUTHOR%' => mb_convert_encoding($this->config->get('author'), 'ISO-8859-1', 'UTF-8'), + '%PROJECT_VERSION%' => mb_convert_encoding($this->config->get('version'), 'ISO-8859-1', 'UTF-8'), + '%PROJECT_DESCRIPTION%' => mb_convert_encoding( + $this->config->get('description'), + 'ISO-8859-1', + 'UTF-8' ), + '%PROJECT_ZEPVERSION%' => Zephir::VERSION, + '%EXTENSION_GLOBALS%' => $globalCode, + '%EXTENSION_STRUCT_GLOBALS%' => $globalStruct, ]; foreach ($toReplace as $mark => $replace) { - $contentW32 = str_replace($mark, $replace, $contentW32); + $content = str_replace($mark, $replace, $content); } - $needConfigure = file_put_contents_ex($contentW32, 'ext/config.w32'); + HardDisk::persistByHash($content, 'ext/php_' . $safeProject . '.h'); + unset($content); + + return $needConfigure; + } + /** + * Generates the C sources from Zephir without compiling them. + * + * @throws Exception + * @throws ReflectionException + */ + public function generate(bool $fromGenerate = false): bool + { /** - * php_ext.h. + * Get global namespace. */ - $content = $this->backend->getTemplateFileContents('php_ext.h'); - if (empty($content)) { - throw new Exception("Template php_ext.h doesn't exist"); + $namespace = $this->checkDirectory(); + + /** + * Check whether there are external dependencies. + */ + $externalDependencies = $this->config->get('external-dependencies'); + if (is_array($externalDependencies)) { + foreach ($externalDependencies as $dependencyNs => $location) { + if (!file_exists($location)) { + throw new CompilerException( + sprintf( + 'Location of dependency "%s" does not exist. Check the config.json for more information.', + $dependencyNs + ) + ); + } + + $this->addExternalDependency($dependencyNs, $location); + } } - $toReplace = [ - '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), - ]; + /** + * Round 1. pre-compile all files in memory + */ + $this->recursivePreCompile(str_replace('\\', DIRECTORY_SEPARATOR, $namespace)); + if (!count($this->files)) { + throw new Exception( + "Zephir files to compile couldn't be found. Did you add a first class to the extension?" + ); + } - foreach ($toReplace as $mark => $replace) { - $content = str_replace($mark, $replace, $content); + /** + * Round 2. Check 'extends' and 'implements' dependencies + */ + foreach ($this->files as $compileFile) { + $compileFile->checkDependencies($this); } - file_put_contents_ex($content, 'ext/php_ext.h'); + /** + * Sort the files by dependency ranking. + */ + $files = []; + $rankedFiles = []; + $this->calculateDependencies($this->files); + + foreach ($this->files as $rankFile) { + $rank = $rankFile->getClassDefinition()->getDependencyRank(); + $rankedFiles[$rank][] = $rankFile; + } + + krsort($rankedFiles); + foreach ($rankedFiles as $rankFiles) { + $files = array_merge($files, $rankFiles); + } + $this->files = $files; /** - * ext.h. + * Convert C-constants into PHP constants. */ - $content = $this->backend->getTemplateFileContents('ext.h'); - if (empty($content)) { - throw new Exception("Template ext.h doesn't exist"); + $constantsSources = $this->config->get('constants-sources'); + if (is_array($constantsSources)) { + $this->loadConstantsSources($constantsSources); } - $toReplace = [ - '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), - ]; + /** + * Set extension globals. + */ + $globals = $this->config->get('globals'); + if (is_array($globals)) { + $this->setExtensionGlobals($globals); + } - foreach ($toReplace as $mark => $replace) { - $content = str_replace($mark, $replace, $content); + /** + * Load function optimizers + */ + if (false === self::$loadedPrototypes) { + $optimizersPath = $this->resolveOptimizersPath(); + FunctionCall::addOptimizerDir("{$optimizersPath}/FunctionCall"); + + $customOptimizersPaths = $this->config->get('optimizer-dirs'); + if (is_array($customOptimizersPaths)) { + foreach ($customOptimizersPaths as $directory) { + FunctionCall::addOptimizerDir(realpath($directory)); + } + } + + /** + * Load additional extension prototypes. + */ + $prototypesPath = $this->resolvePrototypesPath(); + foreach (new DirectoryIterator($prototypesPath) as $file) { + if ($file->isDir() || $file->isDot()) { + continue; + } + + // Do not use $file->getRealPath() because it does not work inside phar + $realPath = "{$file->getPath()}/{$file->getFilename()}"; + $extension = $file->getBasename(".{$file->getExtension()}"); + + if (!extension_loaded($extension)) { + require_once $realPath; + } + } + + /** + * Load customer additional extension prototypes. + */ + $prototypeDirs = $this->config->get('prototype-dir'); + if (is_array($prototypeDirs)) { + foreach ($prototypeDirs as $prototype => $prototypeDir) { + /** + * Check if the extension is installed + */ + if (!extension_loaded($prototype)) { + $prototypeRealpath = realpath($prototypeDir); + if ($prototypeRealpath) { + foreach (new RecursiveDirectoryIterator($prototypeRealpath) as $file) { + if ($file->isDir()) { + continue; + } + + require_once $file->getRealPath(); + } + } + } + } + } + + self::$loadedPrototypes = true; } - file_put_contents_ex($content, 'ext/ext.h'); + /** + * Round 3. Compile all files to C sources. + */ + $files = []; + + $hash = ''; + foreach ($this->files as $compileFile) { + /** + * Only compile classes in the local extension, ignore external classes + */ + if (!$compileFile->isExternal()) { + $compileFile->compile($this, $this->stringManager); + $compiledFile = $compileFile->getCompiledFile(); + + $methods = []; + $classDefinition = $compileFile->getClassDefinition(); + foreach ($classDefinition->getMethods() as $method) { + $methods[] = '[' . $method->getName() . ':' . implode('-', $method->getVisibility()) . ']'; + if ($method->isInitializer() && $method->isStatic()) { + $this->internalInitializers[] = "\t" . $method->getName() . '();'; + } + } + + $files[] = $compiledFile; + + $hash .= '|' + . $compiledFile + . ':' + . $classDefinition->getClassEntry() + . '[' + . implode('|', $methods) + . ']'; + } + } /** - * ext_config.h. + * Round 3.2. Compile anonymous classes */ - $content = $this->backend->getTemplateFileContents('ext_config.h'); - if (empty($content)) { - throw new Exception("Template ext_config.h doesn't exist"); + foreach ($this->anonymousFiles as $compileFile) { + $compileFile->compile($this, $this->stringManager); + $compiledFile = $compileFile->getCompiledFile(); + + $methods = []; + $classDefinition = $compileFile->getClassDefinition(); + foreach ($classDefinition->getMethods() as $method) { + $methods[] = '[' + . $method->getName() + . ':' + . implode('-', $method->getVisibility()) + . ']'; + } + + $files[] = $compiledFile; + + $hash .= '|' + . $compiledFile + . ':' + . $classDefinition->getClassEntry() + . '[' + . implode('|', $methods) + . ']'; } - $toReplace = [ - '%PROJECT_LOWER%' => strtolower($project), - ]; + $hash = md5($hash); + $this->compiledFiles = $files; - foreach ($toReplace as $mark => $replace) { - $content = str_replace($mark, $replace, $content); + /** + * Round 3.3. Load extra C-sources. + */ + $extraSources = $this->config->get('extra-sources'); + if (is_array($extraSources)) { + $this->extraFiles = $extraSources; + } else { + $this->extraFiles = []; + } + + /** + * Round 3.4. Load extra classes sources. + */ + $extraClasses = $this->config->get('extra-classes'); + if (is_array($extraClasses)) { + foreach ($extraClasses as $value) { + if (isset($value['source'])) { + $this->extraFiles[] = $value['source']; + } + } } - file_put_contents_ex($content, 'ext/ext_config.h'); - /** - * ext_clean. + * Round 4. Create config.m4 and config.w32 files / Create project.c and project.h files. */ - $content = $this->backend->getTemplateFileContents('clean'); - if (empty($content)) { - throw new Exception("Clean file doesn't exist"); + $namespace = str_replace('\\', '_', $namespace); + $extensionName = $this->config->get('extension-name'); + if (empty($extensionName) || !is_string($extensionName)) { + $extensionName = $namespace; } - if (file_put_contents_ex($content, 'ext/clean')) { - chmod('ext/clean', 0755); - } + $needConfigure = $this->createConfigFiles($extensionName); + $needConfigure |= $this->createProjectFiles($extensionName); + $needConfigure |= $this->checkIfPhpized(); + // Bitwise returns `int` instead of `bool`. + $needConfigure = (bool)$needConfigure; /** - * ext_install. + * When a new file is added or removed we need to run configure again */ - $content = $this->backend->getTemplateFileContents('install'); - if (empty($content)) { - throw new Exception("Install file doesn't exist"); + if (!$fromGenerate) { + if (false === $this->filesystem->exists('compiled-files-sum')) { + $needConfigure = true; + $this->filesystem->write('compiled-files-sum', $hash); + } else { + if ($this->filesystem->read('compiled-files-sum') != $hash) { + $needConfigure = true; + $this->filesystem->delete('compiled-files-sum'); + $this->filesystem->write('compiled-files-sum', $hash); + } + } } - $toReplace = [ - '%PROJECT_LOWER%' => strtolower($project), - ]; - - foreach ($toReplace as $mark => $replace) { - $content = str_replace($mark, $replace, $content); - } + /** + * Round 5. Generate concatenation functions + */ + $this->stringManager->genConcatCode(); + $this->fcallManager->genFcallCode(); - if (file_put_contents_ex($content, 'ext/install')) { - chmod('ext/install', 0755); + if ($this->config->get('stubs-run-after-generate', 'stubs')) { + $this->stubs($fromGenerate); } - return (bool) $needConfigure; + return $needConfigure; } - /** - * Process extension globals. - * - * @param string $namespace - * - * @throws Exception - * - * @return array - */ - public function processExtensionGlobals(string $namespace): array + public function generateFunctionInformation(): array { - $globalCode = ''; - $globalStruct = ''; - $globalsDefault = [[], []]; - $initEntries = []; + $headerPrinter = new Printer(); + $entryPrinter = new Printer(); /** - * Generate the extensions globals declaration. + * Specifying Argument Information */ - $globals = $this->config->get('globals'); - if (is_array($globals)) { - $structures = []; - $variables = []; - foreach ($globals as $name => $global) { - $parts = explode('.', $name); - if (isset($parts[1])) { - $structures[$parts[0]][$parts[1]] = $global; - } else { - $variables[$parts[0]] = $global; - } - } + foreach ($this->functionDefinitions as $func) { + $argInfo = new ArgInfoDefinition( + $func->getArgInfoName(), + $func, + $headerPrinter, + $func->getCallGathererPass()->getCompilationContext() + ); - /** - * Process compound structures - */ - foreach ($structures as $structureName => $internalStructure) { - if (preg_match('/^[0-9a-zA-Z\_]$/', $structureName)) { - throw new Exception("Struct name: '".$structureName."' contains invalid characters"); - } + $funcName = $func->getInternalName(); + $argInfoName = $func->getArgInfoName(); - $structBuilder = new Struct('_zephir_struct_'.$structureName, $structureName); - foreach ($internalStructure as $field => $global) { - if (preg_match('/^[0-9a-zA-Z\_]$/', $field)) { - throw new Exception("Struct field name: '".$field."' contains invalid characters"); - } + $headerPrinter->output('PHP_FUNCTION(' . $funcName . ');'); - $structBuilder->addProperty($field, $global); + $argInfo->setBooleanDefinition('_IS_BOOL'); + $argInfo->setRichFormat(true); - $isModuleGlobal = (int) !empty($global['module']); - $globalsDefault[$isModuleGlobal][] = $structBuilder->getCDefault($field, $global, $namespace); - $initEntries[] = $structBuilder->getInitEntry($field, $global, $namespace); - } + $argInfo->render(); + + /** Generate FE's */ + $paramData = 'NULL'; - $globalStruct .= $structBuilder.PHP_EOL; + $richFormat = $func->isReturnTypesHintDetermined() && $func->areReturnTypesCompatible(); + + if ($richFormat || $func->hasParameters()) { + $paramData = $argInfoName; } - $globalCode = PHP_EOL; - foreach ($structures as $structureName => $internalStructure) { - $globalCode .= "\t".'zephir_struct_'.$structureName.' '.$structureName.';'.PHP_EOL; + if ($func->isGlobal()) { + $entryPrinter->output( + 'ZEND_NAMED_FE(' . $func->getName() . ', ZEND_FN(' . $funcName . '), ' . $paramData . ')' + ); + } else { + $entryPrinter->output( + 'ZEND_NS_NAMED_FE("' . str_replace('\\', '\\\\', $func->getNamespace()) . '", ' . + $func->getName() . + ', ZEND_FN(' . $funcName . '), ' . + $paramData . ')' + ); } + } - /** - * Process single variables - */ - foreach ($variables as $name => $global) { - if (preg_match('/^[0-9a-zA-Z\_]$/', $name)) { - throw new Exception("Extension global variable name: '".$name."' contains invalid characters"); - } + $entryPrinter->output('ZEND_FE_END'); - if (!isset($global['default'])) { - throw new Exception("Extension global variable name: '".$name."' contains invalid characters"); - } + return [$headerPrinter->getOutput(), $entryPrinter->getOutput()]; + } - $isModuleGlobal = (int) !empty($global['module']); - $type = $global['type']; - // TODO: Add support for 'hash' - // TODO: Zephir\Optimizers\FunctionCall\GlobalsSetOptimizer - switch ($global['type']) { - case 'boolean': - case 'bool': - $type = 'zend_bool'; - if (true === $global['default']) { - $globalsDefault[$isModuleGlobal][] = "\t".$namespace.'_globals->'.$name.' = 1;'; - } else { - $globalsDefault[$isModuleGlobal][] = "\t".$namespace.'_globals->'.$name.' = 0;'; - } - break; + /** + * Generate package-dependencies config for m4. + * + * TODO: Move the template depending part to backend? + */ + public function generatePackageDependenciesM4(string $contentM4): string + { + $packageDependencies = $this->config->get('package-dependencies'); + if (!is_array($packageDependencies)) { + return str_replace('%PROJECT_PACKAGE_DEPENDENCIES%', '', $contentM4); + } - case 'int': - case 'uint': - case 'long': - case 'double': - $globalsDefault[$isModuleGlobal][] = "\t".$namespace.'_globals->'.$name.' = '.$global['default'].';'; - break; + $pkgconfigM4 = $this->backend->getTemplateFileContents('pkg-config.m4'); + $pkgconfigCheckM4 = $this->backend->getTemplateFileContents('pkg-config-check.m4'); + $extraCFlags = ''; - case 'char': - case 'uchar': - $globalsDefault[$isModuleGlobal][] = "\t".$namespace.'_globals->'.$name.' = \''.$global['default'].'\';'; + foreach ($packageDependencies as $pkg => $version) { + $pkgM4Buf = $pkgconfigCheckM4; + + $operator = '='; + $operatorCmd = '--exact-version'; + $ar = explode('=', $version); + + if (1 === count($ar)) { + if ('*' === $version) { + $version = '0.0.0'; + $operator = '>='; + $operatorCmd = '--atleast-version'; + } + } else { + switch ($ar[0]) { + case '<': + $operator = '<='; + $operatorCmd = '--max-version'; break; - case 'string': - $type = 'char *'; - $globalsDefault[$isModuleGlobal][] = "\t".$namespace.'_globals->'.$name.' = ZSTR_VAL(zend_string_init(ZEND_STRL("'.$global['default'].'"), 0));'; + case '>': + $operator = '>='; + $operatorCmd = '--atleast-version'; break; - default: - throw new Exception( - "Unknown type '".$global['type']."' for extension global '".$name."'" - ); } - $globalCode .= "\t".$type.' '.$name.';'.PHP_EOL; - - $iniEntry = $global['ini-entry'] ?? []; - $iniName = $iniEntry['name'] ?? $namespace.'.'.$name; - $scope = $iniEntry['scope'] ?? 'PHP_INI_ALL'; + $version = trim($ar[1]); + } - switch ($global['type']) { - case 'boolean': - case 'bool': - $initEntries[] = - 'STD_PHP_INI_BOOLEAN("'. - $iniName. - '", "'. - (int) (true === $global['default']). - '", '. - $scope. - ', OnUpdateBool, '. - $name. - ', zend_'. - $namespace. - '_globals, '. - $namespace.'_globals)'; - break; + $toReplace = [ + '%PACKAGE_LOWER%' => strtolower($pkg), + '%PACKAGE_UPPER%' => strtoupper($pkg), + '%PACKAGE_REQUESTED_VERSION%' => $operator . ' ' . $version, + '%PACKAGE_PKG_CONFIG_COMPARE_VERSION%' => $operatorCmd . '=' . $version, + ]; - case 'string': - $initEntries[] = sprintf( - 'STD_PHP_INI_ENTRY(%s, %s, %s, NULL, %s, %s, %s)', - '"'.$iniName.'"', - '"'.$global['default'].'"', - $scope, - $name, - 'zend_'.$namespace.'_globals', - $namespace.'_globals', - ); - break; - } + foreach ($toReplace as $mark => $replace) { + $pkgM4Buf = str_replace($mark, $replace, $pkgM4Buf); } + + $pkgconfigM4 .= $pkgM4Buf; + $extraCFlags .= '$PHP_' . strtoupper($pkg) . '_INCS '; } - $globalsDefault[0] = implode(PHP_EOL, $globalsDefault[0]); - $globalsDefault[1] = implode(PHP_EOL, $globalsDefault[1]); + $contentM4 = str_replace('%PROJECT_EXTRA_CFLAGS%', '%PROJECT_EXTRA_CFLAGS% ' . $extraCFlags, $contentM4); - return [$globalCode, $globalStruct, $globalsDefault, $initEntries]; + return str_replace('%PROJECT_PACKAGE_DEPENDENCIES%', $pkgconfigM4, $contentM4); } /** - * Generates phpinfo() sections showing information about the extension. - * - * @return string + * Returns class the class definition from a given class name. */ - public function processExtensionInfo(): string + public function getClassDefinition(string $className): Definition | bool { - $phpinfo = ''; - - $info = $this->config->get('info'); - if (!is_array($info)) { - return $phpinfo; + foreach ($this->definitions as $key => $value) { + if (!strcasecmp($key, $className)) { + return $value; + } } - foreach ($info as $table) { - $phpinfo .= "\t".'php_info_print_table_start();'.PHP_EOL; - if (isset($table['header'])) { - $headerArray = []; - foreach ($table['header'] as $header) { - $headerArray[] = '"'.htmlentities($header).'"'; - } + return false; + } - $phpinfo .= "\t".'php_info_print_table_header('.count($headerArray).', '. - implode(', ', $headerArray).');'.PHP_EOL; - } + /** + * Returns a Zephir Constant by its name. + */ + public function getConstant(string $name): mixed + { + return $this->constants[$name]; + } - if (isset($table['rows'])) { - foreach ($table['rows'] as $row) { - $rowArray = []; - foreach ($row as $field) { - $rowArray[] = '"'.htmlentities($field).'"'; - } + /** + * Returns an extension global by its name. + */ + public function getExtensionGlobal(string $name): array + { + return $this->globals[$name]; + } + + /** + * Returns GCC flags for current compilation. + */ + public function getGccFlags(bool $development = false): string + { + if (Os::isWindows()) { + // TODO + return ''; + } - $phpinfo .= "\t".'php_info_print_table_row('.count($rowArray).', '. - implode(', ', $rowArray).');'.PHP_EOL; + $gccFlags = getenv('CFLAGS'); + + if (!is_string($gccFlags)) { + if (false === $development) { + $gccVersion = $this->getGccVersion(); + if (version_compare($gccVersion, '4.6.0', '>=')) { + $gccFlags = '-O2 -fvisibility=hidden -Wparentheses -flto -DZEPHIR_RELEASE=1'; + } else { + $gccFlags = '-O2 -fvisibility=hidden -Wparentheses -DZEPHIR_RELEASE=1'; } + } else { + $gccFlags = '-O0 -g3'; } - - $phpinfo .= "\t".'php_info_print_table_end();'.PHP_EOL; } - return $phpinfo; + return $gccFlags; } /** - * Process extension code injection. - * - * @param array $entries - * @param string $section + * Returns class the class definition from a given class name. * - * @return array + * @throws ReflectionException */ - public function processCodeInjection(array $entries, string $section = 'request'): array + public function getInternalClassDefinition(string $className): Definition { - $codes = []; - $includes = []; - - if (isset($entries[$section])) { - foreach ($entries[$section] as $entry) { - if (isset($entry['code']) && !empty($entry['code'])) { - $codes[] = $entry['code'].';'; - } - - if (isset($entry['include']) && !empty($entry['include'])) { - $includes[] = '#include "'.$entry['include'].'"'; - } - } + if (!isset(self::$internalDefinitions[$className])) { + $reflection = new ReflectionClass($className); + self::$internalDefinitions[$className] = Definition::buildFromReflection($reflection); } - return [implode(PHP_EOL, $includes), implode("\n\t", $codes)]; + return self::$internalDefinitions[$className]; } /** - * Adds an external dependency to the compiler. + * Gets the Zephir Parser Manager. * - * @param string $namespace - * @param string $location + * @deprecated */ - public function addExternalDependency(string $namespace, string $location): void + public function getParserManager(): Parser\Manager { - $this->externalDependencies[$namespace] = $location; + return $this->parserManager; } /** - * @param CompilerFile[] $files - * @param null $_dependency + * Returns the php include directories returned by php-config. */ - public function calculateDependencies(array $files, $_dependency = null): void + public function getPhpIncludeDirs(): string { - /** - * Classes are ordered according to a dependency ranking - * Classes with higher rank, need to be initialized first - * We first build a dependency tree and then set the rank accordingly - */ - if (null === $_dependency) { - $dependencyTree = []; - foreach ($files as $file) { - if (!$file->isExternal()) { - $classDefinition = $file->getClassDefinition(); - $dependencyTree[$classDefinition->getCompleteName()] = $classDefinition->getDependencies(); - } - } - - // Make sure the dependencies are loaded first (recursively) - foreach ($dependencyTree as $dependencies) { - foreach ($dependencies as $dependency) { - $dependency->increaseDependencyRank(0); - $this->calculateDependencies($dependencyTree, $dependency); - } - } + $this->filesystem->system('php-config --includes', 'stdout', 'php-includes'); - return; - } + return trim($this->filesystem->read('php-includes')); + } - $dependencyTree = $files; - if (isset($dependencyTree[$_dependency->getCompleteName()])) { - foreach ($dependencyTree[$_dependency->getCompleteName()] as $dependency) { - $dependency->increaseDependencyRank(0); - $this->calculateDependencies($dependencyTree, $dependency); - } - } + /** + * Returns a short user path. + */ + public static function getShortUserPath(string $path): string + { + return str_replace('\\', '/', str_replace(getcwd() . DIRECTORY_SEPARATOR, '', $path)); } /** - * Create project.c and project.h according to the current extension. - * - * TODO: Move the part of the logic which depends on templates (backend-specific) to backend? - * - * @param string $project - * - * @return bool + * Compiles and installs the extension. * * @throws Exception + * @throws NotImplementedException + * @throws CompilerException */ - public function createProjectFiles(string $project): bool + public function install(bool $development = false): void { - $needConfigure = $this->checkKernelFiles(); + // Get global namespace + $namespace = str_replace('\\', '_', $this->checkDirectory()); + $currentDir = getcwd(); - /** - * project.c. - */ - $content = $this->backend->getTemplateFileContents('project.c'); - if (empty($content)) { - throw new Exception("Template project.c doesn't exist"); + if (Os::isWindows()) { + throw new NotImplementedException('Installation is not implemented for Windows yet. Aborting.'); } - $includes = ''; - $reqInitializers = ''; - $reqDestructors = ''; - $prqDestructors = ''; - $modInitializers = ''; - $modDestructors = ''; - $glbInitializers = ''; - $glbDestructors = ''; - $files = array_merge($this->files, $this->anonymousFiles); - - /** - * Round 1. Calculate the dependency rank - */ - $this->calculateDependencies($files); - - $classEntries = []; - $classInits = []; + $this->logger->info('Installing...'); + $gccFlags = $this->getGccFlags($development); - $interfaceEntries = []; - $interfaceInits = []; + $command = strtr( + // TODO: Sort out with sudo + 'cd ext && export CC="gcc" && export CFLAGS=":cflags" && ' . + 'make 2>> ":stderr" 1>> ":stdout" && ' . + 'sudo make install 2>> ":stderr" 1>> ":stdout"', + [ + ':cflags' => $gccFlags, + ':stderr' => "{$currentDir}/compile-errors.log", + ':stdout' => "{$currentDir}/compile.log", + ] + ); - /** - * Round 2. Generate the ZEPHIR_INIT calls according to the dependency rank - */ - /** @var FileInterface $file */ - foreach ($files as $file) { - if ($file->isExternal()) { - continue; + array_map(function ($entry): void { + if (!empty($entry)) { + $this->logger->debug(trim($entry)); } + }, explode('&&', $command)); - $classDefinition = $file->getClassDefinition(); - if ($classDefinition === null) { - continue; - } + exec($command, $output, $exit); + $fileName = $this->config->get('extension-name') ?: $namespace; - $dependencyRank = $classDefinition->getDependencyRank(); - if ('class' === $classDefinition->getType()) { - $classEntries[$dependencyRank][] = 'zend_class_entry *'.$classDefinition->getClassEntry().';'; - $classInits[$dependencyRank][] = 'ZEPHIR_INIT('.$classDefinition->getCNamespace().'_'.$classDefinition->getName().');'; - } else { - $interfaceEntries[$dependencyRank][] = 'zend_class_entry *'.$classDefinition->getClassEntry().';'; - $interfaceInits[$dependencyRank][] = 'ZEPHIR_INIT('.$classDefinition->getCNamespace().'_'.$classDefinition->getName().');'; - } + if (false === file_exists("{$currentDir}/ext/modules/{$fileName}.so")) { + throw new CompilerException( + 'Internal extension compilation failed. Check compile-errors.log for more information.' + ); } + } - krsort($classInits); - krsort($classEntries); - krsort($interfaceInits); - krsort($interfaceEntries); + /** + * Allows checking if a class is part of PHP. + */ + public function isBundledClass(string $className): bool + { + return class_exists($className, false); + } - $completeInterfaceInits = []; - foreach ($interfaceInits as $rankInterfaceInits) { - asort($rankInterfaceInits, SORT_STRING); - $completeInterfaceInits = array_merge($completeInterfaceInits, $rankInterfaceInits); - } + /** + * Allows checking if an interface is part of PHP. + */ + public function isBundledInterface(string $className): bool + { + return interface_exists($className, false); + } - $completeInterfaceEntries = []; - foreach ($interfaceEntries as $rankInterfaceEntries) { - asort($rankInterfaceEntries, SORT_STRING); - $completeInterfaceEntries = array_merge($completeInterfaceEntries, $rankInterfaceEntries); + /** + * Allows to check if a class is part of the compiled extension. + */ + public function isClass(string $className): bool + { + foreach ($this->definitions as $key => $value) { + if (!strcasecmp($key, $className) && 'class' === $value->getType()) { + return true; + } } - $completeClassInits = []; - foreach ($classInits as $rankClassInits) { - asort($rankClassInits, SORT_STRING); - $completeClassInits = array_merge($completeClassInits, $rankClassInits); + /** + * Try to autoload the class from an external dependency + */ + foreach ($this->externalDependencies as $namespace => $location) { + if (preg_match('#^' . $namespace . '\\\\#i', $className)) { + return $this->loadExternalClass($className, $location); + } } - $completeClassEntries = []; - foreach ($classEntries as $rankClassEntries) { - asort($rankClassEntries, SORT_STRING); - $completeClassEntries = array_merge($completeClassEntries, $rankClassEntries); + return false; + } + + /** + * Checks if $name is a Zephir constant. + */ + public function isConstant(string $name): bool + { + return isset($this->constants[$name]); + } + + /** + * Checks if a specific extension global is defined. + */ + public function isExtensionGlobal(string $name): bool + { + return isset($this->globals[$name]); + } + + /** + * Allows checking if an interface is part of the compiled extension. + * + * @throws CompilerException + * @throws IllegalStateException + * @throws ParseException + */ + public function isInterface(string $className): bool + { + foreach ($this->definitions as $key => $value) { + if (!strcasecmp($key, $className) && Definition::TYPE_INTERFACE === $value->getType()) { + return true; + } } /** - * Round 3. Process extension globals + * Try to autoload the class from an external dependency */ - list($globalCode, $globalStruct, $globalsDefault, $initEntries) = $this->processExtensionGlobals($project); - if ('zend' == $project) { - $safeProject = 'zend_'; - } else { - $safeProject = $project; + foreach ($this->externalDependencies as $namespace => $location) { + if (preg_match('#^' . $namespace . '\\\\#i', $className)) { + return $this->loadExternalClass($className, $location); + } } - /** - * Round 4. Process extension info. - */ - $phpInfo = $this->processExtensionInfo(); + return false; + } - /** - * Round 5. Generate Function entries (FE) - */ - list($feHeader, $feEntries) = $this->generateFunctionInformation(); + /** + * Loads a class definition in an external dependency. + * + * @throws CompilerException + * @throws IllegalStateException + * @throws ParseException + */ + public function loadExternalClass(string $className, string $location): bool + { + $filePath = $location + . DIRECTORY_SEPARATOR + . strtolower( + str_replace('\\', DIRECTORY_SEPARATOR, $className) + ) + . '.zep'; /** - * Check if there are module/request/global destructors. + * Fix the class name. */ - $destructors = $this->config->get('destructors'); - if (is_array($destructors)) { - $invokeRequestDestructors = $this->processCodeInjection($destructors, 'request'); - $includes .= PHP_EOL.$invokeRequestDestructors[0]; - $reqDestructors = $invokeRequestDestructors[1]; + $className = implode( + '\\', + array_map( + 'ucfirst', + explode('\\', $className) + ) + ); + + if (isset($this->files[$className])) { + return true; + } + + if (!file_exists($filePath)) { + return false; + } - $invokePostRequestDestructors = $this->processCodeInjection($destructors, 'post-request'); - $includes .= PHP_EOL.$invokePostRequestDestructors[0]; - $prqDestructors = $invokePostRequestDestructors[1]; + /** @var CompilerFile|CompilerFileAnonymous $compilerFile */ + $compilerFile = $this->compilerFileFactory->create($className, $filePath); + $compilerFile->setIsExternal(true); + $compilerFile->preCompile($this); - $invokeModuleDestructors = $this->processCodeInjection($destructors, 'module'); - $includes .= PHP_EOL.$invokeModuleDestructors[0]; - $modDestructors = $invokeModuleDestructors[1]; + $this->files[$className] = $compilerFile; + $this->definitions[$className] = $compilerFile->getClassDefinition(); - $invokeGlobalsDestructors = $this->processCodeInjection($destructors, 'globals'); - $includes .= PHP_EOL.$invokeGlobalsDestructors[0]; - $glbDestructors = $invokeGlobalsDestructors[1]; + return true; + } + + /** + * Pre-compile headers to speed up compilation. + */ + public function preCompileHeaders(): void + { + if (Os::isWindows()) { + // TODO: Add Windows support + return; } - /** - * Check if there are module/request/global initializers. - */ - $initializers = $this->config->get('initializers'); - if (is_array($initializers)) { - $invokeRequestInitializers = $this->processCodeInjection($initializers, 'request'); - $includes .= PHP_EOL.$invokeRequestInitializers[0]; - $reqInitializers = $invokeRequestInitializers[1]; + $phpIncludes = $this->getPhpIncludeDirs(); - $invokeModuleInitializers = $this->processCodeInjection($initializers, 'module'); - $includes .= PHP_EOL.$invokeModuleInitializers[0]; - $modInitializers = $invokeModuleInitializers[1]; + /** @var DirectoryIterator $file */ + foreach (new DirectoryIterator('ext/kernel') as $file) { + if ($file->isDir() || $file->getExtension() !== 'h') { + continue; + } - $invokeGlobalsInitializers = $this->processCodeInjection($initializers, 'globals'); - $includes .= PHP_EOL.$invokeGlobalsInitializers[0]; - $glbInitializers = $invokeGlobalsInitializers[1]; + $command = sprintf( + 'cd ext && gcc -c kernel/%s -I. %s -o kernel/%s.gch', + $file->getBaseName(), + $phpIncludes, + $file->getBaseName() + ); + + $path = $file->getRealPath(); + if (!file_exists($path . '.gch') || filemtime($path) > filemtime($path . '.gch')) { + $this->filesystem->system($command, 'stdout', 'compile-header'); + } } + } - /** - * Append extra details. - */ - $extraClasses = $this->config->get('extra-classes'); - if (is_array($extraClasses)) { - foreach ($extraClasses as $value) { - if (isset($value['init'])) { - $completeClassInits[] = 'ZEPHIR_INIT('.$value['init'].')'; + /** + * Process extension code injection. + */ + public function processCodeInjection(array $entries, string $section = 'request'): array + { + $codes = []; + $includes = []; + + if (isset($entries[$section])) { + foreach ($entries[$section] as $entry) { + if (!empty($entry['code'])) { + $codes[] = $entry['code'] . ';'; } - if (isset($value['entry'])) { - $completeClassEntries[] = 'zend_class_entry *'.$value['entry'].';'; + if (!empty($entry['include'])) { + $includes[] = '#include "' . $entry['include'] . '"'; } } } - $modRequires = array_map(function ($mod) { - return sprintf('ZEND_MOD_REQUIRED("%s")', strtolower($mod)); - }, $this->config->get('extensions', 'requires') ?: []); + return [implode(PHP_EOL, $includes), implode("\n\t", $codes)]; + } - $toReplace = [ - '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), - '%PROJECT_LOWER%' => strtolower($project), - '%PROJECT_UPPER%' => strtoupper($project), - '%PROJECT_CAMELIZE%' => ucfirst($project), - '%CLASS_ENTRIES%' => implode( - PHP_EOL, - array_merge($completeInterfaceEntries, $completeClassEntries) - ), - '%CLASS_INITS%' => implode( - PHP_EOL."\t", - array_merge($completeInterfaceInits, $completeClassInits) - ), - '%INIT_GLOBALS%' => implode( - PHP_EOL."\t", - array_merge((array) $globalsDefault[0], [$glbInitializers]) - ), - '%INIT_MODULE_GLOBALS%' => $globalsDefault[1], - '%DESTROY_GLOBALS%' => $glbDestructors, - '%EXTENSION_INFO%' => $phpInfo, - '%EXTRA_INCLUDES%' => implode( - PHP_EOL, - array_unique(explode(PHP_EOL, $includes)) - ), - '%MOD_INITIALIZERS%' => $modInitializers, - '%MOD_DESTRUCTORS%' => $modDestructors, - '%REQ_INITIALIZERS%' => implode( - PHP_EOL."\t", - array_merge($this->internalInitializers, [$reqInitializers]) - ), - '%REQ_DESTRUCTORS%' => $reqDestructors, - '%POSTREQ_DESTRUCTORS%' => empty($prqDestructors) ? '' : implode( - PHP_EOL, - [ - '#define ZEPHIR_POST_REQUEST 1', - 'static PHP_PRSHUTDOWN_FUNCTION('.strtolower($project).')', - '{', - "\t".implode( - PHP_EOL."\t", - explode(PHP_EOL, $prqDestructors) - ), - '}', - ] - ), - '%FE_HEADER%' => $feHeader, - '%FE_ENTRIES%' => $feEntries, - '%PROJECT_INI_ENTRIES%' => implode(PHP_EOL."\t", $initEntries), - '%PROJECT_DEPENDENCIES%' => implode(PHP_EOL."\t", $modRequires), - ]; - foreach ($toReplace as $mark => $replace) { - $content = str_replace($mark, $replace, $content); - } + /** + * Process extension globals. + * + * @throws Exception + */ + public function processExtensionGlobals(string $namespace): array + { + $globalCode = ''; + $globalStruct = ''; + $globalsDefault = [[], []]; + $initEntries = []; /** - * Round 5. Generate and place the entry point of the project + * Generate the extensions globals declaration. */ - file_put_contents_ex($content, 'ext/'.$safeProject.'.c'); - unset($content); + $globals = $this->config->get('globals'); + if (is_array($globals)) { + $structures = []; + $variables = []; + foreach ($globals as $name => $global) { + $parts = explode('.', $name); + if (isset($parts[1])) { + $structures[$parts[0]][$parts[1]] = $global; + } else { + $variables[$parts[0]] = $global; + } + } - /** - * Round 6. Generate the project main header. - */ - $content = $this->backend->getTemplateFileContents('project.h'); - if (empty($content)) { - throw new Exception("Template project.h doesn't exists"); - } + /** + * Process compound structures + */ + foreach ($structures as $structureName => $internalStructure) { + if (preg_match('/^[0-9a-zA-Z_]$/', $structureName)) { + throw new Exception("Struct name: '" . $structureName . "' contains invalid characters"); + } - $includeHeaders = []; - foreach ($this->compiledFiles as $file) { - if ($file) { - $fileH = str_replace('.c', '.zep.h', $file); - $include = '#include "'.$fileH.'"'; - $includeHeaders[] = $include; - } - } + $structBuilder = new Struct('_zephir_struct_' . $structureName, $structureName); + foreach ($internalStructure as $field => $global) { + if (preg_match('/^[0-9a-zA-Z_]$/', $field)) { + throw new Exception("Struct field name: '" . $field . "' contains invalid characters"); + } - /** - * Append extra headers. - */ - $extraClasses = $this->config->get('extra-classes'); - if (is_array($extraClasses)) { - foreach ($extraClasses as $value) { - if (isset($value['header'])) { - $include = '#include "'.$value['header'].'"'; - $includeHeaders[] = $include; + $structBuilder->addProperty($field, $global['type']); + + $isModuleGlobal = (int)!empty($global['module']); + $globalsDefault[$isModuleGlobal][] = $structBuilder->getCDefault($field, $global, $namespace); + $initEntries[] = $structBuilder->getInitEntry($field, $global, $namespace); } + + $globalStruct .= $structBuilder . PHP_EOL; } - } - $toReplace = [ - '%INCLUDE_HEADERS%' => implode(PHP_EOL, $includeHeaders), - ]; + $globalCode = PHP_EOL; + foreach ($structures as $structureName => $internalStructure) { + $globalCode .= "\t" . 'zephir_struct_' . $structureName . ' ' . $structureName . ';' . PHP_EOL; + } - foreach ($toReplace as $mark => $replace) { - $content = str_replace($mark, $replace, $content); - } + /** + * Process single variables + */ + foreach ($variables as $name => $global) { + if (preg_match('/^[0-9a-zA-Z_]$/', $name)) { + throw new Exception("Extension global variable name: '" . $name . "' contains invalid characters"); + } - file_put_contents_ex($content, 'ext/'.$safeProject.'.h'); - unset($content); + if (!isset($global['default'])) { + throw new Exception("Extension global variable name: '" . $name . "' contains invalid characters"); + } - /** - * Round 7. Create php_project.h. - */ - $content = $this->backend->getTemplateFileContents('php_project.h'); - if (empty($content)) { - throw new Exception("Template php_project.h doesn't exist"); - } + $isModuleGlobal = (int)!empty($global['module']); + $type = $global['type']; + // TODO: Add support for 'hash' + // TODO: Zephir\Optimizers\FunctionCall\GlobalsSetOptimizer + switch ($global['type']) { + case 'boolean': + case 'bool': + $type = 'zend_bool'; + if (true === $global['default']) { + $globalsDefault[$isModuleGlobal][] = "\t" . $namespace . '_globals->' . $name . ' = 1;'; + } else { + $globalsDefault[$isModuleGlobal][] = "\t" . $namespace . '_globals->' . $name . ' = 0;'; + } + break; - $toReplace = [ - '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), - '%PROJECT_LOWER%' => strtolower($project), - '%PROJECT_UPPER%' => strtoupper($project), - '%PROJECT_EXTNAME%' => strtolower($project), - '%PROJECT_NAME%' => mb_convert_encoding($this->config->get('name'), 'ISO-8859-1', 'UTF-8'), - '%PROJECT_AUTHOR%' => mb_convert_encoding($this->config->get('author'), 'ISO-8859-1', 'UTF-8'), - '%PROJECT_VERSION%' => mb_convert_encoding($this->config->get('version'), 'ISO-8859-1', 'UTF-8'), - '%PROJECT_DESCRIPTION%' => mb_convert_encoding($this->config->get('description'), 'ISO-8859-1', 'UTF-8'), - '%PROJECT_ZEPVERSION%' => Zephir::VERSION, - '%EXTENSION_GLOBALS%' => $globalCode, - '%EXTENSION_STRUCT_GLOBALS%' => $globalStruct, - ]; + case 'int': + case 'uint': + case 'long': + case 'double': + $globalsDefault[$isModuleGlobal][] = "\t" . $namespace . '_globals->' . $name . ' = ' . $global['default'] . ';'; + break; - foreach ($toReplace as $mark => $replace) { - $content = str_replace($mark, $replace, $content); - } + case 'char': + case 'uchar': + $globalsDefault[$isModuleGlobal][] = "\t" . $namespace . '_globals->' . $name . ' = \'' . $global['default'] . '\';'; + break; + case 'string': + $type = 'char *'; + $globalsDefault[$isModuleGlobal][] = "\t" . $namespace . '_globals->' . $name . ' = ZSTR_VAL(zend_string_init(ZEND_STRL("' . $global['default'] . '"), 0));'; + break; + default: + throw new Exception( + "Unknown type '" . $global['type'] . "' for extension global '" . $name . "'" + ); + } - file_put_contents_ex($content, 'ext/php_'.$safeProject.'.h'); - unset($content); + $globalCode .= "\t" . $type . ' ' . $name . ';' . PHP_EOL; - return $needConfigure; - } + $iniEntry = $global['ini-entry'] ?? []; + $iniName = $iniEntry['name'] ?? $namespace . '.' . $name; + $scope = $iniEntry['scope'] ?? 'PHP_INI_ALL'; - public function generateFunctionInformation(): array - { - $headerPrinter = new CodePrinter(); - $entryPrinter = new CodePrinter(); + switch ($global['type']) { + case 'boolean': + case 'bool': + $initEntries[] = + 'STD_PHP_INI_BOOLEAN("' . + $iniName . + '", "' . + (int)(true === $global['default']) . + '", ' . + $scope . + ', OnUpdateBool, ' . + $name . + ', zend_' . + $namespace . + '_globals, ' . + $namespace . '_globals)'; + break; - /** - * Specifying Argument Information - */ - foreach ($this->functionDefinitions as $func) { - $argInfo = new ArgInfoDefinition( - $func->getArgInfoName(), - $func, - $headerPrinter, - $func->getCallGathererPass()->getCompilationContext() - ); + case 'string': + $initEntries[] = sprintf( + 'STD_PHP_INI_ENTRY(%s, %s, %s, NULL, %s, %s, %s)', + '"' . $iniName . '"', + '"' . $global['default'] . '"', + $scope, + $name, + 'zend_' . $namespace . '_globals', + $namespace . '_globals', + ); + break; + } + } + } - $funcName = $func->getInternalName(); - $argInfoName = $func->getArgInfoName(); + $globalsDefault[0] = implode(PHP_EOL, $globalsDefault[0]); + $globalsDefault[1] = implode(PHP_EOL, $globalsDefault[1]); - $headerPrinter->output('PHP_FUNCTION('.$funcName.');'); + return [$globalCode, $globalStruct, $globalsDefault, $initEntries]; + } + + /** + * Generates phpinfo() sections showing information about the extension. + */ + public function processExtensionInfo(): string + { + $phpinfo = ''; - $argInfo->setBooleanDefinition($this->backend->isZE3() ? '_IS_BOOL' : 'IS_BOOL'); - $argInfo->setRichFormat($this->backend->isZE3()); + $info = $this->config->get('info'); + if (!is_array($info)) { + return $phpinfo; + } - $argInfo->render(); + foreach ($info as $table) { + $phpinfo .= "\t" . 'php_info_print_table_start();' . PHP_EOL; + if (isset($table['header'])) { + $headerArray = []; + foreach ($table['header'] as $header) { + $headerArray[] = '"' . htmlentities($header) . '"'; + } - /** Generate FE's */ - $paramData = 'NULL'; + $phpinfo .= "\t" . 'php_info_print_table_header(' . count($headerArray) . ', ' . + implode(', ', $headerArray) . ');' . PHP_EOL; + } - $richFormat = $this->backend->isZE3() && - $func->isReturnTypesHintDetermined() && - $func->areReturnTypesCompatible(); + if (isset($table['rows'])) { + foreach ($table['rows'] as $row) { + $rowArray = []; + foreach ($row as $field) { + $rowArray[] = '"' . htmlentities($field) . '"'; + } - if ($richFormat || $func->hasParameters()) { - $paramData = $argInfoName; + $phpinfo .= "\t" . 'php_info_print_table_row(' . count($rowArray) . ', ' . + implode(', ', $rowArray) . ');' . PHP_EOL; + } } - if ($func->isGlobal()) { - $entryPrinter->output( - 'ZEND_NAMED_FE('.$func->getName().', ZEND_FN('.$funcName.'), '.$paramData.')' - ); - } else { - $entryPrinter->output( - 'ZEND_NS_NAMED_FE("'.str_replace('\\', '\\\\', $func->getNamespace()).'", '. - $func->getName(). - ', ZEND_FN('.$funcName.'), '. - $paramData.')' - ); - } + $phpinfo .= "\t" . 'php_info_print_table_end();' . PHP_EOL; } - $entryPrinter->output('ZEND_FE_END'); - - return [$headerPrinter->getOutput(), $entryPrinter->getOutput()]; + return $phpinfo; } /** - * Check if the project must be phpized again. - * - * @return bool + * Sets extensions globals. */ - public function checkIfPhpized(): bool + public function setExtensionGlobals(array $globals): void { - return !file_exists('ext/Makefile'); + foreach ($globals as $key => $value) { + $this->globals[$key] = $value; + } } - /** - * Returns a short user path. - * - * @param string $path - * - * @return string - */ - public static function getShortUserPath(string $path): string + public function setOptimizersPath(string $optimizersPath): void + { + $this->optimizersPath = $optimizersPath; + } + + public function setPrototypesPath(string $prototypesPath): void + { + $this->prototypesPath = $prototypesPath; + } + + public function setTemplatesPath(string $templatesPath): void { - return str_replace('\\', '/', str_replace(getcwd().DIRECTORY_SEPARATOR, '', $path)); + $this->templatesPath = $templatesPath; } /** - * Generate package-dependencies config for m4. - * - * TODO: Move the template depending part to backend? - * - * @param string $contentM4 + * Generate IDE stubs. * - * @return string + * @throws Exception + * @throws ReflectionException */ - public function generatePackageDependenciesM4(string $contentM4): string + public function stubs(bool $fromGenerate = false): void { - $packageDependencies = $this->config->get('package-dependencies'); - if (!is_array($packageDependencies)) { - return str_replace('%PROJECT_PACKAGE_DEPENDENCIES%', '', $contentM4); + if (!$fromGenerate) { + $this->generate(); } - $pkgconfigM4 = $this->backend->getTemplateFileContents('pkg-config.m4'); - $pkgconfigCheckM4 = $this->backend->getTemplateFileContents('pkg-config-check.m4'); - $extraCFlags = ''; + $this->logger->info('Generating stubs...'); - foreach ($packageDependencies as $pkg => $version) { - $pkgM4Buf = $pkgconfigCheckM4; + $path = str_replace( + [ + '%version%', + '%namespace%', + ], + [ + $this->config->get('version'), + ucfirst($this->config->get('namespace')), + ], + $this->config->get('path', 'stubs') + ); - $operator = '='; - $operatorCmd = '--exact-version'; - $ar = explode('=', $version); + (new Stubs\Generator($this->files))->generate( + $this->config->get('namespace'), + $path, + $this->config->get('indent', 'extra'), + $this->config->get('banner', 'stubs') ?? '' + ); + } - if (1 === count($ar)) { - if ('*' === $version) { - $version = '0.0.0'; - $operator = '>='; - $operatorCmd = '--atleast-version'; - } - } else { - switch ($ar[0]) { - case '<': - $operator = '<='; - $operatorCmd = '--max-version'; - break; - case '>': - $operator = '>='; - $operatorCmd = '--atleast-version'; - break; - } + /** + * Ensure that required extensions is present. + * + * @throws RuntimeException + */ + private function assertRequiredExtensionsIsPresent(): void + { + $extensionRequires = $this->config->get('extensions', 'requires'); + if (empty($extensionRequires)) { + return; + } - $version = trim($ar[1]); + $extensions = []; + foreach ($extensionRequires as $value) { + // TODO: We'll use this as an object in the future. + if (!is_string($value)) { + continue; } - $toReplace = [ - '%PACKAGE_LOWER%' => strtolower($pkg), - '%PACKAGE_UPPER%' => strtoupper($pkg), - '%PACKAGE_REQUESTED_VERSION%' => $operator.' '.$version, - '%PACKAGE_PKG_CONFIG_COMPARE_VERSION%' => $operatorCmd.'='.$version, - ]; - - foreach ($toReplace as $mark => $replace) { - $pkgM4Buf = str_replace($mark, $replace, $pkgM4Buf); + if (!extension_loaded($value)) { + $extensions[] = $value; } - - $pkgconfigM4 .= $pkgM4Buf; - $extraCFlags .= '$PHP_'.strtoupper($pkg).'_INCS '; } - $contentM4 = str_replace('%PROJECT_EXTRA_CFLAGS%', '%PROJECT_EXTRA_CFLAGS% '.$extraCFlags, $contentM4); - - return str_replace('%PROJECT_PACKAGE_DEPENDENCIES%', $pkgconfigM4, $contentM4); + if (!empty($extensions)) { + throw new RuntimeException( + sprintf( + 'Could not load extension(s): %s. You must load extensions above before build this extension.', + implode(', ', $extensions) + ) + ); + } } /** - * Pre-compiles classes creating a CompilerFile definition. - * - * @param string $filePath + * Checks if the current directory is a valid Zephir project. * - * @throws IllegalStateException + * @throws Exception */ - private function preCompile(string $filePath): void + private function checkDirectory(): string { - if (!$this->parserManager->isAvailable()) { - throw new IllegalStateException($this->parserManager->requirements()); + $namespace = $this->config->get('namespace'); + if (!$namespace) { + // TODO: Add more user friendly message. + // For example assume if the user call the command from the wrong dir + throw new Exception('Extension namespace cannot be loaded'); } - if (preg_match('#\.zep$#', $filePath)) { - $className = str_replace(DIRECTORY_SEPARATOR, '\\', $filePath); - $className = preg_replace('#.zep$#', '', $className); + if (!is_string($namespace)) { + throw new Exception('Extension namespace is invalid'); + } - $className = implode('\\', array_map('ucfirst', explode('\\', $className))); + if (!$this->filesystem->isInitialized()) { + $this->filesystem->initialize(); + } - $compilerFile = $this->compilerFileFactory->create($className, $filePath); - $compilerFile->preCompile($this); + if (!$this->filesystem->exists('.')) { + if (!$this->checkIfPhpized()) { + $this->logger->info( + 'Zephir version has changed, use "zephir fullclean" to perform a full clean of the project' + ); + } - $this->files[$className] = $compilerFile; - $this->definitions[$className] = $compilerFile->getClassDefinition(); + $this->filesystem->makeDirectory('.'); } + + return $namespace; } /** - * Recursively pre-compiles all sources found in the given path. + * Checks if a file must be copied. * - * @param string $path + * @param string $src + * @param string $dst * - * @throws IllegalStateException - * @throws InvalidArgumentException + * @return bool */ - private function recursivePreCompile(string $path) + private function checkKernelFile(string $src, string $dst): bool { - if (!is_dir($path)) { - throw new InvalidArgumentException( - sprintf( - "An invalid path was passed to the compiler. Unable to obtain the '%s%s%s' directory.", - getcwd(), - DIRECTORY_SEPARATOR, - $path - ) - ); + if (preg_match('#kernels/ZendEngine[2-9]/concat\.#', $src)) { + return true; } - /** - * Pre compile all files. - */ - $iterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path), - RecursiveIteratorIterator::SELF_FIRST - ); + if (!file_exists($dst)) { + return false; + } - $files = []; - foreach ($iterator as $item) { - if (!$item->isDir()) { - $files[] = $item->getPathname(); + return md5_file($src) === md5_file($dst); + } + + /** + * Checks which files in the base kernel must be copied. + * + * @throws Exception + */ + private function checkKernelFiles(): bool + { + $kernelPath = 'ext' . DIRECTORY_SEPARATOR . 'kernel'; + + if (!file_exists($kernelPath)) { + if (!mkdir($kernelPath, 0775, true)) { + throw new Exception("Cannot create kernel directory: {$kernelPath}"); } } - sort($files, SORT_STRING); - foreach ($files as $file) { - $this->preCompile($file); + $kernelPath = realpath($kernelPath); + $sourceKernelPath = $this->backend->getInternalKernelPath(); + + $configured = $this->recursiveProcess( + $sourceKernelPath, + $kernelPath, + '@.*\.[ch]$@', + [$this, 'checkKernelFile'] + ); + + if (!$configured) { + $this->logger->info('Cleaning old kernel files...'); + $this->recursiveDeletePath($kernelPath, '@^.*\.[lcho]$@'); + + @mkdir($kernelPath); + + $this->logger->info('Copying new kernel files...'); + $this->recursiveProcess($sourceKernelPath, $kernelPath, '@^.*\.[ch]$@'); } + + return !$configured; } /** - * Copies the base kernel to the extension destination. - * - * TODO: - * - * @deprecated - * - * @param $src - * @param $dest - * @param string $pattern - * @param mixed $callback - * - * @return bool + * Returns current GCC version. */ - private function recursiveProcess($src, $dest, $pattern = null, $callback = 'copy') + private function getGccVersion(): string { - $success = true; - $iterator = new DirectoryIterator($src); - foreach ($iterator as $item) { - $pathName = $item->getPathname(); - if (!is_readable($pathName)) { - $this->logger->warning('File is not readable :'.$pathName); - continue; - } + if (Os::isWindows()) { + return '0.0.0'; + } - $fileName = $item->getFileName(); + if ($this->filesystem->exists('gcc-version')) { + return $this->filesystem->read('gcc-version'); + } - if ($item->isDir()) { - if ('.' != $fileName && '..' != $fileName && '.libs' != $fileName) { - if (!is_dir($dest.DIRECTORY_SEPARATOR.$fileName)) { - mkdir($dest.DIRECTORY_SEPARATOR.$fileName, 0755, true); - } - $this->recursiveProcess($pathName, $dest.DIRECTORY_SEPARATOR.$fileName, $pattern, $callback); - } - } elseif (!$pattern || ($pattern && 1 === preg_match($pattern, $fileName))) { - $path = $dest.DIRECTORY_SEPARATOR.$fileName; - $success = $success && \call_user_func($callback, $pathName, $path); - } + $this->filesystem->system('gcc -dumpversion', 'stdout', 'gcc-version'); + $lines = $this->filesystem->file('gcc-version'); + $lines = array_filter($lines); + + $lastLine = $lines[count($lines) - 1]; + if (preg_match('/\d+\.\d+\.\d+/', $lastLine, $matches)) { + return $matches[0]; } - return $success; + return '0.0.0'; } - /** - * Recursively deletes files in a specified location. - * - * @deprecated - * - * @param string $path Directory to deletes files - * @param string $mask Regular expression to deletes files - */ - private function recursiveDeletePath($path, $mask) + private function getWindowsReleaseDir(): string { - if (!file_exists($path) || !is_dir($path) || !is_readable($path)) { - $this->logger->warning("Directory '{$path}' is not readable. Skip..."); + if ($this->isZts()) { + if (PHP_INT_SIZE === 4) { + // 32-bit version of PHP + return 'ext\\Release_TS'; + } - return; + if (PHP_INT_SIZE === 8) { + // 64-bit version of PHP + return 'ext\\x64\\Release_TS'; + } + + // fallback + return 'ext\\Release_TS'; } - $objects = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path), - RecursiveIteratorIterator::SELF_FIRST - ); + if (PHP_INT_SIZE === 4) { + // 32-bit version of PHP + return 'ext\\Release'; + } - foreach ($objects as $name => $object) { - if (preg_match($mask, $name)) { - @unlink($name); - } + if (PHP_INT_SIZE === 8) { + // 64-bit version of PHP + return 'ext\\x64\\Release'; + } + + // fallback + return 'ext\\Release'; + } + + private function isZts(): bool + { + if (defined('ZEND_THREAD_SAFE') && ZEND_THREAD_SAFE === true) { + return true; } + + ob_start(); + phpinfo(INFO_GENERAL); + + return (bool)preg_match('/Thread\s*Safety\s*enabled/i', strip_tags(ob_get_clean())); } /** @@ -2157,11 +2060,11 @@ private function recursiveDeletePath($path, $mask) * * @throws Exception */ - private function loadConstantsSources(array $constantsSources) + private function loadConstantsSources(array $constantsSources): void { foreach ($constantsSources as $constantsSource) { if (!file_exists($constantsSource)) { - throw new Exception("File '".$constantsSource."' with constants definitions"); + throw new Exception("File '" . $constantsSource . "' with constants definitions"); } foreach (file($constantsSource) as $line) { @@ -2176,6 +2079,31 @@ private function loadConstantsSources(array $constantsSources) } } + /** + * Pre-compiles classes creating a CompilerFile definition. + * + * @throws IllegalStateException + */ + private function preCompile(string $filePath): void + { + if (!$this->parserManager->isAvailable()) { + throw new IllegalStateException($this->parserManager->requirements()); + } + + if (preg_match('#\.zep$#', $filePath)) { + $className = str_replace(DIRECTORY_SEPARATOR, '\\', $filePath); + $className = preg_replace('#.zep$#', '', $className); + + $className = implode('\\', array_map('ucfirst', explode('\\', $className))); + + $compilerFile = $this->compilerFileFactory->create($className, $filePath); + $compilerFile->preCompile($this); + + $this->files[$className] = $compilerFile; + $this->definitions[$className] = $compilerFile->getClassDefinition(); + } + } + /** * Process config.w32 sections. * @@ -2198,177 +2126,174 @@ private function processAddSources(array $sources, string $project): array $groups = []; foreach ($groupSources as $dirname => $files) { - $groups[] = 'ADD_SOURCES(configure_module_dirname + "/'.$dirname.'", "'.implode(' ', $files).'", "'.$project.'");'; + $groups[] = 'ADD_SOURCES(configure_module_dirname + "/' + . $dirname + . '", "' + . implode(' ', $files) + . '", "' + . $project + . '");'; } return $groups; } /** - * Ensure that required extensions is present. + * Recursively deletes files in a specified location. + * + * @param string $path Directory to deletes files + * @param string $mask Regular expression to deletes files + * + * @deprecated * - * @throws RuntimeException */ - private function assertRequiredExtensionsIsPresent(): void + private function recursiveDeletePath($path, $mask): void { - $extensionRequires = $this->config->get('extensions', 'requires'); - if (empty($extensionRequires)) { + if (!file_exists($path) || !is_dir($path) || !is_readable($path)) { + $this->logger->warning("Directory '{$path}' is not readable. Skip..."); + return; } - $extensions = []; - foreach ($extensionRequires as $value) { - // TODO: We'll use this as an object in the future. - if (!is_string($value)) { - continue; - } + $objects = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($path), + RecursiveIteratorIterator::SELF_FIRST + ); - if (!extension_loaded($value)) { - $extensions[] = $value; + foreach ($objects as $name => $object) { + if (preg_match($mask, $name)) { + @unlink($name); } } - - if (!empty($extensions)) { - throw new RuntimeException( - sprintf( - 'Could not load extension(s): %s. You must load extensions above before build this extension.', - implode(', ', $extensions) - ) - ); - } } /** - * Checks if a file must be copied. - * - * @param string $src - * @param string $dst + * Recursively pre-compiles all sources found in the given path. * - * @return bool + * @throws IllegalStateException + * @throws InvalidArgumentException */ - private function checkKernelFile(string $src, string $dst): bool + private function recursivePreCompile(string $path): void { - if (preg_match('#kernels/ZendEngine[2-9]/concat\.#', $src)) { - return true; + if (!is_dir($path)) { + throw new InvalidArgumentException( + sprintf( + "An invalid path was passed to the compiler. Unable to obtain the '%s%s%s' directory.", + getcwd(), + DIRECTORY_SEPARATOR, + $path + ) + ); } - if (!file_exists($dst)) { - return false; + /** + * Pre compile all files. + */ + $iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($path), + RecursiveIteratorIterator::SELF_FIRST + ); + + $files = []; + foreach ($iterator as $item) { + if (!$item->isDir()) { + $files[] = $item->getPathname(); + } } - return md5_file($src) === md5_file($dst); + sort($files, SORT_STRING); + foreach ($files as $file) { + $this->preCompile($file); + } } /** - * Checks which files in the base kernel must be copied. + * Copies the base kernel to the extension destination. * - * @throws Exception + * TODO: + * + * @param $src + * @param $dest + * @param string $pattern + * @param mixed $callback * * @return bool + * @deprecated + * */ - private function checkKernelFiles(): bool + private function recursiveProcess($src, $dest, $pattern = null, $callback = 'copy') { - $kernelPath = 'ext'.DIRECTORY_SEPARATOR.'kernel'; - - if (!file_exists($kernelPath)) { - if (!mkdir($kernelPath, 0775, true)) { - throw new Exception("Cannot create kernel directory: {$kernelPath}"); + $success = true; + $iterator = new DirectoryIterator($src); + foreach ($iterator as $item) { + $pathName = $item->getPathname(); + if (!is_readable($pathName)) { + $this->logger->warning('File is not readable :' . $pathName); + continue; } - } - - $kernelPath = realpath($kernelPath); - $sourceKernelPath = $this->backend->getInternalKernelPath(); - $configured = $this->recursiveProcess( - $sourceKernelPath, - $kernelPath, - '@.*\.[ch]$@', - [$this, 'checkKernelFile'] - ); - - if (!$configured) { - $this->logger->info('Cleaning old kernel files...'); - $this->recursiveDeletePath($kernelPath, '@^.*\.[lcho]$@'); - - @mkdir($kernelPath); + $fileName = $item->getFileName(); - $this->logger->info('Copying new kernel files...'); - $this->recursiveProcess($sourceKernelPath, $kernelPath, '@^.*\.[ch]$@'); + if ($item->isDir()) { + if ('.' != $fileName && '..' != $fileName && '.libs' != $fileName) { + if (!is_dir($dest . DIRECTORY_SEPARATOR . $fileName)) { + mkdir($dest . DIRECTORY_SEPARATOR . $fileName, 0755, true); + } + $this->recursiveProcess($pathName, $dest . DIRECTORY_SEPARATOR . $fileName, $pattern, $callback); + } + } elseif (!$pattern || ($pattern && 1 === preg_match($pattern, $fileName))) { + $path = $dest . DIRECTORY_SEPARATOR . $fileName; + $success = $success && call_user_func($callback, $pathName, $path); + } } - return !$configured; + return $success; } /** - * Checks if the current directory is a valid Zephir project. - * - * @throws Exception + * Resolves path to the internal optimizers. * - * @return string + * @throws IllegalStateException in case of absence internal optimizers directory */ - private function checkDirectory(): string + private function resolveOptimizersPath(): ?string { - $namespace = $this->config->get('namespace'); - if (!$namespace) { - // TODO: Add more user friendly message. - // For example assume if the user call the command from the wrong dir - throw new Exception('Extension namespace cannot be loaded'); - } - - if (!is_string($namespace)) { - throw new Exception('Extension namespace is invalid'); - } + $optimizersPath = $this->optimizersPath; - if (!$this->filesystem->isInitialized()) { - $this->filesystem->initialize(); + // fallback + if (empty($optimizersPath)) { + $optimizersPath = __DIR__ . '/Optimizers'; } - if (!$this->filesystem->exists('.')) { - if (!$this->checkIfPhpized()) { - $this->logger->info( - 'Zephir version has changed, use "zephir fullclean" to perform a full clean of the project' - ); - } - - $this->filesystem->makeDirectory('.'); + if (!is_dir($optimizersPath) || !is_readable($optimizersPath)) { + throw new IllegalStateException('Unable to resolve internal optimizers directory.'); } - return $namespace; + return $optimizersPath; } /** - * Returns current GCC version. - * - * @return string + * Resolves path to the internal prototypes. */ - private function getGccVersion(): string + private function resolvePrototypesPath(): ?string { - if (is_windows()) { - return '0.0.0'; - } + $prototypesPath = $this->prototypesPath; - if ($this->filesystem->exists('gcc-version')) { - return $this->filesystem->read('gcc-version'); + // fallback + if (empty($prototypesPath)) { + $prototypesPath = dirname(__DIR__) . '/prototypes'; } - $this->filesystem->system('gcc -dumpversion', 'stdout', 'gcc-version'); - $lines = $this->filesystem->file('gcc-version'); - $lines = array_filter($lines); - - $lastLine = $lines[count($lines) - 1]; - if (preg_match('/\d+\.\d+\.\d+/', $lastLine, $matches)) { - return $matches[0]; + if (!is_dir($prototypesPath) || !is_readable($prototypesPath)) { + throw new IllegalStateException('Unable to resolve internal prototypes directory.'); } - return '0.0.0'; + return $prototypesPath; } private function toUnixPaths(array $paths): array { return array_map( - static function (string $path): string { - return str_replace(DIRECTORY_SEPARATOR, '/', $path); - }, + static fn(string $path): string => str_replace(DIRECTORY_SEPARATOR, '/', $path), $paths ); } diff --git a/Library/Compiler/CompilerFileFactory.php b/src/Compiler/CompilerFileFactory.php similarity index 68% rename from Library/Compiler/CompilerFileFactory.php rename to src/Compiler/CompilerFileFactory.php index 1b2b1659b0..8dbeb42d60 100644 --- a/Library/Compiler/CompilerFileFactory.php +++ b/src/Compiler/CompilerFileFactory.php @@ -21,31 +21,21 @@ final class CompilerFileFactory { - private Config $config; - private FileSystemInterface $filesystem; - private LoggerInterface $logger; - - public function __construct(Config $config, FileSystemInterface $filesystem, LoggerInterface $logger) - { - $this->config = $config; - $this->filesystem = $filesystem; - $this->logger = $logger; + public function __construct( + private Config $config, + private FileSystemInterface $filesystem, + private LoggerInterface $logger, + ) { } /** * Creates CompilerFile instance. * * NOTE: Each instance of CompilerFile must have its own AliasManager instance. - * - * @param string $className - * @param string $filePath - * - * @return FileInterface */ public function create(string $className, string $filePath): FileInterface { $compiler = new CompilerFile($this->config, new AliasManager(), $this->filesystem); - $compiler->setClassName($className); $compiler->setFilePath($filePath); $compiler->setLogger($this->logger); diff --git a/Library/Compiler/FileInterface.php b/src/Compiler/FileInterface.php similarity index 91% rename from Library/Compiler/FileInterface.php rename to src/Compiler/FileInterface.php index 6485c41d01..3ca4e5fb8a 100644 --- a/Library/Compiler/FileInterface.php +++ b/src/Compiler/FileInterface.php @@ -9,31 +9,31 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Compiler; -use Zephir\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Compiler; /** - * FileInterface. - * * Provides a common interface for compiler files */ interface FileInterface { /** - * Checks if the class file belongs to an external dependency or not. + * Returns the class definition related to the compiled file. * - * @return bool + * @return Definition */ - public function isExternal(); + public function getClassDefinition(); /** - * Returns the class definition related to the compiled file. + * Checks if the class file belongs to an external dependency or not. * - * @return ClassDefinition + * @return bool */ - public function getClassDefinition(); + public function isExternal(); /** * Pre-compiles a Zephir file. diff --git a/Library/CompilerFile.php b/src/CompilerFile.php similarity index 69% rename from Library/CompilerFile.php rename to src/CompilerFile.php index e634da6fd8..5f7a48ee7f 100644 --- a/Library/CompilerFile.php +++ b/src/CompilerFile.php @@ -16,14 +16,42 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; use ReflectionException; +use Zephir\Class\Constant; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Definition\DefinitionRuntime; +use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Property; +use Zephir\Code\Printer; use Zephir\Compiler\FileInterface; use Zephir\Documentation\DocblockParser; use Zephir\Exception\CompilerException; use Zephir\Exception\IllegalStateException; use Zephir\Exception\ParseException; use Zephir\FileSystem\FileSystemInterface; - +use Zephir\Traits\CompilerTrait; + +use function array_map; +use function count; +use function explode; +use function file_exists; +use function file_put_contents; +use function filemtime; use function is_array; +use function json_decode; +use function json_encode; +use function md5; +use function preg_match; +use function realpath; +use function sprintf; +use function str_replace; +use function strtolower; +use function substr; +use function trim; + +use const DIRECTORY_SEPARATOR; +use const JSON_PRETTY_PRINT; +use const PHP_EOL; /** * This class represents every file compiled in a project. @@ -31,50 +59,38 @@ */ final class CompilerFile implements FileInterface { + use CompilerTrait; use LoggerAwareTrait; /** - * @var string|null + * @var AliasManager */ - private ?string $namespace = null; - + private AliasManager $aliasManager; /** - * @var string|null + * @var Definition|null */ - private ?string $className = null; - + private ?Definition $classDefinition = null; + private ?string $className = null; /** * @var string|null */ - private ?string $filePath = null; - - /** - * @var bool - */ - private bool $external = false; - + private ?string $compiledFile = null; /** - * Original internal representation (IR) of the file. - * - * @var array|null + * @var Config */ - private ?array $ir = null; - + private Config $config; /** - * @var mixed + * @var bool */ - private $originalNode; - + private bool $external = false; /** * @var string|null */ - private ?string $compiledFile = null; - + private ?string $filePath = null; /** - * @var ClassDefinition|null + * @var FileSystemInterface */ - private ?ClassDefinition $classDefinition = null; - + private FileSystemInterface $filesystem; /** * @var FunctionDefinition[] */ @@ -84,21 +100,17 @@ final class CompilerFile implements FileInterface * @var array */ private array $headerCBlocks = []; - - /** - * @var Config - */ - private Config $config; - /** - * @var AliasManager + * Original internal representation (IR) of the file. + * + * @var array|null */ - private AliasManager $aliasManager; - + private ?array $ir = null; + private ?string $namespace = null; /** - * @var FileSystemInterface + * @var mixed */ - private FileSystemInterface $filesystem; + private $originalNode; /** * CompilerFile constructor. @@ -112,61 +124,10 @@ public function __construct( AliasManager $aliasManager, FileSystemInterface $filesystem ) { - $this->config = $config; - $this->logger = new NullLogger(); + $this->config = $config; + $this->logger = new NullLogger(); $this->aliasManager = $aliasManager; - $this->filesystem = $filesystem; - } - - /** - * @param string $filePath - */ - public function setFilePath(string $filePath) - { - $this->filePath = $filePath; - } - - /** - * @param string $className - */ - public function setClassName(string $className) - { - $this->className = $className; - } - - /** - * {@inheritdoc} - * - * @return ClassDefinition - */ - public function getClassDefinition() - { - $this->classDefinition->setAliasManager($this->aliasManager); - - return $this->classDefinition; - } - - public function getFunctionDefinitions() - { - return $this->functionDefinitions; - } - - /** - * Sets if the class belongs to an external dependency or not. - * - * @param bool $external - */ - public function setIsExternal($external): void - { - $this->external = (bool) $external; - } - - /** - * @return bool - */ - public function isExternal(): bool - { - return $this->external; + $this->filesystem = $filesystem; } /** @@ -178,7 +139,7 @@ public function isExternal(): bool * * @throws CompilerException */ - public function addFunction(Compiler $compiler, FunctionDefinition $func, array $statement = []) + public function addFunction(Compiler $compiler, FunctionDefinition $func, array $statement = []): void { $compiler->addFunction($func, $statement); $funcName = strtolower($func->getInternalName()); @@ -192,258 +153,382 @@ public function addFunction(Compiler $compiler, FunctionDefinition $func, array $this->functionDefinitions[$funcName] = $func; } - /** - * Compiles the file generating a JSON intermediate representation. - * - * @param Compiler $compiler - * - * @throws ParseException - * @throws IllegalStateException if the intermediate representation is not of type 'array' - * - * @return array - */ - public function genIR(Compiler $compiler): array + public function applyClassHeaders(CompilationContext $compilationContext): void { - $normalizedPath = $this->filesystem->normalizePath($this->filePath); - - $compilePath = "{$normalizedPath}.json"; - $zepRealPath = realpath($this->filePath); + $classDefinition = $this->classDefinition; - if ($this->filesystem->exists($compilePath)) { - if ($this->filesystem->modificationTime($compilePath) < filemtime($zepRealPath)) { - $this->filesystem->delete($compilePath); - } - } + $code = $this->generateCodeHeadersPre($classDefinition); - if (!$this->filesystem->exists($compilePath)) { - $parser = $compiler->getParserManager()->getParser(); - $ir = $parser->parse($zepRealPath); - $this->filesystem->write($compilePath, json_encode($ir, JSON_PRETTY_PRINT)); + if ('class' == $classDefinition->getType()) { + $code .= '#include ' . PHP_EOL; + $code .= '#include ' . PHP_EOL; + $code .= '#include ' . PHP_EOL; } else { - $ir = json_decode($this->filesystem->read($compilePath), true); + $code .= '#include ' . PHP_EOL; } - return $ir; + $this->generateClassHeadersPost($code, $classDefinition, $compilationContext); } /** - * Compiles the class/interface contained in the file. + * Check dependencies. * - * @param CompilationContext $compilationContext + * @param Compiler $compiler * - * @throws Exception * @throws ReflectionException */ - public function compileClass(CompilationContext $compilationContext): void + public function checkDependencies(Compiler $compiler): void { - $this->classDefinition->compile($compilationContext); - } + $classDefinition = $this->classDefinition; - /** - * Compiles a function. - * - * @param CompilationContext $compilationContext - * @param FunctionDefinition $functionDefinition - */ - public function compileFunction(CompilationContext $compilationContext, FunctionDefinition $functionDefinition) - { - /** Make sure we do not produce calls like ZEPHIR_CALL_SELF */ - $bakClassDefinition = $compilationContext->classDefinition; - $compilationContext->classDefinition = null; - $compilationContext->currentMethod = $functionDefinition; + $extendedClass = $classDefinition->getExtendsClass(); + if ($extendedClass) { + if ('class' == $classDefinition->getType()) { + if ($compiler->isClass($extendedClass)) { + $extendedDefinition = $compiler->getClassDefinition($extendedClass); + $classDefinition->setExtendsClassDefinition($extendedDefinition); + } else { + if ($compiler->isBundledClass($extendedClass)) { + $extendedDefinition = $compiler->getInternalClassDefinition($extendedClass); + $classDefinition->setExtendsClassDefinition($extendedDefinition); + } else { + $extendedDefinition = new DefinitionRuntime($extendedClass); + $classDefinition->setExtendsClassDefinition($extendedDefinition); - $codePrinter = $compilationContext->codePrinter; - $codePrinter->output('PHP_FUNCTION('.$functionDefinition->getInternalName().') {'); - $functionDefinition->compile($compilationContext); - $codePrinter->output('}'); - $codePrinter->outputBlankLine(); + $this->logger->warning( + sprintf( + 'Cannot locate class "%s" when extending class "%s"', + $extendedClass, + $classDefinition->getCompleteName() + ), + ['nonexistent-class', $this->originalNode] + ); + } + } + } else { + // Whether the $extendedClass is part of the compiled extension + if ($compiler->isInterface($extendedClass)) { + $extendedDefinition = $compiler->getClassDefinition($extendedClass); + $classDefinition->setExtendsClassDefinition($extendedDefinition); + } else { + if ($compiler->isBundledInterface($extendedClass)) { + $extendedDefinition = $compiler->getInternalClassDefinition($extendedClass); + $classDefinition->setExtendsClassDefinition($extendedDefinition); + } else { + $extendedDefinition = new DefinitionRuntime($extendedClass); + $classDefinition->setExtendsClassDefinition($extendedDefinition); - /* Restore */ - $compilationContext->classDefinition = $bakClassDefinition; - $compilationContext->currentMethod = null; - } + $this->logger->warning( + sprintf( + 'Cannot locate class "%s" when extending interface "%s"', + $extendedClass, + $classDefinition->getCompleteName() + ), + ['nonexistent-class', $this->originalNode] + ); + } + } + } + } - /** - * Compiles a comment as a top-level statement. - * - * @param CompilationContext $compilationContext - * @param array $topStatement - */ - public function compileComment(CompilationContext $compilationContext, $topStatement) - { - $compilationContext->codePrinter->output('/'.$topStatement['value'].'/'); + $interfaceDefinitions = []; + foreach ($classDefinition->getImplementedInterfaces() as $interface) { + if ($compiler->isInterface($interface)) { + $interfaceDefinitions[$interface] = $compiler->getClassDefinition($interface); + } else { + if ($compiler->isBundledInterface($interface)) { + $interfaceDefinitions[$interface] = $compiler->getInternalClassDefinition($interface); + } else { + if ($extendedClass !== null) { + $classDefinition->setExtendsClassDefinition(new DefinitionRuntime($extendedClass)); + } + + $this->logger->warning( + sprintf( + 'Cannot locate class "%s" when extending interface "%s"', + $interface, + $classDefinition->getCompleteName() + ), + ['nonexistent-class', $this->originalNode] + ); + } + } + } + + if (count($interfaceDefinitions) > 0) { + $classDefinition->setImplementedInterfaceDefinitions($interfaceDefinitions); + } } /** - * Creates a definition for an interface. + * Compiles the file. * - * @param string $namespace - * @param array $topStatement - * @param array $docblock + * @param Compiler $compiler + * @param StringsManager $stringsManager + * + * @throws CompilerException */ - public function preCompileInterface($namespace, $topStatement, $docblock) + public function compile(Compiler $compiler, StringsManager $stringsManager): void { - $classDefinition = new ClassDefinition($namespace, $topStatement['name']); - $classDefinition->setIsExternal($this->external); - - if (isset($topStatement['extends'])) { - foreach ($topStatement['extends'] as &$extend) { - $extend['value'] = $this->getFullName($extend['value']); - } - $classDefinition->setImplementsInterfaces($topStatement['extends']); + if (!$this->ir) { + throw new CompilerException('Unable to locate the intermediate representation of the compiled file'); } - $classDefinition->setType('interface'); - - if (is_array($docblock)) { - $classDefinition->setDocBlock($docblock['value']); + /** + * External classes should not be compiled as part of the extension + */ + if ($this->external) { + return; } - if (isset($topStatement['definition'])) { - $definition = $topStatement['definition']; - - /** - * Register constants - */ - if (isset($definition['constants'])) { - foreach ($definition['constants'] as $constant) { - $classConstant = new ClassConstant( - $constant['name'], - $constant['default'] ?? null, - $constant['docblock'] ?? null - ); - $classDefinition->addConstant($classConstant); - } + /** + * Compilation context stores common objects required by compilation entities. + */ + $compilationContext = new CompilationContext(); + + /** + * Set global compiler in the compilation context + */ + $compilationContext->compiler = $compiler; + + /** + * Set global config in the compilation context + */ + $compilationContext->config = $this->config; + + /** + * Set global logger in the compilation context + */ + $compilationContext->logger = $this->logger; + + /** + * Set global strings manager + */ + $compilationContext->stringsManager = $stringsManager; + $compilationContext->backend = $compiler->backend; + + /** + * Headers manager. + */ + $headersManager = new HeadersManager(); + $compilationContext->headersManager = $headersManager; + + /** + * Main code-printer for the file. + */ + $codePrinter = new Printer(); + $compilationContext->codePrinter = $codePrinter; + + /** + * Alias manager + */ + $compilationContext->aliasManager = $this->aliasManager; + + $codePrinter->outputBlankLine(); + + $class = false; + $interface = false; + + foreach ($this->ir as $topStatement) { + switch ($topStatement['type']) { + case 'class': + case Definition::TYPE_INTERFACE: + if ($interface || $class) { + throw new CompilerException('More than one class defined in the same file', $topStatement); + } + $class = true; + $this->compileClass($compilationContext); + break; + + case 'comment': + $this->compileComment($compilationContext, $topStatement); + break; + + default: + break; } + } + + /* ensure functions are handled last */ + foreach ($this->functionDefinitions as $funcDef) { + $this->compileFunction($compilationContext, $funcDef); + } + + /* apply headers */ + $this->applyClassHeaders($compilationContext); + + $classDefinition = $this->classDefinition; + if (!$classDefinition) { + $this->ir = null; + + return; + } + + $classDefinition->setOriginalNode($this->originalNode); + $completeName = $classDefinition->getCompleteName(); + + [$path, $filePath, $filePathHeader] = $this->calculatePaths($completeName); + + /** + * If the file does not exist we create it for the first time + */ + if (!file_exists($filePath)) { + file_put_contents($filePath, $codePrinter->getOutput()); + if ($compilationContext->headerPrinter) { + file_put_contents($filePathHeader, $compilationContext->headerPrinter->getOutput()); + } + } else { /** - * Register methods + * Use md5 hash to avoid rewrite the file again and again when it hasn't changed + * thus avoiding unnecessary recompilations. */ - if (isset($definition['methods'])) { - foreach ($definition['methods'] as $method) { - $classMethod = new ClassMethod( - $classDefinition, - $method['visibility'], - $method['name'], - isset($method['parameters']) ? new ClassMethodParameters($method['parameters']) : null, - null, - $method['docblock'] ?? null, - $method['return-type'] ?? null, - $method - ); - $classDefinition->addMethod($classMethod, $method); + $output = $codePrinter->getOutput(); + $hash = $this->filesystem->getHashFile('md5', $filePath, true); + if (md5($output) != $hash) { + file_put_contents($filePath, $output); + } + + if ($compilationContext->headerPrinter) { + $output = $compilationContext->headerPrinter->getOutput(); + $hash = $this->filesystem->getHashFile('md5', $filePathHeader, true); + if (md5($output) != $hash) { + file_put_contents($filePathHeader, $output); } } } - $this->classDefinition = $classDefinition; + /** + * Add to file compiled + */ + $this->compiledFile = $path . '.c'; + $this->ir = null; } /** - * Creates a definition for a class. + * Compiles the class/interface contained in the file. + * + * @param CompilationContext $compilationContext + * + * @throws Exception + * @throws ReflectionException + */ + public function compileClass(CompilationContext $compilationContext): void + { + $this->classDefinition->compile($compilationContext); + } + + /** + * Compiles a comment as a top-level statement. * * @param CompilationContext $compilationContext - * @param string $namespace * @param array $topStatement - * @param array $docblock */ - public function preCompileClass(CompilationContext $compilationContext, $namespace, $topStatement, $docblock) + public function compileComment(CompilationContext $compilationContext, $topStatement): void { - $classDefinition = new ClassDefinition($namespace, $topStatement['name']); - $classDefinition->setIsExternal($this->external); + $compilationContext->codePrinter->output('/' . $topStatement['value'] . '/'); + } - if (isset($topStatement['extends'])) { - $classDefinition->setExtendsClass($this->getFullName($topStatement['extends'])); - } + /** + * Compiles a function. + * + * @param CompilationContext $compilationContext + * @param FunctionDefinition $functionDefinition + * + * @throws Exception + */ + public function compileFunction( + CompilationContext $compilationContext, + FunctionDefinition $functionDefinition + ): void { + /** Make sure we do not produce calls like ZEPHIR_CALL_SELF */ + $bakClassDefinition = $compilationContext->classDefinition; + $compilationContext->classDefinition = null; + $compilationContext->currentMethod = $functionDefinition; - if (isset($topStatement['implements'])) { - foreach ($topStatement['implements'] as &$implement) { - $implement['value'] = $this->getFullName($implement['value']); - } - $classDefinition->setImplementsInterfaces($topStatement['implements']); - } + $codePrinter = $compilationContext->codePrinter; + $codePrinter->output('PHP_FUNCTION(' . $functionDefinition->getInternalName() . ') {'); + $functionDefinition->compile($compilationContext); + $codePrinter->output('}'); + $codePrinter->outputBlankLine(); - if (isset($topStatement['abstract'])) { - $classDefinition->setIsAbstract((bool) $topStatement['abstract']); - } + /* Restore */ + $compilationContext->classDefinition = $bakClassDefinition; + $compilationContext->currentMethod = null; + } - if (isset($topStatement['final'])) { - $classDefinition->setIsFinal((bool) $topStatement['final']); - } + /** + * Compiles the file generating a JSON intermediate representation. + * + * @param Compiler $compiler + * + * @return array + * + * @throws ParseException + * @throws IllegalStateException if the intermediate representation is not of type 'array' + */ + public function genIR(Compiler $compiler): array + { + $normalizedPath = $this->filesystem->normalizePath($this->filePath); - if (is_array($docblock)) { - $classDefinition->setDocBlock($docblock['value']); - } + $compilePath = "{$normalizedPath}.json"; + $zepRealPath = realpath($this->filePath); - if (isset($topStatement['definition'])) { - $definition = $topStatement['definition']; + if ($this->filesystem->exists($compilePath)) { + if ($this->filesystem->modificationTime($compilePath) < filemtime($zepRealPath)) { + $this->filesystem->delete($compilePath); + } + } - if (isset($definition['properties'])) { - foreach ($definition['properties'] as $property) { - /** - * Add property to the definition - */ - $classDefinition->addProperty(new ClassProperty( - $classDefinition, - $property['visibility'], - $property['name'], - $property['default'] ?? null, - $property['docblock'] ?? null, - $property - )); + if (!$this->filesystem->exists($compilePath)) { + $parser = $compiler->getParserManager()->getParser(); + $ir = $parser->parse($zepRealPath); + $this->filesystem->write($compilePath, json_encode($ir, JSON_PRETTY_PRINT)); + } else { + $ir = json_decode($this->filesystem->read($compilePath), true); + } - /** - * Check and process shortcuts - */ - if (isset($property['shortcuts'])) { - $this->processShortcuts($property, $classDefinition); - } - } - } + return $ir; + } - /** - * Register constants - */ - if (isset($definition['constants'])) { - foreach ($definition['constants'] as $constant) { - $classDefinition->addConstant(new ClassConstant( - $constant['name'], - $constant['default'] ?? null, - $constant['docblock'] ?? null - )); - } - } + /** + * {@inheritdoc} + * + * @return Definition + */ + public function getClassDefinition() + { + $this->classDefinition->setAliasManager($this->aliasManager); - /** - * Register methods - */ - if (isset($definition['methods'])) { - foreach ($definition['methods'] as $method) { - $classDefinition->addMethod(new ClassMethod( - $classDefinition, - $method['visibility'], - $method['name'], - isset($method['parameters']) ? new ClassMethodParameters($method['parameters']) : null, - isset($method['statements']) ? new StatementsBlock($method['statements']) : null, - $method['docblock'] ?? null, - $method['return-type'] ?? null, - $method - ), $method); - } - } - } + return $this->classDefinition; + } - $this->classDefinition = $classDefinition; + /** + * Returns the path to the compiled file. + * + * @return string + */ + public function getCompiledFile(): string + { + return $this->compiledFile; + } - /** - * Assign current class definition to the compilation context - */ - $compilationContext->classDefinition = $classDefinition; + /** + * Returns the path to the source file. + * + * @return string + */ + public function getFilePath(): string + { + return $this->filePath; + } - /** - * Run pre-compilation passes - */ - $classDefinition->preCompile($compilationContext); + /** + * @return bool + */ + public function isExternal(): bool + { + return $this->external; } /** @@ -457,7 +542,7 @@ public function preCompileClass(CompilationContext $compilationContext, $namespa * @throws IllegalStateException * @throws ParseException */ - public function preCompile(Compiler $compiler) + public function preCompile(Compiler $compiler): void { $ir = $this->genIR($compiler); @@ -468,12 +553,12 @@ public function preCompile(Compiler $compiler) /** * Compilation context stores common objects required by compilation entities. */ - $compilationContext = new CompilationContext(); - $compilationContext->compiler = $compiler; - $compilationContext->config = $this->config; - $compilationContext->logger = $this->logger; + $compilationContext = new CompilationContext(); + $compilationContext->compiler = $compiler; + $compilationContext->config = $this->config; + $compilationContext->logger = $this->logger; $compilationContext->aliasManager = $this->aliasManager; - $compilationContext->backend = $compiler->backend; + $compilationContext->backend = $compiler->backend; /** * Traverse the top level statements looking for the namespace. @@ -487,7 +572,7 @@ public function preCompile(Compiler $compiler) throw new CompilerException('The namespace must be defined just one time', $topStatement); } - $namespace = $topStatement['name']; + $namespace = $topStatement['name']; $this->namespace = $namespace; if (!preg_match('/^[A-Z]/', $namespace)) { @@ -511,7 +596,7 @@ public function preCompile(Compiler $compiler) $parameters = null; if (isset($topStatement['parameters'])) { - $parameters = new ClassMethodParameters($topStatement['parameters']); + $parameters = new Parameters($topStatement['parameters']); } $returnType = null; @@ -546,9 +631,9 @@ public function preCompile(Compiler $compiler) } } - $name = null; - $class = false; - $interface = false; + $name = null; + $class = false; + $interface = false; $lastComment = null; foreach ($ir as $topStatement) { @@ -561,13 +646,13 @@ public function preCompile(Compiler $compiler) ); } $class = true; - $name = $topStatement['name']; + $name = $topStatement['name']; $this->preCompileClass($compilationContext, $namespace, $topStatement, $lastComment); $this->originalNode = $topStatement; - $lastComment = null; + $lastComment = null; break; - case 'interface': + case Definition::TYPE_INTERFACE: if ($class || $interface) { throw new CompilerException( 'More than one class/interface defined in the same file', @@ -575,10 +660,10 @@ public function preCompile(Compiler $compiler) ); } $interface = true; - $name = $topStatement['name']; + $name = $topStatement['name']; $this->preCompileInterface($namespace, $topStatement, $lastComment); $this->originalNode = $topStatement; - $lastComment = null; + $lastComment = null; break; case 'use': @@ -606,11 +691,11 @@ public function preCompile(Compiler $compiler) if (!$this->external) { $expectedPath = strtolower( - str_replace('\\', \DIRECTORY_SEPARATOR, $namespace).\DIRECTORY_SEPARATOR.$name.'.zep' + str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR . $name . '.zep' ); if (strtolower($this->filePath) != $expectedPath) { - $className = $namespace.'\\'.$name; + $className = $namespace . '\\' . $name; throw new CompilerException( sprintf( @@ -638,326 +723,256 @@ public function preCompile(Compiler $compiler) } /** - * Returns the path to the compiled file. - * - * @return string - */ - public function getCompiledFile(): string - { - return $this->compiledFile; - } - - /** - * Check dependencies. - * - * @param Compiler $compiler - * - * @throws ReflectionException - */ - public function checkDependencies(Compiler $compiler) - { - $classDefinition = $this->classDefinition; - - $extendedClass = $classDefinition->getExtendsClass(); - if ($extendedClass) { - if ('class' == $classDefinition->getType()) { - if ($compiler->isClass($extendedClass)) { - $extendedDefinition = $compiler->getClassDefinition($extendedClass); - $classDefinition->setExtendsClassDefinition($extendedDefinition); - } else { - if ($compiler->isBundledClass($extendedClass)) { - $extendedDefinition = $compiler->getInternalClassDefinition($extendedClass); - $classDefinition->setExtendsClassDefinition($extendedDefinition); - } else { - $extendedDefinition = new ClassDefinitionRuntime($extendedClass); - $classDefinition->setExtendsClassDefinition($extendedDefinition); - - $this->logger->warning( - sprintf( - 'Cannot locate class "%s" when extending class "%s"', - $extendedClass, - $classDefinition->getCompleteName() - ), - ['nonexistent-class', $this->originalNode] - ); - } - } - } else { - // Whether the $extendedClass is part of the compiled extension - if ($compiler->isInterface($extendedClass)) { - $extendedDefinition = $compiler->getClassDefinition($extendedClass); - $classDefinition->setExtendsClassDefinition($extendedDefinition); - } else { - if ($compiler->isBundledInterface($extendedClass)) { - $extendedDefinition = $compiler->getInternalClassDefinition($extendedClass); - $classDefinition->setExtendsClassDefinition($extendedDefinition); - } else { - $extendedDefinition = new ClassDefinitionRuntime($extendedClass); - $classDefinition->setExtendsClassDefinition($extendedDefinition); - - $this->logger->warning( - sprintf( - 'Cannot locate class "%s" when extending interface "%s"', - $extendedClass, - $classDefinition->getCompleteName() - ), - ['nonexistent-class', $this->originalNode] - ); - } - } - } - } - - $interfaceDefinitions = []; - foreach ($classDefinition->getImplementedInterfaces() as $interface) { - if ($compiler->isInterface($interface)) { - $interfaceDefinitions[$interface] = $compiler->getClassDefinition($interface); - } else { - if ($compiler->isBundledInterface($interface)) { - $interfaceDefinitions[$interface] = $compiler->getInternalClassDefinition($interface); - } else { - if ($extendedClass !== null) { - $classDefinition->setExtendsClassDefinition(new ClassDefinitionRuntime($extendedClass)); - } - - $this->logger->warning( - sprintf( - 'Cannot locate class "%s" when extending interface "%s"', - $interface, - $classDefinition->getCompleteName() - ), - ['nonexistent-class', $this->originalNode] - ); - } - } - } - - if (count($interfaceDefinitions) > 0) { - $classDefinition->setImplementedInterfaceDefinitions($interfaceDefinitions); - } - } - - /** - * Compiles the file. - * - * @param Compiler $compiler - * @param StringsManager $stringsManager + * Creates a definition for a class. * - * @throws CompilerException - */ - public function compile(Compiler $compiler, StringsManager $stringsManager) - { - if (!$this->ir) { - throw new CompilerException('Unable to locate the intermediate representation of the compiled file'); - } - - /** - * External classes should not be compiled as part of the extension - */ - if ($this->external) { - return; - } - - /** - * Compilation context stores common objects required by compilation entities. - */ - $compilationContext = new CompilationContext(); - - /** - * Set global compiler in the compilation context - */ - $compilationContext->compiler = $compiler; - - /** - * Set global config in the compilation context - */ - $compilationContext->config = $this->config; - - /** - * Set global logger in the compilation context - */ - $compilationContext->logger = $this->logger; - - /** - * Set global strings manager - */ - $compilationContext->stringsManager = $stringsManager; - $compilationContext->backend = $compiler->backend; - - /** - * Headers manager. - */ - $headersManager = new HeadersManager(); - $compilationContext->headersManager = $headersManager; - - /** - * Main code-printer for the file. - */ - $codePrinter = new CodePrinter(); - $compilationContext->codePrinter = $codePrinter; - - /** - * Alias manager - */ - $compilationContext->aliasManager = $this->aliasManager; - - $codePrinter->outputBlankLine(); - - $class = false; - $interface = false; - - foreach ($this->ir as $topStatement) { - switch ($topStatement['type']) { - case 'class': - case 'interface': - if ($interface || $class) { - throw new CompilerException('More than one class defined in the same file', $topStatement); - } - $class = true; - $this->compileClass($compilationContext); - break; + * @param CompilationContext $compilationContext + * @param string $namespace + * @param array $topStatement + * @param array $docblock + */ + public function preCompileClass(CompilationContext $compilationContext, $namespace, $topStatement, $docblock): void + { + $classDefinition = new Definition($namespace, $topStatement['name']); + $classDefinition->setIsExternal($this->external); - case 'comment': - $this->compileComment($compilationContext, $topStatement); - break; + if (isset($topStatement['extends'])) { + $classDefinition->setExtendsClass($this->getFullName($topStatement['extends'])); + } - default: - break; + if (isset($topStatement['implements'])) { + foreach ($topStatement['implements'] as &$implement) { + $implement['value'] = $this->getFullName($implement['value']); } + $classDefinition->setImplementsInterfaces($topStatement['implements']); } - /* ensure functions are handled last */ - foreach ($this->functionDefinitions as $funcDef) { - $this->compileFunction($compilationContext, $funcDef); + if (isset($topStatement['abstract'])) { + $classDefinition->setIsAbstract((bool)$topStatement['abstract']); } - /* apply headers */ - $this->applyClassHeaders($compilationContext); - - $classDefinition = $this->classDefinition; - if (!$classDefinition) { - $this->ir = null; + if (isset($topStatement['final'])) { + $classDefinition->setIsFinal((bool)$topStatement['final']); + } - return; + if (is_array($docblock)) { + $classDefinition->setDocBlock($docblock['value']); } - $classDefinition->setOriginalNode($this->originalNode); + if (isset($topStatement['definition'])) { + $definition = $topStatement['definition']; - $completeName = $classDefinition->getCompleteName(); + if (isset($definition['properties'])) { + foreach ($definition['properties'] as $property) { + /** + * Add property to the definition + */ + $classDefinition->addProperty( + new Property( + $classDefinition, + $property['visibility'], + $property['name'], + $property['default'] ?? null, + $property['docblock'] ?? null, + $property + ) + ); - $path = str_replace('\\', \DIRECTORY_SEPARATOR, strtolower($completeName)); + /** + * Check and process shortcuts + */ + if (isset($property['shortcuts'])) { + $this->processShortcuts($property, $classDefinition); + } + } + } - $filePath = 'ext/'.$path.'.zep.c'; - $filePathHeader = 'ext/'.$path.'.zep.h'; + /** + * Register constants + */ + if (isset($definition['constants'])) { + foreach ($definition['constants'] as $constant) { + $classDefinition->addConstant( + new Constant( + $constant['name'], + $constant['default'] ?? null, + $constant['docblock'] ?? null + ) + ); + } + } - if (strpos($path, \DIRECTORY_SEPARATOR)) { - $dirname = \dirname($filePath); - if (!is_dir($dirname)) { - mkdir($dirname, 0755, true); + /** + * Register methods + */ + if (isset($definition['methods'])) { + foreach ($definition['methods'] as $method) { + $classDefinition->addMethod( + new Method( + $classDefinition, + $method['visibility'], + $method['name'], + isset($method['parameters']) ? new Parameters($method['parameters']) : null, + isset($method['statements']) ? new StatementsBlock($method['statements']) : null, + $method['docblock'] ?? null, + $method['return-type'] ?? null, + $method + ), + $method + ); + } } } + $this->classDefinition = $classDefinition; + /** - * If the file does not exists we create it for the first time + * Assign current class definition to the compilation context */ - if (!file_exists($filePath)) { - file_put_contents($filePath, $codePrinter->getOutput()); - if ($compilationContext->headerPrinter) { - file_put_contents($filePathHeader, $compilationContext->headerPrinter->getOutput()); + $compilationContext->classDefinition = $classDefinition; + + /** + * Run pre-compilation passes + */ + $classDefinition->preCompile($compilationContext); + } + + /** + * Creates a definition for an interface. + * + * @param string $namespace + * @param array $topStatement + * @param array $docblock + */ + public function preCompileInterface($namespace, $topStatement, $docblock): void + { + $classDefinition = new Definition($namespace, $topStatement['name']); + $classDefinition->setIsExternal($this->external); + + if (isset($topStatement['extends'])) { + foreach ($topStatement['extends'] as &$extend) { + $extend['value'] = $this->getFullName($extend['value']); } - } else { + $classDefinition->setImplementsInterfaces($topStatement['extends']); + } + + $classDefinition->setType(Definition::TYPE_INTERFACE); + + if (is_array($docblock)) { + $classDefinition->setDocBlock($docblock['value']); + } + + if (isset($topStatement['definition'])) { + $definition = $topStatement['definition']; + /** - * Use md5 hash to avoid rewrite the file again and again when it hasn't changed - * thus avoiding unnecessary recompilations. + * Register constants */ - $output = $codePrinter->getOutput(); - $hash = $this->filesystem->getHashFile('md5', $filePath, true); - if (md5($output) != $hash) { - file_put_contents($filePath, $output); + if (isset($definition['constants'])) { + foreach ($definition['constants'] as $constant) { + $classConstant = new Constant( + $constant['name'], + $constant['default'] ?? null, + $constant['docblock'] ?? null + ); + $classDefinition->addConstant($classConstant); + } } - if ($compilationContext->headerPrinter) { - $output = $compilationContext->headerPrinter->getOutput(); - $hash = $this->filesystem->getHashFile('md5', $filePathHeader, true); - if (md5($output) != $hash) { - file_put_contents($filePathHeader, $output); + /** + * Register methods + */ + if (isset($definition['methods'])) { + foreach ($definition['methods'] as $method) { + $classMethod = new Method( + $classDefinition, + $method['visibility'], + $method['name'], + isset($method['parameters']) ? new Parameters($method['parameters']) : null, + null, + $method['docblock'] ?? null, + $method['return-type'] ?? null, + $method + ); + $classDefinition->addMethod($classMethod, $method); } } } - /** - * Add to file compiled - */ - $this->compiledFile = $path.'.c'; - $this->ir = null; + $this->classDefinition = $classDefinition; } - public function applyClassHeaders(CompilationContext $compilationContext) + /** + * @param string $className + */ + public function setClassName(string $className): void { - $classDefinition = $this->classDefinition; - - $separators = str_repeat('../', \count(explode('\\', $classDefinition->getCompleteName())) - 1); + $this->className = $className; + } - $code = ''.PHP_EOL; - $code .= '#ifdef HAVE_CONFIG_H'.PHP_EOL; - $code .= '#include "'.$separators.'ext_config.h"'.PHP_EOL; - $code .= '#endif'.PHP_EOL; - $code .= ''.PHP_EOL; + /** + * @param string $filePath + */ + public function setFilePath(string $filePath): void + { + $this->filePath = $filePath; + } - $code .= '#include '.PHP_EOL; - $code .= '#include "'.$separators.'php_ext.h"'.PHP_EOL; - $code .= '#include "'.$separators.'ext.h"'.PHP_EOL; - $code .= ''.PHP_EOL; + /** + * Sets if the class belongs to an external dependency or not. + * + * @param bool $external + */ + public function setIsExternal($external): void + { + $this->external = (bool)$external; + } - if ('class' == $classDefinition->getType()) { - $code .= '#include '.PHP_EOL; - $code .= '#include '.PHP_EOL; - $code .= '#include '.PHP_EOL; - } else { - $code .= '#include '.PHP_EOL; + /** + * Create returns type list. + */ + protected function createReturnsType(array $types, bool $annotated = false): ?array + { + if (!$types) { + return null; } - $code .= ''.PHP_EOL; - - $code .= '#include "kernel/main.h"'.PHP_EOL; - if ('class' == $classDefinition->getType()) { - foreach ($compilationContext->headersManager->get() as $header => $one) { - $code .= '#include "'.$header.'.h"'.PHP_EOL; - } - } + $list = []; - if (\count($this->headerCBlocks) > 0) { - $code .= implode(PHP_EOL, $this->headerCBlocks).PHP_EOL; + foreach ($types as $type) { + $list[] = [ + 'type' => $annotated ? 'return-type-annotation' : 'return-type-paramater', + 'data-type' => 'mixed' === $type ? 'variable' : $type, + 'mandatory' => false, + ]; } - /* - * Prepend the required files to the header - */ - $compilationContext->codePrinter->preOutput($code); + return [ + 'type' => 'return-type', + 'list' => $list, + 'void' => empty($list), + ]; } /** - * Returns the path to the source file. - * - * @return string + * Transform class/interface name to FQN format. */ - public function getFilePath(): string + protected function getFullName(string $name): string { - return $this->filePath; + return Name::fetchFQN($name, $this->namespace, $this->aliasManager); } /** * Creates the property shortcuts. * - * @param array $property - * @param ClassDefinition $classDefinition + * @param array $property + * @param Definition $classDefinition * * @throws CompilerException */ - protected function processShortcuts(array $property, ClassDefinition $classDefinition) + protected function processShortcuts(array $property, Definition $classDefinition): void { foreach ($property['shortcuts'] as $shortcut) { - if ('_' == substr($property['name'], 0, 1)) { + if (str_starts_with($property['name'], '_')) { $name = substr($property['name'], 1); } else { $name = $property['name']; @@ -973,13 +988,14 @@ protected function processShortcuts(array $property, ClassDefinition $classDefin $returnsType = []; if ($docBlock) { - $docBlockParser = new DocblockParser('/'.$docBlock.'/'); + $docBlockParser = new DocblockParser('/' . $docBlock . '/'); $docBlockParsed = $docBlockParser->parse(); if ($annotations = $docBlockParsed->getAnnotationsByType('var')) { - $returnsType = array_map(function ($type) { - return 'mixed' == ($type = trim($type)) ? 'variable' : $type; - }, (array) explode('|', $annotations[0]->getString())); + $returnsType = array_map( + fn($type) => 'mixed' == ($type = trim($type)) ? 'variable' : $type, + explode('|', $annotations[0]->getString()) + ); } // Clear annotations @@ -989,161 +1005,127 @@ protected function processShortcuts(array $property, ClassDefinition $classDefin switch ($shortcut['name']) { case 'get': - $classDefinition->addMethod(new ClassMethod( - $classDefinition, - ['public'], - 'get'.camelize($name), - null, - new StatementsBlock([ - [ - 'type' => 'return', - 'expr' => [ - 'type' => 'property-access', - 'left' => [ - 'type' => 'variable', - 'value' => 'this', - ], - 'right' => [ - 'type' => 'variable', - 'value' => $property['name'], + $classDefinition->addMethod( + new Method( + $classDefinition, + ['public'], + 'get' . Name::camelize($name), + null, + new StatementsBlock([ + [ + 'type' => 'return', + 'expr' => [ + 'type' => 'property-access', + 'left' => [ + 'type' => 'variable', + 'value' => 'this', + ], + 'right' => [ + 'type' => 'variable', + 'value' => $property['name'], + ], ], ], - ], - ]), - $docBlock, - $this->createReturnsType($returnsType, true), + ]), + $docBlock, + $this->createReturnsType($returnsType, true), + $shortcut + ), $shortcut - ), $shortcut); + ); break; case 'set': - $classDefinition->addMethod(new ClassMethod( - $classDefinition, - ['public'], - 'set'.camelize($name), - new ClassMethodParameters([ - [ - 'type' => 'parameter', - 'name' => $name, - 'const' => 0, - 'data-type' => 1 == \count($returnsType) ? $returnsType[0] : 'variable', - 'mandatory' => 0, - ], - ]), - new StatementsBlock([ - [ - 'type' => 'let', - 'assignments' => [ - [ - 'assign-type' => 'object-property', - 'operator' => 'assign', - 'variable' => 'this', - 'property' => $property['name'], - 'expr' => [ - 'type' => 'variable', - 'value' => $name, - 'file' => $property['file'], - 'line' => $property['line'], - 'char' => $property['char'], + $classDefinition->addMethod( + new Method( + $classDefinition, + ['public'], + 'set' . Name::camelize($name), + new Parameters([ + [ + 'type' => 'parameter', + 'name' => $name, + 'const' => 0, + 'data-type' => 1 == count($returnsType) ? $returnsType[0] : 'variable', + 'mandatory' => 0, + ], + ]), + new StatementsBlock([ + [ + 'type' => 'let', + 'assignments' => [ + [ + 'assign-type' => 'object-property', + 'operator' => 'assign', + 'variable' => 'this', + 'property' => $property['name'], + 'expr' => [ + 'type' => 'variable', + 'value' => $name, + 'file' => $property['file'], + 'line' => $property['line'], + 'char' => $property['char'], + ], + 'file' => $property['file'], + 'line' => $property['line'], + 'char' => $property['char'], ], - 'file' => $property['file'], - 'line' => $property['line'], - 'char' => $property['char'], ], ], - ], - [ - 'type' => 'return', - 'expr' => [ - 'type' => 'variable', - 'value' => 'this', - 'file' => $property['file'], - 'line' => $property['line'], - 'char' => $property['char'], + [ + 'type' => 'return', + 'expr' => [ + 'type' => 'variable', + 'value' => 'this', + 'file' => $property['file'], + 'line' => $property['line'], + 'char' => $property['char'], + ], ], - ], - ]), - $docBlock, - null, + ]), + $docBlock, + null, + $shortcut + ), $shortcut - ), $shortcut); + ); break; case 'toString': case '__toString': - $classDefinition->addMethod(new ClassMethod( - $classDefinition, - ['public'], - '__toString', - null, - new StatementsBlock([ - [ - 'type' => 'return', - 'expr' => [ - 'type' => 'property-access', - 'left' => [ - 'type' => 'variable', - 'value' => 'this', - ], - 'right' => [ - 'type' => 'variable', - 'value' => $property['name'], + $classDefinition->addMethod( + new Method( + $classDefinition, + ['public'], + '__toString', + null, + new StatementsBlock([ + [ + 'type' => 'return', + 'expr' => [ + 'type' => 'property-access', + 'left' => [ + 'type' => 'variable', + 'value' => 'this', + ], + 'right' => [ + 'type' => 'variable', + 'value' => $property['name'], + ], ], ], - ], - ]), - $docBlock, - $this->createReturnsType(['string']), + ]), + $docBlock, + $this->createReturnsType(['string']), + $shortcut + ), $shortcut - ), $shortcut); + ); break; default: - throw new CompilerException("Unknown shortcut '".$shortcut['name']."'", $shortcut); + throw new CompilerException("Unknown shortcut '" . $shortcut['name'] . "'", $shortcut); } } } - - /** - * Transform class/interface name to FQN format. - * - * @param string $name - * - * @return string - */ - protected function getFullName(string $name): string - { - return fqcn($name, $this->namespace, $this->aliasManager); - } - - /** - * Create returns type list. - * - * @param array $types - * @param bool $annotated - * - * @return array - */ - protected function createReturnsType(array $types, bool $annotated = false): ?array - { - if (!$types) { - return null; - } - - $list = []; - - foreach ($types as $type) { - $list[] = [ - 'type' => $annotated ? 'return-type-annotation' : 'return-type-paramater', - 'data-type' => 'mixed' === $type ? 'variable' : $type, - 'mandatory' => false, - ]; - } - - return [ - 'type' => 'return-type', - 'list' => $list, - 'void' => empty($list), - ]; - } } diff --git a/Library/CompilerFileAnonymous.php b/src/CompilerFileAnonymous.php similarity index 58% rename from Library/CompilerFileAnonymous.php rename to src/CompilerFileAnonymous.php index b4b54557ef..d818991448 100644 --- a/Library/CompilerFileAnonymous.php +++ b/src/CompilerFileAnonymous.php @@ -16,9 +16,17 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; use ReflectionException; +use Zephir\Class\Definition\Definition; +use Zephir\Code\Printer; use Zephir\Compiler\FileInterface; +use Zephir\Traits\CompilerTrait; -use function count; +use function file_exists; +use function file_put_contents; +use function hash_file; +use function md5; + +use const PHP_EOL; /** * This class represents an anonymous file created to dump @@ -26,108 +34,30 @@ */ final class CompilerFileAnonymous implements FileInterface { + use CompilerTrait; use LoggerAwareTrait; - protected ?string $namespace = null; - protected ?string $compiledFile = null; - protected bool $external = false; - protected array $headerCBlocks = []; - protected ?CompilationContext $context = null; - protected ClassDefinition $classDefinition; - protected Config $config; + protected Definition $classDefinition; + protected ?string $compiledFile = null; + protected Config $config; + protected ?CompilationContext $context = null; + protected bool $external = false; + protected array $headerCBlocks = []; + protected ?string $namespace = null; /** * CompilerFileAnonymous constructor. * - * @param ClassDefinition $classDefinition + * @param Definition $classDefinition * @param Config $config * @param CompilationContext|null $context */ - public function __construct(ClassDefinition $classDefinition, Config $config, ?CompilationContext $context = null) + public function __construct(Definition $classDefinition, Config $config, CompilationContext $context = null) { $this->classDefinition = $classDefinition; - $this->config = $config; - $this->context = $context; - $this->logger = new NullLogger(); - } - - /** - * @return ClassDefinition - */ - public function getClassDefinition(): ClassDefinition - { - return $this->classDefinition; - } - - /** - * Sets if the class belongs to an external dependency or not. - * - * @param bool $external - */ - public function setIsExternal($external) - { - $this->external = (bool) $external; - } - - /** - * @return bool - */ - public function isExternal(): bool - { - return $this->external; - } - - /** - * Compiles the class/interface contained in the file. - * - * @param CompilationContext $compilationContext - * - * @throws Exception - * @throws ReflectionException - */ - private function compileClass(CompilationContext $compilationContext) - { - $classDefinition = $this->classDefinition; - - /** - * Do the compilation - */ - $classDefinition->compile($compilationContext); - - $separators = str_repeat('../', count(explode('\\', $classDefinition->getCompleteName())) - 1); - - $code = ''.PHP_EOL; - $code .= '#ifdef HAVE_CONFIG_H'.PHP_EOL; - $code .= '#include "'.$separators.'ext_config.h"'.PHP_EOL; - $code .= '#endif'.PHP_EOL; - $code .= ''.PHP_EOL; - - $code .= '#include '.PHP_EOL; - $code .= '#include "'.$separators.'php_ext.h"'.PHP_EOL; - $code .= '#include "'.$separators.'ext.h"'.PHP_EOL; - $code .= ''.PHP_EOL; - - $code .= '#include '.PHP_EOL; - $code .= '#include '.PHP_EOL; - $code .= '#include '.PHP_EOL; - $code .= ''.PHP_EOL; - - $code .= '#include "kernel/main.h"'.PHP_EOL; - - if ('class' == $classDefinition->getType()) { - foreach ($compilationContext->headersManager->get() as $header => $one) { - $code .= '#include "'.$header.'.h"'.PHP_EOL; - } - } - - if (count($this->headerCBlocks) > 0) { - $code .= implode(PHP_EOL, $this->headerCBlocks).PHP_EOL; - } - - /** - * Prepend the required files to the header - */ - $compilationContext->codePrinter->preOutput($code); + $this->config = $config; + $this->context = $context; + $this->logger = new NullLogger(); } /** @@ -138,7 +68,7 @@ private function compileClass(CompilationContext $compilationContext) * * @throws Exception */ - public function compile(Compiler $compiler, StringsManager $stringsManager) + public function compile(Compiler $compiler, StringsManager $stringsManager): void { /** * Compilation context stores common objects required by compilation entities. @@ -151,22 +81,22 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) $compilationContext->aliasManager = new AliasManager(); } - $compilationContext->compiler = $compiler; - $compilationContext->config = $this->config; - $compilationContext->logger = $this->logger; + $compilationContext->compiler = $compiler; + $compilationContext->config = $this->config; + $compilationContext->logger = $this->logger; $compilationContext->stringsManager = $stringsManager; - $compilationContext->backend = $compiler->backend; + $compilationContext->backend = $compiler->backend; /** * Headers manager. */ - $headersManager = new HeadersManager(); + $headersManager = new HeadersManager(); $compilationContext->headersManager = $headersManager; /** * Main code-printer for the file. */ - $codePrinter = new CodePrinter(); + $codePrinter = new Printer(); $compilationContext->codePrinter = $codePrinter; $codePrinter->outputBlankLine(); @@ -175,17 +105,7 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) $completeName = $this->classDefinition->getCompleteName(); - $path = str_replace('\\', \DIRECTORY_SEPARATOR, strtolower($completeName)); - - $filePath = 'ext/'.$path.'.zep.c'; - $filePathHeader = 'ext/'.$path.'.zep.h'; - - if (strpos($path, \DIRECTORY_SEPARATOR)) { - $dirname = \dirname($filePath); - if (!is_dir($dirname)) { - mkdir($dirname, 0755, true); - } - } + [$path, $filePath, $filePathHeader] = $this->calculatePaths($completeName); /** * If the file does not exist we create it for the first time @@ -201,14 +121,14 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) * thus avoiding unnecessary recompilations. */ $output = $codePrinter->getOutput(); - $hash = hash_file('md5', $filePath); + $hash = hash_file('md5', $filePath); if (md5($output) !== $hash) { file_put_contents($filePath, $output); } if ($compilationContext->headerPrinter) { $output = $compilationContext->headerPrinter->getOutput(); - $hash = hash_file('md5', $filePathHeader); + $hash = hash_file('md5', $filePathHeader); if (md5($output) !== $hash) { file_put_contents($filePathHeader, $output); } @@ -218,7 +138,15 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) /** * Add to file compiled */ - $this->compiledFile = $path.'.c'; + $this->compiledFile = $path . '.c'; + } + + /** + * @return Definition + */ + public function getClassDefinition(): Definition + { + return $this->classDefinition; } /** @@ -231,6 +159,14 @@ public function getCompiledFile() return $this->compiledFile; } + /** + * @return bool + */ + public function isExternal(): bool + { + return $this->external; + } + /** * {@inheritdoc} * @@ -238,8 +174,44 @@ public function getCompiledFile() * * @param Compiler $compiler */ - public function preCompile(Compiler $compiler) + public function preCompile(Compiler $compiler): void { // nothing to do } + + /** + * Sets if the class belongs to an external dependency or not. + * + * @param bool $external + */ + public function setIsExternal($external): void + { + $this->external = (bool)$external; + } + + /** + * Compiles the class/interface contained in the file. + * + * @param CompilationContext $compilationContext + * + * @throws Exception + * @throws ReflectionException + */ + private function compileClass(CompilationContext $compilationContext): void + { + $classDefinition = $this->classDefinition; + + /** + * Do the compilation + */ + $classDefinition->compile($compilationContext); + + $code = $this->generateCodeHeadersPre($classDefinition); + + $code .= '#include ' . PHP_EOL; + $code .= '#include ' . PHP_EOL; + $code .= '#include ' . PHP_EOL; + + $this->generateClassHeadersPost($code, $classDefinition, $compilationContext); + } } diff --git a/Library/Config.php b/src/Config.php similarity index 57% rename from Library/Config.php rename to src/Config.php index 73aeaf59b0..bef1a9f75e 100644 --- a/Library/Config.php +++ b/src/Config.php @@ -15,6 +15,29 @@ use ArrayAccess; use JsonSerializable; +use ReturnTypeWillChange; + +use function array_key_exists; +use function array_values; +use function count; +use function current; +use function file_exists; +use function file_get_contents; +use function file_put_contents; +use function is_array; +use function json_decode; +use function json_encode; +use function json_last_error; +use function key; +use function preg_match; + +use const JSON_ERROR_CTRL_CHAR; +use const JSON_ERROR_DEPTH; +use const JSON_ERROR_NONE; +use const JSON_ERROR_STATE_MISMATCH; +use const JSON_ERROR_SYNTAX; +use const JSON_ERROR_UTF8; +use const JSON_PRETTY_PRINT; /** * Manages compiler global configuration. @@ -23,89 +46,83 @@ class Config implements ArrayAccess, JsonSerializable { /** * Is config changed? - * - * @var bool */ - protected $changed = false; + protected bool $changed = false; /** * Default configuration for project. - * - * @var array */ - private $container = [ - 'stubs' => [ - 'path' => 'ide/%version%/%namespace%/', + private array $container = [ + 'stubs' => [ + 'path' => 'ide/%version%/%namespace%/', 'stubs-run-after-generate' => false, - 'banner' => '', + 'banner' => '', ], - 'api' => [ - 'path' => 'doc/%version%', + 'api' => [ + 'path' => 'doc/%version%', 'theme' => [ - 'name' => 'zephir', + 'name' => 'zephir', 'options' => [ - 'github' => null, - 'analytics' => null, - 'main_color' => '#3E6496', - 'link_color' => '#3E6496', + 'github' => null, + 'analytics' => null, + 'main_color' => '#3E6496', + 'link_color' => '#3E6496', 'link_hover_color' => '#5F9AE7', ], ], ], - 'warnings' => [ - 'unused-variable' => true, - 'unused-variable-external' => false, - 'possible-wrong-parameter' => true, + 'warnings' => [ + 'unused-variable' => true, + 'unused-variable-external' => false, + 'possible-wrong-parameter' => true, 'possible-wrong-parameter-undefined' => false, - 'nonexistent-function' => true, - 'nonexistent-class' => true, - 'non-valid-isset' => true, - 'non-array-update' => true, - 'non-valid-objectupdate' => true, - 'non-valid-fetch' => true, - 'invalid-array-index' => true, - 'non-array-append' => true, - 'invalid-return-type' => true, - 'unreachable-code' => true, - 'nonexistent-constant' => true, - 'not-supported-magic-constant' => true, - 'non-valid-decrement' => true, - 'non-valid-increment' => true, - 'non-valid-clone' => true, - 'non-valid-new' => true, - 'non-array-access' => true, - 'invalid-reference' => true, - 'invalid-typeof-comparison' => true, - 'conditional-initialization' => true, + 'nonexistent-function' => true, + 'nonexistent-class' => true, + 'non-valid-isset' => true, + 'non-array-update' => true, + 'non-valid-objectupdate' => true, + 'non-valid-fetch' => true, + 'invalid-array-index' => true, + 'non-array-append' => true, + 'invalid-return-type' => true, + 'unreachable-code' => true, + 'nonexistent-constant' => true, + 'not-supported-magic-constant' => true, + 'non-valid-decrement' => true, + 'non-valid-increment' => true, + 'non-valid-clone' => true, + 'non-valid-new' => true, + 'non-array-access' => true, + 'invalid-reference' => true, + 'invalid-typeof-comparison' => true, + 'conditional-initialization' => true, ], 'optimizations' => [ - 'static-type-inference' => true, + 'static-type-inference' => true, 'static-type-inference-second-pass' => true, - 'local-context-pass' => true, - 'constant-folding' => true, - 'static-constant-class-folding' => true, - 'call-gatherer-pass' => true, - 'check-invalid-reads' => false, - 'internal-call-transformation' => false, + 'local-context-pass' => true, + 'constant-folding' => true, + 'static-constant-class-folding' => true, + 'call-gatherer-pass' => true, + 'check-invalid-reads' => false, + 'internal-call-transformation' => false, ], - 'extra' => [ - 'indent' => 'spaces', + 'extra' => [ + 'indent' => 'spaces', 'export-classes' => false, ], - 'namespace' => '', - 'name' => '', - 'description' => '', - 'author' => 'Phalcon Team', - 'version' => '0.0.1', - 'verbose' => false, - 'requires' => [ + 'namespace' => '', + 'name' => '', + 'description' => '', + 'author' => 'Phalcon Team', + 'version' => '0.0.1', + 'verbose' => false, + 'requires' => [ 'extensions' => [], ], ]; /** - * Config constructor. - * * @throws Exception */ public function __construct() @@ -115,18 +132,22 @@ public function __construct() /** * Returns JSON representation of the project config. - * - * @return string */ public function __toString() { - return (string) json_encode($this, JSON_PRETTY_PRINT); + return (string)json_encode($this, JSON_PRETTY_PRINT); + } + + /** + * Writes the configuration if it has been changed. + */ + public function dumpToFile(): void + { + file_put_contents('config.json', $this); } /** * Factory method to create a Config instance from the $_SERVER['argv']. - * - * @return Config */ public static function fromServer(): self { @@ -203,22 +224,43 @@ public static function fromServer(): self } $_SERVER['argv'] = array_values($argv); - $_SERVER['argc'] = \count($argv); + $_SERVER['argc'] = count($argv); } return $config; } /** - * Allows to check whether a $key is defined. + * Retrieves a configuration setting. * * @param mixed $key + * @param mixed $namespace + * + * @return mixed|null + */ + public function get($key, $namespace = null) + { + return null !== $namespace ? $this->offsetGet([$namespace => $key]) : $this->offsetGet($key); + } + + /** + * Specify data which should be serialized to JSON. + */ + public function jsonSerialize(): array + { + return $this->container; + } + + /** + * Allows to check whether a $key is defined. + * + * @param mixed $offset * * @return bool */ - public function offsetExists($key): bool + public function offsetExists($offset): bool { - return isset($this->container[$key]) || \array_key_exists($key, $this->container); + return isset($this->container[$offset]) || array_key_exists($offset, $this->container); } /** @@ -228,21 +270,21 @@ public function offsetExists($key): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] + #[ReturnTypeWillChange] public function offsetGet($offset) { - if (!\is_array($offset)) { + if (!is_array($offset)) { return $this->offsetExists($offset) ? $this->container[$offset] : null; } $namespace = key($offset); - $offset = current($offset); + $offset = current($offset); - if (!$this->offsetExists($namespace) || !\is_array($this->container[$namespace])) { + if (!$this->offsetExists($namespace) || !is_array($this->container[$namespace])) { return null; } - if (isset($this->container[$namespace][$offset]) || \array_key_exists($offset, $this->container[$namespace])) { + if (isset($this->container[$namespace][$offset]) || array_key_exists($offset, $this->container[$namespace])) { return $this->container[$namespace][$offset]; } @@ -252,52 +294,40 @@ public function offsetGet($offset) /** * Sets a configuration value. * - * @param mixed $key + * @param mixed $offset * @param mixed $value */ - #[\ReturnTypeWillChange] - public function offsetSet($key, $value) + #[ReturnTypeWillChange] + public function offsetSet($offset, $value): void { - if (!\is_array($key)) { - $this->container[$key] = $value; + if (!is_array($offset)) { + $this->container[$offset] = $value; return; } - $namespace = key($key); - $key = current($key); + $namespace = key($offset); + $offset = current($offset); - if (!\array_key_exists($namespace, $this->container)) { + if (!array_key_exists($namespace, $this->container)) { $this->container[$namespace] = []; } - $this->container[$namespace][$key] = $value; + $this->container[$namespace][$offset] = $value; } /** * Unsets a $key from internal container. * + * @param mixed $offset + * * @deprecated * - * @param mixed $key */ - #[\ReturnTypeWillChange] - public function offsetUnset($key) + #[ReturnTypeWillChange] + public function offsetUnset($offset): void { - unset($this->container[$key]); - } - - /** - * Retrieves a configuration setting. - * - * @param mixed $key - * @param mixed $namespace - * - * @return mixed|null - */ - public function get($key, $namespace = null) - { - return null !== $namespace ? $this->offsetGet([$namespace => $key]) : $this->offsetGet($key); + unset($this->container[$offset]); } /** @@ -307,41 +337,23 @@ public function get($key, $namespace = null) * @param mixed $value * @param mixed $namespace */ - public function set($key, $value, $namespace = null) + public function set($key, $value, $namespace = null): void { null !== $namespace ? $this->offsetSet([$namespace => $key], $value) : $this->offsetSet($key, $value); } - /** - * Writes the configuration if it has been changed. - */ - public function dumpToFile() - { - file_put_contents('config.json', $this); - } - - /** - * Specify data which should be serialized to JSON. - * - * @return array - */ - public function jsonSerialize(): array - { - return $this->container; - } - /** * Populate project configuration. * * @throws Exception */ - protected function populate() + protected function populate(): void { if (!file_exists('config.json')) { return; } - $config = json_decode(file_get_contents('config.json'), true); + $config = json_decode(file_get_contents('config.json'), true); $message = 'The config.json file is invalid'; switch (json_last_error()) { @@ -352,19 +364,19 @@ protected function populate() return; case JSON_ERROR_DEPTH: - $message = "{$message}: Maximum stack depth exceeded"; + $message = "$message: Maximum stack depth exceeded"; break; case JSON_ERROR_STATE_MISMATCH: - $message = "{$message}: Underflow or the modes mismatch"; + $message = "$message: Underflow or the modes mismatch"; break; case JSON_ERROR_CTRL_CHAR: - $message = "{$message}: Unexpected control character found"; + $message = "$message: Unexpected control character found"; break; case JSON_ERROR_SYNTAX: - $message = "{$message}: Syntax error, malformed JSON"; + $message = "$message: Syntax error, malformed JSON"; break; case JSON_ERROR_UTF8: - $message = "{$message}: Malformed UTF-8 characters, possibly incorrectly encoded"; + $message = "$message: Malformed UTF-8 characters, possibly incorrectly encoded"; break; default: break; diff --git a/Library/ConfigException.php b/src/ConfigException.php similarity index 53% rename from Library/ConfigException.php rename to src/ConfigException.php index ab1ad6229a..90499af2ea 100644 --- a/Library/ConfigException.php +++ b/src/ConfigException.php @@ -9,15 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; -use Exception; +use const PHP_EOL; -class ConfigException extends Exception +class ConfigException extends \Exception { - public function __construct($message = '', $code = 0, Exception $previous = null) + public function __construct($message = '', $code = 0, \Exception $previous = null) { - $message .= PHP_EOL.'Please see https://docs.zephir-lang.com/0.12/en/config for more information'; + $message .= PHP_EOL . 'Please see https://docs.zephir-lang.com/0.12/en/config for more information'; parent::__construct($message, $code, $previous); } diff --git a/Library/Console/Application.php b/src/Console/Application.php similarity index 83% rename from Library/Console/Application.php rename to src/Console/Application.php index 32cfa2d96d..f33529b246 100644 --- a/Library/Console/Application.php +++ b/src/Console/Application.php @@ -30,9 +30,18 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Throwable; use Zephir\Console\Command\ListCommand; -use Zephir\EventListener\ConsoleErrorListener; use Zephir\Zephir; +use function explode; +use function fprintf; +use function implode; +use function sprintf; +use function strtolower; +use function trim; + +use const PHP_EOL; +use const STDERR; + final class Application extends BaseApplication { public function __construct() @@ -40,70 +49,11 @@ public function __construct() parent::__construct('Zephir', Zephir::VERSION); $dispatcher = new EventDispatcher(); - $dispatcher->addListener(ConsoleEvents::ERROR, [new ConsoleErrorListener(), 'onCommandError']); + $dispatcher->addListener(ConsoleEvents::ERROR, [new ErrorListener(), 'onCommandError']); $this->setDispatcher($dispatcher); } - /** - * {@inheritdoc} - * - * @return string - */ - public function getHelp() - { - return Zephir::LOGO.parent::getHelp(); - } - - /** - * Get Version Number - * - * @return string The application version - */ - public function getVerNum(): string - { - $version = explode('-', parent::getVersion()); - $version = explode('.', $version[0]); - - return $version[0].sprintf('%02s', $version[1]).sprintf('%02s', $version[2]); - } - - /** - * Gets the application version as integer. - * - * @return string The application version - */ - public function getVersion(): string - { - $version = explode('-', parent::getVersion()); - - if (isset($version[1]) && 0 === strpos($version[1], '$')) { - return "{$version[0]}-source"; - } - - return implode('-', $version); - } - - /** - * {@inheritdoc} - * - * @return string The long application version - */ - public function getLongVersion(): string - { - $version = explode('-', $this->getVersion()); - $commit = "({$version[1]})"; - - return trim( - sprintf( - '%s %s by Andres Gutierrez and Serghei Iakovlev %s', - $this->getName(), - $version[0], - $commit - ) - ); - } - /** * {@inheritdoc} * @@ -114,7 +64,7 @@ public function getLongVersion(): string * * @throws Exception|Throwable */ - public function doRun(InputInterface $input, OutputInterface $output) + public function doRun(InputInterface $input, OutputInterface $output): int { if (true === $input->hasParameterOption(['--dumpversion', '-dumpversion'], true)) { $output->writeln($this->getVersion()); @@ -131,12 +81,12 @@ public function doRun(InputInterface $input, OutputInterface $output) try { // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument. $input->bind($this->getDefinition()); - } catch (ExceptionInterface $e) { + } catch (ExceptionInterface) { // Errors must be ignored, full binding/validation happens later when the command is known. } $wantsHelp = false; - $name = $this->getCommandName($input); + $name = $this->getCommandName($input); if ($name && 'help' == strtolower($name) && 2 == $_SERVER['argc']) { $wantsHelp = true; @@ -152,15 +102,71 @@ public function doRun(InputInterface $input, OutputInterface $output) try { return parent::doRun($input, $output); - } catch (CommandNotFoundException $e) { - fprintf(STDERR, $e->getMessage().PHP_EOL); + } catch (CommandNotFoundException | RuntimeException $e) { + fprintf(STDERR, $e->getMessage() . PHP_EOL); return 1; - } catch (RuntimeException $e) { - fprintf(STDERR, $e->getMessage().PHP_EOL); + } + } - return 1; + /** + * {@inheritdoc} + * + * @return string + */ + public function getHelp(): string + { + return Zephir::LOGO . parent::getHelp(); + } + + /** + * {@inheritdoc} + * + * @return string The long application version + */ + public function getLongVersion(): string + { + $version = explode('-', $this->getVersion()); + $commit = "({$version[1]})"; + + return trim( + sprintf( + '%s %s by the Phalcon Team' . PHP_EOL . + 'Thanks to the work by: Andres Gutierrez and Serghei Iakovlev %s', + $this->getName(), + $version[0], + $commit + ) + ); + } + + /** + * Get Version Number + * + * @return string The application version + */ + public function getVerNum(): string + { + $version = explode('-', parent::getVersion()); + $version = explode('.', $version[0]); + + return $version[0] . sprintf('%02s', $version[1]) . sprintf('%02s', $version[2]); + } + + /** + * Gets the application version as integer. + * + * @return string The application version + */ + public function getVersion(): string + { + $version = explode('-', parent::getVersion()); + + if (isset($version[1]) && str_starts_with($version[1], '$')) { + return "{$version[0]}-source"; } + + return implode('-', $version); } /** @@ -168,7 +174,7 @@ public function doRun(InputInterface $input, OutputInterface $output) * * @return Command[] An array of default Command instances */ - protected function getDefaultCommands() + protected function getDefaultCommands(): array { return [new HelpCommand(), new ListCommand()]; } @@ -195,7 +201,7 @@ protected function getDefaultInputDefinition(): InputDefinition '--verbose', '-v', InputOption::VALUE_NONE, - 'Displays more detail in error messages from exceptions generated by commands '. + 'Displays more detail in error messages from exceptions generated by commands ' . '(can also disable with -V)' ), new InputOption( diff --git a/Library/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php similarity index 88% rename from Library/Console/Command/AbstractCommand.php rename to src/Console/Command/AbstractCommand.php index cc43e6120e..25b8afcdae 100644 --- a/Library/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -22,7 +22,7 @@ abstract class AbstractCommand extends Command /** * @param bool $mergeArgs */ - public function mergeApplicationDefinition($mergeArgs = true) + public function mergeApplicationDefinition(bool $mergeArgs = true): void { parent::mergeApplicationDefinition($mergeArgs); diff --git a/Library/Console/Command/ApiCommand.php b/src/Console/Command/ApiCommand.php similarity index 81% rename from Library/Console/Command/ApiCommand.php rename to src/Console/Command/ApiCommand.php index e19477ac6b..c71ad8d3fb 100644 --- a/Library/Console/Command/ApiCommand.php +++ b/src/Console/Command/ApiCommand.php @@ -21,7 +21,15 @@ use Zephir\Compiler; use Zephir\Config; +use function array_filter; +use function array_keys; +use function array_merge; use function in_array; +use function preg_match; +use function sprintf; + +use const ARRAY_FILTER_USE_BOTH; +use const PHP_EOL; /** * Generates an HTML API based on the classes exposed in the extension. @@ -30,24 +38,51 @@ final class ApiCommand extends AbstractCommand { use ZflagsAwareTrait; - private Compiler $compiler; - private Config $config; - - public function __construct(Compiler $compiler, Config $config) + public function __construct(private Compiler $compiler, private Config $config) { - $this->compiler = $compiler; - $this->config = $config; - parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('api') ->setDescription('Generates a HTML API based on the classes exposed in the extension') ->setDefinition($this->createDefinition()) - ->setHelp(sprintf('%s.', $this->getDescription()).PHP_EOL.PHP_EOL.$this->getZflagsHelp()); + ->setHelp(sprintf('%s.', $this->getDescription()) . PHP_EOL . PHP_EOL . $this->getZflagsHelp()) + ; + } + + protected function createDefinition(): InputDefinition + { + return new InputDefinition( + [ + new InputOption( + 'path', + 'p', + InputOption::VALUE_REQUIRED, + 'The API theme to be used' + ), + new InputOption( + 'output', + 'o', + InputOption::VALUE_REQUIRED, + 'Output directory to generate theme' + ), + new InputOption( + 'options', + null, + InputOption::VALUE_REQUIRED, + 'Theme options' + ), + new InputOption( + 'url', + null, + InputOption::VALUE_REQUIRED, + 'The base URL to be used when generating links' + ), + ] + ); } protected function execute(InputInterface $input, OutputInterface $output) @@ -66,10 +101,10 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function getDefaultOptions(): array { return [ - 'path' => null, - 'output' => $this->config->get('path', 'api'), + 'path' => null, + 'output' => $this->config->get('path', 'api'), 'options' => null, - 'url' => $this->config->get('base-url', 'api'), + 'url' => $this->config->get('base-url', 'api'), ]; } @@ -94,43 +129,4 @@ protected function sanitizeOptionsFromInput(InputInterface $input): array return $options; } - - protected function createDefinition(): InputDefinition - { - return new InputDefinition( - [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to generate HTML API for the extension', - 'ZendEngine3' - ), - new InputOption( - 'path', - 'p', - InputOption::VALUE_REQUIRED, - 'The API theme to be used' - ), - new InputOption( - 'output', - 'o', - InputOption::VALUE_REQUIRED, - 'Output directory to generate theme' - ), - new InputOption( - 'options', - null, - InputOption::VALUE_REQUIRED, - 'Theme options' - ), - new InputOption( - 'url', - null, - InputOption::VALUE_REQUIRED, - 'The base URL to be used when generating links' - ), - ] - ); - } } diff --git a/Library/Console/Command/BuildCommand.php b/src/Console/Command/BuildCommand.php similarity index 77% rename from Library/Console/Command/BuildCommand.php rename to src/Console/Command/BuildCommand.php index 9e2740d655..c24ba0c053 100644 --- a/Library/Console/Command/BuildCommand.php +++ b/src/Console/Command/BuildCommand.php @@ -13,6 +13,7 @@ namespace Zephir\Console\Command; +use Exception; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; @@ -20,9 +21,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use const PHP_EOL; + /** - * Build Command - * * Generates/Compiles/Installs a Zephir extension. */ final class BuildCommand extends AbstractCommand @@ -30,7 +31,7 @@ final class BuildCommand extends AbstractCommand use DevelopmentModeAwareTrait; use ZflagsAwareTrait; - protected function configure() + protected function configure(): void { $this ->setName('build') @@ -38,23 +39,28 @@ protected function configure() ->setDefinition($this->createDefinition()) ->addOption('dev', null, InputOption::VALUE_NONE, 'Build the extension in development mode') ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Build the extension in production mode') - ->setHelp($this->getDevelopmentModeHelp().PHP_EOL.$this->getZflagsHelp()); + ->setHelp($this->getDevelopmentModeHelp() . PHP_EOL . $this->getZflagsHelp()) + ; + } + + protected function createDefinition(): InputDefinition + { + return new InputDefinition([]); } protected function execute(InputInterface $input, OutputInterface $output) { // call generate $command = $this->getApplication()->find('generate'); - $io = new SymfonyStyle($input, $output); + $io = new SymfonyStyle($input, $output); $arguments = [ 'command' => 'generate', - '--backend' => $input->getOption('backend'), ]; try { $command->run(new ArrayInput($arguments), $output); - } catch (\Exception $e) { + } catch (Exception $e) { $io->getErrorStyle()->error($e->getMessage()); return 1; @@ -62,17 +68,16 @@ protected function execute(InputInterface $input, OutputInterface $output) // call compile $command = $this->getApplication()->find('compile'); - $io = new SymfonyStyle($input, $output); + $io = new SymfonyStyle($input, $output); $arguments = [ 'command' => 'compile', - '--backend' => $input->getOption('backend'), - '--dev' => $this->isDevelopmentModeEnabled($input), + '--dev' => $this->isDevelopmentModeEnabled($input), ]; try { $command->run(new ArrayInput($arguments), $output); - } catch (\Exception $e) { + } catch (Exception $e) { $io->getErrorStyle()->error($e->getMessage()); return 1; @@ -80,37 +85,22 @@ protected function execute(InputInterface $input, OutputInterface $output) // call install $command = $this->getApplication()->find('install'); - $io = new SymfonyStyle($input, $output); + $io = new SymfonyStyle($input, $output); $arguments = [ 'command' => 'install', - '--dev' => $this->isDevelopmentModeEnabled($input), + '--dev' => $this->isDevelopmentModeEnabled($input), ]; try { return $command->run(new ArrayInput($arguments), $output); - } catch (\Exception $e) { + } catch (Exception $e) { $io->getErrorStyle()->error($e->getMessage()); return 1; } } - protected function createDefinition(): InputDefinition - { - return new InputDefinition( - [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to build extension', - 'ZendEngine3' - ), - ] - ); - } - /** * @return string */ diff --git a/Library/Console/Command/CleanCommand.php b/src/Console/Command/CleanCommand.php similarity index 84% rename from Library/Console/Command/CleanCommand.php rename to src/Console/Command/CleanCommand.php index b620c1d3ad..21f88d259a 100644 --- a/Library/Console/Command/CleanCommand.php +++ b/src/Console/Command/CleanCommand.php @@ -17,13 +17,15 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Throwable; use Zephir\Exception\FileSystemException; use Zephir\FileSystem\FileSystemInterface; -use function Zephir\is_windows; +use Zephir\Os; + +use function sprintf; +use function system; /** - * Zephir\Console\Command\CleanCommand. - * * Cleans any object files created by the extension. */ final class CleanCommand extends AbstractCommand @@ -37,12 +39,13 @@ public function __construct(FileSystemInterface $filesystem) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('clean') ->setDescription('Cleans any object files created by the extension') - ->setHelp(sprintf('%s.', $this->getDescription())); + ->setHelp(sprintf('%s.', $this->getDescription())) + ; } protected function execute(InputInterface $input, OutputInterface $output) @@ -58,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->filesystem->clean(); // TODO(klay): Do nothing if there is no Makefile - if (is_windows()) { + if (Os::isWindows()) { // TODO(klay): Is there an analogue for "> /dev/null" ? system('cd ext && nmake clean-all'); } else { @@ -67,16 +70,16 @@ protected function execute(InputInterface $input, OutputInterface $output) } catch (FileSystemException $e) { $io->getErrorStyle()->error( sprintf( - "For reasons beyond Zephir's control, a filesystem error has occurred. ". - 'Please note: On Linux/Unix systems the current user must have the delete and execute '. - 'permissions on the internal cache directory, For more information see chmod(1) and chown(1). '. + "For reasons beyond Zephir's control, a filesystem error has occurred. " . + 'Please note: On Linux/Unix systems the current user must have the delete and execute ' . + 'permissions on the internal cache directory, For more information see chmod(1) and chown(1). ' . 'System error was: %s', $e->getMessage() ) ); return 1; - } catch (Exception | \Throwable $e) { + } catch (Exception | Throwable $e) { $io->getErrorStyle()->error($e->getMessage()); return 1; diff --git a/Library/Console/Command/CompileCommand.php b/src/Console/Command/CompileCommand.php similarity index 83% rename from Library/Console/Command/CompileCommand.php rename to src/Console/Command/CompileCommand.php index fc82d98caa..6da74cf34a 100644 --- a/Library/Console/Command/CompileCommand.php +++ b/src/Console/Command/CompileCommand.php @@ -21,9 +21,9 @@ use Zephir\Compiler; use Zephir\Exception\CompilerException; +use const PHP_EOL; + /** - * Compile Command - * * Compile a Zephir extension. */ final class CompileCommand extends AbstractCommand @@ -40,7 +40,7 @@ public function __construct(Compiler $compiler) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('compile') @@ -49,14 +49,20 @@ protected function configure() ->addOption('dev', null, InputOption::VALUE_NONE, 'Compile the extension in development mode') ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Compile the extension in production mode') ->addOption('jobs', 'j', InputOption::VALUE_REQUIRED, 'Set make -j (job slots)') - ->setHelp($this->getDevelopmentModeHelp().PHP_EOL.$this->getZflagsHelp()); + ->setHelp($this->getDevelopmentModeHelp() . PHP_EOL . $this->getZflagsHelp()) + ; + } + + protected function createDefinition(): InputDefinition + { + return new InputDefinition([]); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); - $jobs = $input->hasOption('jobs') ? (int) $input->getOption('jobs') : null; + $jobs = $input->hasOption('jobs') ? (int)$input->getOption('jobs') : null; try { // TODO: Move all the stuff from the compiler @@ -73,21 +79,6 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - protected function createDefinition(): InputDefinition - { - return new InputDefinition( - [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to compile extension', - 'ZendEngine3' - ), - ] - ); - } - /** * @return string */ diff --git a/Library/Console/Command/DevelopmentModeAwareTrait.php b/src/Console/Command/DevelopmentModeAwareTrait.php similarity index 100% rename from Library/Console/Command/DevelopmentModeAwareTrait.php rename to src/Console/Command/DevelopmentModeAwareTrait.php diff --git a/Library/Console/Command/FullCleanCommand.php b/src/Console/Command/FullCleanCommand.php similarity index 83% rename from Library/Console/Command/FullCleanCommand.php rename to src/Console/Command/FullCleanCommand.php index 27effaaf3d..39b46e9190 100644 --- a/Library/Console/Command/FullCleanCommand.php +++ b/src/Console/Command/FullCleanCommand.php @@ -18,8 +18,10 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Zephir\Exception\FileSystemException; +use Zephir\Os; -use function Zephir\is_windows; +use function sprintf; +use function system; /** * Full Clean Command @@ -28,17 +30,18 @@ */ final class FullCleanCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('fullclean') ->setDescription('Cleans any object files created by the extension (including files generated by phpize)') - ->setHelp(sprintf('%s.', $this->getDescription())); + ->setHelp(sprintf('%s.', $this->getDescription())) + ; } protected function execute(InputInterface $input, OutputInterface $output) { - $command = $this->getApplication()->find('clean'); + $command = $this->getApplication()->find('clean'); $arguments = ['command' => 'install']; $io = new SymfonyStyle($input, $output); @@ -49,7 +52,7 @@ protected function execute(InputInterface $input, OutputInterface $output) */ try { if (0 === $command->run(new ArrayInput($arguments), $output)) { - if (is_windows()) { + if (Os::isWindows()) { system('cd ext && phpize --clean'); } else { system('cd ext && phpize --clean > /dev/null'); @@ -59,9 +62,9 @@ protected function execute(InputInterface $input, OutputInterface $output) } catch (FileSystemException $e) { $io->getErrorStyle()->error( sprintf( - "For reasons beyond Zephir's control, a filesystem error has occurred. ". - 'Please note: On Linux/Unix systems the current user must have the delete and execute '. - 'permissions on the internal cache directory, For more information see chmod(1) and chown(1). '. + "For reasons beyond Zephir's control, a filesystem error has occurred. " . + 'Please note: On Linux/Unix systems the current user must have the delete and execute ' . + 'permissions on the internal cache directory, For more information see chmod(1) and chown(1). ' . 'System error was: %s', $e->getMessage() ) diff --git a/Library/Console/Command/GenerateCommand.php b/src/Console/Command/GenerateCommand.php similarity index 77% rename from Library/Console/Command/GenerateCommand.php rename to src/Console/Command/GenerateCommand.php index 8ca92df7e3..94346f6f5e 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/src/Console/Command/GenerateCommand.php @@ -13,7 +13,6 @@ namespace Zephir\Console\Command; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -24,6 +23,10 @@ use Zephir\Exception\InvalidArgumentException; use function extension_loaded; +use function ini_get; +use function sprintf; + +use const PHP_EOL; /** * Generate Command @@ -43,14 +46,14 @@ public function __construct(Compiler $compiler) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('generate') ->setDescription('Generates C code from the Zephir code without compiling it') - ->setDefinition($this->createDefinition()) ->addOption('trace', 't', InputOption::VALUE_NONE, 'Show trace message output (in case of exception error)') - ->setHelp(sprintf('%s.', $this->getDescription()).PHP_EOL.PHP_EOL.$this->getZflagsHelp()); + ->setHelp(sprintf('%s.', $this->getDescription()) . PHP_EOL . PHP_EOL . $this->getZflagsHelp()) + ; } protected function execute(InputInterface $input, OutputInterface $output) @@ -90,7 +93,9 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } catch (ExceptionInterface | Exception $e) { if ($trace === true) { - $io->getErrorStyle()->error($e->getMessage().sprintf(' (Zephir file: %s#%d)', $e->getFile(), $e->getLine())); + $io->getErrorStyle()->error( + $e->getMessage() . sprintf(' (Zephir file: %s#%d)', $e->getFile(), $e->getLine()) + ); $io->getErrorStyle()->error($e->getTraceAsString()); } else { $io->getErrorStyle()->error($e->getMessage()); @@ -101,19 +106,4 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - - protected function createDefinition(): InputDefinition - { - return new InputDefinition( - [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to generate extension', - 'ZendEngine3' - ), - ] - ); - } } diff --git a/Library/Console/Command/InitCommand.php b/src/Console/Command/InitCommand.php similarity index 77% rename from Library/Console/Command/InitCommand.php rename to src/Console/Command/InitCommand.php index 63f1bf2105..42a4a4bfe8 100644 --- a/Library/Console/Command/InitCommand.php +++ b/src/Console/Command/InitCommand.php @@ -19,9 +19,8 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Zephir\BaseBackend; +use Zephir\Backend\Backend; use Zephir\Config; use function chdir; @@ -30,6 +29,9 @@ use function is_readable; use function mkdir; use function preg_match; +use function preg_replace; +use function sprintf; +use function strtolower; use const DIRECTORY_SEPARATOR; @@ -40,29 +42,43 @@ */ final class InitCommand extends AbstractCommand { - private BaseBackend $backend; - private Config $config; + private Backend $backend; + private Config $config; private LoggerInterface $logger; - public function __construct(BaseBackend $backend, Config $config, LoggerInterface $logger) + public function __construct(Backend $backend, Config $config, LoggerInterface $logger) { $this->backend = $backend; - $this->config = $config; - $this->logger = $logger; + $this->config = $config; + $this->logger = $logger; parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('init') ->setDescription('Initializes a Zephir extension') ->setDefinition($this->createDefinition()) - ->setHelp(sprintf('%s.', $this->getDescription())); + ->setHelp(sprintf('%s.', $this->getDescription())) + ; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function createDefinition(): InputDefinition + { + return new InputDefinition( + [ + new InputArgument( + 'namespace', + InputArgument::REQUIRED, + 'The extension namespace' + ), + ] + ); + } + + protected function execute(InputInterface $input, OutputInterface $output): int { $namespace = $this->sanitizeNamespace($input->getArgument('namespace')); @@ -87,50 +103,12 @@ protected function execute(InputInterface $input, OutputInterface $output) // Copy the latest kernel files $this->recursiveProcess($this->backend->getInternalKernelPath(), 'ext/kernel'); - // Dump initial configuration on project creation $this->config->dumpToFile(); return 0; } - protected function createDefinition(): InputDefinition - { - return new InputDefinition( - [ - new InputArgument( - 'namespace', - InputArgument::REQUIRED, - 'The extension namespace' - ), - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to create extension', - 'ZendEngine3' - ), - ] - ); - } - - private function sanitizeNamespace(string $namespace): string - { - // Prevent "" namespace - if (empty($namespace)) { - throw new RuntimeException('Not enough arguments (missing: "namespace").'); - } - - $namespace = strtolower(preg_replace('/[^0-9a-zA-Z]/', '', $namespace)); - - // If sanitizing returns an empty string - if (empty($namespace)) { - throw new RuntimeException('Cannot obtain a valid initial namespace for the project.'); - } - - return $namespace; - } - /** * Copies the base kernel to the extension destination. * @@ -139,17 +117,17 @@ private function sanitizeNamespace(string $namespace): string * @param string|null $pattern * @param string $callback * - * @return bool + * @return void */ - private function recursiveProcess(string $src, string $dst, ?string $pattern = null, string $callback = 'copy'): bool + private function recursiveProcess(string $src, string $dst, string $pattern = null, string $callback = 'copy'): void { - $success = true; + $success = true; $iterator = new DirectoryIterator($src); foreach ($iterator as $item) { $pathName = $item->getPathname(); if (!is_readable($pathName)) { - $this->logger->error('File is not readable :'.$pathName); + $this->logger->error('File is not readable :' . $pathName); continue; } @@ -157,17 +135,32 @@ private function recursiveProcess(string $src, string $dst, ?string $pattern = n if ($item->isDir()) { if ('.' != $fileName && '..' != $fileName && '.libs' != $fileName) { - if (!is_dir($dst.DIRECTORY_SEPARATOR.$fileName)) { - mkdir($dst.DIRECTORY_SEPARATOR.$fileName, 0755, true); + if (!is_dir($dst . DIRECTORY_SEPARATOR . $fileName)) { + mkdir($dst . DIRECTORY_SEPARATOR . $fileName, 0755, true); } - $this->recursiveProcess($pathName, $dst.DIRECTORY_SEPARATOR.$fileName, $pattern, $callback); + $this->recursiveProcess($pathName, $dst . DIRECTORY_SEPARATOR . $fileName, $pattern, $callback); } } elseif ($pattern === null || 1 === preg_match($pattern, $fileName)) { - $path = $dst.DIRECTORY_SEPARATOR.$fileName; + $path = $dst . DIRECTORY_SEPARATOR . $fileName; $success = $success && $callback($pathName, $path); } } + } + + private function sanitizeNamespace(string $namespace): string + { + // Prevent "" namespace + if (empty($namespace)) { + throw new RuntimeException('Not enough arguments (missing: "namespace").'); + } - return $success; + $namespace = strtolower(preg_replace('/[^0-9a-zA-Z]/', '', $namespace)); + + // If sanitizing returns an empty string + if (empty($namespace)) { + throw new RuntimeException('Cannot obtain a valid initial namespace for the project.'); + } + + return $namespace; } } diff --git a/Library/Console/Command/InstallCommand.php b/src/Console/Command/InstallCommand.php similarity index 92% rename from Library/Console/Command/InstallCommand.php rename to src/Console/Command/InstallCommand.php index 0d8b6d0037..0a4b6bfeb0 100644 --- a/Library/Console/Command/InstallCommand.php +++ b/src/Console/Command/InstallCommand.php @@ -24,6 +24,9 @@ use Zephir\Exception\NotImplementedException; use function extension_loaded; +use function sprintf; + +use const PHP_EOL; /** * Install Command @@ -36,24 +39,25 @@ final class InstallCommand extends AbstractCommand use ZflagsAwareTrait; private Compiler $compiler; - private Config $config; + private Config $config; public function __construct(Compiler $compiler, Config $config) { $this->compiler = $compiler; - $this->config = $config; + $this->config = $config; parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('install') ->setDescription('Installs the extension in the extension directory (may require root password)') ->addOption('dev', null, InputOption::VALUE_NONE, 'Install the extension in development mode') ->addOption('no-dev', null, InputOption::VALUE_NONE, 'Install the extension in production mode') - ->setHelp($this->getDevelopmentModeHelp().PHP_EOL.$this->getZflagsHelp()); + ->setHelp($this->getDevelopmentModeHelp() . PHP_EOL . $this->getZflagsHelp()) + ; } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/Library/Console/Command/ListCommand.php b/src/Console/Command/ListCommand.php similarity index 94% rename from Library/Console/Command/ListCommand.php rename to src/Console/Command/ListCommand.php index 01c28dc8f0..4e43e5fc3f 100644 --- a/Library/Console/Command/ListCommand.php +++ b/src/Console/Command/ListCommand.php @@ -26,23 +26,23 @@ final class ListCommand extends Command /** * {@inheritdoc} + * + * @param bool $mergeArgs */ - protected function configure() + public function mergeApplicationDefinition($mergeArgs = true): void { - parent::configure(); + parent::mergeApplicationDefinition($mergeArgs); - $this->setHidden(true); + $this->removeOptions(['dumpversion', 'version']); } /** * {@inheritdoc} - * - * @param bool $mergeArgs */ - public function mergeApplicationDefinition($mergeArgs = true) + protected function configure(): void { - parent::mergeApplicationDefinition($mergeArgs); + parent::configure(); - $this->removeOptions(['dumpversion', 'version']); + $this->setHidden(true); } } diff --git a/Library/Console/Command/RemoveOptionsTrait.php b/src/Console/Command/RemoveOptionsTrait.php similarity index 67% rename from Library/Console/Command/RemoveOptionsTrait.php rename to src/Console/Command/RemoveOptionsTrait.php index c362fe5930..b55398cd3d 100644 --- a/Library/Console/Command/RemoveOptionsTrait.php +++ b/src/Console/Command/RemoveOptionsTrait.php @@ -13,7 +13,6 @@ namespace Zephir\Console\Command; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; use function array_filter; @@ -23,12 +22,12 @@ trait RemoveOptionsTrait { protected function removeOptions(array $names): void { - /** @var InputDefinition $definition */ $definition = $this->getDefinition(); - $filtered = array_filter($definition->getOptions(), function (InputOption $option) use ($names) { - return !in_array($option->getName(), $names, true); - }); + $filtered = array_filter( + $definition->getOptions(), + fn(InputOption $option) => !in_array($option->getName(), $names, true) + ); $definition->setOptions($filtered); } diff --git a/Library/Console/Command/StubsCommand.php b/src/Console/Command/StubsCommand.php similarity index 74% rename from Library/Console/Command/StubsCommand.php rename to src/Console/Command/StubsCommand.php index 6e0d6602ae..9070e5e07d 100644 --- a/Library/Console/Command/StubsCommand.php +++ b/src/Console/Command/StubsCommand.php @@ -15,12 +15,15 @@ use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Zephir\Compiler; use Zephir\Exception\ExceptionInterface; +use function sprintf; + +use const PHP_EOL; + /** * Stubs Command * @@ -39,13 +42,19 @@ public function __construct(Compiler $compiler) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('stubs') ->setDescription('Generates stubs that can be used in a PHP IDE') ->setDefinition($this->createDefinition()) - ->setHelp(sprintf('%s.', $this->getDescription()).PHP_EOL.PHP_EOL.$this->getZflagsHelp()); + ->setHelp(sprintf('%s.', $this->getDescription()) . PHP_EOL . PHP_EOL . $this->getZflagsHelp()) + ; + } + + protected function createDefinition(): InputDefinition + { + return new InputDefinition([]); } protected function execute(InputInterface $input, OutputInterface $output) @@ -63,19 +72,4 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - - protected function createDefinition(): InputDefinition - { - return new InputDefinition( - [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to generate stubs for the extension', - 'ZendEngine3' - ), - ] - ); - } } diff --git a/Library/Console/Command/ZflagsAwareTrait.php b/src/Console/Command/ZflagsAwareTrait.php similarity index 100% rename from Library/Console/Command/ZflagsAwareTrait.php rename to src/Console/Command/ZflagsAwareTrait.php diff --git a/Library/EventListener/ConsoleErrorListener.php b/src/Console/ErrorListener.php similarity index 84% rename from Library/EventListener/ConsoleErrorListener.php rename to src/Console/ErrorListener.php index 7c1d56acae..ece6e2d7f8 100644 --- a/Library/EventListener/ConsoleErrorListener.php +++ b/src/Console/ErrorListener.php @@ -11,13 +11,18 @@ declare(strict_types=1); -namespace Zephir\EventListener; +namespace Zephir\Console; use Symfony\Component\Console\Event\ConsoleErrorEvent; use Zephir\Exception\CompilerException; use Zephir\Exception\ExceptionInterface; -class ConsoleErrorListener +use function filter_var; +use function getenv; + +use const FILTER_VALIDATE_BOOLEAN; + +class ErrorListener { public function onCommandError(ConsoleErrorEvent $event): void { @@ -25,14 +30,13 @@ public function onCommandError(ConsoleErrorEvent $event): void return; } - $exitCode = $event->getExitCode(); $throwable = $event->getError(); $event->setError( new CompilerException( $event->getError()->getMessage(), $throwable instanceof ExceptionInterface ? $throwable->getExtra() : null, - $exitCode, + $event->getExitCode(), $event->getError() ) ); diff --git a/Library/Detectors/ForValueUseDetector.php b/src/Detectors/ForValueUseDetector.php similarity index 95% rename from Library/Detectors/ForValueUseDetector.php rename to src/Detectors/ForValueUseDetector.php index de0cb35bfa..3bb6e40343 100644 --- a/Library/Detectors/ForValueUseDetector.php +++ b/src/Detectors/ForValueUseDetector.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Detectors; /** diff --git a/Library/Detectors/ReadDetector.php b/src/Detectors/ReadDetector.php similarity index 66% rename from Library/Detectors/ReadDetector.php rename to src/Detectors/ReadDetector.php index 160f8d0019..01900ed983 100644 --- a/Library/Detectors/ReadDetector.php +++ b/src/Detectors/ReadDetector.php @@ -13,9 +13,12 @@ namespace Zephir\Detectors; -use Zephir\Variable; +use Zephir\Variable\Variable; +use function in_array; use function is_array; +use function strpos; +use function substr; /** * Detects if a variable is used in a given expression context @@ -45,13 +48,24 @@ public function detect($variable, array $expression): bool if (in_array($expression['type'], ['fcall', 'mcall', 'scall']) && isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { - if (is_array($parameter['parameter']) && 'variable' === $parameter['parameter']['type'] && $variable == $parameter['parameter']['value']) { + if ( + is_array($parameter['parameter']) && + 'variable' === $parameter['parameter']['type'] && + $variable == $parameter['parameter']['value'] + ) { return true; } } } - return (isset($expression['left']) && is_array($expression['left']) && $this->detect($variable, $expression['left'])) || - (isset($expression['right']) && is_array($expression['right']) && $this->detect($variable, $expression['right'])); + return ( + isset($expression['left']) && + is_array($expression['left']) && + $this->detect($variable, $expression['left']) + ) || ( + isset($expression['right']) && + is_array($expression['right']) && + $this->detect($variable, $expression['right']) + ); } } diff --git a/Library/Detectors/WriteDetector.php b/src/Detectors/WriteDetector.php similarity index 90% rename from Library/Detectors/WriteDetector.php rename to src/Detectors/WriteDetector.php index a16cf941ef..66b12442c0 100644 --- a/Library/Detectors/WriteDetector.php +++ b/src/Detectors/WriteDetector.php @@ -13,6 +13,8 @@ namespace Zephir\Detectors; +use const PHP_EOL; + /** * Detects whether a variable is mutated in a given context * If a variable is not modified in a local context (method block) we can avoid allocate @@ -22,29 +24,41 @@ */ class WriteDetector { - public const DETECT_NONE = 0; - - public const DETECT_PARAM_PASS = 1; - - public const DETECT_ARRAY_USE = 2; - + public const DETECT_ALL = 255; + public const DETECT_ARRAY_USE = 2; + public const DETECT_NONE = 0; + public const DETECT_PARAM_PASS = 1; public const DETECT_VALUE_IN_ASSIGNMENT = 4; + protected int $detectionFlags = 0; - public const DETECT_ALL = 255; + protected array $mutations = []; - protected $detectionFlags = 0; + /** + * Pass "declare" statement. + */ + public function declareVariables(array $statement): void + { + if (isset($statement['data-type'])) { + if ('variable' != $statement['data-type']) { + return; + } + } - protected $mutations = []; + foreach ($statement['variables'] as $variable) { + if (isset($variable['expr'])) { + if ('string' == $variable['expr']['type'] || 'empty-array' == $variable['expr']['type'] || 'array' == $variable['expr']['type']) { + continue; + } + } + + $this->increaseMutations($variable['variable']); + } + } /** * Do the detection pass on a single variable. - * - * @param string $variable - * @param array $statements - * - * @return bool */ - public function detect($variable, array $statements) + public function detect(string $variable, array $statements): bool { $this->passStatementBlock($statements); @@ -52,23 +66,17 @@ public function detect($variable, array $statements) } /** - * Sets detection flags. - * - * @param int $flags + * Returns the number of assignment instructions that mutated a variable. */ - public function setDetectionFlags($flags) + public function getNumberOfMutations(string $variable): int { - $this->detectionFlags = $flags; + return $this->mutations[$variable] ?? 0; } /** * Increase the number of mutations a variable has inside a statement block. - * - * @param string $variable - * - * @return WriteDetector */ - public function increaseMutations($variable): self + public function increaseMutations(string $variable): self { if (isset($this->mutations[$variable])) { ++$this->mutations[$variable]; @@ -79,70 +87,10 @@ public function increaseMutations($variable): self return $this; } - /** - * Returns the number of assignment instructions that mutated a variable. - * - * @param string $variable - * - * @return int - */ - public function getNumberOfMutations($variable) - { - if (isset($this->mutations[$variable])) { - return $this->mutations[$variable]; - } - - return 0; - } - - /** - * Pass let statements. - * - * @param array $statement - */ - public function passLetStatement(array $statement) - { - foreach ($statement['assignments'] as $assignment) { - if (isset($assignment['expr'])) { - $this->passExpression($assignment['expr']); - } - $this->increaseMutations($assignment['variable']); - if (self::DETECT_VALUE_IN_ASSIGNMENT == ($this->detectionFlags & self::DETECT_VALUE_IN_ASSIGNMENT)) { - if (isset($assignment['expr'])) { - if ('variable' == $assignment['expr']['type']) { - $this->increaseMutations($assignment['expr']['value']); - break; - } - } - } - } - } - - /** - * Pass call expressions. - * - * @param array $expression - */ - public function passCall(array $expression) - { - if (isset($expression['parameters'])) { - foreach ($expression['parameters'] as $parameter) { - $usePass = self::DETECT_PARAM_PASS == ($this->detectionFlags & self::DETECT_PARAM_PASS); - if ($usePass && 'variable' == $parameter['parameter']['type']) { - $this->increaseMutations($parameter['parameter']['value']); - } else { - $this->passExpression($parameter['parameter']); - } - } - } - } - /** * Pass array expressions. - * - * @param array $expression */ - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { $usePass = self::DETECT_ARRAY_USE == ($this->detectionFlags & self::DETECT_ARRAY_USE); @@ -155,11 +103,9 @@ public function passArray(array $expression) } /** - * Pass "new" expressions. - * - * @param array $expression + * Pass call expressions. */ - public function passNew(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -173,36 +119,10 @@ public function passNew(array $expression) } } - /** - * Pass "declare" statement. - * - * @param array $statement - */ - public function declareVariables(array $statement): void - { - if (isset($statement['data-type'])) { - if ('variable' != $statement['data-type']) { - return; - } - } - - foreach ($statement['variables'] as $variable) { - if (isset($variable['expr'])) { - if ('string' == $variable['expr']['type'] || 'empty-array' == $variable['expr']['type'] || 'array' == $variable['expr']['type']) { - continue; - } - } - - $this->increaseMutations($variable['variable']); - } - } - /** * Pass expressions. - * - * @param array $expression */ - public function passExpression(array $expression) + public function passExpression(array $expression): void { switch ($expression['type']) { case 'bool': @@ -301,12 +221,48 @@ public function passExpression(array $expression) } } + /** + * Pass let statements. + */ + public function passLetStatement(array $statement): void + { + foreach ($statement['assignments'] as $assignment) { + if (isset($assignment['expr'])) { + $this->passExpression($assignment['expr']); + } + $this->increaseMutations($assignment['variable']); + if (self::DETECT_VALUE_IN_ASSIGNMENT == ($this->detectionFlags & self::DETECT_VALUE_IN_ASSIGNMENT)) { + if (isset($assignment['expr'])) { + if ('variable' == $assignment['expr']['type']) { + $this->increaseMutations($assignment['expr']['value']); + break; + } + } + } + } + } + + /** + * Pass "new" expressions. + */ + public function passNew(array $expression): void + { + if (isset($expression['parameters'])) { + foreach ($expression['parameters'] as $parameter) { + $usePass = self::DETECT_PARAM_PASS == ($this->detectionFlags & self::DETECT_PARAM_PASS); + if ($usePass && 'variable' == $parameter['parameter']['type']) { + $this->increaseMutations($parameter['parameter']['value']); + } else { + $this->passExpression($parameter['parameter']); + } + } + } + } + /** * Pass statement block. - * - * @param array $statements */ - public function passStatementBlock(array $statements) + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { @@ -448,4 +404,12 @@ public function passStatementBlock(array $statements) } } } + + /** + * Sets detection flags. + */ + public function setDetectionFlags(int $flags): void + { + $this->detectionFlags = $flags; + } } diff --git a/Library/Documentation.php b/src/Documentation.php similarity index 81% rename from Library/Documentation.php rename to src/Documentation.php index 416f83b712..eb25c7685f 100644 --- a/Library/Documentation.php +++ b/src/Documentation.php @@ -9,15 +9,36 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; +use Zephir\Class\Definition\Definition; use Zephir\Documentation\File; use Zephir\Documentation\NamespaceAccessor; use Zephir\Documentation\Theme; use Zephir\Exception\InvalidArgumentException; +use function array_merge; +use function file_exists; +use function file_get_contents; +use function getcwd; +use function is_array; +use function is_dir; +use function is_writable; +use function json_decode; +use function ksort; +use function mkdir; +use function realpath; +use function rtrim; +use function sprintf; +use function str_replace; +use function trim; + +use const DIRECTORY_SEPARATOR; + /** * Documentation Generator. */ @@ -25,22 +46,16 @@ class Documentation { use LoggerAwareTrait; - protected $outputDirectory; - - /** @var Config */ - protected $config; - + protected $baseUrl; /** @var CompilerFile[] */ protected $classes; - - /** @var Theme */ - protected $theme; - + /** @var Config */ + protected $config; /** @var array */ protected $options; - - protected $baseUrl; - + protected $outputDirectory; + /** @var Theme */ + protected $theme; protected $themesDirectories; /** @var string|null */ @@ -61,97 +76,23 @@ public function __construct(array $classes, Config $config, $templatesPath, arra { ksort($classes); - $this->config = $config; - $this->classes = $classes; - $this->logger = new NullLogger(); + $this->config = $config; + $this->classes = $classes; + $this->logger = new NullLogger(); $this->templatesPath = $templatesPath; - $this->options = $options; + $this->options = $options; $this->initialize(); } - /** - * TODO: options => to ApiOptions object - * TODO: Validate options. - * - * @throws ConfigException - * @throws Exception - */ - protected function initialize() - { - $themeConfig = $this->config->get('theme', 'api'); - - if (!$themeConfig) { - throw new ConfigException('Theme configuration is not present'); - } - - $themeDir = $this->findThemeDirectory($themeConfig, $this->options['path']); - - if (!file_exists($themeDir)) { - throw new ConfigException('There is no theme named '.$themeConfig['name']); - } - - $outputDir = $this->findOutputDirectory($this->options['output']); - - if (!$outputDir) { - throw new ConfigException('Api path (output directory) is not configured'); - } - - $this->outputDirectory = $outputDir; - - if (!file_exists($outputDir)) { - if (!mkdir($outputDir, 0777, true)) { - throw new Exception("Can't write output directory $outputDir"); - } - } - - if (!is_writable($outputDir)) { - throw new Exception("Can't write output directory $outputDir"); - } - - $themeConfig['options'] = $this->prepareThemeOptions($themeConfig, $this->options['options']); - - $this->theme = new Theme($themeDir, $outputDir, $themeConfig, $this->config, $this); - - $this->baseUrl = $this->options['url']; - } - - /** - * Search a theme by its name. - * - * Return the path to it if it exists. Otherwise NULL. - * - * @param string $name - * - * @return string|null - */ - public function findThemePathByName($name) - { - // check the theme from the config - $path = null; - - foreach ($this->themesDirectories as $themeDir) { - $path = rtrim($themeDir, '\\/').\DIRECTORY_SEPARATOR.$name; - if (0 !== strpos($path, 'phar://')) { - $path = realpath($path); - } - - if (is_dir($path)) { - break; - } - } - - return $path; - } - /** * @throws Exception */ - public function build() + public function build(): void { foreach ($this->classes as $class) { // class files (class/ns1/n2/class.html) - $cfile = new File\ClassFile($this->config, $class); + $cfile = new File\ClassFile($class); $this->theme->drawFile($cfile); // class source file (source/ns1/n2/class.html) @@ -160,7 +101,7 @@ public function build() } // classes file (classes.html) - $file = new File\ClassesFile($this->config, $this->classes); + $file = new File\ClassesFile($this->classes); $this->theme->drawFile($file); $namespaceAccessor = new NamespaceAccessor($this->classes); @@ -170,7 +111,7 @@ public function build() foreach ($byNamespace as $namespaceName => $nh) { // namespace files (namespace/ns1/n2/namespace.html) - $nfile = new File\NamespaceFile($this->config, $nh); + $nfile = new File\NamespaceFile($nh); $this->theme->drawFile($nfile); } @@ -184,11 +125,11 @@ public function build() $this->theme->drawFile($sitemapFile); // namespaces files (namespaces.html) - $nsfile = new File\NamespacesFile($this->config, $namespaceAccessor); + $nsfile = new File\NamespacesFile($namespaceAccessor); $this->theme->drawFile($nsfile); // index (index.html) - $indexfile = new File\IndexFile($this->config, $namespaceAccessor); + $indexfile = new File\IndexFile($namespaceAccessor); $this->theme->drawFile($indexfile); $this->theme->buildStaticDirectory(); @@ -200,21 +141,39 @@ public function build() public static function classUrl($c) { $cname = $c; - if ($c instanceof ClassDefinition) { + if ($c instanceof Definition) { $cname = $c->getCompleteName(); } - return '/class/'.trim(str_replace('\\', '/', $cname), '/').'.html'; + return '/class/' . trim(str_replace('\\', '/', $cname), '/') . '.html'; } - public static function namespaceUrl($ns) + /** + * Search a theme by its name. + * + * Return the path to it if it exists, otherwise NULL. + * + * @param string $name + * + * @return string|null + */ + public function findThemePathByName($name) { - return '/namespace/'.str_replace('\\', '/', $ns).'.html'; - } + // check the theme from the config + $path = null; - public static function sourceUrl(ClassDefinition $c) - { - return '/source/'.str_replace('\\', '/', $c->getCompleteName()).'.html'; + foreach ($this->themesDirectories as $themeDir) { + $path = rtrim($themeDir, '\\/') . DIRECTORY_SEPARATOR . $name; + if (!str_starts_with($path, 'phar://')) { + $path = realpath($path); + } + + if (is_dir($path)) { + break; + } + } + + return $path; } /** @@ -227,49 +186,60 @@ public function getOutputDirectory() return $this->outputDirectory; } + public static function namespaceUrl($ns) + { + return '/namespace/' . str_replace('\\', '/', $ns) . '.html'; + } + + public static function sourceUrl(Definition $c) + { + return '/source/' . str_replace('\\', '/', $c->getCompleteName()) . '.html'; + } + /** - * Prepare the options by merging the one in the project config with the one in the command line arg "theme-options". - * - * command line arg "theme-options" can be either a path to a json file containing the options or a raw json string - * - * @param array $themeConfig - * @param string|null $options + * TODO: options => to ApiOptions object + * TODO: Validate options. * + * @throws ConfigException * @throws Exception - * - * @return array */ - private function prepareThemeOptions($themeConfig, $options = null) + protected function initialize(): void { - $parsedOptions = null; - if (!empty($options)) { - if ('{' == $options[0]) { - $parsedOptions = json_decode(trim($options), true); - if (!$parsedOptions || !\is_array($parsedOptions)) { - throw new Exception("Unable to parse json from 'theme-options' argument"); - } - } else { - if (file_exists($options)) { - $unparsed = file_get_contents($options); - $parsedOptions = json_decode($unparsed, true); - if (!$parsedOptions || !\is_array($parsedOptions)) { - throw new Exception( - sprintf("Unable to parse json from the file '%s'", $options) - ); - } - } else { - throw new Exception(sprintf("Unable to find file '%s'", $options)); - } + $themeConfig = $this->config->get('theme', 'api'); + + if (!$themeConfig) { + throw new ConfigException('Theme configuration is not present'); + } + + $themeDir = $this->findThemeDirectory($themeConfig, $this->options['path']); + + if (!file_exists($themeDir)) { + throw new ConfigException('There is no theme named ' . $themeConfig['name']); + } + + $outputDir = $this->findOutputDirectory($this->options['output']); + + if (!$outputDir) { + throw new ConfigException('Api path (output directory) is not configured'); + } + + $this->outputDirectory = $outputDir; + + if (!file_exists($outputDir)) { + if (!mkdir($outputDir, 0777, true)) { + throw new Exception("Can't write output directory $outputDir"); } } - if (\is_array($parsedOptions)) { - $options = array_merge($themeConfig['options'], $parsedOptions); - } else { - $options = $themeConfig['options']; + if (!is_writable($outputDir)) { + throw new Exception("Can't write output directory $outputDir"); } - return $options; + $themeConfig['options'] = $this->prepareThemeOptions($themeConfig, $this->options['options']); + + $this->theme = new Theme($themeDir, $outputDir, $themeConfig, $this->config, $this); + + $this->baseUrl = $this->options['url']; } /** @@ -277,7 +247,7 @@ private function prepareThemeOptions($themeConfig, $options = null) * * output directory is checked in this order : * => check if the command line argument --output-directory was given - * => if not ; check if config config[api][path] was given + * => if not ; check if config[api][path] was given * * @param string $outputDir * @@ -288,7 +258,7 @@ private function findOutputDirectory($outputDir) $outputDir = str_replace('%version%', $this->config->get('version'), $outputDir); if ('/' !== $outputDir[0]) { - $outputDir = getcwd().'/'.$outputDir; + $outputDir = getcwd() . '/' . $outputDir; } return $outputDir; @@ -306,17 +276,17 @@ private function findOutputDirectory($outputDir) * @param array $themeConfig * @param string|null $path * + * @return string|null + * * @throws InvalidArgumentException * @throws ConfigException - * - * @return string|null */ private function findThemeDirectory($themeConfig, $path = null) { // check if there are additional theme paths in the config $themeDirectoriesConfig = $this->config->get('theme-directories', 'api'); if ($themeDirectoriesConfig) { - if (\is_array($themeDirectoriesConfig)) { + if (is_array($themeDirectoriesConfig)) { $themesDirectories = $themeDirectoriesConfig; } else { throw new InvalidArgumentException("Invalid value for theme config 'theme-directories'"); @@ -325,7 +295,7 @@ private function findThemeDirectory($themeConfig, $path = null) $themesDirectories = []; } - $themesDirectories[] = $this->templatesPath.'/Api/themes'; + $themesDirectories[] = $this->templatesPath . '/Api/themes'; $this->themesDirectories = $themesDirectories; // check if the path was set from the command @@ -350,4 +320,50 @@ private function findThemeDirectory($themeConfig, $path = null) return $this->findThemePathByName($themeConfig['name']); } + + /** + * Prepare the options by merging the one in the project config with the one in the command line arg + * "theme-options". + * + * command line arg "theme-options" can be either a path to a json file containing the options or a raw json string + * + * @param array $themeConfig + * @param string|null $options + * + * @return array + * + * @throws Exception + */ + private function prepareThemeOptions($themeConfig, $options = null) + { + $parsedOptions = null; + if (!empty($options)) { + if ('{' == $options[0]) { + $parsedOptions = json_decode(trim($options), true); + if (!$parsedOptions || !is_array($parsedOptions)) { + throw new Exception("Unable to parse json from 'theme-options' argument"); + } + } else { + if (file_exists($options)) { + $unparsed = file_get_contents($options); + $parsedOptions = json_decode($unparsed, true); + if (!$parsedOptions || !is_array($parsedOptions)) { + throw new Exception( + sprintf("Unable to parse json from the file '%s'", $options) + ); + } + } else { + throw new Exception(sprintf("Unable to find file '%s'", $options)); + } + } + } + + if (is_array($parsedOptions)) { + $options = array_merge($themeConfig['options'], $parsedOptions); + } else { + $options = $themeConfig['options']; + } + + return $options; + } } diff --git a/Library/Documentation/Annotation.php b/src/Documentation/Annotation.php similarity index 70% rename from Library/Documentation/Annotation.php rename to src/Documentation/Annotation.php index 7e0231b45d..9518ac8a02 100644 --- a/Library/Documentation/Annotation.php +++ b/src/Documentation/Annotation.php @@ -9,39 +9,36 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation; +use function trim; + /** - * Annotation. - * * A parsed Annotation */ class Annotation { - protected $name; - - protected $string; + protected bool $contentParsed = false; - protected $contentParsed = false; - - public function __construct(string $name, string $string) + public function __construct(protected string $name, protected string $string) { - $this->name = $name; $this->string = trim($string); } - public function getString(): string + public function getName(): string { - return $this->string; + return $this->name; } - public function setString(string $string) + public function getString(): string { - $this->string = $string; + return $this->string; } - public function getName(): string + public function setString(string $string): void { - return $this->name; + $this->string = $string; } } diff --git a/Library/Documentation/Annotation/Link.php b/src/Documentation/Annotation/Link.php similarity index 85% rename from Library/Documentation/Annotation/Link.php rename to src/Documentation/Annotation/Link.php index 8c40a747f5..cdb9c3208a 100644 --- a/Library/Documentation/Annotation/Link.php +++ b/src/Documentation/Annotation/Link.php @@ -9,47 +9,51 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\Annotation; use Zephir\Documentation\Annotation; +use function strpos; +use function substr; + /** * A link annotation that looks like `(@)link uri text`. */ class Link extends Annotation { - /** @var string|null */ - protected $uri; - /** @var string|null */ protected $linkText; + /** @var string|null */ + protected $uri; - public function getUri() + public function getLinkText() { if (!$this->contentParsed) { $this->parseContent(); } - return $this->uri; + return $this->linkText; } - public function getLinkText() + public function getUri() { if (!$this->contentParsed) { $this->parseContent(); } - return $this->linkText; + return $this->uri; } - protected function parseContent() + protected function parseContent(): void { $spaceIndex = strpos($this->string, ' '); $this->uri = $this->string; if (false !== $spaceIndex) { - $this->uri = substr($this->string, 0, $spaceIndex); + $this->uri = substr($this->string, 0, $spaceIndex); $this->linkText = substr($this->string, $spaceIndex + 1); } diff --git a/Library/Documentation/Annotation/ReturnAnnotation.php b/src/Documentation/Annotation/ReturnAnnotation.php similarity index 80% rename from Library/Documentation/Annotation/ReturnAnnotation.php rename to src/Documentation/Annotation/ReturnAnnotation.php index 8c69583da0..56b027a47c 100644 --- a/Library/Documentation/Annotation/ReturnAnnotation.php +++ b/src/Documentation/Annotation/ReturnAnnotation.php @@ -9,44 +9,49 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\Annotation; use Zephir\Documentation\Annotation; +use function strpos; +use function substr; + /** * A return annotation that looks like `(@)return type description`. */ class ReturnAnnotation extends Annotation { - protected $returnType; - protected $description; + protected string $description; + protected string $returnType; - public function getReturnType(): string + public function getDescription(): string { if (!$this->contentParsed) { $this->parseContent(); } - return $this->returnType; + return $this->description; } - public function getDescription(): string + public function getReturnType(): string { if (!$this->contentParsed) { $this->parseContent(); } - return $this->description; + return $this->returnType; } - protected function parseContent() + protected function parseContent(): void { $spaceIndex = strpos($this->string, ' '); $this->returnType = $this->string; if (false !== $spaceIndex) { - $this->returnType = substr($this->string, 0, $spaceIndex); + $this->returnType = substr($this->string, 0, $spaceIndex); $this->description = substr($this->string, $spaceIndex + 1); } diff --git a/Library/Documentation/Annotation/See.php b/src/Documentation/Annotation/See.php similarity index 85% rename from Library/Documentation/Annotation/See.php rename to src/Documentation/Annotation/See.php index 4fac67b8bc..0fcc87fdc7 100644 --- a/Library/Documentation/Annotation/See.php +++ b/src/Documentation/Annotation/See.php @@ -9,10 +9,15 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\Annotation; use Zephir\Documentation\Annotation; +use function strpos; +use function substr; + /** * A link annotation that looks like `(@)link uri text`. */ @@ -39,7 +44,7 @@ public function getText(): string return $this->text; } - protected function parseContent() + protected function parseContent(): void { $spaceIndex = strpos($this->string, ' '); @@ -47,7 +52,7 @@ protected function parseContent() if (false !== $spaceIndex) { $this->resource = substr($this->string, 0, $spaceIndex); - $this->text = substr($this->string, $spaceIndex + 1); + $this->text = substr($this->string, $spaceIndex + 1); } $this->contentParsed = true; diff --git a/Library/Documentation/Docblock.php b/src/Documentation/Docblock.php similarity index 60% rename from Library/Documentation/Docblock.php rename to src/Documentation/Docblock.php index f6ebd296de..4210cc201a 100644 --- a/Library/Documentation/Docblock.php +++ b/src/Documentation/Docblock.php @@ -9,60 +9,76 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation; +use function explode; +use function trim; + +use const PHP_EOL; + /** - * Annotation. - * * A parsed Annotation */ class Docblock { - /** - * @var string - */ - protected $description; - /** * @var Annotation[] */ - protected $annotations = []; + protected array $annotations = []; - /** - * @var string - */ - protected $summary; + protected string $description; + + protected string $summary; - /** - * @return string - */ public function __toString() { return $this->generate(); } - /** - * @return string - */ - public function getDescription(): string + public function addAnnotation(Annotation $annotation): void { - return $this->description; + $this->annotations[] = $annotation; } - /** - * @return Annotation[] - */ - public function getAnnotations(): array + public function generate(): string { - return $this->annotations; + $docBlock = '**'; + $summaryBlock = $this->getSummary(); + $descriptionBlock = $this->getDescription(); + $annotationsBlock = $this->getAnnotations(); + + if ($summaryBlock) { + $docBlock .= PHP_EOL . ' * ' . $summaryBlock; + } + + if ($descriptionBlock) { + $docBlock .= PHP_EOL . ' *'; + $docBlock .= PHP_EOL . ' *'; + + foreach (explode("\n", $descriptionBlock) as $line) { + $docBlock .= PHP_EOL . ' * ' . trim($line); + } + + $docBlock .= PHP_EOL . ' *'; + } + + if ($annotationsBlock) { + foreach ($annotationsBlock as $annotation) { + $docBlock .= PHP_EOL . ' * @' . $annotation->getName() . ' ' . $annotation->getString(); + } + } + + return $docBlock . PHP_EOL . ' *'; } /** - * @param Annotation[] $annotations + * @return Annotation[] */ - public function setAnnotations(array $annotations) + public function getAnnotations(): array { - $this->annotations = $annotations; + return $this->annotations; } /** @@ -83,69 +99,31 @@ public function getAnnotationsByType(string $type): array return $annotation; } - /** - * @param string $description - */ - public function setDescription(string $description) - { - $this->description = $description; - } - - /** - * @param Annotation $annotation - */ - public function addAnnotation(Annotation $annotation) + public function getDescription(): string { - $this->annotations[] = $annotation; + return $this->description; } - /** - * @return string - */ public function getSummary(): string { return $this->summary; } /** - * @param string $summary + * @param Annotation[] $annotations */ - public function setSummary(string $summary) + public function setAnnotations(array $annotations): void { - $this->summary = $summary; + $this->annotations = $annotations; } - /** - * @return string - */ - public function generate(): string + public function setDescription(string $description): void { - $docBlock = '**'; - $summaryBlock = $this->getSummary(); - $descriptionBlock = $this->getDescription(); - $annotationsBlock = $this->getAnnotations(); - - if ($summaryBlock) { - $docBlock .= PHP_EOL.' * '.$summaryBlock; - } - - if ($descriptionBlock) { - $docBlock .= PHP_EOL.' *'; - $docBlock .= PHP_EOL.' *'; - - foreach ((array) explode("\n", $descriptionBlock) as $line) { - $docBlock .= PHP_EOL.' * '.trim($line); - } - - $docBlock .= PHP_EOL.' *'; - } - - if ($annotationsBlock) { - foreach ($annotationsBlock as $annotation) { - $docBlock .= PHP_EOL.' * @'.$annotation->getName().' '.$annotation->getString(); - } - } + $this->description = $description; + } - return $docBlock.PHP_EOL.' *'; + public function setSummary(string $summary): void + { + $this->summary = $summary; } } diff --git a/Library/Documentation/DocblockParser.php b/src/Documentation/DocblockParser.php similarity index 85% rename from Library/Documentation/DocblockParser.php rename to src/Documentation/DocblockParser.php index d3596fe418..b2a27a5285 100644 --- a/Library/Documentation/DocblockParser.php +++ b/src/Documentation/DocblockParser.php @@ -9,8 +9,15 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation; +use function strlen; +use function trim; + +use const PHP_EOL; + /** * Helper to parse raw docblocks to structured object. */ @@ -18,34 +25,30 @@ class DocblockParser { protected $annotation; protected $annotationLen; - - protected $currentChar = null; - protected $currentCharIndex = null; - protected $currentLine = null; - protected $lines = []; - - // Parsing helpers - protected $ignoreSpaces; - protected $ignoreStar; - protected $commentOpen; protected $annotationNameOpen; protected $annotationOpen; - protected $summaryOpen; - protected $descriptionOpen; + protected $commentOpen; - // parsed data - protected $currentAnnotationStr; + // Parsing helpers protected $currentAnnotationContentStr; - protected $summaryStr; + protected $currentAnnotationStr; + protected $currentChar; + protected $currentCharIndex; + protected $currentLine; + protected $descriptionOpen; protected $descriptionStr; + // parsed data /** * @var Docblock */ protected $docblockObj; + protected $ignoreSpaces; + protected $ignoreStar; + protected $summaryOpen; + protected $summaryStr; /** - * @param string $annotation a row annotation string begining with /** */ public function __construct(string $annotation) { @@ -53,49 +56,13 @@ public function __construct(string $annotation) } /** - * check if there is a currently parsed annotation, registers it, and stops the current annotation parsing. - */ - private function __tryRegisterAnnotation() - { - if (($this->annotationNameOpen || $this->annotationOpen) && $this->currentAnnotationStr !== '') { - $annotation = $this->__createAnnotation($this->currentAnnotationStr, $this->currentAnnotationContentStr); - $this->docblockObj->addAnnotation($annotation); - } - - $this->annotationNameOpen = false; - $this->annotationOpen = false; - } - - /** - * @param string $name the annotation name - * @param string $string the annotation name + * return the parsed docblock. It will return null until you run the parse() method. * - * @return \Zephir\Documentation\Annotation + * @return Docblock the parsed docblock */ - private function __createAnnotation($name, $string) + public function getParsedDocblock() { - switch ($name) { - case 'link': - $annotation = new Annotation\Link($name, $string); - $annotation->getLinkText(); - break; - - case 'return': - $annotation = new Annotation\ReturnAnnotation($name, $string); - $annotation->getReturnType(); - break; - - case 'see': - $annotation = new Annotation\See($name, $string); - $annotation->getResource(); - break; - - default: - $annotation = new Annotation($name, $string); - break; - } - - return $annotation; + return $this->docblockObj; } /** @@ -107,24 +74,24 @@ public function parse() { $this->docblockObj = new Docblock(); - $this->ignoreSpaces = false; - $this->ignoreStar = true; - $this->commentOpen = false; + $this->ignoreSpaces = false; + $this->ignoreStar = true; + $this->commentOpen = false; $this->annotationNameOpen = false; - $this->annotationOpen = false; - $this->summaryOpen = true; - $this->descriptionOpen = false; + $this->annotationOpen = false; + $this->summaryOpen = true; + $this->descriptionOpen = false; - $this->currentAnnotationStr = null; + $this->currentAnnotationStr = null; $this->currentAnnotationContentStr = null; - $this->summaryStr = ''; + $this->summaryStr = ''; $this->descriptionStr = ''; - $this->currentLine = 0; + $this->currentLine = 0; $this->currentCharIndex = 0; - $this->annotationLen = \strlen($this->annotation); - $this->currentChar = $this->annotation[0]; + $this->annotationLen = strlen($this->annotation); + $this->currentChar = $this->annotation[0]; while (null !== $this->currentChar) { $currentChar = $this->currentChar; @@ -160,10 +127,10 @@ public function parse() $this->descriptionOpen = false; } - $this->currentAnnotationStr = ''; + $this->currentAnnotationStr = ''; $this->currentAnnotationContentStr = ''; - $this->ignoreSpaces = false; + $this->ignoreSpaces = false; $this->annotationNameOpen = true; } elseif ($this->annotationNameOpen || $this->annotationOpen) { // stop annotation parsing on new line @@ -171,11 +138,11 @@ public function parse() $this->__tryRegisterAnnotation(); $this->ignoreSpaces = false; - $this->ignoreStar = true; + $this->ignoreStar = true; } elseif ($this->annotationNameOpen) { if (ctype_space($currentChar)) { $this->annotationNameOpen = false; - $this->annotationOpen = true; + $this->annotationOpen = true; } else { $this->currentAnnotationStr .= $currentChar; } @@ -185,9 +152,9 @@ public function parse() } elseif ($this->summaryOpen) { // stop summary on new line if ($this->summaryStr !== '' && ("\n" == $currentChar || "\r" == $currentChar)) { - $this->summaryOpen = false; + $this->summaryOpen = false; $this->descriptionOpen = true; - $this->ignoreStar = true; + $this->ignoreStar = true; } else { $this->summaryStr .= $currentChar; } @@ -212,13 +179,49 @@ public function parse() } /** - * return the parsed docblock. It will return null until you run the parse() method. + * @param string $name the annotation name + * @param string $string the annotation name * - * @return Docblock the parsed docblock + * @return Annotation */ - public function getParsedDocblock() + private function __createAnnotation($name, $string) { - return $this->docblockObj; + switch ($name) { + case 'link': + $annotation = new Annotation\Link($name, $string); + $annotation->getLinkText(); + break; + + case 'return': + $annotation = new Annotation\ReturnAnnotation($name, $string); + $annotation->getReturnType(); + break; + + case 'see': + $annotation = new Annotation\See($name, $string); + $annotation->getResource(); + break; + + default: + $annotation = new Annotation($name, $string); + break; + } + + return $annotation; + } + + /** + * check if there is a currently parsed annotation, registers it, and stops the current annotation parsing. + */ + private function __tryRegisterAnnotation(): void + { + if (($this->annotationNameOpen || $this->annotationOpen) && $this->currentAnnotationStr !== '') { + $annotation = $this->__createAnnotation($this->currentAnnotationStr, $this->currentAnnotationContentStr); + $this->docblockObj->addAnnotation($annotation); + } + + $this->annotationNameOpen = false; + $this->annotationOpen = false; } /** diff --git a/Library/Documentation/File/ClassFile.php b/src/Documentation/File/ClassFile.php similarity index 55% rename from Library/Documentation/File/ClassFile.php rename to src/Documentation/File/ClassFile.php index 5c47251b95..35676df799 100644 --- a/Library/Documentation/File/ClassFile.php +++ b/src/Documentation/File/ClassFile.php @@ -9,79 +9,59 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\File; -use Zephir\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\CompilerFile; use Zephir\Documentation; use Zephir\Documentation\FileInterface; +use function explode; + class ClassFile implements FileInterface { - /** - * @var ClassDefinition - */ - protected $class; + protected Definition $class; - /** - * @var CompilerFile - */ - protected $compilerFile; - - public function __construct($config, CompilerFile $class) + public function __construct(protected CompilerFile $compilerFile) { - $this->compilerFile = $class; - $this->class = $class->getClassDefinition(); + $this->class = $compilerFile->getClassDefinition(); } - /** - * {@inheritdoc} - * - * @return string - */ - public function getTemplateName(): string - { - return 'class.phtml'; - } - - /** - * {@inheritdoc} - * - * @return array - */ public function getData(): array { $nsPieces = explode('\\', $this->class->getNamespace()); $nsPatches = []; - $nsStr = ''; + $nsStr = ''; foreach ($nsPieces as $n) { if ($nsStr !== '') { $nsStr .= '\\'; } - $nsStr .= $n; + $nsStr .= $n; $nsPatches[$n] = $nsStr; } return [ 'classDefinition' => $this->class, - 'compilerFile' => $this->compilerFile, - 'className' => $this->class->getName(), - 'classNamespace' => $this->class->getNamespace(), - 'fullName' => $this->class->getCompleteName(), - 'methods' => $this->class->getMethods(), + 'compilerFile' => $this->compilerFile, + 'className' => $this->class->getName(), + 'classNamespace' => $this->class->getNamespace(), + 'fullName' => $this->class->getCompleteName(), + 'methods' => $this->class->getMethods(), 'namespacePieces' => $nsPatches, ]; } - /** - * {@inheritdoc} - * - * @return string - */ public function getOutputFile(): string { return Documentation::classUrl($this->class); } + + public function getTemplateName(): string + { + return 'class.phtml'; + } } diff --git a/Library/Documentation/File/ClassesFile.php b/src/Documentation/File/ClassesFile.php similarity index 63% rename from Library/Documentation/File/ClassesFile.php rename to src/Documentation/File/ClassesFile.php index 4035b1dfe5..5bb01a79de 100644 --- a/Library/Documentation/File/ClassesFile.php +++ b/src/Documentation/File/ClassesFile.php @@ -9,38 +9,19 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\File; -use Zephir\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Documentation\FileInterface; class ClassesFile implements FileInterface { - /** - * @var ClassDefinition - */ - protected $classes; - - public function __construct($config, $classList) - { - $this->classes = $classList; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getTemplateName(): string + public function __construct(protected Definition $classes) { - return 'classes.phtml'; } - /** - * {@inheritdoc} - * - * @return array - */ public function getData(): array { return [ @@ -48,13 +29,13 @@ public function getData(): array ]; } - /** - * {@inheritdoc} - * - * @return string - */ public function getOutputFile(): string { return 'classes.html'; } + + public function getTemplateName(): string + { + return 'classes.phtml'; + } } diff --git a/Library/Documentation/File/IndexFile.php b/src/Documentation/File/IndexFile.php similarity index 56% rename from Library/Documentation/File/IndexFile.php rename to src/Documentation/File/IndexFile.php index a90f729b28..20275e15c2 100644 --- a/Library/Documentation/File/IndexFile.php +++ b/src/Documentation/File/IndexFile.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\File; use Zephir\Documentation\FileInterface; @@ -16,47 +18,26 @@ class IndexFile implements FileInterface { - /** - * @var NamespaceAccessor - */ - protected $namespaceAccessor; - - public function __construct($config, NamespaceAccessor $namespaceAccessor) - { - $this->namespaceAccessor = $namespaceAccessor; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getTemplateName(): string + public function __construct(protected NamespaceAccessor $namespaceAccessor) { - return 'index.phtml'; } - /** - * {@inheritdoc} - * - * @return array - */ public function getData(): array { return [ 'namespaceAccessor' => $this->namespaceAccessor, - 'namespacesTree' => $this->namespaceAccessor->getNamespaceTree(), - 'namespaces' => $this->namespaceAccessor->getByNamespace(), + 'namespacesTree' => $this->namespaceAccessor->getNamespaceTree(), + 'namespaces' => $this->namespaceAccessor->getByNamespace(), ]; } - /** - * {@inheritdoc} - * - * @return string - */ public function getOutputFile(): string { return 'index.html'; } + + public function getTemplateName(): string + { + return 'index.phtml'; + } } diff --git a/Library/Documentation/File/NamespaceFile.php b/src/Documentation/File/NamespaceFile.php similarity index 71% rename from Library/Documentation/File/NamespaceFile.php rename to src/Documentation/File/NamespaceFile.php index 9eb3f21438..c5fba5bfcd 100644 --- a/Library/Documentation/File/NamespaceFile.php +++ b/src/Documentation/File/NamespaceFile.php @@ -9,38 +9,18 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\File; -use Zephir\CompilerFile; use Zephir\Documentation; use Zephir\Documentation\FileInterface; use Zephir\Documentation\NamespaceHelper; class NamespaceFile implements FileInterface { - /** - * @var NamespaceHelper - */ - protected $namespaceHelper; - - /** - * @var CompilerFile - */ - protected $compilerFile; - - public function __construct($config, NamespaceHelper $nh) + public function __construct(protected NamespaceHelper $namespaceHelper) { - $this->namespaceHelper = $nh; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getTemplateName(): string - { - return 'namespace.phtml'; } /** @@ -52,8 +32,8 @@ public function getData(): array { return [ 'namespaceHelper' => $this->namespaceHelper, - 'subNamespaces' => $this->namespaceHelper->getNamespaces(), - 'subClasses' => $this->namespaceHelper->getClasses(), + 'subNamespaces' => $this->namespaceHelper->getNamespaces(), + 'subClasses' => $this->namespaceHelper->getClasses(), ]; } @@ -66,4 +46,14 @@ public function getOutputFile(): string { return Documentation::namespaceUrl($this->namespaceHelper->getFullNamespace()); } + + /** + * {@inheritdoc} + * + * @return string + */ + public function getTemplateName(): string + { + return 'namespace.phtml'; + } } diff --git a/Library/Documentation/File/NamespacesFile.php b/src/Documentation/File/NamespacesFile.php similarity index 56% rename from Library/Documentation/File/NamespacesFile.php rename to src/Documentation/File/NamespacesFile.php index 1ac54c9861..460510fe34 100644 --- a/Library/Documentation/File/NamespacesFile.php +++ b/src/Documentation/File/NamespacesFile.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\File; use Zephir\Documentation\FileInterface; @@ -16,47 +18,26 @@ class NamespacesFile implements FileInterface { - /** - * @var NamespaceAccessor - */ - protected $namespaceAccessor; - - public function __construct($config, NamespaceAccessor $namespaceAccessor) - { - $this->namespaceAccessor = $namespaceAccessor; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getTemplateName(): string + public function __construct(protected NamespaceAccessor $namespaceAccessor) { - return 'namespaces.phtml'; } - /** - * {@inheritdoc} - * - * @return array - */ public function getData(): array { return [ 'namespaceAccessor' => $this->namespaceAccessor, - 'namespacesTree' => $this->namespaceAccessor->getNamespaceTree(), - 'namespaces' => $this->namespaceAccessor->getByNamespace(), + 'namespacesTree' => $this->namespaceAccessor->getNamespaceTree(), + 'namespaces' => $this->namespaceAccessor->getByNamespace(), ]; } - /** - * {@inheritdoc} - * - * @return string - */ public function getOutputFile(): string { return 'namespaces.html'; } + + public function getTemplateName(): string + { + return 'namespaces.phtml'; + } } diff --git a/Library/Documentation/File/Sitemap.php b/src/Documentation/File/Sitemap.php similarity index 73% rename from Library/Documentation/File/Sitemap.php rename to src/Documentation/File/Sitemap.php index b4863c002c..60ceb086a0 100644 --- a/Library/Documentation/File/Sitemap.php +++ b/src/Documentation/File/Sitemap.php @@ -9,33 +9,29 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\File; use Zephir\Documentation\FileInterface; +use function rtrim; + +use const DIRECTORY_SEPARATOR; + class Sitemap implements FileInterface { + protected $baseUrl; protected $classes; protected $namespaces; - protected $baseUrl; private $baseDir; public function __construct($baseDir, $baseUrl, $classList, $namespaceList) { - $this->classes = $classList; + $this->classes = $classList; $this->namespaces = $namespaceList; - $this->baseUrl = rtrim($baseUrl, '\\/').\DIRECTORY_SEPARATOR; - $this->baseDir = $baseDir; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getTemplateName(): string - { - return $this->baseDir.'/Api/sitemap.php'; + $this->baseUrl = rtrim($baseUrl, '\\/') . DIRECTORY_SEPARATOR; + $this->baseDir = $baseDir; } /** @@ -46,9 +42,9 @@ public function getTemplateName(): string public function getData(): array { return [ - 'classes' => $this->classes, + 'classes' => $this->classes, 'namespaces' => $this->namespaces, - 'baseUrl' => $this->baseUrl, + 'baseUrl' => $this->baseUrl, ]; } @@ -61,4 +57,14 @@ public function getOutputFile(): string { return 'sitemap.xml'; } + + /** + * {@inheritdoc} + * + * @return string + */ + public function getTemplateName(): string + { + return $this->baseDir . '/Api/sitemap.php'; + } } diff --git a/Library/Documentation/File/SourceFile.php b/src/Documentation/File/SourceFile.php similarity index 70% rename from Library/Documentation/File/SourceFile.php rename to src/Documentation/File/SourceFile.php index 37e03662db..b07f9a77c7 100644 --- a/Library/Documentation/File/SourceFile.php +++ b/src/Documentation/File/SourceFile.php @@ -9,35 +9,24 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\File; -use Zephir\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Documentation; class SourceFile extends ClassFile { - /** - * @var ClassDefinition - */ - protected $class; + protected Definition $class; - /** - * {@inheritdoc} - * - * @return string - */ - public function getTemplateName(): string + public function getOutputFile(): string { - return 'source.phtml'; + return Documentation::sourceUrl($this->class); } - /** - * {@inheritdoc} - * - * @return string - */ - public function getOutputFile(): string + public function getTemplateName(): string { - return Documentation::sourceUrl($this->class); + return 'source.phtml'; } } diff --git a/Library/Documentation/FileInterface.php b/src/Documentation/FileInterface.php similarity index 78% rename from Library/Documentation/FileInterface.php rename to src/Documentation/FileInterface.php index 1080e5a587..74040c9df6 100644 --- a/Library/Documentation/FileInterface.php +++ b/src/Documentation/FileInterface.php @@ -9,22 +9,15 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation; interface FileInterface { - /** - * @return string - */ - public function getTemplateName(): string; + public function getData(): array; - /** - * @return string - */ public function getOutputFile(): string; - /** - * @return array - */ - public function getData(): array; + public function getTemplateName(): string; } diff --git a/Library/Documentation/NamespaceAccessor.php b/src/Documentation/NamespaceAccessor.php similarity index 75% rename from Library/Documentation/NamespaceAccessor.php rename to src/Documentation/NamespaceAccessor.php index 0825adce75..ddd0cd39ec 100644 --- a/Library/Documentation/NamespaceAccessor.php +++ b/src/Documentation/NamespaceAccessor.php @@ -9,56 +9,47 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation; +use Zephir\CompilerFile; + +use function explode; + class NamespaceAccessor { + protected $byNamespace; /** - * @var \Zephir\CompilerFile[] + * @var CompilerFile[] */ protected $classes; - protected $namespaceTree; - protected $byNamespace; - /** - * @param \Zephir\CompilerFile[] $files + * @param CompilerFile[] $files */ public function __construct($files) { $this->classes = $files; } - /** - * @return NamespaceHelper[] - */ - public function getByNamespace() - { - return $this->byNamespace; - } - - public function getNamespaceTree() - { - return $this->namespaceTree; - } - - public function build() + public function build(): void { $byNamespace = []; - $tree = []; + $tree = []; - foreach ($this->classes as $className => $class) { - $ns = explode('\\', $class->getClassDefinition()->getNamespace()); + foreach ($this->classes as $class) { + $ns = explode('\\', $class->getClassDefinition()->getNamespace()); $actualStr = ''; foreach ($ns as $n) { if ($actualStr !== '') { - $previous = $byNamespace[$actualStr]; + $previous = $byNamespace[$actualStr]; $actualStr .= '\\'; - $isRoot = false; + $isRoot = false; } else { $previous = null; - $isRoot = true; + $isRoot = true; } $actualStr .= $n; @@ -82,7 +73,20 @@ public function build() $nh->addClass($class); } - $this->byNamespace = $byNamespace; + $this->byNamespace = $byNamespace; $this->namespaceTree = $tree; } + + /** + * @return NamespaceHelper[] + */ + public function getByNamespace() + { + return $this->byNamespace; + } + + public function getNamespaceTree() + { + return $this->namespaceTree; + } } diff --git a/src/Documentation/NamespaceHelper.php b/src/Documentation/NamespaceHelper.php new file mode 100644 index 0000000000..6a9846c503 --- /dev/null +++ b/src/Documentation/NamespaceHelper.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Documentation; + +use Zephir\CompilerFile; + +use function array_pop; +use function count; +use function explode; +use function implode; + +class NamespaceHelper +{ + protected array $classes = []; + protected string $endNamespace; + protected array $namespaces = []; + protected string $parentName; + + public function __construct(protected string $fullNamespace) + { + $ex = explode('\\', $fullNamespace); + $this->endNamespace = $ex[count($ex) - 1]; + + array_pop($ex); + + $this->parentName = implode('\\', $ex); + } + + public function addClass(CompilerFile $c): void + { + $this->classes[] = $c; + } + + public function getClasses(): array + { + return $this->classes; + } + + public function getFullNamespace(): string + { + return $this->fullNamespace; + } + + public function getNamespaces(): array + { + return $this->namespaces; + } + + public function getParentName(): string + { + return $this->parentName; + } + + public function getShortName(): string + { + return $this->endNamespace; + } +} diff --git a/Library/Documentation/Template.php b/src/Documentation/Template.php similarity index 56% rename from Library/Documentation/Template.php rename to src/Documentation/Template.php index 19e893ce55..12803af96c 100644 --- a/Library/Documentation/Template.php +++ b/src/Documentation/Template.php @@ -9,26 +9,32 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation; -use Zephir\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\CompilerFile; use Zephir\Config; use Zephir\Documentation; use Zephir\Exception; +use function array_merge; +use function file_exists; +use function file_put_contents; +use function is_string; +use function ltrim; +use function ob_get_clean; +use function ob_start; + class Template { - protected $template; - protected $data; - protected $nestedLevel; - protected $pathToRoot = './'; - protected $themeOptions; - protected $theme; + protected string $pathToRoot = './'; /** * @var Config */ protected $projectConfig; + protected $themeOptions; /** * Template constructor. @@ -40,79 +46,59 @@ class Template * * @throws Exception */ - public function __construct(Theme $theme, array $data, string $template, int $nestedLevel = 0) - { + public function __construct( + protected Theme $theme, + protected array $data, + protected string $template, + protected int $nestedLevel = 0, + ) { // todo clean buffer before exception if ($nestedLevel > 800) { throw new Exception('Recursive inclusion detected in theme creation'); } - - $this->theme = $theme; - $this->data = $data; - $this->template = $template; - $this->nestedLevel = $nestedLevel; - } - - private function getTemplatePath($fileName) - { - if ('/' == $fileName[0] || 0 === strpos($fileName, 'phar://')) { - return $fileName; - } - - $inputFilename = $this->theme->getThemePathExtendsAware($fileName); - - if (!file_exists($inputFilename)) { - throw new Exception("Template not found : $inputFilename"); - } - - return $inputFilename; } /** - * Set a variable that will be accessible in the template. - * - * @param $name - * @param $value + * @return string */ - public function setVar($name, $value) + public function getPathToRoot(): string { - $this->data[$name] = $value; + return $this->pathToRoot; } - /** - * get a variable set with setVar(). - * - * @param $name - * - * @return bool - */ - public function getVar($name) + public function parse() { - return isset($this->data[$name]) ? $this->data[$name] : null; + foreach ($this->data as $name => $value) { + $$name = $value; + } + $path = $this->getTemplatePath($this->template); + ob_start(); + include $path; + $content = ob_get_clean(); + + return $content; } - /** - * find the value in the project configuration (e.g the version). - * - * @param string $name the name of the config to get - */ - public function projectConfig($name) + public function partial(string $fileName, array $data = []) { - if (isset($this->projectConfig)) { - return $this->projectConfig->get($name); - } else { - return null; - } + $newLevel = $this->nestedLevel + 1; + + $template = new self($this->theme, array_merge($this->data, $data), $fileName, $newLevel); + $template->setPathToRoot($this->getPathToRoot()); + $template->setThemeOptions($this->themeOptions); + $template->setProjectConfig($this->projectConfig); + + return $template->parse(); } /** - * find the value of an option of the theme. + * the path to root for the hyperlink in the templates. * - * @param string $name the name of the option to get + * @param string $pathToRoot */ - public function themeOption($name) + public function setPathToRoot(string $pathToRoot): void { - return isset($this->themeOptions[$name]) ? $this->themeOptions[$name] : null; + $this->pathToRoot = $pathToRoot; } /** @@ -120,7 +106,7 @@ public function themeOption($name) * * @param array $projectConfig */ - public function setProjectConfig($projectConfig) + public function setProjectConfig($projectConfig): void { $this->projectConfig = $projectConfig; } @@ -130,35 +116,11 @@ public function setProjectConfig($projectConfig) * * @param array $themeOptions */ - public function setThemeOptions($themeOptions) + public function setThemeOptions($themeOptions): void { $this->themeOptions = $themeOptions; } - /** - * get a value from the theme config (theme.json file placed inside the theme directory). - */ - public function getAssets() - { - $css = $this->theme->getThemeInfoExtendAware('css'); - $js = $this->theme->getThemeInfoExtendAware('javascript'); - - return [ - 'css' => $css, - 'javascript' => $js, - ]; - } - - /** - * the path to root for the hyperlink in the templates. - * - * @param string $pathToRoot - */ - public function setPathToRoot($pathToRoot) - { - $this->pathToRoot = $pathToRoot; - } - /** * Generate an url relative to the current directory. * @@ -166,15 +128,15 @@ public function setPathToRoot($pathToRoot) * * @return string the relative path to the url */ - public function url($url) + public function url(string $url): string { - if (\is_string($url)) { + if (is_string($url)) { if ('/' == $url[0]) { - return $this->getPathToRoot().ltrim($url, '/'); - } elseif (\is_string($url)) { + return $this->getPathToRoot() . ltrim($url, '/'); + } elseif (is_string($url)) { return $url; } - } elseif ($url instanceof ClassDefinition) { + } elseif ($url instanceof Definition) { return $this->url(Documentation::classUrl($url)); } elseif ($url instanceof CompilerFile) { return $this->url(Documentation::classUrl($url->getClassDefinition())); @@ -183,47 +145,24 @@ public function url($url) return ''; } - /** - * @return string - */ - public function getPathToRoot() - { - return $this->pathToRoot; - } - - public function asset($name) - { - return $this->getPathToRoot().'asset/'.rtrim($name); - } - - public function write($outputFile) + public function write($outputFile): void { $content = $this->parse(); file_put_contents($outputFile, $content); } - public function parse() + private function getTemplatePath($fileName) { - foreach ($this->data as $name => $value) { - $$name = $value; + if ('/' == $fileName[0] || str_starts_with($fileName, 'phar://')) { + return $fileName; } - $path = $this->getTemplatePath($this->template); - ob_start(); - include $path; - $content = ob_get_clean(); - - return $content; - } - public function partial(string $fileName, array $data = []) - { - $newLevel = $this->nestedLevel + 1; + $inputFilename = $this->theme->getThemePathExtendsAware($fileName); - $template = new self($this->theme, array_merge($this->data, $data), $fileName, $newLevel); - $template->setPathToRoot($this->getPathToRoot()); - $template->setThemeOptions($this->themeOptions); - $template->setProjectConfig($this->projectConfig); + if (!file_exists($inputFilename)) { + throw new Exception("Template not found : $inputFilename"); + } - return $template->parse(); + return $inputFilename; } } diff --git a/Library/Documentation/Theme.php b/src/Documentation/Theme.php similarity index 72% rename from Library/Documentation/Theme.php rename to src/Documentation/Theme.php index 4e6ee9c633..f70307c42c 100644 --- a/Library/Documentation/Theme.php +++ b/src/Documentation/Theme.php @@ -9,36 +9,58 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation; use Zephir\Documentation; use Zephir\Exception; +use function array_unshift; +use function closedir; +use function copy; +use function count; +use function explode; +use function file_exists; +use function file_get_contents; +use function file_put_contents; +use function is_array; +use function is_dir; +use function json_decode; +use function json_encode; +use function ltrim; +use function mkdir; +use function opendir; +use function pathinfo; +use function readdir; +use function str_repeat; +use function str_replace; +use function strpos; +use function touch; + class Theme { - protected $themeDir; - protected $outputDir; - protected $themeConfig; - protected $options; - protected $projectConfig; /** * @var Documentation */ protected $documentation; - /** * @var Theme */ protected $extendedTheme; - + protected $options; + protected $outputDir; + protected $projectConfig; + protected $themeConfig; + protected $themeDir; protected $themeInfos = []; public function __construct($themeDir, $outputDir, $themeConfig, $config, Documentation $documentation) { - $this->outputDir = $outputDir; - $this->themeConfig = $themeConfig; - $this->themeDir = $themeDir; - $this->options = $themeConfig['options']; + $this->outputDir = $outputDir; + $this->themeConfig = $themeConfig; + $this->themeDir = $themeDir; + $this->options = $themeConfig['options']; $this->projectConfig = $config; $this->documentation = $documentation; @@ -52,7 +74,7 @@ public function __construct($themeDir, $outputDir, $themeConfig, $config, Docume if (isset($themeInfos['extends'])) { $extThemePath = $documentation->findThemePathByName($themeInfos['extends']); if (!$extThemePath) { - throw new Exception('Unable to find extended theme '.$themeInfos['extends']); + throw new Exception('Unable to find extended theme ' . $themeInfos['extends']); } $this->extendedTheme = new self($extThemePath, $outputDir, $themeConfig, $config, $documentation); @@ -61,51 +83,96 @@ public function __construct($themeDir, $outputDir, $themeConfig, $config, Docume } } - private function __namespaceTreeHelper(NamespaceHelper $ns) + public function buildJsonClassDefinition($classList, NamespaceAccessor $nsA) { $output = [ - 'classes' => [], - 'namespaces' => [], + 'allClasses' => [], + 'allNamespaces' => [], + 'classes' => [], + 'namespaces' => [], ]; - $subNs = $ns->getNamespaces(); - $subCs = $ns->getClasses(); + foreach ($classList as $class) { + $cDef = $class->getClassDefinition(); + $cName = $cDef->getCompleteName(); - foreach ($subCs as $c) { - $output['classes'][] = $c->getClassDefinition()->getCompleteName(); + $output['allClasses'][$cName] = [ + 'type' => $cDef->getType(), + 'name' => $cName, + 'shortname' => $cDef->getName(), + ]; + + if (!strpos($cName, '\\') > 0) { + $output['classes'][] = $cName; + } } - foreach ($subNs as $sns) { - $output['namespaces'][$sns->getFullNamespace()] = $this->__namespaceTreeHelper($sns); + $namespaces = $nsA->getByNamespace(); + + foreach ($namespaces as $ns) { + $subclasses = []; + $subnamespaces = []; + + foreach ($ns->getClasses() as $scs) { + $subclasses[] = $scs->getClassDefinition()->getCompleteName(); + } + + foreach ($ns->getNamespaces() as $sns) { + $subnamespaces[] = $sns->getFullNamespace(); + } + + $output['allNamespaces'][$ns->getFullNamespace()] = [ + 'name' => $ns->getFullNamespace(), + 'shortName' => $ns->getShortName(), + 'parentName' => $ns->getParentName(), + 'classes' => $subclasses, + 'namespaces' => $subnamespaces, + ]; + + if (!strpos($ns->getFullNamespace(), '\\') > 0) { + $output['namespaces'][] = $ns->getFullNamespace(); + } } - return $output; + return json_encode($output); } /** - * from : https://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php. - * - * @param $src - * @param $dst - * @param $files + * copy the static directory of the theme into the output directory. */ - private function __copyDir($src, $dst, &$files = null) + public function buildStaticDirectory(): void { - $dir = opendir($src); - @mkdir($dst); - while (false !== ($file = readdir($dir))) { - if (('.' != $file) && ('..' != $file)) { - if (is_dir($src.'/'.$file)) { - $this->__copyDir($src.'/'.$file, $dst.'/'.$file, $files); - } else { - copy($src.'/'.$file, $dst.'/'.$file); - if (\is_array($files)) { - $files[] = $dst.'/'.$file; - } + $outputStt = $this->getOutputPath('asset'); + + if (!file_exists($outputStt)) { + mkdir($outputStt, 0777, true); + } + + $this->extendedTheme?->buildStaticDirectory(); + + $themeStt = $this->getThemePath('static'); + + if ($themeStt) { + $files = []; + + $this->__copyDir($themeStt, $outputStt . '/static', $files); + + foreach ($files as $f) { + foreach ($this->options as $optName => $opt) { + $fcontent = file_get_contents($f); + $fcontent = str_replace('%_' . $optName . '_%', $opt, $fcontent); + + file_put_contents($f, $fcontent); } } } - closedir($dir); + } + + public function createFile($path, $content): void + { + $outputFile = $this->getOutputPath($path); + touch($outputFile); + file_put_contents($outputFile, $content); } /** @@ -115,21 +182,21 @@ private function __copyDir($src, $dst, &$files = null) * * @throws Exception */ - public function drawFile(FileInterface $file) + public function drawFile(FileInterface $file): void { $outputFile = ltrim($file->getOutputFile(), '/'); - $output = pathinfo($this->outputDir.'/'.$outputFile); - $outputDirname = $output['dirname']; + $output = pathinfo($this->outputDir . '/' . $outputFile); + $outputDirname = $output['dirname']; $outputBasename = $output['basename']; - $outputFilename = $outputDirname.'/'.$outputBasename; + $outputFilename = $outputDirname . '/' . $outputBasename; // todo : check if writable if (!file_exists($outputDirname)) { mkdir($outputDirname, 0777, true); } - $subDirNumber = \count(explode('/', $outputFile)) - 1; + $subDirNumber = count(explode('/', $outputFile)) - 1; if ($subDirNumber > 0) { $pathToRoot = str_repeat('../', $subDirNumber); @@ -146,6 +213,16 @@ public function drawFile(FileInterface $file) $template->write($outputFilename); } + public function getOutputPath($path) + { + $path = pathinfo($this->outputDir . '/' . $path); + $pathDirname = $path['dirname']; + $pathBasename = $path['basename']; + $pathFilename = $pathDirname . '/' . $pathBasename; + + return $pathFilename; + } + /** * Get assets from the theme info (theme.json file placed inside the theme directory). * @@ -183,97 +260,24 @@ public function getThemeInfoExtendAware($name) } /** - * copy the static directory of the theme into the output directory. + * find the path to a file in the theme. + * + * @param $path + * + * @return string */ - public function buildStaticDirectory() - { - $outputStt = $this->getOutputPath('asset'); - - if (!file_exists($outputStt)) { - mkdir($outputStt, 0777, true); - } - - if ($this->extendedTheme) { - $this->extendedTheme->buildStaticDirectory(); - } - - $themeStt = $this->getThemePath('static'); - - if ($themeStt) { - $files = []; - - $this->__copyDir($themeStt, $outputStt.'/static', $files); - - foreach ($files as $f) { - foreach ($this->options as $optName => $opt) { - $fcontent = file_get_contents($f); - $fcontent = str_replace('%_'.$optName.'_%', $opt, $fcontent); - - file_put_contents($f, $fcontent); - } - } - } - } - - public function buildJsonClassDefinition($classList, NamespaceAccessor $nsA) + public function getThemePath($path) { - $output = [ - 'allClasses' => [], - 'allNamespaces' => [], - 'classes' => [], - 'namespaces' => [], - ]; - - foreach ($classList as $class) { - $cDef = $class->getClassDefinition(); - $cName = $cDef->getCompleteName(); - - $output['allClasses'][$cName] = [ - 'type' => $cDef->getType(), - 'name' => $cName, - 'shortname' => $cDef->getName(), - ]; - - if (!strpos($cName, '\\') > 0) { - $output['classes'][] = $cName; - } - } - - $namespaces = $nsA->getByNamespace(); - - foreach ($namespaces as $ns) { - $subclasses = []; - $subnamespaces = []; - - foreach ($ns->getClasses() as $scs) { - $subclasses[] = $scs->getClassDefinition()->getCompleteName(); - } - - foreach ($ns->getNamespaces() as $sns) { - $subnamespaces[] = $sns->getFullNamespace(); - } - - $output['allNamespaces'][$ns->getFullNamespace()] = [ - 'name' => $ns->getFullNamespace(), - 'shortName' => $ns->getShortName(), - 'parentName' => $ns->getParentName(), - 'classes' => $subclasses, - 'namespaces' => $subnamespaces, - ]; + $path = pathinfo($this->themeDir . '/' . $path); + $pathDirname = $path['dirname']; + $pathBasename = $path['basename']; + $pathFilename = $pathDirname . '/' . $pathBasename; - if (!strpos($ns->getFullNamespace(), '\\') > 0) { - $output['namespaces'][] = $ns->getFullNamespace(); - } + if (!file_exists($pathFilename)) { + return null; } - return json_encode($output); - } - - public function createFile($path, $content) - { - $outputFile = $this->getOutputPath($path); - touch($outputFile); - file_put_contents($outputFile, $content); + return $pathFilename; } /** @@ -296,33 +300,28 @@ public function getThemePathExtendsAware($path) } /** - * find the path to a file in the theme. - * - * @param $path + * from : https://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php. * - * @return string + * @param $src + * @param $dst + * @param $files */ - public function getThemePath($path) + private function __copyDir($src, $dst, &$files = null): void { - $path = pathinfo($this->themeDir.'/'.$path); - $pathDirname = $path['dirname']; - $pathBasename = $path['basename']; - $pathFilename = $pathDirname.'/'.$pathBasename; - - if (!file_exists($pathFilename)) { - return null; + $dir = opendir($src); + @mkdir($dst); + while (false !== ($file = readdir($dir))) { + if (('.' != $file) && ('..' != $file)) { + if (is_dir($src . '/' . $file)) { + $this->__copyDir($src . '/' . $file, $dst . '/' . $file, $files); + } else { + copy($src . '/' . $file, $dst . '/' . $file); + if (is_array($files)) { + $files[] = $dst . '/' . $file; + } + } + } } - - return $pathFilename; - } - - public function getOutputPath($path) - { - $path = pathinfo($this->outputDir.'/'.$path); - $pathDirname = $path['dirname']; - $pathBasename = $path['basename']; - $pathFilename = $pathDirname.'/'.$pathBasename; - - return $pathFilename; + closedir($dir); } } diff --git a/Library/Exception.php b/src/Exception.php similarity index 93% rename from Library/Exception.php rename to src/Exception.php index 7b4b45d5e1..3efe3fbe26 100644 --- a/Library/Exception.php +++ b/src/Exception.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; /** diff --git a/src/Exception/CompilerException.php b/src/Exception/CompilerException.php new file mode 100644 index 0000000000..b5a66919bc --- /dev/null +++ b/src/Exception/CompilerException.php @@ -0,0 +1,259 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Exception; + +use Exception; +use Throwable; +use Zephir\CompiledExpression; +use Zephir\Variable\Variable; + +use function is_array; + +/** + * Exceptions generated by the compiler + */ +class CompilerException extends RuntimeException +{ + /** + * CompilerException constructor. + * + * @param string $message the Exception message to throw [optional] + * @param array|null $extra extra info [optional] + * @param int $code the Exception code [optional] + * @param Exception|Throwable|null $previous the previous throwable used for the exception chaining [optional] + */ + public function __construct( + string $message = '', + ?array $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ) { + if (is_array($extra) && isset($extra['file'])) { + $message .= ' in ' . $extra['file'] . ' on line ' . $extra['line']; + } + + $this->extra = $extra; + + parent::__construct($message, $code, $previous); + } + + /** + * Cannot use variable type as array + * + * @param string $type the variable type + * @param array|null $extra extra info [optional] + * @param int $code the Exception code [optional] + * @param Exception|Throwable|null $previous the previous throwable used for the exception chaining [optional] + * + * @return self + */ + public static function cannotUseAsArray( + string $type, + array | null $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ): self { + return new self( + "Cannot use variable type: '" . $type . "' as array", + $extra, + $code, + $previous + ); + } + + /** + * Cannot use non-initialized variable as an object + * + * @param array|null $extra extra info [optional] + * @param int $code the Exception code [optional] + * @param Exception|Throwable|null $previous the previous throwable used for the exception chaining [optional] + * + * @return self + */ + public static function cannotUseNonInitializedVariableAsObject( + array | null $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ): self { + return new self( + 'Cannot use non-initialized variable as an object', + $extra, + $code, + $previous + ); + } + + /** + * Cannot use non-initialized variable as an object + * + * @param array|null $extra extra info [optional] + * @param int $code the Exception code [optional] + * @param Exception|Throwable|null $previous the previous throwable used for the exception chaining [optional] + * + * @return self + */ + public static function cannotUseValueTypeAs( + Variable $variable, + string $asType, + array | null $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ): self { + return new self( + 'Cannot use value type: ' . $variable->getType() . ' as ' . $asType, + $extra, + $code, + $previous + ); + } + + /** + * Cannot use non-initialized variable as an object + * + * @param array|null $extra extra info [optional] + * @param int $code the Exception code [optional] + * @param Exception|Throwable|null $previous the previous throwable used for the exception chaining [optional] + * + * @return self + */ + public static function cannotUseVariableTypeAs( + Variable $variable, + string $asType, + array | null $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ): self { + return new self( + 'Cannot use variable type: ' . $variable->getType() . ' ' . $asType, + $extra, + $code, + $previous + ); + } + + /** + * Class does not have a property called + * + * @param string $className + * @param string $property + * @param array|null $extra + * @param int $code + * @param Exception|Throwable|null $previous + * + * @return self + */ + public static function classDoesNotHaveProperty( + string $className, + string $property, + array | null $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ): self { + return new self( + "Class '" + . $className + . "' does not have a property called: '" . $property . "'", + $extra, + $code, + $previous + ); + } + + /** + * @param string $operator + * @param string $dataType + * @param array $statement + * + * @return self + */ + public static function illegalOperationTypeOnStaticVariable( + string $operator, + string $dataType, + array $statement + ): self { + return new self( + "Operator '$operator' isn't supported for static variables and $dataType typed expressions", + $statement + ); + } + + /** + * Returned Values can only be assigned to variant variables + * + * @param array|null $extra extra info [optional] + * @param int $code the Exception code [optional] + * @param Exception|Throwable|null $previous the previous throwable used for the exception chaining [optional] + * + * @return self + */ + public static function returnValuesVariantVars( + array | null $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ): self { + return new self( + 'Returned values by functions can only be assigned to variant variables', + $extra, + $code, + $previous + ); + } + + /** + * Unknown variable type + * + * @param array|null $extra + * @param int $code + * @param Exception|Throwable|null $previous + * + * @return self + */ + public static function unknownType( + Variable $variable, + array | null $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ): self { + return new self( + "Unknown '" . $variable->getType() . "'", + $extra, + $code, + $previous + ); + } + + /** + * Unsupported Type + * + * @param CompiledExpression $expression + * @param array|null $extra + * @param int $code + * @param Exception|Throwable|null $previous + * + * @return self + */ + public static function unsupportedType( + CompiledExpression $expression, + array | null $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ): self { + return new self( + 'Unsupported type: ' . $expression->getType(), + $extra, + $code, + $previous + ); + } +} diff --git a/Library/Exception/ExceptionExtraAwareTrait.php b/src/Exception/ExceptionExtraAwareTrait.php similarity index 72% rename from Library/Exception/ExceptionExtraAwareTrait.php rename to src/Exception/ExceptionExtraAwareTrait.php index 470f55c1dc..3ccb013dbd 100644 --- a/Library/Exception/ExceptionExtraAwareTrait.php +++ b/src/Exception/ExceptionExtraAwareTrait.php @@ -9,45 +9,36 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Exception; -/** - * Zephir\Exception\ExceptionInterface. - */ +use function file; +use function file_exists; +use function sprintf; +use function str_repeat; +use function str_replace; + trait ExceptionExtraAwareTrait { /** * Extra info. - * - * @var array */ - protected $extra = []; - - /** - * {@inheritdoc} - * - * @return array - */ - public function getExtra() - { - return $this->extra; - } + protected ?array $extra = []; /** - * {@inheritdoc} - * * @return string */ - public function getErrorRegion() + public function getErrorRegion(): string { $region = ''; - $extra = $this->getExtra(); + $extra = $this->getExtra(); if (isset($extra['file']) && file_exists($extra['file'])) { $lines = file($extra['file']); if (isset($lines[$extra['line'] - 1])) { - $line = $lines[$extra['line'] - 1]; + $line = $lines[$extra['line'] - 1]; $region .= sprintf("\t%s", str_replace("\t", ' ', $line)); if (($extra['char'] - 1) > 0) { @@ -58,4 +49,12 @@ public function getErrorRegion() return $region; } + + /** + * @return array + */ + public function getExtra(): array + { + return $this->extra; + } } diff --git a/Library/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php similarity index 77% rename from Library/Exception/ExceptionInterface.php rename to src/Exception/ExceptionInterface.php index 17f94bf9a8..9861299cb6 100644 --- a/Library/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Exception; /** @@ -17,16 +19,16 @@ interface ExceptionInterface { /** - * Gets extra info. + * Returns the code block in which the error occurred. * - * @return array + * @return string */ - public function getExtra(); + public function getErrorRegion(): string; /** - * Returns the code block in which the error occurred. + * Gets extra info. * - * @return string + * @return array|null */ - public function getErrorRegion(); + public function getExtra(): array | null; } diff --git a/Library/Exception/FileSystemException.php b/src/Exception/FileSystemException.php similarity index 86% rename from Library/Exception/FileSystemException.php rename to src/Exception/FileSystemException.php index 96977003bc..349303d27c 100644 --- a/Library/Exception/FileSystemException.php +++ b/src/Exception/FileSystemException.php @@ -9,11 +9,10 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Exception; -/** - * Zephir\Exception\FileSystemException. - */ class FileSystemException extends RuntimeException { } diff --git a/Library/Exception/IllegalOperationException.php b/src/Exception/IllegalOperationException.php similarity index 94% rename from Library/Exception/IllegalOperationException.php rename to src/Exception/IllegalOperationException.php index 0255fa4143..b46afe8c72 100644 --- a/Library/Exception/IllegalOperationException.php +++ b/src/Exception/IllegalOperationException.php @@ -9,13 +9,14 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Exception; use Zephir\TypeAwareInterface; -/** - * Zephir\Exception\IllegalOperationException. - */ +use function sprintf; + class IllegalOperationException extends CompilerException { /** diff --git a/Library/Exception/IllegalStateException.php b/src/Exception/IllegalStateException.php similarity index 86% rename from Library/Exception/IllegalStateException.php rename to src/Exception/IllegalStateException.php index d0ad8ff935..4712fb39e2 100644 --- a/Library/Exception/IllegalStateException.php +++ b/src/Exception/IllegalStateException.php @@ -9,11 +9,10 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Exception; -/** - * Zephir\Exception\IllegalStateException. - */ class IllegalStateException extends RuntimeException { } diff --git a/Library/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php similarity index 87% rename from Library/Exception/InvalidArgumentException.php rename to src/Exception/InvalidArgumentException.php index c940e61c23..14ac255948 100644 --- a/Library/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -9,11 +9,10 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Exception; -/** - * Zephir\Exception\InvalidArgumentException. - */ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface { use ExceptionExtraAwareTrait; diff --git a/Library/Exception/InvalidTypeException.php b/src/Exception/InvalidTypeException.php similarity index 97% rename from Library/Exception/InvalidTypeException.php rename to src/Exception/InvalidTypeException.php index fad4b82b46..d89e5efd43 100644 --- a/Library/Exception/InvalidTypeException.php +++ b/src/Exception/InvalidTypeException.php @@ -13,6 +13,8 @@ namespace Zephir\Exception; +use function sprintf; + final class InvalidTypeException extends CompilerException { /** diff --git a/Library/Exception/LogicException.php b/src/Exception/LogicException.php similarity index 79% rename from Library/Exception/LogicException.php rename to src/Exception/LogicException.php index 5a961bffef..cc45e9af27 100644 --- a/Library/Exception/LogicException.php +++ b/src/Exception/LogicException.php @@ -9,13 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Exception; /** - * Zephir\Exception\LogicException. - * * Exception that represents error in the program logic. - * This kind of exceptions should directly lead to a fix in your code. + * This kind of exception should directly lead to a fix in your code. */ class LogicException extends \LogicException implements ExceptionInterface { diff --git a/Library/Exception/NotImplementedException.php b/src/Exception/NotImplementedException.php similarity index 91% rename from Library/Exception/NotImplementedException.php rename to src/Exception/NotImplementedException.php index 69cb57d676..2583febe6d 100644 --- a/Library/Exception/NotImplementedException.php +++ b/src/Exception/NotImplementedException.php @@ -9,11 +9,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Exception; /** - * Zephir\Exception\NotImplementedException. - * * Thrown to indicate that a block of code has not been implemented. * Represents the case where the author has yet to implement * the logic at this point in the program. diff --git a/src/Exception/ParseException.php b/src/Exception/ParseException.php new file mode 100644 index 0000000000..8b20a1e401 --- /dev/null +++ b/src/Exception/ParseException.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Exception; + +use Exception; +use Throwable; + +use function is_array; + +/** + * Exceptions generated by parsing actions + */ +class ParseException extends RuntimeException +{ + /** + * ParseException constructor. + * + * @param string $message the Exception message to throw [optional] + * @param array|null $extra extra info [optional] + * @param int $code the Exception code [optional] + * @param Exception|Throwable|null $previous the previous throwable used for the exception chaining [optional] + */ + public function __construct( + string $message = '', + ?array $extra = null, + int $code = 0, + Exception | Throwable $previous = null + ) { + if (is_array($extra) && isset($extra['file'])) { + $message .= ' in ' . $extra['file'] . ' on line ' . $extra['line']; + } + + $this->extra = $extra; + + parent::__construct($message, $code, $previous); + } +} diff --git a/Library/Exception/RuntimeException.php b/src/Exception/RuntimeException.php similarity index 91% rename from Library/Exception/RuntimeException.php rename to src/Exception/RuntimeException.php index 4772baf94d..da441dd5ef 100644 --- a/Library/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -9,11 +9,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Exception; /** - * Zephir\Exception\RuntimeException. - * * Exception thrown if an error which can only be found on runtime occurs. */ class RuntimeException extends \RuntimeException implements ExceptionInterface diff --git a/Library/Expression.php b/src/Expression.php similarity index 85% rename from Library/Expression.php rename to src/Expression.php index 817612f408..9619d3c8ec 100644 --- a/Library/Expression.php +++ b/src/Expression.php @@ -67,6 +67,13 @@ use Zephir\Operators\Other\UnlikelyOperator; use Zephir\Operators\Unary\MinusOperator; use Zephir\Operators\Unary\NotOperator; +use Zephir\Variable\Variable; + +use function str_replace; +use function strlen; +use function substr; + +use const PHP_EOL; /** * Represents an expression. @@ -74,156 +81,14 @@ */ class Expression { - protected bool $noisy = true; - protected bool $expecting = true; - protected bool $readOnly = false; - protected bool $evalMode = false; - protected array $expression = []; + protected bool $evalMode = false; + protected bool $expecting = true; protected ?Variable $expectingVariable = null; + protected bool $noisy = true; + protected bool $readOnly = false; - /** - * Expression constructor. - * - * @param array $expression - */ - public function __construct(array $expression) - { - $this->expression = $expression; - } - - /** - * Returns the original expression. - * - * @return array - */ - public function getExpression(): array - { - return $this->expression; - } - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable - */ - public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly - */ - public function setReadOnly(bool $readOnly): void - { - $this->readOnly = $readOnly; - } - - /** - * Checks if the result of the evaluated expression is read only. - * - * @return bool - */ - public function isReadOnly(): bool - { - return $this->readOnly; - } - - /** - * Checks if the returned value by the expression - * is expected to be assigned to an external symbol. - * - * @return bool - */ - public function isExpectingReturn(): bool - { - return $this->expecting; - } - - /** - * Returns the variable which is expected to return the - * result of the expression evaluation. - * - * @return Variable|null - */ - public function getExpectingVariable(): ?Variable - { - return $this->expectingVariable; - } - - /** - * Sets whether the expression must be resolved in "noisy" mode. - * - * @param bool $noisy - */ - public function setNoisy(bool $noisy): void - { - $this->noisy = $noisy; - } - - /** - * Checks whether the expression must be resolved in "noisy" mode. - * - * @return bool - */ - public function isNoisy(): bool - { - return $this->noisy; - } - - /** - * Sets if the expression is being evaluated in an evaluation like the ones in 'if' and 'while' statements. - * - * @param bool $evalMode - */ - public function setEvalMode(bool $evalMode): void - { - $this->evalMode = $evalMode; - } - - /** - * Compiles foo = []. - * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - */ - public function emptyArray(array $expression, CompilationContext $compilationContext): CompiledExpression + public function __construct(protected array $expression) { - /** - * Resolves the symbol that expects the value - */ - if ($this->expecting) { - if ($this->expectingVariable) { - $symbolVariable = &$this->expectingVariable; - $symbolVariable->initVariant($compilationContext); - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } - - /** - * Variable that receives property accesses must be polymorphic - */ - if (!$symbolVariable->isVariable() && 'array' != $symbolVariable->getType()) { - throw new CompilerException('Cannot use variable: '.$symbolVariable->getName().'('.$symbolVariable->getType().') to create empty array', $expression); - } - - /** - * Mark the variable as an 'array' - */ - $symbolVariable->setDynamicTypes('array'); - $compilationContext->backend->initArray($symbolVariable, $compilationContext); - - return new CompiledExpression('array', $symbolVariable->getRealName(), $expression); } /** @@ -231,17 +96,16 @@ public function emptyArray(array $expression, CompilationContext $compilationCon * * @param CompilationContext $compilationContext * - * @throws CompilerException|Exception - * * @return CompiledExpression * + * @throws CompilerException|Exception * @throws Exception * @throws ReflectionException */ public function compile(CompilationContext $compilationContext): CompiledExpression { $expression = $this->expression; - $type = $expression['type']; + $type = $expression['type']; switch ($type) { case 'null': @@ -257,19 +121,37 @@ public function compile(CompilationContext $compilationContext): CompiledExpress return new LiteralCompiledExpression($type, $expression['value'], $expression); case 'string': - return new LiteralCompiledExpression('string', str_replace(PHP_EOL, '\\n', $expression['value']), $expression); + return new LiteralCompiledExpression( + 'string', + str_replace(PHP_EOL, '\\n', $expression['value']), + $expression + ); case 'istring': - return new LiteralCompiledExpression('istring', str_replace(PHP_EOL, '\\n', $expression['value']), $expression); + return new LiteralCompiledExpression( + 'istring', + str_replace(PHP_EOL, '\\n', $expression['value']), + $expression + ); case 'char': - if (!\strlen($expression['value'])) { + if (!strlen($expression['value'])) { throw new CompilerException('Invalid empty char literal', $expression); } - if (\strlen($expression['value']) > 2) { - if (\strlen($expression['value']) > 10) { - throw new CompilerException("Invalid char literal: '".substr($expression['value'], 0, 10)."...'", $expression); + if (strlen($expression['value']) > 2) { + if (strlen($expression['value']) > 10) { + throw new CompilerException( + "Invalid char literal: '" + . substr($expression['value'], 0, 10) + . "...'", + $expression + ); } else { - throw new CompilerException("Invalid char literal: '".$expression['value']."'", $expression); + throw new CompilerException( + "Invalid char literal: '" + . $expression['value'] + . "'", + $expression + ); } } @@ -473,12 +355,16 @@ public function compile(CompilationContext $compilationContext): CompiledExpress ); } $numberPrints = $compilationContext->codePrinter->getNumberPrints(); - $expr = new self($expression['left']); + $expr = new self($expression['left']); $expr->setExpectReturn($this->expecting, $this->expectingVariable); $resolved = $expr->compile($compilationContext); if (($compilationContext->codePrinter->getNumberPrints() - $numberPrints) <= 1) { - if (false !== strpos($resolved->getCode(), ' ')) { - return new CompiledExpression($resolved->getType(), '('.$resolved->getCode().')', $expression); + if (str_contains($resolved->getCode(), ' ')) { + return new CompiledExpression( + $resolved->getType(), + '(' . $resolved->getCode() . ')', + $expression + ); } } @@ -516,7 +402,10 @@ public function compile(CompilationContext $compilationContext): CompiledExpress case 'likely': if (!$this->evalMode) { - throw new CompilerException("'likely' operator can only be used in evaluation expressions", $expression); + throw new CompilerException( + "'likely' operator can only be used in evaluation expressions", + $expression + ); } $expr = new LikelyOperator(); $expr->setReadOnly($this->isReadOnly()); @@ -525,7 +414,10 @@ public function compile(CompilationContext $compilationContext): CompiledExpress case 'unlikely': if (!$this->evalMode) { - throw new CompilerException("'unlikely' operator can only be used in evaluation expressions", $expression); + throw new CompilerException( + "'unlikely' operator can only be used in evaluation expressions", + $expression + ); } $expr = new UnlikelyOperator(); $expr->setReadOnly($this->isReadOnly()); @@ -557,7 +449,7 @@ public function compile(CompilationContext $compilationContext): CompiledExpress break; default: - throw new CompilerException('Unknown expression: '.$type, $expression); + throw new CompilerException('Unknown expression: ' . $type, $expression); } $compilableExpression->setReadOnly($this->isReadOnly()); @@ -565,4 +457,154 @@ public function compile(CompilationContext $compilationContext): CompiledExpress return $compilableExpression->compile($expression, $compilationContext); } + + /** + * Compiles foo = []. + * + * @param array $expression + * @param CompilationContext $compilationContext + * + * @return CompiledExpression + */ + public function emptyArray(array $expression, CompilationContext $compilationContext): CompiledExpression + { + /** + * Resolves the symbol that expects the value + */ + if ($this->expecting) { + if ($this->expectingVariable) { + $symbolVariable = &$this->expectingVariable; + $symbolVariable->initVariant($compilationContext); + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } + + /** + * Variable that receives property accesses must be polymorphic + */ + if (!$symbolVariable->isVariable() && 'array' != $symbolVariable->getType()) { + throw new CompilerException( + 'Cannot use variable: ' + . $symbolVariable->getName() + . '(' + . $symbolVariable->getType() + . ') to create empty array', + $expression + ); + } + + /** + * Mark the variable as an 'array' + */ + $symbolVariable->setDynamicTypes('array'); + $compilationContext->backend->initArray($symbolVariable, $compilationContext); + + return new CompiledExpression('array', $symbolVariable->getRealName(), $expression); + } + + /** + * Returns the variable which is expected to return the + * result of the expression evaluation. + * + * @return Variable|null + */ + public function getExpectingVariable(): ?Variable + { + return $this->expectingVariable; + } + + /** + * Returns the original expression. + * + * @return array + */ + public function getExpression(): array + { + return $this->expression; + } + + /** + * Checks if the returned value by the expression + * is expected to be assigned to an external symbol. + * + * @return bool + */ + public function isExpectingReturn(): bool + { + return $this->expecting; + } + + /** + * Checks whether the expression must be resolved in "noisy" mode. + * + * @return bool + */ + public function isNoisy(): bool + { + return $this->noisy; + } + + /** + * Checks if the result of the evaluated expression is read only. + * + * @return bool + */ + public function isReadOnly(): bool + { + return $this->readOnly; + } + + /** + * Sets if the expression is being evaluated in an evaluation like the ones in 'if' and 'while' statements. + * + * @param bool $evalMode + */ + public function setEvalMode(bool $evalMode): void + { + $this->evalMode = $evalMode; + } + + /** + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. + * + * @param bool $expecting + * @param Variable|null $expectingVariable + */ + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void + { + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets whether the expression must be resolved in "noisy" mode. + * + * @param bool $noisy + */ + public function setNoisy(bool $noisy): void + { + $this->noisy = $noisy; + } + + /** + * Sets if the result of the evaluated expression is read only. + * + * @param bool $readOnly + */ + public function setReadOnly(bool $readOnly): void + { + $this->readOnly = $readOnly; + } } diff --git a/Library/Expression/Builder/AbstractBuilder.php b/src/Expression/Builder/AbstractBuilder.php similarity index 92% rename from Library/Expression/Builder/AbstractBuilder.php rename to src/Expression/Builder/AbstractBuilder.php index 53be021693..be0339483e 100644 --- a/Library/Expression/Builder/AbstractBuilder.php +++ b/src/Expression/Builder/AbstractBuilder.php @@ -9,66 +9,67 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder; -/** - * Class AbstractBuilder. - */ +use function is_array; +use function is_object; +use function is_scalar; + abstract class AbstractBuilder { - private $file = null; - private $line = null; - private $char = null; + private $char; + private $file; + private $line; /** - * @param string $file - * @param int $line - * @param null $char - * - * @return $this + * @return array */ - public function setParseInfo($file, $line, $char = null) + public function build() { - $this->setFile($file); - $this->setLine($line); + $expression = $this->preBuild(); - if (null !== $char) { - $this->setChar($char); + if (!isset($expression['file']) && (($file = $this->getFile()) && null !== $file)) { + $expression['file'] = $file; } - return $this; + if (!isset($expression['line']) && (($line = $this->getLine()) && null !== $line)) { + $expression['line'] = $line; + } + + if (!isset($expression['char']) && (($char = $this->getChar()) && null !== $char)) { + $expression['char'] = $char; + } + + return $this->resolve($expression); } /** - * @param string $file + * @return array * - * @return AbstractBuilder + * @deprecated since version 0.8.0, to be removed in 1.0. + * Use {@link \Zephir\Builder\AbstractBuilder::build()} */ - public function setFile($file) + public function get() { - $this->file = $file; - - return $this; + return $this->build(); } /** - * @return string + * @return int */ - public function getFile() + public function getChar() { - return $this->file; + return $this->char; } /** - * @param string $line - * - * @return AbstractBuilder + * @return string */ - public function setLine($line) + public function getFile() { - $this->line = $line; - - return $this; + return $this->file; } /** @@ -92,44 +93,46 @@ public function setChar($char) } /** - * @return int + * @param string $file + * + * @return AbstractBuilder */ - public function getChar() + public function setFile($file) { - return $this->char; + $this->file = $file; + + return $this; } /** - * @return array + * @param string $line * - * @deprecated since version 0.8.0, to be removed in 1.0. - * Use {@link \Zephir\Builder\AbstractBuilder::build()} + * @return AbstractBuilder */ - public function get() + public function setLine($line) { - return $this->build(); + $this->line = $line; + + return $this; } /** - * @return array + * @param string $file + * @param int $line + * @param null $char + * + * @return $this */ - public function build() + public function setParseInfo($file, $line, $char = null) { - $expression = $this->preBuild(); - - if (!isset($expression['file']) && (($file = $this->getFile()) && null !== $file)) { - $expression['file'] = $file; - } - - if (!isset($expression['line']) && (($line = $this->getLine()) && null !== $line)) { - $expression['line'] = $line; - } + $this->setFile($file); + $this->setLine($line); - if (!isset($expression['char']) && (($char = $this->getChar()) && null !== $char)) { - $expression['char'] = $char; + if (null !== $char) { + $this->setChar($char); } - return $this->resolve($expression); + return $this; } /** @@ -144,7 +147,7 @@ abstract protected function preBuild(); */ protected function resolve($expr) { - if (\is_array($expr)) { + if (is_array($expr)) { foreach ($expr as &$value) { if (!is_scalar($value)) { $value = $this->resolve($value); @@ -154,7 +157,7 @@ protected function resolve($expr) return $expr; } - if (\is_object($expr) && $expr instanceof self) { + if (is_object($expr) && $expr instanceof self) { return $expr->build(); } diff --git a/Library/Expression/Builder/BuilderFactory.php b/src/Expression/Builder/BuilderFactory.php similarity index 93% rename from Library/Expression/Builder/BuilderFactory.php rename to src/Expression/Builder/BuilderFactory.php index 9132a0dd64..40de0981ea 100644 --- a/Library/Expression/Builder/BuilderFactory.php +++ b/src/Expression/Builder/BuilderFactory.php @@ -9,25 +9,22 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder; use Zephir\Expression\Builder\Factory\OperatorsFactory; use Zephir\Expression\Builder\Factory\StatementsFactory; -/** - * Zephir\Expression\Builder\BuilderFactory. - */ class BuilderFactory { + /** @var self */ + protected static $instance; /** @var OperatorsFactory */ protected $operatorsFactory; - /** @var StatementsFactory */ protected $statementsFactory; - /** @var self */ - protected static $instance; - /** * @return self */ @@ -40,6 +37,20 @@ public static function getInstance() return static::$instance; } + /** + * @param $type + * @param null $value + * + * @return RawExpression + */ + public function literal($type, $value = null) + { + return $this->raw([ + 'type' => $type, + 'value' => $value, + ]); + } + /** * @return OperatorsFactory */ @@ -52,6 +63,16 @@ public function operators() return $this->operatorsFactory; } + /** + * @param $expression + * + * @return RawExpression + */ + public function raw($expression) + { + return new RawExpression($expression); + } + /** * @return StatementsFactory */ @@ -72,32 +93,8 @@ public function statements() public function variable($name) { return $this->raw([ - 'type' => 'variable', + 'type' => 'variable', 'value' => $name, ]); } - - /** - * @param $type - * @param null $value - * - * @return RawExpression - */ - public function literal($type, $value = null) - { - return $this->raw([ - 'type' => $type, - 'value' => $value, - ]); - } - - /** - * @param $expression - * - * @return RawExpression - */ - public function raw($expression) - { - return new RawExpression($expression); - } } diff --git a/Library/Expression/Builder/Factory/OperatorsFactory.php b/src/Expression/Builder/Factory/OperatorsFactory.php similarity index 78% rename from Library/Expression/Builder/Factory/OperatorsFactory.php rename to src/Expression/Builder/Factory/OperatorsFactory.php index c5d4ccd9ed..adbf873eca 100644 --- a/Library/Expression/Builder/Factory/OperatorsFactory.php +++ b/src/Expression/Builder/Factory/OperatorsFactory.php @@ -21,30 +21,10 @@ use Zephir\Expression\Builder\Operators\RawOperator; use Zephir\Expression\Builder\Operators\UnaryOperator; -/** - * Class OperatorsFactory. - */ class OperatorsFactory { - protected BuilderFactory $factory; - - /** - * @param BuilderFactory $factory - */ - public function __construct(BuilderFactory $factory) - { - $this->factory = $factory; - } - - /** - * @param null $variable - * @param AbstractBuilder|null $expression - * - * @return AssignVariableOperator - */ - public function assignVariable($variable = null, AbstractBuilder $expression = null) + public function __construct(protected BuilderFactory $factory) { - return new AssignVariableOperator($variable, $expression); } /** @@ -54,8 +34,11 @@ public function assignVariable($variable = null, AbstractBuilder $expression = n * * @return AssignPropertyOperator */ - public function assignProperty($variable = null, $property = null, AbstractBuilder $expression = null) - { + public function assignProperty( + $variable = null, + $property = null, + AbstractBuilder $expression = null + ): AssignPropertyOperator { $assignProperty = new AssignPropertyOperator($variable, $property, $expression); $assignProperty->setType($assignProperty::TYPE_ASSIGN_OBJECT_PROPERTY); @@ -69,8 +52,11 @@ public function assignProperty($variable = null, $property = null, AbstractBuild * * @return AssignPropertyOperator */ - public function assignStaticProperty($variable = null, $property = null, AbstractBuilder $expression = null) - { + public function assignStaticProperty( + $variable = null, + $property = null, + AbstractBuilder $expression = null + ): AssignPropertyOperator { $assignProperty = $this->assignProperty($variable, $property, $expression); $assignProperty->setType($assignProperty::TYPE_ASSIGN_STATIC_PROPERTY); @@ -78,30 +64,33 @@ public function assignStaticProperty($variable = null, $property = null, Abstrac } /** - * @param null $operator - * @param AbstractBuilder|null $leftExpression - * @param AbstractBuilder|null $rightExpression + * @param null $variable + * @param AbstractBuilder|null $expression * - * @return BinaryOperator + * @return AssignVariableOperator */ - public function binary($operator = null, AbstractBuilder $leftExpression = null, AbstractBuilder $rightExpression = null) + public function assignVariable($variable = null, AbstractBuilder $expression = null): AssignVariableOperator { - return new BinaryOperator($operator, $leftExpression, $rightExpression); + return new AssignVariableOperator($variable, $expression); } /** - * @param string|null $operator - * @param AbstractBuilder|null $expression + * @param null $operator + * @param AbstractBuilder|null $leftExpression + * @param AbstractBuilder|null $rightExpression * - * @return UnaryOperator + * @return BinaryOperator */ - public function unary($operator = null, AbstractBuilder $expression = null) - { - return new UnaryOperator($operator, $expression); + public function binary( + $operator = null, + AbstractBuilder $leftExpression = null, + AbstractBuilder $rightExpression = null + ) { + return new BinaryOperator($operator, $leftExpression, $rightExpression); } /** - * @param $type + * @param $type * @param AbstractBuilder $expression * * @return RawOperator @@ -109,14 +98,14 @@ public function unary($operator = null, AbstractBuilder $expression = null) public function cast($type, AbstractBuilder $expression) { return $this->raw([ - 'type' => BinaryOperator::OPERATOR_CAST, - 'left' => $type, + 'type' => BinaryOperator::OPERATOR_CAST, + 'left' => $type, 'right' => $expression, ]); } /** - * @param $type + * @param $type * @param AbstractBuilder $expression * * @return RawOperator @@ -124,8 +113,8 @@ public function cast($type, AbstractBuilder $expression) public function hint($type, AbstractBuilder $expression) { return $this->raw([ - 'type' => BinaryOperator::OPERATOR_TYPE_HINT, - 'left' => $type, + 'type' => BinaryOperator::OPERATOR_TYPE_HINT, + 'left' => $type, 'right' => $expression, ]); } @@ -139,4 +128,15 @@ public function raw(array $expression) { return new RawOperator($expression); } + + /** + * @param string|null $operator + * @param AbstractBuilder|null $expression + * + * @return UnaryOperator + */ + public function unary($operator = null, AbstractBuilder $expression = null) + { + return new UnaryOperator($operator, $expression); + } } diff --git a/Library/Expression/Builder/Factory/StatementsFactory.php b/src/Expression/Builder/Factory/StatementsFactory.php similarity index 63% rename from Library/Expression/Builder/Factory/StatementsFactory.php rename to src/Expression/Builder/Factory/StatementsFactory.php index 99190f963c..6148a8be9c 100644 --- a/Library/Expression/Builder/Factory/StatementsFactory.php +++ b/src/Expression/Builder/Factory/StatementsFactory.php @@ -17,8 +17,6 @@ use Zephir\Expression\Builder\BuilderFactory; use Zephir\Expression\Builder\Operators\AbstractOperator; use Zephir\Expression\Builder\Statements\CallFunctionStatement; -use Zephir\Expression\Builder\Statements\CallMethodStatement; -use Zephir\Expression\Builder\Statements\CallStaticStatement; use Zephir\Expression\Builder\Statements\IfStatement; use Zephir\Expression\Builder\Statements\LetStatement; use Zephir\Expression\Builder\Statements\RawStatement; @@ -26,51 +24,8 @@ class StatementsFactory { - protected BuilderFactory $factory; - - /** - * @param BuilderFactory $factory - */ - public function __construct(BuilderFactory $factory) + public function __construct(protected BuilderFactory $factory) { - $this->factory = $factory; - } - - /** - * @param string $name - * @param array|null $parameters - * @param int $type - * - * @return CallFunctionStatement - */ - public function functionCall($name, $parameters = null, $type = CallFunctionStatement::TYPE_CALL_DIRECT) - { - return new CallFunctionStatement($name, $parameters, $type); - } - - /** - * @param $variable - * @param $name - * @param null $parameters - * @param int $type - * - * @return CallMethodStatement - */ - public function methodCall($variable, $name, $parameters = null, $type = CallMethodStatement::TYPE_CALL_DIRECT) - { - return new CallMethodStatement($variable, $name, $parameters, $type); - } - - /** - * @param $class - * @param $method - * @param null $parameters - * - * @return CallStaticStatement - */ - public function staticCall($class, $method, $parameters = null) - { - return new CallStaticStatement($class, $method, $parameters); } /** @@ -84,13 +39,15 @@ public function block(array $statements = null) } /** - * @param array|null $assignments + * @param string $name + * @param array|null $parameters + * @param int $type * - * @return LetStatement + * @return CallFunctionStatement */ - public function let(array $assignments = null) + public function functionCall($name, $parameters = null, $type = CallFunctionStatement::TYPE_CALL_DIRECT) { - return new LetStatement($assignments); + return new CallFunctionStatement($name, $parameters, $type); } /** @@ -100,35 +57,32 @@ public function let(array $assignments = null) * * @return IfStatement */ - public function ifX(AbstractOperator $condition = null, StatementsBlock $statements = null, StatementsBlock $elseStatements = null) - { + public function ifX( + AbstractOperator $condition = null, + StatementsBlock $statements = null, + StatementsBlock $elseStatements = null + ) { return new IfStatement($condition, $statements, $elseStatements); } /** - * @param AbstractBuilder $expression + * @param array|null $assignments * - * @return RawStatement + * @return LetStatement */ - public function returnX(AbstractBuilder $expression) + public function let(array $assignments = null) { - return $this->raw([ - 'type' => 'return', - 'expr' => $expression, - ]); + return new LetStatement($assignments); } /** - * @param AbstractBuilder $expression + * @param array $expression * * @return RawStatement */ - public function throwX(AbstractBuilder $expression) + public function raw(array $expression) { - return $this->raw([ - 'type' => 'throw', - 'expr' => $expression, - ]); + return new RawStatement($expression); } /** @@ -139,18 +93,21 @@ public function throwX(AbstractBuilder $expression) public function rawC($value) { return $this->raw([ - 'type' => 'cblock', + 'type' => 'cblock', 'value' => $value, ]); } /** - * @param array $expression + * @param AbstractBuilder $expression * * @return RawStatement */ - public function raw(array $expression) + public function returnX(AbstractBuilder $expression) { - return new RawStatement($expression); + return $this->raw([ + 'type' => 'return', + 'expr' => $expression, + ]); } } diff --git a/Library/Expression/Builder/Operators/AbstractOperator.php b/src/Expression/Builder/Operators/AbstractOperator.php similarity index 91% rename from Library/Expression/Builder/Operators/AbstractOperator.php rename to src/Expression/Builder/Operators/AbstractOperator.php index 67a10a8ee9..07705b8596 100644 --- a/Library/Expression/Builder/Operators/AbstractOperator.php +++ b/src/Expression/Builder/Operators/AbstractOperator.php @@ -9,13 +9,12 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Operators; use Zephir\Expression\Builder\AbstractBuilder; -/** - * Class AbstractOperator. - */ abstract class AbstractOperator extends AbstractBuilder { } diff --git a/src/Expression/Builder/Operators/AssignPropertyOperator.php b/src/Expression/Builder/Operators/AssignPropertyOperator.php new file mode 100644 index 0000000000..ed1cb6b167 --- /dev/null +++ b/src/Expression/Builder/Operators/AssignPropertyOperator.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Expression\Builder\Operators; + +use Zephir\Expression\Builder\AbstractBuilder; + +class AssignPropertyOperator extends AssignVariableOperator +{ + // a -> property = expr + public const TYPE_ASSIGN_OBJECT_PROPERTY = 'object-property'; + + // a :: property = expr + public const TYPE_ASSIGN_STATIC_PROPERTY = 'static-property'; + private string $type = self::TYPE_ASSIGN_OBJECT_PROPERTY; + + public function __construct($variable = null, private $property = null, AbstractBuilder $expression = null) + { + parent::__construct($variable, $expression); + + if (null !== $property) { + $this->setProperty($property); + } + } + + public function getProperty(): string + { + return $this->property; + } + + public function getType(): string + { + return $this->type; + } + + public function setProperty(string $property): static + { + $this->property = $property; + + return $this; + } + + public function setType(string $type): static + { + $this->type = $type; + + return $this; + } + + protected function preBuild(): array + { + $expression = parent::preBuild(); + $expression['assign-type'] = $this->getType(); + $expression['property'] = $this->getProperty(); + + return $expression; + } +} diff --git a/Library/Expression/Builder/Operators/AssignVariableOperator.php b/src/Expression/Builder/Operators/AssignVariableOperator.php similarity index 56% rename from Library/Expression/Builder/Operators/AssignVariableOperator.php rename to src/Expression/Builder/Operators/AssignVariableOperator.php index 2a9424be5d..ef2dc7c851 100644 --- a/Library/Expression/Builder/Operators/AssignVariableOperator.php +++ b/src/Expression/Builder/Operators/AssignVariableOperator.php @@ -9,60 +9,52 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Operators; use Zephir\Expression\Builder\AbstractBuilder; -/** - * Class AssignVariableOperator. - */ class AssignVariableOperator extends AbstractOperator { // = - const OPERATOR_ASSIGN = 'assign'; + public const OPERATOR_ADD = 'add-assign'; // += - const OPERATOR_ADD = 'add-assign'; + public const OPERATOR_ASSIGN = 'assign'; // -= - const OPERATOR_SUB = 'sub-assign'; + public const OPERATOR_BITWISE_AND = 'bitwise-and-assign'; // *= - const OPERATOR_MUL = 'mul-assign'; + public const OPERATOR_BITWISE_OR = 'bitwise-or-assign'; // /= - const OPERATOR_DIV = 'div-assign'; + public const OPERATOR_BITWISE_SHIFTLEFT = 'bitwise-shiftleft-assign'; // .= - const OPERATOR_CONCAT = 'concat-assign'; + public const OPERATOR_BITWISE_SHIFTRIGHT = 'bitwise-shiftright-assign'; // %= - const OPERATOR_MOD = 'mod-assign'; + public const OPERATOR_BITWISE_XOR = 'bitwise-xor-assign'; // &= - const OPERATOR_BITWISE_AND = 'bitwise-and-assign'; + public const OPERATOR_CONCAT = 'concat-assign'; // |= - const OPERATOR_BITWISE_OR = 'bitwise-or-assign'; + public const OPERATOR_DIV = 'div-assign'; // ^= - const OPERATOR_BITWISE_XOR = 'bitwise-xor-assign'; + public const OPERATOR_MOD = 'mod-assign'; // <<= - const OPERATOR_BITWISE_SHIFTLEFT = 'bitwise-shiftleft-assign'; + public const OPERATOR_MUL = 'mul-assign'; // >>= - const OPERATOR_BITWISE_SHIFTRIGHT = 'bitwise-shiftright-assign'; + public const OPERATOR_SUB = 'sub-assign'; + private string $operator = self::OPERATOR_ASSIGN; - private $variable; - private $operator = self::OPERATOR_ASSIGN; - private $expression; - - /** - * @param null $variable - * @param AbstractBuilder|null $expression - */ - public function __construct($variable = null, AbstractBuilder $expression = null) + public function __construct(private $variable = null, private ?AbstractBuilder $expression = null) { if (null !== $variable) { $this->setVariable($variable); @@ -74,61 +66,49 @@ public function __construct($variable = null, AbstractBuilder $expression = null } /** - * @return string + * @return mixed */ - public function getVariable() + public function getExpression() { - return $this->variable; + return $this->expression; } /** - * @param string $variable - * - * @return $this + * @return string */ - public function setVariable($variable) + public function getOperator() { - $this->variable = $variable; - - return $this; + return $this->operator; } /** * @return string */ - public function getOperator() + public function getVariable() { - return $this->operator; + return $this->variable; } /** - * @param $operator + * @param $expression * * @return $this */ - public function setOperator($operator) + public function setExpression($expression) { - $this->operator = $operator; + $this->expression = $expression; return $this; } /** - * @return mixed - */ - public function getExpression() - { - return $this->expression; - } - - /** - * @param $expression + * @param string $variable * * @return $this */ - public function setExpression($expression) + public function setVariable($variable) { - $this->expression = $expression; + $this->variable = $variable; return $this; } @@ -140,9 +120,9 @@ protected function preBuild() { return [ 'assign-type' => 'variable', - 'variable' => $this->getVariable(), - 'operator' => $this->getOperator(), - 'expr' => $this->getExpression(), + 'variable' => $this->getVariable(), + 'operator' => $this->getOperator(), + 'expr' => $this->getExpression(), ]; } } diff --git a/Library/Expression/Builder/Operators/BinaryOperator.php b/src/Expression/Builder/Operators/BinaryOperator.php similarity index 58% rename from Library/Expression/Builder/Operators/BinaryOperator.php rename to src/Expression/Builder/Operators/BinaryOperator.php index 9e934dc100..29ee39314a 100644 --- a/Library/Expression/Builder/Operators/BinaryOperator.php +++ b/src/Expression/Builder/Operators/BinaryOperator.php @@ -9,115 +9,114 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Operators; use Zephir\Expression\Builder\AbstractBuilder; /** - * BinaryOperator. - * * Allows to manually build a binary operator AST node */ class BinaryOperator extends AbstractOperator { // x + y - const OPERATOR_ADD = 'add'; + public const OPERATOR_ACCESS_ARRAY = 'array-access'; // x - y - const OPERATOR_SUB = 'sub'; + public const OPERATOR_ACCESS_PROPERTY = 'property-access'; // x * y - const OPERATOR_MUL = 'mul'; + public const OPERATOR_ACCESS_PROPERTY_DYNAMIC = 'property-dynamic-access'; // x / y - const OPERATOR_DIV = 'div'; + public const OPERATOR_ACCESS_PROPERTY_STRING = 'property-string-access'; // x % y - const OPERATOR_MOD = 'mod'; + public const OPERATOR_ACCESS_STATIC_CONSTANT = 'static-constant-access'; // x . y - const OPERATOR_CONCAT = 'concat'; + public const OPERATOR_ACCESS_STATIC_PROPERTY = 'static-property-access'; // x && y - const OPERATOR_AND = 'and'; + public const OPERATOR_ADD = 'add'; // x || y - const OPERATOR_OR = 'or'; + public const OPERATOR_AND = 'and'; // x | y - const OPERATOR_BITWISE_OR = 'bitwise_or'; + public const OPERATOR_BITWISE_AND = 'bitwise_and'; // x & y - const OPERATOR_BITWISE_AND = 'bitwise_and'; + public const OPERATOR_BITWISE_OR = 'bitwise_or'; // x ^ y - const OPERATOR_BITWISE_XOR = 'bitwise_xor'; + public const OPERATOR_BITWISE_SHIFT_LEFT = 'bitwise_shiftleft'; // x << y - const OPERATOR_BITWISE_SHIFT_LEFT = 'bitwise_shiftleft'; + public const OPERATOR_BITWISE_SHIFT_RIGHT = 'bitwise_shiftright'; // x >> y - const OPERATOR_BITWISE_SHIFT_RIGHT = 'bitwise_shiftright'; + public const OPERATOR_BITWISE_XOR = 'bitwise_xor'; // x instanceof y - const OPERATOR_INSTANCEOF = 'instanceof'; + public const OPERATOR_CAST = 'cast'; // x .. y - const OPERATOR_IRANGE = 'irange'; + public const OPERATOR_CONCAT = 'concat'; // x ... y - const OPERATOR_ERANGE = 'erange'; + public const OPERATOR_DIV = 'div'; // x == y - const OPERATOR_EQUALS = 'equals'; + public const OPERATOR_EQUALS = 'equals'; // x != y - const OPERATOR_NOT_EQUALS = 'not-equals'; + public const OPERATOR_ERANGE = 'erange'; // x ==- y - const OPERATOR_IDENTICAL = 'identical'; + public const OPERATOR_GREATER = 'greater'; // x !== y - const OPERATOR_NOT_IDENTICAL = 'not-identical'; + public const OPERATOR_GREATER_EQUAL = 'greater-equal'; // x < y - const OPERATOR_LESS = 'less'; + public const OPERATOR_IDENTICAL = 'identical'; // x > y - const OPERATOR_GREATER = 'greater'; + public const OPERATOR_INSTANCEOF = 'instanceof'; // x <= y - const OPERATOR_LESS_EQUAL = 'less-equal'; + public const OPERATOR_IRANGE = 'irange'; // x >= y - const OPERATOR_GREATER_EQUAL = 'greater-equal'; + public const OPERATOR_LESS = 'less'; // (type) a - const OPERATOR_CAST = 'cast'; + public const OPERATOR_LESS_EQUAL = 'less-equal'; // a - const OPERATOR_TYPE_HINT = 'type-hint'; + public const OPERATOR_MOD = 'mod'; // x -> y - const OPERATOR_ACCESS_PROPERTY = 'property-access'; + public const OPERATOR_MUL = 'mul'; // x -> {y} - const OPERATOR_ACCESS_PROPERTY_DYNAMIC = 'property-dynamic-access'; + public const OPERATOR_NOT_EQUALS = 'not-equals'; // x -> {"string"} - const OPERATOR_ACCESS_PROPERTY_STRING = 'property-string-access'; + public const OPERATOR_NOT_IDENTICAL = 'not-identical'; // x :: y - const OPERATOR_ACCESS_STATIC_PROPERTY = 'static-property-access'; + public const OPERATOR_OR = 'or'; // x :: CONSTANT - const OPERATOR_ACCESS_STATIC_CONSTANT = 'static-constant-access'; + public const OPERATOR_SUB = 'sub'; // x [{expr}] - const OPERATOR_ACCESS_ARRAY = 'array-access'; - - private $operator; + public const OPERATOR_TYPE_HINT = 'type-hint'; private $leftExpression; + private $operator; private $rightExpression; /** @@ -125,8 +124,11 @@ class BinaryOperator extends AbstractOperator * @param AbstractBuilder|null $leftExpression * @param AbstractBuilder|null $rightExpression */ - public function __construct($operator = null, AbstractBuilder $leftExpression = null, AbstractBuilder $rightExpression = null) - { + public function __construct( + $operator = null, + AbstractBuilder $leftExpression = null, + AbstractBuilder $rightExpression = null + ) { if (null !== $operator) { $this->setOperator($operator); } @@ -141,31 +143,27 @@ public function __construct($operator = null, AbstractBuilder $leftExpression = } /** - * @return string + * @return AbstractBuilder */ - public function getOperator() + public function getLeftExpression() { - return $this->operator; + return $this->leftExpression; } /** - * @param string $operator - * - * @return BinaryOperator + * @return string */ - public function setOperator($operator) + public function getOperator() { - $this->operator = $operator; - - return $this; + return $this->operator; } /** * @return AbstractBuilder */ - public function getLeftExpression() + public function getRightExpression() { - return $this->leftExpression; + return $this->rightExpression; } /** @@ -181,11 +179,15 @@ public function setLeftExpression(AbstractBuilder $leftExpression) } /** - * @return AbstractBuilder + * @param string $operator + * + * @return BinaryOperator */ - public function getRightExpression() + public function setOperator($operator) { - return $this->rightExpression; + $this->operator = $operator; + + return $this; } /** @@ -206,8 +208,8 @@ public function setRightExpression(AbstractBuilder $rightExpression) protected function preBuild() { return [ - 'type' => $this->getOperator(), - 'left' => $this->getLeftExpression(), + 'type' => $this->getOperator(), + 'left' => $this->getLeftExpression(), 'right' => $this->getRightExpression(), ]; } diff --git a/Library/Expression/Builder/Operators/RawOperator.php b/src/Expression/Builder/Operators/RawOperator.php similarity index 97% rename from Library/Expression/Builder/Operators/RawOperator.php rename to src/Expression/Builder/Operators/RawOperator.php index 17805751d5..cbcfbc82c3 100644 --- a/Library/Expression/Builder/Operators/RawOperator.php +++ b/src/Expression/Builder/Operators/RawOperator.php @@ -9,11 +9,10 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Operators; -/** - * Class RawOperator. - */ class RawOperator extends AbstractOperator { /** diff --git a/Library/Expression/Builder/Operators/UnaryOperator.php b/src/Expression/Builder/Operators/UnaryOperator.php similarity index 74% rename from Library/Expression/Builder/Operators/UnaryOperator.php rename to src/Expression/Builder/Operators/UnaryOperator.php index a0f6168a3f..b2fa1cacf1 100644 --- a/Library/Expression/Builder/Operators/UnaryOperator.php +++ b/src/Expression/Builder/Operators/UnaryOperator.php @@ -9,61 +9,60 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Operators; use Zephir\Expression\Builder\AbstractBuilder; /** - * UnaryOperator. - * * Allows to manually build a unary operator AST node */ class UnaryOperator extends AbstractOperator { // y = &a - const OPERATOR_REFERENCE = 'reference'; + public const OPERATOR_BITWISE_NOT = 'bitwise_not'; // y = !a - const OPERATOR_NOT = 'not'; + public const OPERATOR_CLONE = 'clone'; // y = ~a - const OPERATOR_BITWISE_NOT = 'bitwise_not'; + public const OPERATOR_EMPTY = 'empty'; // y = -a - const OPERATOR_MINUS = 'minus'; + public const OPERATOR_ISSET = 'isset'; // y = +a - const OPERATOR_PLUS = 'plus'; + public const OPERATOR_LIKELY = 'likely'; // y = isset a - const OPERATOR_ISSET = 'isset'; + public const OPERATOR_LIST = 'list'; // y = require a - const OPERATOR_REQUIRE = 'require'; + public const OPERATOR_MINUS = 'minus'; // y = require_once a - const OPERATOR_REQUIRE_ONCE = 'require_once'; + public const OPERATOR_NOT = 'not'; // y = clone a - const OPERATOR_CLONE = 'clone'; + public const OPERATOR_PLUS = 'plus'; // y = empty a - const OPERATOR_EMPTY = 'empty'; + public const OPERATOR_REFERENCE = 'reference'; // y = likely a - const OPERATOR_LIKELY = 'likely'; + public const OPERATOR_REQUIRE = 'require'; // y = unlikely a - const OPERATOR_UNLIKELY = 'unlikely'; + public const OPERATOR_REQUIRE_ONCE = 'require_once'; // y = list a - const OPERATOR_LIST = 'list'; + public const OPERATOR_TYPEOF = 'typeof'; // y = typeof a - const OPERATOR_TYPEOF = 'typeof'; - - private $operator; + public const OPERATOR_UNLIKELY = 'unlikely'; private $expression; + private $operator; /** * @param null $operator @@ -80,6 +79,14 @@ public function __construct($operator = null, AbstractBuilder $expression = null } } + /** + * @return mixed + */ + public function getExpression() + { + return $this->expression; + } + /** * @return mixed */ @@ -89,33 +96,25 @@ public function getOperator() } /** - * @param $operator + * @param AbstractBuilder $expression * * @return $this */ - public function setOperator($operator) + public function setExpression(AbstractBuilder $expression) { - $this->operator = $operator; + $this->expression = $expression; return $this; } /** - * @return mixed - */ - public function getExpression() - { - return $this->expression; - } - - /** - * @param AbstractBuilder $expression + * @param $operator * * @return $this */ - public function setExpression(AbstractBuilder $expression) + public function setOperator($operator) { - $this->expression = $expression; + $this->operator = $operator; return $this; } diff --git a/Library/Expression/Builder/RawExpression.php b/src/Expression/Builder/RawExpression.php similarity index 97% rename from Library/Expression/Builder/RawExpression.php rename to src/Expression/Builder/RawExpression.php index a46d5b1067..45b0c0e154 100644 --- a/Library/Expression/Builder/RawExpression.php +++ b/src/Expression/Builder/RawExpression.php @@ -9,11 +9,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder; /** - * RawExpression. - * * Allows to use a raw expression in a builder */ class RawExpression extends AbstractBuilder diff --git a/Library/Expression/Builder/Statements/AbstractStatement.php b/src/Expression/Builder/Statements/AbstractStatement.php similarity index 91% rename from Library/Expression/Builder/Statements/AbstractStatement.php rename to src/Expression/Builder/Statements/AbstractStatement.php index 2423dcb04b..b11df243b2 100644 --- a/Library/Expression/Builder/Statements/AbstractStatement.php +++ b/src/Expression/Builder/Statements/AbstractStatement.php @@ -9,13 +9,12 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Statements; use Zephir\Expression\Builder\AbstractBuilder; -/** - * Class AbstractStatement. - */ abstract class AbstractStatement extends AbstractBuilder { } diff --git a/Library/Expression/Builder/Statements/CallFunctionStatement.php b/src/Expression/Builder/Statements/CallFunctionStatement.php similarity index 79% rename from Library/Expression/Builder/Statements/CallFunctionStatement.php rename to src/Expression/Builder/Statements/CallFunctionStatement.php index 0778dc0b06..44cc80a440 100644 --- a/Library/Expression/Builder/Statements/CallFunctionStatement.php +++ b/src/Expression/Builder/Statements/CallFunctionStatement.php @@ -9,13 +9,15 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Statements; use Zephir\FunctionCall; +use function is_array; + /** - * CallFunctionStatement. - * * Allows to manually build a function call AST node */ class CallFunctionStatement extends AbstractStatement @@ -23,20 +25,19 @@ class CallFunctionStatement extends AbstractStatement /** * f(x, y, ... , N). */ - const TYPE_CALL_DIRECT = FunctionCall::CALL_NORMAL; + public const TYPE_CALL_DIRECT = FunctionCall::CALL_NORMAL; /** * {f}(x, y, ... , N). */ - const TYPE_CALL_DYNAMIC = FunctionCall::CALL_DYNAMIC; + public const TYPE_CALL_DYNAMIC = FunctionCall::CALL_DYNAMIC; /** * {"f"}(x, y, ... , N). */ - const TYPE_CALL_DYNAMIC_STRING = FunctionCall::CALL_DYNAMIC_STRING; - - private $name; + public const TYPE_CALL_DYNAMIC_STRING = FunctionCall::CALL_DYNAMIC_STRING; private $arguments; + private $name; private $typeCall; /** @@ -44,7 +45,7 @@ class CallFunctionStatement extends AbstractStatement * @param array|null $parameters * @param int $typeCall */ - public function __construct($name = null, array $parameters = null, $typeCall = self::TYPE_CALL_DIRECT) + public function __construct(string $name = null, array $parameters = null, int $typeCall = self::TYPE_CALL_DIRECT) { if (null !== $name) { $this->setName($name); @@ -60,21 +61,13 @@ public function __construct($name = null, array $parameters = null, $typeCall = } /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name + * @param $argument * * @return $this */ - public function setName($name) + public function addArgument($argument) { - $this->name = $name; + $this->arguments[] = $argument; return $this; } @@ -88,15 +81,11 @@ public function getArguments() } /** - * @param array $arguments - * - * @return $this + * @return string */ - public function setArguments(array $arguments = null) + public function getName() { - $this->arguments = $arguments; - - return $this; + return $this->name; } /** @@ -108,25 +97,37 @@ public function getTypeCall() } /** - * @param int $typeCall + * @param array|null $arguments * * @return $this */ - public function setTypeCall($typeCall) + public function setArguments(array $arguments = null) { - $this->typeCall = $typeCall; + $this->arguments = $arguments; return $this; } /** - * @param $argument + * @param string $name * * @return $this */ - public function addArgument($argument) + public function setName($name) { - $this->arguments[] = $argument; + $this->name = $name; + + return $this; + } + + /** + * @param int $typeCall + * + * @return $this + */ + public function setTypeCall($typeCall) + { + $this->typeCall = $typeCall; return $this; } @@ -138,16 +139,16 @@ protected function preBuild() { if ($arguments = $this->getArguments()) { foreach ($arguments as &$argument) { - if (!\is_array($argument) || !isset($argument['parameter'])) { + if (!is_array($argument) || !isset($argument['parameter'])) { $argument = ['parameter' => $argument]; } } } return [ - 'type' => 'fcall', - 'name' => $this->getName(), - 'call-type' => $this->getTypeCall(), + 'type' => 'fcall', + 'name' => $this->getName(), + 'call-type' => $this->getTypeCall(), 'parameters' => $arguments, ]; } diff --git a/Library/Expression/Builder/Statements/CallMethodStatement.php b/src/Expression/Builder/Statements/CallMethodStatement.php similarity index 80% rename from Library/Expression/Builder/Statements/CallMethodStatement.php rename to src/Expression/Builder/Statements/CallMethodStatement.php index 1dc31db2a4..fabdfadd82 100644 --- a/Library/Expression/Builder/Statements/CallMethodStatement.php +++ b/src/Expression/Builder/Statements/CallMethodStatement.php @@ -9,11 +9,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Statements; /** - * CallMethodStatement. - * * Allows to manually build a method call AST node */ class CallMethodStatement extends CallFunctionStatement @@ -26,8 +26,12 @@ class CallMethodStatement extends CallFunctionStatement * @param array|null $parameters * @param int $type */ - public function __construct($variable = null, $name = null, array $parameters = null, $type = self::TYPE_CALL_DIRECT) - { + public function __construct( + $variable = null, + $name = null, + array $parameters = null, + $type = self::TYPE_CALL_DIRECT + ) { parent::__construct($name, $parameters, $type); if (null !== $name) { @@ -60,8 +64,8 @@ public function setVariable($variable) */ protected function preBuild() { - $expression = parent::preBuild(); - $expression['type'] = 'mcall'; + $expression = parent::preBuild(); + $expression['type'] = 'mcall'; $expression['variable'] = $this->getVariable(); return $expression; diff --git a/Library/Expression/Builder/Statements/CallStaticStatement.php b/src/Expression/Builder/Statements/CallStaticStatement.php similarity index 88% rename from Library/Expression/Builder/Statements/CallStaticStatement.php rename to src/Expression/Builder/Statements/CallStaticStatement.php index 6ebc3d153d..7449da116e 100644 --- a/Library/Expression/Builder/Statements/CallStaticStatement.php +++ b/src/Expression/Builder/Statements/CallStaticStatement.php @@ -9,20 +9,22 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Statements; +use function is_array; + /** - * CallStaticStatement. - * * Allows to manually build a static function call AST node */ class CallStaticStatement extends AbstractStatement { - private $class; - private $method; private $arguments; - private $dynamicClass = false; + private $class; + private $dynamicClass = false; private $dynamicMethod = false; + private $method; /** * @param null $class @@ -47,21 +49,17 @@ public function __construct($class = null, $method = null, array $parameters = n /** * @return mixed */ - public function getClass() + public function getArguments() { - return $this->class; + return $this->arguments; } /** - * @param mixed $class - * - * @return CallStaticStatement + * @return mixed */ - public function setClass($class) + public function getClass() { - $this->class = $class; - - return $this; + return $this->class; } /** @@ -73,23 +71,19 @@ public function getMethod() } /** - * @param mixed $method - * - * @return CallStaticStatement + * @return bool */ - public function setMethod($method) + public function isDynamicClass() { - $this->method = $method; - - return $this; + return $this->dynamicClass; } /** - * @return mixed + * @return bool */ - public function getArguments() + public function isDynamicMethod() { - return $this->arguments; + return $this->dynamicMethod; } /** @@ -105,11 +99,15 @@ public function setArguments($arguments) } /** - * @return bool + * @param mixed $class + * + * @return CallStaticStatement */ - public function isDynamicClass() + public function setClass($class) { - return $this->dynamicClass; + $this->class = $class; + + return $this; } /** @@ -125,21 +123,25 @@ public function setDynamicClass($dynamicClass) } /** - * @return bool + * @param bool $dynamicMethod + * + * @return CallStaticStatement */ - public function isDynamicMethod() + public function setDynamicMethod($dynamicMethod) { - return $this->dynamicMethod; + $this->dynamicMethod = $dynamicMethod; + + return $this; } /** - * @param bool $dynamicMethod + * @param mixed $method * * @return CallStaticStatement */ - public function setDynamicMethod($dynamicMethod) + public function setMethod($method) { - $this->dynamicMethod = $dynamicMethod; + $this->method = $method; return $this; } @@ -151,19 +153,19 @@ protected function preBuild() { if ($arguments = $this->getArguments()) { foreach ($arguments as &$argument) { - if (!\is_array($argument) || !isset($argument['parameter'])) { + if (!is_array($argument) || !isset($argument['parameter'])) { $argument = ['parameter' => $argument]; } } } return [ - 'type' => 'scall', - 'class' => $this->getClass(), - 'name' => $this->getMethod(), - 'parameters' => $arguments, + 'type' => 'scall', + 'class' => $this->getClass(), + 'name' => $this->getMethod(), + 'parameters' => $arguments, 'dynamic-class' => $this->isDynamicClass(), - 'dynamic' => $this->isDynamicMethod(), + 'dynamic' => $this->isDynamicMethod(), ]; } } diff --git a/Library/Expression/Builder/Statements/IfStatement.php b/src/Expression/Builder/Statements/IfStatement.php similarity index 88% rename from Library/Expression/Builder/Statements/IfStatement.php rename to src/Expression/Builder/Statements/IfStatement.php index 09b8c50c69..185b8abfe3 100644 --- a/Library/Expression/Builder/Statements/IfStatement.php +++ b/src/Expression/Builder/Statements/IfStatement.php @@ -9,13 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Statements; use Zephir\Expression\Builder\Operators\AbstractOperator; /** - * IfStatement. - * * Allows to manually build a 'if' statement AST node */ class IfStatement extends AbstractStatement @@ -24,24 +24,25 @@ class IfStatement extends AbstractStatement * @var AbstractOperator */ private $condition; - /** * @var StatementsBlock */ - private $statements; - + private $elseStatements; /** * @var StatementsBlock */ - private $elseStatements; + private $statements; /** * @param AbstractOperator|null $condition * @param StatementsBlock|null $statements * @param StatementsBlock|null $elseStatements */ - public function __construct(AbstractOperator $condition = null, StatementsBlock $statements = null, StatementsBlock $elseStatements = null) - { + public function __construct( + AbstractOperator $condition = null, + StatementsBlock $statements = null, + StatementsBlock $elseStatements = null + ) { if (null !== $condition) { $this->setCondition($condition); } @@ -64,15 +65,11 @@ public function getCondition() } /** - * @param $condition - * - * @return $this + * @return StatementsBlock */ - public function setCondition(AbstractOperator $condition) + public function getElseStatements() { - $this->condition = $condition; - - return $this; + return $this->elseStatements; } /** @@ -84,33 +81,37 @@ public function getStatements() } /** - * @param StatementsBlock $statements + * @param AbstractOperator $condition * * @return $this */ - public function setStatements(StatementsBlock $statements) + public function setCondition(AbstractOperator $condition) { - $this->statements = $statements; + $this->condition = $condition; return $this; } /** - * @return StatementsBlock + * @param StatementsBlock $elseStatements + * + * @return $this */ - public function getElseStatements() + public function setElseStatements(StatementsBlock $elseStatements) { - return $this->elseStatements; + $this->elseStatements = $elseStatements; + + return $this; } /** - * @param StatementsBlock $elseStatements + * @param StatementsBlock $statements * * @return $this */ - public function setElseStatements(StatementsBlock $elseStatements) + public function setStatements(StatementsBlock $statements) { - $this->elseStatements = $elseStatements; + $this->statements = $statements; return $this; } @@ -121,8 +122,8 @@ public function setElseStatements(StatementsBlock $elseStatements) protected function preBuild() { $expression = [ - 'type' => 'if', - 'expr' => $this->getCondition(), + 'type' => 'if', + 'expr' => $this->getCondition(), 'statements' => $this->getStatements(), ]; diff --git a/Library/Expression/Builder/Statements/LetStatement.php b/src/Expression/Builder/Statements/LetStatement.php similarity index 95% rename from Library/Expression/Builder/Statements/LetStatement.php rename to src/Expression/Builder/Statements/LetStatement.php index d26952c9aa..c7f224a505 100644 --- a/Library/Expression/Builder/Statements/LetStatement.php +++ b/src/Expression/Builder/Statements/LetStatement.php @@ -9,11 +9,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Statements; /** - * LetStatement. - * * Allows to manually build a 'let' statement AST node */ class LetStatement extends AbstractStatement @@ -30,6 +30,18 @@ public function __construct(array $assignments = null) } } + /** + * @param mixed $assignment + * + * @return $this + */ + public function addAssignment($assignment) + { + $this->assignments[] = $assignment; + + return $this; + } + /** * @return mixed */ @@ -50,25 +62,13 @@ public function setAssignments($assignments) return $this; } - /** - * @param mixed $assignment - * - * @return $this - */ - public function addAssignment($assignment) - { - $this->assignments[] = $assignment; - - return $this; - } - /** * {@inheritdoc} */ protected function preBuild() { return [ - 'type' => 'let', + 'type' => 'let', 'assignments' => $this->getAssignments(), ]; } diff --git a/Library/Expression/Builder/Statements/RawStatement.php b/src/Expression/Builder/Statements/RawStatement.php similarity index 97% rename from Library/Expression/Builder/Statements/RawStatement.php rename to src/Expression/Builder/Statements/RawStatement.php index e68dc163d3..a687cbf9c9 100644 --- a/Library/Expression/Builder/Statements/RawStatement.php +++ b/src/Expression/Builder/Statements/RawStatement.php @@ -9,11 +9,10 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Statements; -/** - * Class RawStatement. - */ class RawStatement extends AbstractStatement { /** diff --git a/Library/Expression/Builder/Statements/StatementsBlock.php b/src/Expression/Builder/Statements/StatementsBlock.php similarity index 98% rename from Library/Expression/Builder/Statements/StatementsBlock.php rename to src/Expression/Builder/Statements/StatementsBlock.php index 013c242dd1..d7daf014c1 100644 --- a/Library/Expression/Builder/Statements/StatementsBlock.php +++ b/src/Expression/Builder/Statements/StatementsBlock.php @@ -9,13 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression\Builder\Statements; use Zephir\Expression\Builder\AbstractBuilder; /** - * StatementsBlock. - * * Allows to manually build a statements block AST node */ class StatementsBlock extends AbstractBuilder @@ -32,26 +32,6 @@ public function __construct(array $statements = null) } } - /** - * @return array - */ - public function getStatements() - { - return $this->statements; - } - - /** - * @param array $statements - * - * @return $this - */ - public function setStatements($statements) - { - $this->statements = $statements; - - return $this; - } - /** * @param $statement * @@ -72,6 +52,26 @@ public function build() return $this->resolve($this->preBuild()); } + /** + * @return array + */ + public function getStatements() + { + return $this->statements; + } + + /** + * @param array $statements + * + * @return $this + */ + public function setStatements($statements) + { + $this->statements = $statements; + + return $this; + } + /** * @return array */ diff --git a/Library/Expression/Closure.php b/src/Expression/Closure.php similarity index 66% rename from Library/Expression/Closure.php rename to src/Expression/Closure.php index 3925339689..e9fc8e221d 100644 --- a/Library/Expression/Closure.php +++ b/src/Expression/Closure.php @@ -13,17 +13,18 @@ namespace Zephir\Expression; -use Zephir\ClassDefinition; -use Zephir\ClassMethod; -use Zephir\ClassMethodParameters; -use Zephir\ClassProperty; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Property; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\CompilerFileAnonymous; use Zephir\Exception; use Zephir\StatementsBlock; -use Zephir\Variable; +use Zephir\Variable\Variable; +use function in_array; use function is_array; /** @@ -35,44 +36,18 @@ class Closure * @var bool */ protected bool $expecting = true; - - /** - * @var bool - */ - protected bool $readOnly = false; - /** * @var Variable|null */ protected ?Variable $expectingVariable = null; - /** * Unique closure ID. */ protected static $id = 0; - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable - */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null): void - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly + * @var bool */ - public function setReadOnly(bool $readOnly): void - { - $this->readOnly = $readOnly; - } + protected bool $readOnly = false; /** * Creates a closure. @@ -86,9 +61,9 @@ public function setReadOnly(bool $readOnly): void */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { - $classDefinition = new ClassDefinition( + $classDefinition = new Definition( $compilationContext->config->get('namespace'), - self::$id.'__closure' + self::$id . '__closure' ); $classDefinition->setIsFinal(true); @@ -100,7 +75,7 @@ public function compile(array $expression, CompilationContext $compilationContex $parameters = null; if (isset($expression['left'])) { - $parameters = new ClassMethodParameters($expression['left']); + $parameters = new Parameters($expression['left']); } $block = $expression['right'] ?? []; @@ -108,22 +83,26 @@ public function compile(array $expression, CompilationContext $compilationContex $staticVariables = []; if (isset($expression['use']) && is_array($expression['use'])) { foreach ($expression['use'] as $parameter) { - $staticVariables[$parameter['name']] = $compilationContext->symbolTable->getVariable($parameter['name']); + $staticVariables[$parameter['name']] = $compilationContext->symbolTable->getVariable( + $parameter['name'] + ); } } foreach ($staticVariables as $var) { - $classDefinition->addProperty(new ClassProperty( - $classDefinition, - ['public', 'static'], - $var->getName(), - null, - null, - null - )); + $classDefinition->addProperty( + new Property( + $classDefinition, + ['public', 'static'], + $var->getName(), + null, + null, + null + ) + ); } - $classMethod = new ClassMethod( + $classMethod = new Method( $classDefinition, ['public', 'final'], '__invoke', @@ -134,31 +113,32 @@ public function compile(array $expression, CompilationContext $compilationContex $expression, $staticVariables ); - $classDefinition->addMethod($classMethod, $block); - - $compilationContext->headersManager->add('kernel/object'); - - if ($this->expecting) { - if ($this->expectingVariable) { - $symbolVariable = $this->expectingVariable; - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->createClosure($symbolVariable, $classDefinition, $compilationContext); + $symbolVariable = $this->generateClosure( + $classDefinition, + $classMethod, + $block, + $compilationContext, + $expression + ); $compilationContext->headersManager->add('kernel/object'); foreach ($staticVariables as $var) { if (in_array($var->getType(), ['variable', 'array'])) { - $compilationContext->backend->updateStaticProperty($classDefinition->getClassEntry(), $var->getName(), $var, $compilationContext); + $compilationContext->backend->updateStaticProperty( + $classDefinition->getClassEntry(), + $var->getName(), + $var, + $compilationContext + ); continue; } - $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext, true); + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); switch ($var->getType()) { case 'int': @@ -182,11 +162,83 @@ public function compile(array $expression, CompilationContext $compilationContex break; } - $compilationContext->backend->updateStaticProperty($classDefinition->getClassEntry(), $var->getName(), $tempVariable, $compilationContext); + $compilationContext->backend->updateStaticProperty( + $classDefinition->getClassEntry(), + $var->getName(), + $tempVariable, + $compilationContext + ); } ++self::$id; return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } + + /** + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. + * + * @param bool $expecting + * @param Variable|null $expectingVariable + */ + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void + { + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets if the result of the evaluated expression is read only. + * + * @param bool $readOnly + */ + public function setReadOnly(bool $readOnly): void + { + $this->readOnly = $readOnly; + } + + /** + * @param Definition $classDefinition + * @param Method $classMethod + * @param mixed $block + * @param CompilationContext $compilationContext + * @param array $expression + * + * @return Variable|null + */ + protected function generateClosure( + Definition $classDefinition, + Method $classMethod, + mixed $block, + CompilationContext $compilationContext, + array $expression + ): ?Variable { + $classDefinition->addMethod($classMethod, $block); + + $compilationContext->headersManager->add('kernel/object'); + + if ($this->expecting) { + if ($this->expectingVariable) { + $symbolVariable = $this->expectingVariable; + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } + + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->createClosure($symbolVariable, $classDefinition, $compilationContext); + + return $symbolVariable; + } } diff --git a/Library/Expression/ClosureArrow.php b/src/Expression/ClosureArrow.php similarity index 59% rename from Library/Expression/ClosureArrow.php rename to src/Expression/ClosureArrow.php index 6c8688c481..7a7467f875 100644 --- a/Library/Expression/ClosureArrow.php +++ b/src/Expression/ClosureArrow.php @@ -13,9 +13,9 @@ namespace Zephir\Expression; -use Zephir\ClassDefinition; -use Zephir\ClassMethod; -use Zephir\ClassMethodParameters; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\CompilerFileAnonymous; @@ -34,15 +34,15 @@ class ClosureArrow extends Closure * @param array $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { - $classDefinition = new ClassDefinition( + $classDefinition = new Definition( $compilationContext->config->get('namespace'), - self::$id.'__closure' + self::$id . '__closure' ); $classDefinition->setIsFinal(true); @@ -55,29 +55,29 @@ public function compile(array $expression, CompilationContext $compilationContex /** * Builds parameters using the only parameter available. */ - $parameters = new ClassMethodParameters([ + $parameters = new Parameters([ [ - 'type' => 'parameter', - 'name' => $expression['left']['value'], - 'const' => 0, + 'type' => 'parameter', + 'name' => $expression['left']['value'], + 'const' => 0, 'data-type' => 'variable', 'mandatory' => 0, 'reference' => 0, - 'file' => $expression['left']['file'], - 'line' => $expression['left']['line'], - 'char' => $expression['left']['char'], + 'file' => $expression['left']['file'], + 'line' => $expression['left']['line'], + 'char' => $expression['left']['char'], ], ]); - $exprBuilder = BuilderFactory::getInstance(); + $exprBuilder = BuilderFactory::getInstance(); $statementBlockBuilder = $exprBuilder->statements()->block([ $exprBuilder->statements() - ->returnX($exprBuilder->raw($expression['right'])), + ->returnX($exprBuilder->raw($expression['right'])), ]); $block = $statementBlockBuilder->build(); - $classMethod = new ClassMethod( + $classMethod = new Method( $classDefinition, ['public', 'final'], '__invoke', @@ -87,22 +87,14 @@ public function compile(array $expression, CompilationContext $compilationContex null, $expression ); - $classDefinition->addMethod($classMethod, $block); - - $compilationContext->headersManager->add('kernel/object'); - if ($this->expecting) { - if ($this->expectingVariable) { - $symbolVariable = $this->expectingVariable; - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } - - $symbolVariable->initVariant($compilationContext); - $compilationContext->backend->createClosure($symbolVariable, $classDefinition, $compilationContext); + $symbolVariable = $this->generateClosure( + $classDefinition, + $classMethod, + $block, + $compilationContext, + $expression + ); ++self::$id; diff --git a/Library/Expression/Constants.php b/src/Expression/Constants.php similarity index 76% rename from Library/Expression/Constants.php rename to src/Expression/Constants.php index 587105183b..cf655012ff 100644 --- a/Library/Expression/Constants.php +++ b/src/Expression/Constants.php @@ -9,48 +9,35 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\LiteralCompiledExpression; -use Zephir\Variable; +use Zephir\Name; +use Zephir\Variable\Variable; +use function array_merge; use function constant; use function defined; use function gettype; use function in_array; -use function Zephir\add_slashes; +use function strtolower; /** * Resolves PHP or Zephir constants into C-Code */ class Constants { - /** - * @var bool - */ - protected bool $expecting = true; - - /** - * @var bool - */ - protected bool $readOnly = false; - - /** - * @var Variable|null - */ - protected ?Variable $expectingVariable = null; - /** * Reserved ENV Constants. * * @see https://www.php.net/manual/ru/reserved.constants.php - * - * @var array */ - protected array $envConstants = [ + protected array $envConstants = [ 'PHP_VERSION', 'PHP_MAJOR_VERSION', 'PHP_MINOR_VERSION', @@ -70,13 +57,12 @@ class Constants 'PHP_LIBDIR', 'PHP_DATADIR', ]; - + protected bool $expecting = true; + protected ?Variable $expectingVariable = null; /** * Magic constants. * * @see https://php.net/manual/en/language.constants.predefined.php - * - * @var array */ protected array $magicConstants = [ '__LINE__', @@ -88,49 +74,26 @@ class Constants '__METHOD__', '__NAMESPACE__', ]; - - protected array $resources = [ + protected bool $readOnly = false; + protected array $resources = [ 'STDIN', 'STDOUT', 'STDERR', ]; - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable - */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null) - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly - */ - public function setReadOnly(bool $readOnly): void - { - $this->readOnly = $readOnly; - } - /** * Resolves a PHP constant value into C-code. * * @param array $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function compile(array $expression, CompilationContext $compilationContext) { - $isPhpConstant = false; + $isPhpConstant = false; $isZephirConstant = false; $constantName = $expression['value']; @@ -139,14 +102,14 @@ public function compile(array $expression, CompilationContext $compilationContex if (!defined($expression['value']) && !in_array($constantName, $mergedConstants)) { if (!$compilationContext->compiler->isConstant($constantName)) { $compilationContext->logger->warning( - "Constant '".$constantName."' does not exist at compile time", + "Constant '" . $constantName . "' does not exist at compile time", ['nonexistent-constant', $expression] ); } else { $isZephirConstant = true; } } else { - $isPhpConstant = false === strpos($constantName, 'VERSION'); + $isPhpConstant = !str_contains($constantName, 'VERSION'); } if ($isZephirConstant && !in_array($constantName, $this->resources)) { @@ -157,7 +120,7 @@ public function compile(array $expression, CompilationContext $compilationContex if ($isPhpConstant && !in_array($constantName, $mergedConstants)) { $constantName = constant($constantName); - $type = strtolower(gettype($constantName)); + $type = strtolower(gettype($constantName)); switch ($type) { case 'integer': @@ -167,7 +130,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new LiteralCompiledExpression('double', $constantName, $expression); case 'string': - return new LiteralCompiledExpression('string', add_slashes($constantName), $expression); + return new LiteralCompiledExpression('string', Name::addSlashes($constantName), $expression); case 'object': throw new CompilerException('?'); @@ -181,19 +144,20 @@ public function compile(array $expression, CompilationContext $compilationContex case '__CLASS__': return new CompiledExpression( 'string', - add_slashes($compilationContext->classDefinition->getCompleteName()), + Name::addSlashes($compilationContext->classDefinition->getCompleteName()), $expression ); case '__NAMESPACE__': return new CompiledExpression( 'string', - add_slashes($compilationContext->classDefinition->getNamespace()), + Name::addSlashes($compilationContext->classDefinition->getNamespace()), $expression ); case '__METHOD__': return new CompiledExpression( 'string', - $compilationContext->classDefinition->getName().':'.$compilationContext->currentMethod->getName(), + $compilationContext->classDefinition->getName( + ) . ':' . $compilationContext->currentMethod->getName(), $expression ); case '__FUNCTION__': @@ -205,7 +169,7 @@ public function compile(array $expression, CompilationContext $compilationContex } $compilationContext->logger->warning( - "Magic constant '".$constantName."' is not supported", + "Magic constant '" . $constantName . "' is not supported", ['not-supported-magic-constant', $expression] ); @@ -219,15 +183,46 @@ public function compile(array $expression, CompilationContext $compilationContex $symbolVariable->setMustInitNull(true); $symbolVariable->initVariant($compilationContext); } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); } if (!$symbolVariable->isVariable()) { - throw new CompilerException('Cannot use variable: '.$symbolVariable->getType().' to assign property value', $expression); + throw new CompilerException( + 'Cannot use variable: ' + . $symbolVariable->getType() + . ' to assign property value', + $expression + ); } - $compilationContext->codePrinter->output('ZEPHIR_GET_CONSTANT('.$compilationContext->backend->getVariableCode($symbolVariable).', "'.$expression['value'].'");'); + $compilationContext->codePrinter->output( + 'ZEPHIR_GET_CONSTANT(' . $compilationContext->backend->getVariableCode( + $symbolVariable + ) . ', "' . $expression['value'] . '");' + ); return new CompiledExpression('variable', $symbolVariable->getName(), $expression); } + + /** + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. + */ + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void + { + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets if the result of the evaluated expression is read only. + */ + public function setReadOnly(bool $readOnly): void + { + $this->readOnly = $readOnly; + } } diff --git a/src/Expression/NativeArray.php b/src/Expression/NativeArray.php new file mode 100644 index 0000000000..8462476d36 --- /dev/null +++ b/src/Expression/NativeArray.php @@ -0,0 +1,603 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Expression; + +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\GlobalConstant; +use Zephir\Traits\VariablesTrait; +use Zephir\Types\Types; +use Zephir\Variable\Variable; + +use function count; +use function function_exists; +use function gmp_nextprime; +use function gmp_strval; + +/** + * Resolves expressions that create arrays + */ +class NativeArray +{ + use VariablesTrait; + + protected bool $expecting = true; + protected ?Variable $expectingVariable = null; + protected bool $readOnly = false; + + /** + * Compiles an array initialization. + * + * @param array $expression + * @param CompilationContext $compilationContext + * + * @return CompiledExpression + * + * @throws ReflectionException + * @throws Exception + */ + public function compile(array $expression, CompilationContext $compilationContext) + { + /** + * Resolves the symbol that expects the value + */ + if ($this->expecting) { + if ($this->expectingVariable) { + $symbolVariable = $this->expectingVariable; + if ('variable' != $symbolVariable->getType() && 'array' != $symbolVariable->getType()) { + throw CompilerException::cannotUseVariableTypeAs( + $symbolVariable, + 'as an array', + $expression + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'array', + $compilationContext, + $expression + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'array', + $compilationContext, + $expression + ); + } + + if (!isset($expression['left'])) { + if ($this->expectingVariable) { + $symbolVariable->initVariant($compilationContext); + } + + /** + * Mark the variable as an array + */ + $symbolVariable->setDynamicTypes('array'); + + return new CompiledExpression('array', $symbolVariable->getRealName(), $expression); + } + + $codePrinter = $compilationContext->codePrinter; + $compilationContext->headersManager->add('kernel/array'); + + /** + * This calculates a prime number bigger than the current array size to possibly + * reduce hash collisions when adding new members to the array. + */ + $arrayLength = count($expression['left']); + if ($arrayLength >= 33 && function_exists('gmp_nextprime')) { + $arrayLength = (int)gmp_strval(gmp_nextprime($arrayLength - 1)); + } + + if ($this->expectingVariable && $symbolVariable->getVariantInits() >= 1) { + $symbolVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->initArray( + $symbolVariable, + $compilationContext, + $arrayLength > 0 ? $arrayLength : null + ); + $symbolVariable->setDynamicTypes('array'); + } else { + if ($this->expectingVariable) { + $symbolVariable->initVariant($compilationContext); + } + + /** + * Mark the variable as an array + */ + $symbolVariable->setDynamicTypes('array'); + $compilationContext->backend->initArray( + $symbolVariable, + $compilationContext, + $arrayLength > 0 ? $arrayLength : null + ); + } + foreach ($expression['left'] as $item) { + if (!isset($item['key'])) { + $expr = new Expression($item['value']); + $resolvedExpr = $expr->compile($compilationContext); + $itemVariable = $this->getArrayValue($resolvedExpr, $compilationContext); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $item = $compilationContext->backend->resolveValue($itemVariable, $compilationContext); + $codePrinter->output('zephir_array_fast_append(' . $symbol . ', ' . $item . ');'); + $this->checkVariableTemporal($itemVariable); + + continue; + } + + $exprKey = new Expression($item['key']); + $resolvedExprKey = $exprKey->compile($compilationContext); + + switch ($resolvedExprKey->getType()) { + case Types::T_STRING: + $expr = new Expression($item['value']); + $resolvedExpr = $expr->compile($compilationContext); + switch ($resolvedExpr->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + case Types::T_DOUBLE: + case Types::T_STRING: + $compilationContext->backend->addArrayEntry( + $symbolVariable, + $resolvedExprKey, + $resolvedExpr, + $compilationContext + ); + break; + + case Types::T_BOOL: + $compilationContext->headersManager->add('kernel/array'); + if ('true' == $resolvedExpr->getCode()) { + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + 'true', + $compilationContext, + 'PH_COPY | PH_SEPARATE' + ); + } else { + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + 'false', + $compilationContext, + 'PH_COPY | PH_SEPARATE' + ); + } + break; + + case Types::T_NULL: + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + 'null', + $compilationContext, + 'PH_COPY | PH_SEPARATE' + ); + break; + + case Types::T_ARRAY: + case Types::T_VARIABLE: + $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + $valueVariable, + $compilationContext, + 'PH_COPY | PH_SEPARATE' + ); + $this->checkVariableTemporal($valueVariable); + break; + + default: + throw new CompilerException( + 'Invalid value type: ' . $resolvedExpr->getType(), + $item['value'] + ); + } + break; + + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + $expr = new Expression($item['value']); + $resolvedExpr = $expr->compile($compilationContext); + switch ($resolvedExpr->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + case Types::T_DOUBLE: + case Types::T_STRING: + $compilationContext->backend->addArrayEntry( + $symbolVariable, + $resolvedExprKey, + $resolvedExpr, + $compilationContext + ); + break; + + case Types::T_BOOL: + if ('true' == $resolvedExpr->getCode()) { + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + 'true', + $compilationContext, + 'PH_COPY' + ); + } else { + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + 'false', + $compilationContext, + 'PH_COPY' + ); + } + break; + + case Types::T_NULL: + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + 'null', + $compilationContext, + 'PH_COPY' + ); + break; + + case Types::T_ARRAY: + case Types::T_VARIABLE: + $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + $valueVariable, + $compilationContext, + 'PH_COPY' + ); + $this->checkVariableTemporal($valueVariable); + break; + + default: + throw new CompilerException( + 'Invalid value type: ' . $item['value']['type'], + $item['value'] + ); + } + break; + + case Types::T_VARIABLE: + $variableVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExprKey->getCode(), + $compilationContext, + $item['key'] + ); + switch ($variableVariable->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + $expr = new Expression($item['value']); + $resolvedExpr = $expr->compile($compilationContext); + switch ($resolvedExpr->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + case Types::T_BOOL: + case Types::T_DOUBLE: + case Types::T_NULL: + case Types::T_STRING: + $compilationContext->backend->addArrayEntry( + $symbolVariable, + $resolvedExprKey, + $resolvedExpr, + $compilationContext + ); + break; + + case Types::T_VARIABLE: + $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + $valueVariable, + $compilationContext, + 'PH_COPY' + ); + $this->checkVariableTemporal($valueVariable); + break; + + default: + throw new CompilerException( + 'Invalid value type: ' . $item['value']['type'], + $item['value'] + ); + } + break; + + case Types::T_STRING: + $expr = new Expression($item['value']); + $resolvedExpr = $expr->compile($compilationContext); + switch ($resolvedExpr->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + $codePrinter->output( + 'add_assoc_long_ex(' . $symbolVariable->getName( + ) . ', Z_STRVAL_P(' . $resolvedExprKey->getCode( + ) . '), Z_STRLEN_P(' . $item['key']['value'] . '), ' . $resolvedExpr->getCode( + ) . ');' + ); + break; + + case Types::T_DOUBLE: + $codePrinter->output( + 'add_assoc_double_ex(' . $symbolVariable->getName( + ) . ', Z_STRVAL_P(' . $resolvedExprKey->getCode( + ) . '), Z_STRLEN_P(' . $item['key']['value'] . '), ' . $resolvedExpr->getCode( + ) . ');' + ); + break; + + case Types::T_BOOL: + $codePrinter->output( + 'add_assoc_bool_ex(' . $symbolVariable->getName( + ) . ', Z_STRVAL_P(' . $resolvedExprKey->getCode( + ) . '), Z_STRLEN_P(' . $item['key']['value'] . '), ' . $resolvedExpr->getBooleanCode( + ) . ');' + ); + break; + + case Types::T_STRING: + $compilationContext->backend->addArrayEntry( + $symbolVariable, + $resolvedExprKey, + $resolvedExpr, + $compilationContext + ); + break; + + case Types::T_NULL: + $codePrinter->output( + 'add_assoc_null_ex(' . $symbolVariable->getName( + ) . ', Z_STRVAL_P(' . $resolvedExprKey->getCode( + ) . '), Z_STRLEN_P(' . $item['key']['value'] . ') + 1);' + ); + break; + + case Types::T_VARIABLE: + $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); + $compilationContext->backend->updateArray( + $symbolVariable, + $resolvedExprKey, + $resolvedExpr, + $compilationContext + ); + $this->checkVariableTemporal($valueVariable); + break; + + default: + throw new CompilerException( + 'Invalid value type: ' . $resolvedExpr->getType(), + $item['value'] + ); + } + break; + + case Types::T_VARIABLE: + $expr = new Expression($item['value']); + $resolvedExpr = $expr->compile($compilationContext); + switch ($resolvedExpr->getType()) { + case Types::T_NULL: + case Types::T_VARIABLE: + case Types::T_BOOL: + $valueVariable = $this->getArrayValue($resolvedExpr, $compilationContext); + $compilationContext->backend->updateArray( + $symbolVariable, + $variableVariable, + $valueVariable, + $compilationContext + ); + + $this->checkVariableTemporal($valueVariable); + break; + + default: + throw new CompilerException( + 'Invalid value type: ' . $item['value']['type'], + $item['value'] + ); + } + break; + + default: + throw CompilerException::cannotUseVariableTypeAs( + $variableVariable, + 'as an array index', + $expression + ); + } + break; + + default: + throw new CompilerException( + 'Invalid key type: ' + . $resolvedExprKey->getType(), + $item['key'] + ); + } + } + + return new CompiledExpression('array', $symbolVariable->getRealName(), $expression); + } + + /** + * Resolves an item to be added in an array. + * + * @param CompiledExpression $exprCompiled + * @param CompilationContext $compilationContext + * + * @return GlobalConstant|Variable + */ + public function getArrayValue( + CompiledExpression $exprCompiled, + CompilationContext $compilationContext + ) { + switch ($exprCompiled->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); + $compilationContext->backend->assignLong($tempVar, $exprCompiled->getCode(), $compilationContext); + + return $tempVar; + + case Types::T_CHAR: + case Types::T_UCHAR: + $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); + $compilationContext->backend->assignLong( + $tempVar, + '\'' . $exprCompiled->getCode() . '\'', + $compilationContext + ); + + return $tempVar; + + case Types::T_DOUBLE: + $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); + $compilationContext->backend->assignDouble($tempVar, $exprCompiled->getCode(), $compilationContext); + + return $tempVar; + + case Types::T_BOOL: + if ('true' === $exprCompiled->getCode()) { + return new GlobalConstant('ZEPHIR_GLOBAL(global_true)'); + } + + if ('false' === $exprCompiled->getCode()) { + return new GlobalConstant('ZEPHIR_GLOBAL(global_false)'); + } + + $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); + $compilationContext->backend->assignBool($tempVar, $exprCompiled->getCode(), $compilationContext); + + return $tempVar; + + case Types::T_NULL: + return new GlobalConstant('ZEPHIR_GLOBAL(global_null)'); + + case Types::T_STRING: + case Types::T_ULONG: + $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); + $compilationContext->backend->assignString($tempVar, $exprCompiled->getCode(), $compilationContext); + + return $tempVar; + + case Types::T_ARRAY: + return $compilationContext->symbolTable->getVariableForRead( + $exprCompiled->getCode(), + $compilationContext, + $exprCompiled->getOriginal() + ); + + case Types::T_VARIABLE: + $itemVariable = $compilationContext->symbolTable->getVariableForRead( + $exprCompiled->getCode(), + $compilationContext, + $exprCompiled->getOriginal() + ); + switch ($itemVariable->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + $tempVar = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong($tempVar, $itemVariable, $compilationContext); + + return $tempVar; + + case Types::T_DOUBLE: + $tempVar = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignDouble($tempVar, $itemVariable, $compilationContext); + + return $tempVar; + + case Types::T_BOOL: + $tempVar = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignBool($tempVar, $itemVariable, $compilationContext); + + return $tempVar; + + case Types::T_STRING: + case Types::T_VARIABLE: + case Types::T_ARRAY: + case Types::T_MIXED: + return $itemVariable; + + default: + throw new CompilerException('Unknown ' . $itemVariable->getType(), $itemVariable); + } + break; + + default: + throw new CompilerException('Unknown', $exprCompiled); + } + } + + /** + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. + * + * @param bool $expecting + * @param Variable|null $expectingVariable + */ + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void + { + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets if the result of the evaluated expression is read only. + * + * @param bool $readOnly + */ + public function setReadOnly(bool $readOnly): void + { + $this->readOnly = $readOnly; + } +} diff --git a/Library/Expression/NativeArrayAccess.php b/src/Expression/NativeArrayAccess.php similarity index 66% rename from Library/Expression/NativeArrayAccess.php rename to src/Expression/NativeArrayAccess.php index 8fc2d54ded..bdb9b30adb 100644 --- a/Library/Expression/NativeArrayAccess.php +++ b/src/Expression/NativeArrayAccess.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression; use ReflectionException; @@ -17,67 +19,28 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * Resolves expressions that read array indexes */ class NativeArrayAccess { - /** @var bool */ - protected $expecting = true; - - /** @var bool */ - protected $readOnly = false; - - /** @var Variable|null */ - protected $expectingVariable; - - /** @var bool */ - protected $noisy = true; - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable $expectingVariable - */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly - */ - public function setReadOnly($readOnly) - { - $this->readOnly = $readOnly; - } - - /** - * Sets whether the expression must be resolved in "noisy" mode. - * - * @param bool $noisy - */ - public function setNoisy($noisy) - { - $this->noisy = $noisy; - } + protected bool $expecting = true; + protected ?Variable $expectingVariable; + protected bool $noisy = true; + protected bool $readOnly = false; /** * Compiles foo[x] = {expr}. * - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext) { @@ -93,7 +56,11 @@ public function compile($expression, CompilationContext $compilationContext) */ switch ($exprVariable->getType()) { case 'variable': - $variableVariable = $compilationContext->symbolTable->getVariableForRead($exprVariable->getCode(), $compilationContext, $expression); + $variableVariable = $compilationContext->symbolTable->getVariableForRead( + $exprVariable->getCode(), + $compilationContext, + $expression + ); switch ($variableVariable->getType()) { case 'variable': case 'array': @@ -101,12 +68,18 @@ public function compile($expression, CompilationContext $compilationContext) break; default: - throw new CompilerException('Variable type: '.$variableVariable->getType().' cannot be used as array', $expression['left']); + throw new CompilerException( + 'Variable type: ' . $variableVariable->getType() . ' cannot be used as array', + $expression['left'] + ); } break; default: - throw new CompilerException('Cannot use expression: '.$exprVariable->getType().' as an array', $expression['left']); + throw new CompilerException( + 'Cannot use expression: ' . $exprVariable->getType() . ' as an array', + $expression['left'] + ); } /** @@ -123,64 +96,36 @@ public function compile($expression, CompilationContext $compilationContext) } /** - * @param array $expression - * @param Variable $variableVariable - * @param CompilationContext $compilationContext - * - * @return CompiledExpression + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. * - * @throws ReflectionException - * @throws Exception + * @param bool $expecting + * @param Variable|null $expectingVariable */ - protected function accessStringOffset(array $expression, Variable $variableVariable, CompilationContext $compilationContext) + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { - if ($this->expecting) { - if ($this->expectingVariable) { - $symbolVariable = $this->expectingVariable; - if ('char' != $symbolVariable->getType() && 'uchar' != $symbolVariable->getType()) { - $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('uchar', $compilationContext); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('uchar', $compilationContext); - } - } - - /** - * Right part of expression is the index. - */ - $expr = new Expression($expression['right']); - $exprIndex = $expr->compile($compilationContext); - - $codePrinter = $compilationContext->codePrinter; - $variableCode = $compilationContext->backend->getVariableCode($variableVariable); - - switch ($exprIndex->getType()) { - case 'int': - case 'uint': - case 'long': - $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output($symbolVariable->getName().' = ZEPHIR_STRING_OFFSET('.$variableCode.', '.$exprIndex->getCode().');'); - break; - - case 'variable': - $variableIndex = $compilationContext->symbolTable->getVariableForRead($exprIndex->getCode(), $compilationContext, $expression); - switch ($variableIndex->getType()) { - case 'int': - case 'uint': - case 'long': - $codePrinter->output($symbolVariable->getName().' = ZEPHIR_STRING_OFFSET('.$variableCode.', '.$variableIndex->getName().');'); - break; - - default: - throw new CompilerException('Cannot use index type '.$variableIndex->getType().' as offset', $expression['right']); - } - break; + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } - default: - throw new CompilerException('Cannot use index type '.$exprIndex->getType().' as offset', $expression['right']); - } + /** + * Sets whether the expression must be resolved in "noisy" mode. + * + * @param bool $noisy + */ + public function setNoisy(bool $noisy): void + { + $this->noisy = $noisy; + } - return new CompiledExpression('variable', $symbolVariable->getName(), $expression); + /** + * Sets if the result of the evaluated expression is read only. + * + * @param bool $readOnly + */ + public function setReadOnly(bool $readOnly): void + { + $this->readOnly = $readOnly; } /** @@ -188,12 +133,16 @@ protected function accessStringOffset(array $expression, Variable $variableVaria * @param Variable $variableVariable * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws Exception + * @throws ReflectionException */ - protected function accessDimensionArray($expression, Variable $variableVariable, CompilationContext $compilationContext) - { + protected function accessDimensionArray( + array $expression, + Variable $variableVariable, + CompilationContext $compilationContext + ): CompiledExpression { $arrayAccess = $expression; if ('variable' == $variableVariable->getType()) { @@ -215,7 +164,7 @@ protected function accessDimensionArray($expression, Variable $variableVariable, /** * Resolves the symbol that expects the value. */ - $readOnly = false; + $readOnly = false; $symbolVariable = $this->expectingVariable; if ($this->readOnly) { @@ -227,7 +176,9 @@ protected function accessDimensionArray($expression, Variable $variableVariable, if ('return_value' != $symbolVariable->getName()) { $line = $compilationContext->symbolTable->getLastCallLine(); if (false === $line || ($line > 0 && $line < $expression['line'])) { - $numberMutations = $compilationContext->symbolTable->getExpectedMutations($symbolVariable->getName()); + $numberMutations = $compilationContext->symbolTable->getExpectedMutations( + $symbolVariable->getName() + ); if (1 == $numberMutations) { if ($symbolVariable->getNumberMutations() == $numberMutations) { $symbolVariable->setMemoryTracked(false); @@ -245,11 +196,19 @@ protected function accessDimensionArray($expression, Variable $variableVariable, $symbolVariable->observeVariant($compilationContext); $this->readOnly = false; } else { - $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedUninitializedVariable('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedUninitializedVariable( + 'variable', + $compilationContext, + $expression + ); } } } else { - $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedUninitializedVariable('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedUninitializedVariable( + 'variable', + $compilationContext, + $expression + ); } } else { if ($this->expecting && $this->expectingVariable) { @@ -260,7 +219,9 @@ protected function accessDimensionArray($expression, Variable $variableVariable, if ('return_value' !== $symbolVariable->getName()) { $line = $compilationContext->symbolTable->getLastCallLine(); if (false === $line || ($line > 0 && $line < $expression['line'])) { - $numberMutations = $compilationContext->symbolTable->getExpectedMutations($symbolVariable->getName()); + $numberMutations = $compilationContext->symbolTable->getExpectedMutations( + $symbolVariable->getName() + ); if (1 == $numberMutations) { if ($symbolVariable->getNumberMutations() == $numberMutations) { $symbolVariable->setMemoryTracked(false); @@ -278,11 +239,17 @@ protected function accessDimensionArray($expression, Variable $variableVariable, $symbolVariable->observeVariant($compilationContext); $this->readOnly = false; } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve( + 'variable', + $compilationContext + ); } } } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve( + 'variable', + $compilationContext + ); } } @@ -290,7 +257,10 @@ protected function accessDimensionArray($expression, Variable $variableVariable, * Variable that receives property accesses must be polymorphic */ if (!$symbolVariable->isVariable()) { - throw new CompilerException('Cannot use variable: '.$symbolVariable->getType().' to assign array index', $expression); + throw new CompilerException( + 'Cannot use variable: ' . $symbolVariable->getType() . ' to assign array index', + $expression + ); } /** @@ -307,16 +277,113 @@ protected function accessDimensionArray($expression, Variable $variableVariable, /** * Right part of expression is the index. */ - $expr = new Expression($arrayAccess['right']); + $expr = new Expression($arrayAccess['right']); $exprIndex = $expr->compile($compilationContext); $compilationContext->headersManager->add('kernel/array'); if ('variable' === $exprIndex->getType()) { - $exprIndex = $compilationContext->symbolTable->getVariableForRead($exprIndex->getCode(), $compilationContext, $expression); + $exprIndex = $compilationContext->symbolTable->getVariableForRead( + $exprIndex->getCode(), + $compilationContext, + $expression + ); } - $compilationContext->backend->arrayFetch($symbolVariable, $variableVariable, $exprIndex, $flags, $arrayAccess, $compilationContext); + $compilationContext->backend->arrayFetch( + $symbolVariable, + $variableVariable, + $exprIndex, + $flags, + $arrayAccess, + $compilationContext + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } + + /** + * @param array $expression + * @param Variable $variableVariable + * @param CompilationContext $compilationContext + * + * @return CompiledExpression + * + * @throws ReflectionException + * @throws Exception + */ + protected function accessStringOffset( + array $expression, + Variable $variableVariable, + CompilationContext $compilationContext + ): CompiledExpression { + if ($this->expecting) { + if ($this->expectingVariable) { + $symbolVariable = $this->expectingVariable; + if ('char' != $symbolVariable->getType() && 'uchar' != $symbolVariable->getType()) { + $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'uchar', + $compilationContext + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'uchar', + $compilationContext + ); + } + } + + /** + * Right part of expression is the index. + */ + $expr = new Expression($expression['right']); + $exprIndex = $expr->compile($compilationContext); + + $codePrinter = $compilationContext->codePrinter; + $variableCode = $compilationContext->backend->getVariableCode($variableVariable); + + switch ($exprIndex->getType()) { + case 'int': + case 'uint': + case 'long': + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + $symbolVariable->getName( + ) . ' = ZEPHIR_STRING_OFFSET(' . $variableCode . ', ' . $exprIndex->getCode() . ');' + ); + break; + + case 'variable': + $variableIndex = $compilationContext->symbolTable->getVariableForRead( + $exprIndex->getCode(), + $compilationContext, + $expression + ); + switch ($variableIndex->getType()) { + case 'int': + case 'uint': + case 'long': + $codePrinter->output( + $symbolVariable->getName( + ) . ' = ZEPHIR_STRING_OFFSET(' . $variableCode . ', ' . $variableIndex->getName() . ');' + ); + break; + + default: + throw new CompilerException( + 'Cannot use index type ' . $variableIndex->getType() . ' as offset', + $expression['right'] + ); + } + break; + + default: + throw new CompilerException( + 'Cannot use index type ' . $exprIndex->getType() . ' as offset', + $expression['right'] + ); + } + + return new CompiledExpression('variable', $symbolVariable->getName(), $expression); + } } diff --git a/Library/Expression/PropertyAccess.php b/src/Expression/PropertyAccess.php similarity index 58% rename from Library/Expression/PropertyAccess.php rename to src/Expression/PropertyAccess.php index 35edb3685f..36ff9f62e1 100644 --- a/Library/Expression/PropertyAccess.php +++ b/src/Expression/PropertyAccess.php @@ -9,64 +9,30 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable; + +use function current; /** - * Zephir\Expression\PropertyAccess. - * * Resolves expressions that read properties */ class PropertyAccess { - /** @var bool */ - protected $expecting = true; - - /** @var bool */ - protected $readOnly = false; - - protected $expectingVariable; - - /** @var bool */ - protected $noisy = true; - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable $expectingVariable - */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly - */ - public function setReadOnly($readOnly) - { - $this->readOnly = $readOnly; - } + use VariablesTrait; - /** - * Sets whether the expression must be resolved in "noisy" mode. - * - * @param bool $noisy - */ - public function setNoisy($noisy) - { - $this->noisy = $noisy; - } + protected bool $expecting = true; + protected ?Variable $expectingVariable; + protected bool $noisy = true; + protected bool $readOnly = false; /** * Resolves the access to a property in an object. @@ -86,71 +52,92 @@ public function compile($expression, CompilationContext $compilationContext) switch ($exprVariable->getType()) { case 'variable': - $variableVariable = $compilationContext->symbolTable->getVariableForRead($exprVariable->getCode(), $compilationContext, $expression); + $variableVariable = $compilationContext->symbolTable->getVariableForRead( + $exprVariable->getCode(), + $compilationContext, + $expression + ); switch ($variableVariable->getType()) { case 'variable': break; default: - throw new CompilerException('Variable type: '.$variableVariable->getType().' cannot be used as object', $propertyAccess['left']); + throw new CompilerException( + 'Variable type: ' . $variableVariable->getType() . ' cannot be used as object', + $propertyAccess['left'] + ); } break; default: - throw new CompilerException('Cannot use expression: '.$exprVariable->getType().' as an object', $propertyAccess['left']); + throw new CompilerException( + 'Cannot use expression: ' . $exprVariable->getType() . ' as an object', + $propertyAccess['left'] + ); } $property = $propertyAccess['right']['value']; - $propertyDefinition = null; - $classDefinition = null; + $propertyDefinition = null; + $classDefinition = null; $currentClassDefinition = $compilationContext->classDefinition; - /* + /** * If the property is accessed on 'this', we check if the method does exist */ if ('this' == $variableVariable->getRealName()) { $classDefinition = $currentClassDefinition; - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $expression); - } + $this->checkClassHasProperty( + $classDefinition, + $property, + $expression + ); $propertyDefinition = $classDefinition->getProperty($property); } else { - /* + /** * If we know the class related to a variable we could check if the property * is defined on that class */ if ($variableVariable->hasAnyDynamicType('object')) { $classType = current($variableVariable->getClassTypes()); - $compiler = $compilationContext->compiler; + $compiler = $compilationContext->compiler; - if ($compiler->isClass($classType)) { + if ($classType !== false && $compiler->isClass($classType)) { $classDefinition = $compiler->getClassDefinition($classType); if (!$classDefinition) { - throw new CompilerException('Cannot locate class definition for class: '.$classType, $expression); + throw new CompilerException( + 'Cannot locate class definition for class: ' . $classType, + $expression + ); } - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classType."' does not have a property called: '".$property."'", $expression); - } + $this->checkClassHasProperty( + $classDefinition, + $property, + $expression, + $classType + ); $propertyDefinition = $classDefinition->getProperty($property); } } } - /* + /** * Having a proper propertyDefinition we can check if the property is readable * according to its modifiers */ if ($propertyDefinition) { if ($propertyDefinition->isStatic()) { - throw new CompilerException("Attempt to access static property '".$property."' as non static", $expression); + throw new CompilerException( + "Attempt to access static property '" . $property . "' as non static", + $expression + ); } if (!$propertyDefinition->isPublic()) { - /* + /** * Protected variables only can be read in the class context * where they were declared */ @@ -158,17 +145,28 @@ public function compile($expression, CompilationContext $compilationContext) if ($propertyDefinition->isPrivate()) { $declarationDefinition = $propertyDefinition->getClassDefinition(); if ($declarationDefinition !== $currentClassDefinition) { - throw new CompilerException("Attempt to access private property '".$property."' outside of its declared class context: '".$declarationDefinition->getCompleteName()."'", $expression); + throw new CompilerException( + "Attempt to access private property '" + . $property + . "' outside of its declared class context: '" + . $declarationDefinition->getCompleteName() + . "'", + $expression + ); } } } else { - if ($propertyDefinition->isProtected()) { - } else { - if ($propertyDefinition->isPrivate()) { - $declarationDefinition = $propertyDefinition->getClassDefinition(); - if ($declarationDefinition !== $currentClassDefinition) { - throw new CompilerException("Attempt to access private property '".$property."' outside of its declared class context: '".$declarationDefinition->getCompleteName()."'", $expression); - } + if (!$propertyDefinition->isProtected() && $propertyDefinition->isPrivate()) { + $declarationDefinition = $propertyDefinition->getClassDefinition(); + if ($declarationDefinition !== $currentClassDefinition) { + throw new CompilerException( + "Attempt to access private property '" + . $property + . "' outside of its declared class context: '" + . $declarationDefinition->getCompleteName() + . "'", + $expression + ); } } } @@ -178,20 +176,22 @@ public function compile($expression, CompilationContext $compilationContext) /** * Resolves the symbol that expects the value. */ - $readOnly = false; + $readOnly = false; $makeSymbolVariable = false; if ($this->expecting) { if ($this->expectingVariable) { $symbolVariable = $this->expectingVariable; - /* + /** * If a variable is assigned once in the method, we try to promote it * to a read only variable */ if ('return_value' != $symbolVariable->getName()) { $line = $compilationContext->symbolTable->getLastCallLine(); if (false === $line || ($line > 0 && $line < $expression['line'])) { - $numberMutations = $compilationContext->symbolTable->getExpectedMutations($symbolVariable->getName()); + $numberMutations = $compilationContext->symbolTable->getExpectedMutations( + $symbolVariable->getName() + ); if (1 == $numberMutations) { if ($symbolVariable->getNumberMutations() == $numberMutations) { $symbolVariable->setMemoryTracked(false); @@ -201,13 +201,12 @@ public function compile($expression, CompilationContext $compilationContext) } } - /* - * Variable is not read only or it wasn't promoted + /** + * Variable is not read only, or it wasn't promoted */ if (!$readOnly) { if ('return_value' != $symbolVariable->getName()) { $symbolVariable->observeVariant($compilationContext); - $this->readOnly = false; } else { $makeSymbolVariable = true; } @@ -225,28 +224,76 @@ public function compile($expression, CompilationContext $compilationContext) if ($makeSymbolVariable) { if ($readOnly) { - $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext); + $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext + ); } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve( + 'variable', + $compilationContext + ); } } - /* + /** * Variable that receives a property value must be polymorphic */ if (!$symbolVariable->isVariable()) { - throw new CompilerException('Cannot use variable: '.$symbolVariable->getType().' to assign property value', $expression); + throw new CompilerException( + 'Cannot use variable: ' + . $symbolVariable->getType() + . ' to assign property value', + $expression + ); } - /* + /** * At this point, we don't know the exact dynamic type fetched from the property */ $symbolVariable->setDynamicTypes('undefined'); - $compilationContext->headersManager->add('kernel/object'); - - $compilationContext->backend->fetchProperty($symbolVariable, $variableVariable, $property, $readOnly, $compilationContext); + $compilationContext->backend->fetchProperty( + $symbolVariable, + $variableVariable, + $property, + $readOnly, + $compilationContext + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } + + /** + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. + * + * @param bool $expecting + * @param Variable|null $expectingVariable + */ + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void + { + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets whether the expression must be resolved in "noisy" mode. + * + * @param bool $noisy + */ + public function setNoisy(bool $noisy): void + { + $this->noisy = $noisy; + } + + /** + * Sets if the result of the evaluated expression is read only. + * + * @param bool $readOnly + */ + public function setReadOnly($readOnly): void + { + $this->readOnly = $readOnly; + } } diff --git a/Library/Expression/PropertyDynamicAccess.php b/src/Expression/PropertyDynamicAccess.php similarity index 53% rename from Library/Expression/PropertyDynamicAccess.php rename to src/Expression/PropertyDynamicAccess.php index 433e0e7f2b..7c2d08a0b7 100644 --- a/Library/Expression/PropertyDynamicAccess.php +++ b/src/Expression/PropertyDynamicAccess.php @@ -9,64 +9,27 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable; - -use function Zephir\add_slashes; +use Zephir\Name; +use Zephir\Types\Types; +use Zephir\Variable\Variable; /** - * Zephir\Expression\PropertyDynamicAccess. - * * Resolves expressions that read properties with a dynamic variable as property */ class PropertyDynamicAccess { - protected $expecting = true; - - protected $readOnly = false; - - protected $expectingVariable; - - /** @var bool */ - protected $noisy = true; - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable $expectingVariable - */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly - */ - public function setReadOnly($readOnly) - { - $this->readOnly = $readOnly; - } - - /** - * Sets whether the expression must be resolved in "noisy" mode. - * - * @param bool $noisy - */ - public function setNoisy($noisy) - { - $this->noisy = $noisy; - } + protected bool $expecting = true; + protected ?Variable $expectingVariable = null; + protected bool $noisy = true; + protected bool $readOnly = false; /** * Resolves the access to a property in an object. @@ -80,35 +43,47 @@ public function compile($expression, CompilationContext $compilationContext) { $propertyAccess = $expression; - $expr = new Expression($propertyAccess['left']); + $expr = new Expression($propertyAccess['left']); $exprVariable = $expr->compile($compilationContext); switch ($exprVariable->getType()) { case 'variable': - $variableVariable = $compilationContext->symbolTable->getVariableForRead($exprVariable->getCode(), $compilationContext, $expression); + $variableVariable = $compilationContext->symbolTable->getVariableForRead( + $exprVariable->getCode(), + $compilationContext, + $expression + ); switch ($variableVariable->getType()) { case 'variable': break; default: - throw new CompilerException('Variable type: '.$variableVariable->getType().' cannot be used as object', $propertyAccess['left']); + throw new CompilerException( + 'Variable type: ' . $variableVariable->getType() . ' cannot be used as object', + $propertyAccess['left'] + ); } break; default: - throw new CompilerException('Cannot use expression: '.$exprVariable->getType().' as an object', $propertyAccess['left']); - } - - switch ($propertyAccess['right']['type']) { - case 'variable': - $propertyVariable = $compilationContext->symbolTable->getVariableForRead($propertyAccess['right']['value'], $compilationContext, $expression); - break; - case 'string': - $propertyVariable = null; - break; - default: - throw new CompilerException('Variable type: '.$propertyAccess['right']['type'].' cannot be used as object', $propertyAccess['left']); + throw new CompilerException( + 'Cannot use expression: ' . $exprVariable->getType() . ' as an object', + $propertyAccess['left'] + ); } - /* + $propertyVariable = match ($propertyAccess['right']['type']) { + Types::T_VARIABLE => $compilationContext->symbolTable->getVariableForRead( + $propertyAccess['right']['value'], + $compilationContext, + $expression + ), + Types::T_STRING => null, + default => throw new CompilerException( + 'Variable type: ' . $propertyAccess['right']['type'] . ' cannot be used as object', + $propertyAccess['left'] + ), + }; + + /** * Resolves the symbol that expects the value */ if ($this->expecting) { @@ -117,18 +92,29 @@ public function compile($expression, CompilationContext $compilationContext) if ('return_value' != $symbolVariable->getName()) { $symbolVariable->observeVariant($compilationContext); } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve( + 'variable', + $compilationContext + ); } } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve( + 'variable', + $compilationContext + ); } } - /* + /** * Variable that receives a property value must be polymorphic */ if ($symbolVariable && !$symbolVariable->isVariable()) { - throw new CompilerException('Cannot use variable: '.$symbolVariable->getType().' to assign property value', $expression); + throw new CompilerException( + 'Cannot use variable: ' + . $symbolVariable->getType() + . ' to assign property value', + $expression + ); } /* @@ -138,9 +124,48 @@ public function compile($expression, CompilationContext $compilationContext) $compilationContext->headersManager->add('kernel/object'); - $property = $propertyVariable ?: add_slashes($expression['right']['value']); - $compilationContext->backend->fetchProperty($symbolVariable, $variableVariable, $property, false, $compilationContext); + $property = $propertyVariable ?: Name::addSlashes($expression['right']['value']); + $compilationContext->backend->fetchProperty( + $symbolVariable, + $variableVariable, + $property, + false, + $compilationContext + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } + + /** + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. + * + * @param bool $expecting + * @param Variable|null $expectingVariable + */ + public function setExpectReturn($expecting, Variable $expectingVariable = null): void + { + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets whether the expression must be resolved in "noisy" mode. + * + * @param bool $noisy + */ + public function setNoisy($noisy): void + { + $this->noisy = $noisy; + } + + /** + * Sets if the result of the evaluated expression is read only. + * + * @param bool $readOnly + */ + public function setReadOnly($readOnly): void + { + $this->readOnly = $readOnly; + } } diff --git a/src/Expression/Reference.php b/src/Expression/Reference.php new file mode 100644 index 0000000000..a77ef8dd7e --- /dev/null +++ b/src/Expression/Reference.php @@ -0,0 +1,142 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Expression; + +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\Variable\Variable; + +use function in_array; + +/** + * Expression Reference + * + * Resolves expressions that create arrays. + */ +class Reference +{ + /** + * Expecting the value + */ + protected bool $expecting = true; + /** + * Expecting variable + */ + protected ?Variable $expectingVariable = null; + /** + * Result of the evaluated expression is read only or not + */ + protected bool $readOnly = false; + private array $validTypes = [ + 'variable', + 'string', + 'object', + 'array', + 'callable', + ]; + + /** + * Compiles a reference to a value. + * + * @throws Exception + * @throws ReflectionException + */ + public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression + { + /** + * Resolves the symbol that expects the value + */ + if ($this->expecting) { + if ($this->expectingVariable) { + $symbolVariable = $this->expectingVariable; + if ('variable' !== $symbolVariable->getType()) { + throw CompilerException::cannotUseVariableTypeAs( + $symbolVariable, + 'to store a reference', + $expression + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } + + $leftExpr = new Expression($expression['left']); + $leftExpr->setReadOnly($this->readOnly); + $left = $leftExpr->compile($compilationContext); + + if (!in_array($left->getType(), $this->validTypes)) { + throw new CompilerException('Cannot obtain a reference from type: ' . $left->getType(), $expression); + } + + $leftVariable = $compilationContext->symbolTable->getVariableForRead( + $left->getCode(), + $compilationContext, + $expression + ); + if (!in_array($leftVariable->getType(), $this->validTypes)) { + throw new CompilerException( + 'Cannot obtain reference from variable type: ' . $leftVariable->getType(), + $expression + ); + } + + $symbolVariable->setMustInitNull(true); + $compilationContext->symbolTable->mustGrownStack(true); + + $symbolVariable->increaseVariantIfNull(); + $compilationContext->codePrinter->output( + 'ZEPHIR_MAKE_REFERENCE(' . $symbolVariable->getName() . ', ' . $leftVariable->getName() . ');' + ); + + return new CompiledExpression('reference', $symbolVariable->getRealName(), $expression); + } + + /** + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. + * + * @param bool $expecting + * @param Variable|null $expectingVariable + */ + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void + { + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets if the result of the evaluated expression is read only. + * + * @param bool $readOnly + */ + public function setReadOnly(bool $readOnly): void + { + $this->readOnly = $readOnly; + } +} diff --git a/Library/Expression/StaticConstantAccess.php b/src/Expression/StaticConstantAccess.php similarity index 70% rename from Library/Expression/StaticConstantAccess.php rename to src/Expression/StaticConstantAccess.php index 4ab9fe5f13..4181ce8ee3 100644 --- a/Library/Expression/StaticConstantAccess.php +++ b/src/Expression/StaticConstantAccess.php @@ -9,53 +9,30 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression; -use Zephir\ClassConstant; +use ReflectionException; +use Zephir\Class\Constant; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; -use Zephir\Variable; +use Zephir\Variable\Variable; + +use function gettype; +use function in_array; +use function sprintf; /** - * StaticConstantAccess. - * * Resolves class constants */ class StaticConstantAccess { - /** @var bool */ - protected $expecting = true; - - /** @var bool */ - protected $readOnly = false; - - /** @var Variable|null */ - protected $expectingVariable; - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable - */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } - - /** - * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly - */ - public function setReadOnly($readOnly) - { - $this->readOnly = (bool) $readOnly; - } + protected bool $expecting = true; + protected ?Variable $expectingVariable = null; + protected bool $readOnly = false; /** * Access a static constant class. @@ -63,21 +40,22 @@ public function setReadOnly($readOnly) * @param array $expression * @param CompilationContext $compilationContext * - * @throws CompilerException|Exception - * * @return CompiledExpression + * + * @throws Exception + * @throws ReflectionException */ - public function compile(array $expression, CompilationContext $compilationContext) + public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { - $compiler = &$compilationContext->compiler; + $compiler = &$compilationContext->compiler; $className = $expression['left']['value']; - $constant = $expression['right']['value']; + $constant = $expression['right']['value']; - /* + /** * Fetch the class definition according to the class where the constant * is supposed to be declared */ - if (!\in_array($className, ['this', 'self', 'static', 'parent'])) { + if (!in_array($className, ['this', 'self', 'static', 'parent'])) { $className = $compilationContext->getFullName($className); if ($compiler->isClass($className) || $compiler->isInterface($className)) { $classDefinition = $compiler->getClassDefinition($className); @@ -85,34 +63,32 @@ public function compile(array $expression, CompilationContext $compilationContex if ($compiler->isBundledClass($className) || $compiler->isBundledInterface($className)) { $classDefinition = $compiler->getInternalClassDefinition($className); } else { - throw new CompilerException("Cannot locate class '".$className."'", $expression['left']); + throw new CompilerException("Cannot locate class '" . $className . "'", $expression['left']); } } } else { - if (\in_array($className, ['self', 'static', 'this'])) { + if (in_array($className, ['self', 'static', 'this'])) { $classDefinition = $compilationContext->classDefinition; - } else { - if ('parent' == $className) { - $classDefinition = $compilationContext->classDefinition; - $extendsClass = $classDefinition->getExtendsClass(); - if (!$extendsClass) { - throw new CompilerException( - sprintf( - 'Cannot find constant called "%s" on parent because class %s does not extend any class', - $constant, - $classDefinition->getCompleteName() - ), - $expression - ); - } else { - $classDefinition = $classDefinition->getExtendsClassDefinition(); - } + } elseif ('parent' === $className) { + $classDefinition = $compilationContext->classDefinition; + $extendsClass = $classDefinition->getExtendsClass(); + if (!$extendsClass) { + throw new CompilerException( + sprintf( + 'Cannot find constant called "%s" on parent because class %s does not extend any class', + $constant, + $classDefinition->getCompleteName() + ), + $expression + ); + } else { + $classDefinition = $classDefinition->getExtendsClassDefinition(); } } } - /* - * Constants are resolved to their values at compile time + /** + * Constants are resolved to their values at compile time, * so we need to check that they effectively do exist */ if (!$classDefinition->hasConstant($constant)) { @@ -126,11 +102,11 @@ public function compile(array $expression, CompilationContext $compilationContex ); } - /* + /** * We can optimize the reading of constants by avoiding query their value every time */ if (!$compilationContext->config->get('static-constant-class-folding', 'optimizations')) { - /* + /** * Resolves the symbol that expects the value */ if ($this->expecting) { @@ -152,20 +128,18 @@ public function compile(array $expression, CompilationContext $compilationContex ); } - /* + /** * Variable that receives property accesses must be polymorphic */ if (!$symbolVariable->isVariable()) { throw new CompilerException( - 'Cannot use variable: '.$symbolVariable->getType().' to assign class constants', + 'Cannot use variable: ' . $symbolVariable->getType() . ' to assign class constants', $expression ); } $symbolVariable->setDynamicTypes('undefined'); - $compilationContext->headersManager->add('kernel/object'); - $compilationContext->codePrinter->output( sprintf( 'zephir_get_class_constant(%s, %s, SS("%s"));', @@ -180,14 +154,14 @@ public function compile(array $expression, CompilationContext $compilationContex $constantDefinition = $classDefinition->getConstant($constant); - if ($constantDefinition instanceof ClassConstant) { + if ($constantDefinition instanceof Constant) { $constantDefinition->processValue($compilationContext); $value = $constantDefinition->getValueValue(); - $type = $constantDefinition->getValueType(); + $type = $constantDefinition->getValueType(); } else { $value = $constantDefinition; - $type = \gettype($value); - if ('integer' == $type) { + $type = gettype($value); + if ('integer' === $type) { $type = 'int'; } } @@ -202,16 +176,36 @@ public function compile(array $expression, CompilationContext $compilationContex break; default: $compilationContext->logger->warning( - "Constant '".$constantDefinition->getName()."' does not exist at compile time", + "Constant '" . $constantDefinition->getName() . "' does not exist at compile time", ['nonexistent-constant', $expression] ); return new CompiledExpression('null', null, $expression); } - /* - * Return the value as a literal expression - */ return new CompiledExpression($type, $value, $expression); } + + /** + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. + * + * @param bool $expecting + * @param Variable|null $expectingVariable + */ + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void + { + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets if the result of the evaluated expression is read only. + * + * @param bool $readOnly + */ + public function setReadOnly(bool $readOnly): void + { + $this->readOnly = $readOnly; + } } diff --git a/src/Expression/StaticPropertyAccess.php b/src/Expression/StaticPropertyAccess.php new file mode 100644 index 0000000000..85b4b2c9ff --- /dev/null +++ b/src/Expression/StaticPropertyAccess.php @@ -0,0 +1,200 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Expression; + +use ReflectionException; +use Zephir\Class\Property; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Exception\CompilerException; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable; + +use function in_array; + +/** + * Resolves class static properties + */ +class StaticPropertyAccess +{ + use VariablesTrait; + + protected bool $expecting = true; + protected ?Variable $expectingVariable = null; + protected bool $readOnly = false; + + /** + * Access a static property. + * + * @throws ReflectionException + * @throws Exception + */ + public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression + { + $className = $expression['left']['value']; + $compiler = $compilationContext->compiler; + $property = $expression['right']['value']; + + /** + * Fetch the class definition according to the class where the constant + * is supposed to be declared + */ + if (!in_array($className, ['self', 'static', 'parent'])) { + $className = $compilationContext->getFullName($className); + if ($compiler->isClass($className)) { + $classDefinition = $compiler->getClassDefinition($className); + } else { + if ($compiler->isBundledClass($className)) { + $classDefinition = $compiler->getInternalClassDefinition($className); + } else { + throw new CompilerException("Cannot locate class '" . $className . "'", $expression['left']); + } + } + } else { + if (in_array($className, ['self', 'static'])) { + $classDefinition = $compilationContext->classDefinition; + } else { + if ('parent' === $className) { + $classDefinition = $compilationContext->classDefinition; + if (!$classDefinition->getExtendsClass()) { + throw new CompilerException( + 'Cannot access static property "' + . $property + . '" on parent because class ' + . $classDefinition->getCompleteName() + . ' does not extend any class', + $expression + ); + } else { + $classDefinition = $classDefinition->getExtendsClassDefinition(); + } + } + } + } + + $this->checkClassHasProperty( + $classDefinition, + $property, + $expression + ); + + /** @var Property $propertyDefinition */ + $propertyDefinition = $classDefinition->getProperty($property); + $this->checkAccessNonStaticProperty( + $propertyDefinition, + $classDefinition, + $property, + $expression + ); + + if ($propertyDefinition->isPrivate()) { + if ($classDefinition != $compilationContext->classDefinition) { + throw new CompilerException( + "Cannot access private static property '" + . $classDefinition->getCompleteName() + . '::' + . $property + . "' out of its declaring context", + $expression + ); + } + } + + if ( + $propertyDefinition->isProtected() && + $classDefinition != $compilationContext->classDefinition && + $classDefinition != $compilationContext->classDefinition->getExtendsClassDefinition() + ) { + throw new CompilerException( + "Cannot access protected static property '" + . $classDefinition->getCompleteName() + . '::' + . $property + . "' out of its declaring context", + $expression + ); + } + + /** + * Resolves the symbol that expects the value + */ + if ($this->expecting) { + if ($this->expectingVariable) { + $symbolVariable = $this->expectingVariable; + if ('return_value' === $symbolVariable->getName()) { + $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext + ); + } + + /** + * Variable that receives property accesses must be polymorphic + */ + if (!$symbolVariable->isVariable()) { + throw new CompilerException( + 'Cannot use variable: ' . $symbolVariable->getType() . ' to assign class constants', + $expression + ); + } + + $symbolVariable->setDynamicTypes('undefined'); + $compilationContext->headersManager->add('kernel/object'); + + if (!$this->readOnly && 'return_value' != $symbolVariable->getName()) { + $symbolVariable->observeVariant($compilationContext); + } + + $compilationContext->backend->fetchStaticProperty( + $symbolVariable, + $classDefinition, + $property, + $this->readOnly, + $compilationContext + ); + + return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); + } + + /** + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. + */ + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void + { + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets if the result of the evaluated expression is read only. + */ + public function setReadOnly(bool $readOnly): void + { + $this->readOnly = $readOnly; + } +} diff --git a/Library/FileSystem/FileSystemInterface.php b/src/FileSystem/FileSystemInterface.php similarity index 100% rename from Library/FileSystem/FileSystemInterface.php rename to src/FileSystem/FileSystemInterface.php index 2b89cd29a5..c7be16d36a 100644 --- a/Library/FileSystem/FileSystemInterface.php +++ b/src/FileSystem/FileSystemInterface.php @@ -16,34 +16,25 @@ interface FileSystemInterface { /** - * Checks if the filesystem is initialized. - * - * @return bool - */ - public function isInitialized(): bool; - - /** - * Initialize the filesystem. + * Attempts to remove recursively the temporary directory with all subdirectories and files. */ - public function initialize(); + public function clean(): void; /** - * Checks whether a temporary entry does exist. + * Deletes a temporary entry. * * @param string $path - * - * @return bool */ - public function exists(string $path): bool; + public function delete(string $path); /** - * Creates a directory inside the temporary container. + * Checks whether a temporary entry does exist. * * @param string $path * * @return bool */ - public function makeDirectory(string $path): bool; + public function exists(string $path): bool; /** * Returns a temporary entry as an array. @@ -55,62 +46,72 @@ public function makeDirectory(string $path): bool; public function file(string $path): array; /** - * Requires a file from the temporary directory. + * Generate a hash value using the contents of a given file. * - * @param string $path + * @param string $algorithm + * @param string $sourceFile + * @param bool $useCache * - * @return mixed + * @return string */ - public function requireFile(string $path); + public function getHashFile(string $algorithm, string $sourceFile, bool $useCache = false): string; /** - * Attempts to remove recursively the temporary directory with all subdirectories and files. + * Initialize the filesystem. */ - public function clean(): void; + public function initialize(); /** - * Writes data into a temporary entry. + * Checks if the filesystem is initialized. + * + * @return bool + */ + public function isInitialized(): bool; + + /** + * Creates a directory inside the temporary container. * * @param string $path - * @param string $data + * + * @return bool */ - public function write(string $path, string $data); + public function makeDirectory(string $path): bool; /** - * Writes data from a temporary entry. + * Returns the modification time of a temporary entry. * * @param string $path * - * @return string + * @return int */ - public function read(string $path): string; + public function modificationTime(string $path): int; /** - * Deletes a temporary entry. + * Normalizes path to be used as a temporary entry. * * @param string $path + * + * @return string */ - public function delete(string $path); + public function normalizePath(string $path): string; /** - * Generate a hash value using the contents of a given file. + * Writes data from a temporary entry. * - * @param string $algorithm - * @param string $sourceFile - * @param bool $useCache + * @param string $path * * @return string */ - public function getHashFile(string $algorithm, string $sourceFile, bool $useCache = false): string; + public function read(string $path): string; /** - * Returns the modification time of a temporary entry. + * Requires a file from the temporary directory. * * @param string $path * - * @return int + * @return mixed */ - public function modificationTime(string $path): int; + public function requireFile(string $path); /** * Executes a command and saves the result into a temporary entry. @@ -122,11 +123,10 @@ public function modificationTime(string $path): int; public function system(string $command, string $descriptor, string $destination); /** - * Normalizes path to be used as a temporary entry. + * Writes data into a temporary entry. * * @param string $path - * - * @return string + * @param string $data */ - public function normalizePath(string $path): string; + public function write(string $path, string $data); } diff --git a/Library/FileSystem/HardDisk.php b/src/FileSystem/HardDisk.php similarity index 62% rename from Library/FileSystem/HardDisk.php rename to src/FileSystem/HardDisk.php index b046773222..50a87a9009 100644 --- a/Library/FileSystem/HardDisk.php +++ b/src/FileSystem/HardDisk.php @@ -19,9 +19,30 @@ use RecursiveIteratorIterator; use SplFileInfo; use Zephir\Exception\InvalidArgumentException; -use Zephir\Exception\RuntimeException; use Zephir\Zephir; +use function chmod; +use function escapeshellarg; +use function file_exists; +use function file_get_contents; +use function file_put_contents; +use function filemtime; +use function hash_file; +use function is_dir; +use function is_file; +use function md5; +use function md5_file; +use function mkdir; +use function preg_split; +use function rmdir; +use function rtrim; +use function sprintf; +use function str_replace; +use function system; +use function unlink; + +use const DIRECTORY_SEPARATOR; + /** * Local Hard Disk * @@ -29,36 +50,23 @@ */ class HardDisk implements FileSystemInterface { - /** @var string */ - private string $localPath; - - /** - * Initialize checker - * - * @var bool - */ - private bool $initialized = false; - /** * Root or base path * * Path to where all cached files and folders are collected. - * - * @var string */ private string $basePath; + /** + * Initialize checker + */ + private bool $initialized = false; /** - * HardDisk constructor. - * - * @param string $basePath - * @param string $localPath - * * @throws InvalidArgumentException */ - public function __construct(string $basePath, string $localPath = Zephir::VERSION) + public function __construct(string $basePath, private string $localPath = Zephir::VERSION) { - $this->basePath = $this->rightTrimPath($basePath); + $this->basePath = $this->rightTrimPath($basePath); $this->localPath = $this->rightTrimPath($localPath); if (empty($this->localPath)) { @@ -67,38 +75,34 @@ public function __construct(string $basePath, string $localPath = Zephir::VERSIO } /** - * @param string $path - * - * @return string + * Recursive directory clean */ - private function rightTrimPath(string $path): string + public function clean(): void { - return rtrim($path, '\\/'); - } + if (!is_dir($this->basePath . DIRECTORY_SEPARATOR . $this->localPath)) { + return; + } - /** - * @return bool - */ - public function isInitialized(): bool - { - return $this->initialized; + $contents = $this->listDirectoryRecursively( + $this->basePath . DIRECTORY_SEPARATOR . $this->localPath, + RecursiveIteratorIterator::CHILD_FIRST, + ); + + /** @var SplFileInfo $file */ + foreach ($contents as $file) { + $this->deleteFileInfoObject($file); + } + + unset($contents); + + rmdir($this->basePath . DIRECTORY_SEPARATOR . $this->localPath); } - /** - * Start File System - * - * @throws RuntimeException - */ - public function initialize() + public function delete(string $path): void { - $this->initialized = true; + unlink($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . "/{$path}"); } - /** - * @param string $path - * - * @return bool - */ public function exists(string $path): bool { if ('.' === $path || empty($path)) { @@ -107,14 +111,70 @@ public function exists(string $path): bool $path = "{$this->localPath}/{$path}"; } - return is_file($this->basePath.DIRECTORY_SEPARATOR.$path); + return is_file($this->basePath . DIRECTORY_SEPARATOR . $path); + } + + public function file(string $path): array + { + $contents = file_get_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . "/{$path}"); + + return preg_split("/\r\n|\n|\r/", $contents); } /** - * @param string $path + * This function does not perform operations in the temporary + * directory, but it caches the results to avoid reprocessing. + * + * @param string $algorithm + * @param string $sourceFile + * @param bool $useCache * - * @return bool + * @return string */ + public function getHashFile(string $algorithm, string $sourceFile, bool $useCache = false): string + { + if (false === $useCache) { + return hash_file($algorithm, $sourceFile); + } + + $cacheFile = sprintf( + '%s/%s/%s.%s', + $this->basePath, + $this->localPath, + $this->normalizePath($sourceFile), + $algorithm + ); + + if (!is_file($cacheFile)) { + $contents = hash_file($algorithm, $sourceFile); + file_put_contents($cacheFile, $contents); + + return $contents; + } + + if (filemtime($sourceFile) > filemtime($cacheFile)) { + $contents = hash_file($algorithm, $sourceFile); + file_put_contents($cacheFile, $contents); + + return $contents; + } + + return file_get_contents($cacheFile); + } + + /** + * Start File System + */ + public function initialize(): void + { + $this->initialized = true; + } + + public function isInitialized(): bool + { + return $this->initialized; + } + public function makeDirectory(string $path): bool { if ('.' === $path || empty($path)) { @@ -123,7 +183,7 @@ public function makeDirectory(string $path): bool $path = "{$this->localPath}/{$path}"; } - $dir = $this->basePath.DIRECTORY_SEPARATOR.$path; + $dir = $this->basePath . DIRECTORY_SEPARATOR . $path; if (is_dir($dir)) { chmod($dir, 0755); @@ -131,66 +191,54 @@ public function makeDirectory(string $path): bool return true; } - mkdir($this->basePath.DIRECTORY_SEPARATOR.$path, 0755, true); + mkdir($this->basePath . DIRECTORY_SEPARATOR . $path, 0755, true); return is_dir($path); } - /** - * @param string $path - * - * @return array - */ - public function file(string $path): array + public function modificationTime(string $path): int { - $contents = file_get_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}"); - - return preg_split("/\r\n|\n|\r/", $contents); + return filemtime($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . "/{$path}"); } - /** - * @param string $path - * - * @return int - */ - public function modificationTime(string $path): int + public function normalizePath(string $path): string { - return filemtime($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}"); + return str_replace(['\\', ':', '/'], '_', $path); } /** - * @param string $path - * - * @return string + * Checks if the content of the file on the disk is the same as the content. */ - public function read(string $path): string + public static function persistByHash(string $data, string $path): int | bool { - return file_get_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}"); + if (!file_exists($path)) { + return file_put_contents($path, $data); + } + + if (md5($data) !== md5_file($path)) { + return file_put_contents($path, $data); + } + + return false; } - /** - * @param string $path - */ - public function delete(string $path) + public function read(string $path): string { - unlink($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}"); + return file_get_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . "/{$path}"); } - /** - * @param string $path - * @param string $data - */ - public function write(string $path, string $data) + public function requireFile(string $path): mixed { - file_put_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}", $data); + if (!empty($this->basePath)) { + return require "{$this->basePath}/{$this->localPath}/{$path}"; + } + + $code = file_get_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . "/{$path}"); + + return eval(str_replace('localPath}/{$destination}"; @@ -201,112 +249,26 @@ public function system(string $command, string $descriptor, string $destination) switch ($descriptor) { default: case 'stdout': - system("{$command} > ".escapeshellarg($redirect)); + system("{$command} > " . escapeshellarg($redirect)); break; case 'stderr': - system("{$command} 2> ".escapeshellarg($redirect)); + system("{$command} 2> " . escapeshellarg($redirect)); break; } } - /** - * @param string $path - * - * @return mixed - */ - public function requireFile(string $path) + public function write(string $path, string $data): void { - if (!empty($this->basePath)) { - return require "{$this->basePath}/{$this->localPath}/{$path}"; - } - - $code = file_get_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}"); - - return eval(str_replace('basePath.DIRECTORY_SEPARATOR.$this->localPath)) { - return; - } - - $contents = $this->listDirectoryRecursively($this->basePath.DIRECTORY_SEPARATOR.$this->localPath, RecursiveIteratorIterator::CHILD_FIRST); - - /** @var SplFileInfo $file */ - foreach ($contents as $file) { - $this->deleteFileInfoObject($file); - } - - unset($contents); - - rmdir($this->basePath.DIRECTORY_SEPARATOR.$this->localPath); - } - - /** - * This function does not perform operations in the temporary - * directory, but it caches the results to avoid reprocessing. - * - * @param string $algorithm - * @param string $sourceFile - * @param bool $useCache - * - * @return string - */ - public function getHashFile(string $algorithm, string $sourceFile, bool $useCache = false): string - { - if (false === $useCache) { - return hash_file($algorithm, $sourceFile); - } - - $cacheFile = sprintf( - '%s/%s/%s.%s', - $this->basePath, - $this->localPath, - $this->normalizePath($sourceFile), - $algorithm - ); - - if (!is_file($cacheFile)) { - $contents = hash_file($algorithm, $sourceFile); - file_put_contents($cacheFile, $contents); - - return $contents; - } - - if (filemtime($sourceFile) > filemtime($cacheFile)) { - $contents = hash_file($algorithm, $sourceFile); - file_put_contents($cacheFile, $contents); - - return $contents; - } - - return file_get_contents($cacheFile); - } - - /** - * @param string $path - * - * @return string - */ - public function normalizePath(string $path): string - { - return str_replace(['\\', ':', '/'], '_', $path); + file_put_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath . "/{$path}", $data); } protected function deleteFileInfoObject(SplFileInfo $file): bool { - switch ($file->getType()) { - case 'dir': - return @rmdir((string) $file->getRealPath()); - case 'link': - return @unlink($file->getPathname()); - default: - return @unlink((string) $file->getRealPath()); - } + return match ($file->getType()) { + 'dir' => @rmdir((string)$file->getRealPath()), + 'link' => @unlink($file->getPathname()), + default => @unlink((string)$file->getRealPath()), + }; } private function listDirectoryRecursively( @@ -318,4 +280,9 @@ private function listDirectoryRecursively( $mode ); } + + private function rightTrimPath(string $path): string + { + return rtrim($path, '\\/'); + } } diff --git a/Library/FunctionCall.php b/src/FunctionCall.php similarity index 79% rename from Library/FunctionCall.php rename to src/FunctionCall.php index e7c9ec1d9a..000d6d0b4b 100644 --- a/Library/FunctionCall.php +++ b/src/FunctionCall.php @@ -9,10 +9,32 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; +use ReflectionException; +use ReflectionFunction; use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use Zephir\Traits\VariablesTrait; + +use function class_exists; +use function count; +use function file_exists; +use function function_exists; +use function implode; +use function is_array; +use function is_object; +use function preg_match; +use function sprintf; +use function str_replace; +use function strtolower; +use function substr; +use function version_compare; + +use const DIRECTORY_SEPARATOR; +use const PHP_VERSION; /** * Call functions. By default, functions are called in the PHP userland if an optimizer @@ -20,85 +42,54 @@ */ class FunctionCall extends Call { - /** - * Function is called using a normal method name. - */ - const CALL_NORMAL = 1; + use VariablesTrait; /** * Function is called using a dynamic variable as method name. */ - const CALL_DYNAMIC = 2; - + public const CALL_DYNAMIC = 2; /** * Function is called using a dynamic string as method name. */ - const CALL_DYNAMIC_STRING = 3; - - protected static $optimizers = []; - - protected static $functionReflection = []; - + public const CALL_DYNAMIC_STRING = 3; + /** + * Function is called using a normal method name. + */ + public const CALL_NORMAL = 1; + protected static $functionReflection = []; protected static $optimizerDirectories = []; + protected static $optimizers = []; /** - * Process the ReflectionFunction for the specified function name. - * - * @param string $funcName + * Appends an optimizer directory to the directory list. * - * @return \ReflectionFunction|null + * @param string $directory */ - public function getReflector($funcName) + public static function addOptimizerDir($directory): void { - /* - * Check if the optimizer is already cached - */ - if (!isset(self::$functionReflection[$funcName])) { - try { - $reflectionFunction = new \ReflectionFunction($funcName); - } catch (\ReflectionException $e) { - $reflectionFunction = null; - } - self::$functionReflection[$funcName] = $reflectionFunction; - $this->reflection = $reflectionFunction; - - return $reflectionFunction; - } - $reflectionFunction = self::$functionReflection[$funcName]; - $this->reflection = $reflectionFunction; - - return $reflectionFunction; + self::$optimizerDirectories[] = $directory; } /** - * Checks if the function is a built-in provided by Zephir. + * Compiles a function. * - * @param string $functionName + * @param Expression $expr + * @param CompilationContext $compilationContext * - * @return bool + * @return CompiledExpression + * + * @throws CompilerException|Exception */ - public function isBuiltInFunction($functionName) + public function compile(Expression $expr, CompilationContext $compilationContext) { - switch ($functionName) { - case 'memstr': - case 'get_class_ns': - case 'get_ns_class': - case 'camelize': - case 'uncamelize': - case 'starts_with': - case 'ends_with': - case 'prepare_virtual_path': - case 'create_instance': - case 'create_instance_params': - case 'create_symbol_table': - case 'globals_get': - case 'globals_set': - case 'merge_append': - case 'get_class_lower': - return true; - } + $this->expression = $expr; + $expression = $expr->getExpression(); - return false; + return match ($expression['call-type']) { + self::CALL_NORMAL => $this->_callNormal($expression, $compilationContext), + self::CALL_DYNAMIC => $this->_callDynamic($expression, $compilationContext), + default => new CompiledExpression('null', null, $expression), + }; } /** @@ -111,19 +102,19 @@ public function isBuiltInFunction($functionName) */ public function functionExists($functionName, CompilationContext $context) { - if (\function_exists($functionName)) { + if (function_exists($functionName)) { return true; } if ($this->isBuiltInFunction($functionName)) { return true; } - $internalName = ['f__'.$functionName]; + $internalName = ['f__' . $functionName]; if (isset($context->classDefinition)) { $lowerNamespace = strtolower($context->classDefinition->getNamespace()); - $prefix = 'f_'.str_replace('\\', '_', $lowerNamespace); + $prefix = 'f_' . str_replace('\\', '_', $lowerNamespace); - $internalName[] = $prefix.'_'.$functionName; + $internalName[] = $prefix . '_' . $functionName; } foreach ($internalName as $name) { @@ -136,238 +127,211 @@ public function functionExists($functionName, CompilationContext $context) } /** - * Compiles a function. - * - * @param Expression $expr - * @param CompilationContext $compilationContext + * Process the ReflectionFunction for the specified function name. * - * @throws CompilerException|Exception + * @param string $funcName * - * @return CompiledExpression + * @return ReflectionFunction|null */ - public function compile(Expression $expr, CompilationContext $compilationContext) + public function getReflector($funcName) { - $this->expression = $expr; - $expression = $expr->getExpression(); + /* + * Check if the optimizer is already cached + */ + if (!isset(self::$functionReflection[$funcName])) { + try { + $reflectionFunction = new ReflectionFunction($funcName); + } catch (ReflectionException $e) { + $reflectionFunction = null; + } + self::$functionReflection[$funcName] = $reflectionFunction; + $this->reflection = $reflectionFunction; - switch ($expression['call-type']) { - case self::CALL_NORMAL: - return $this->_callNormal($expression, $compilationContext); - case self::CALL_DYNAMIC: - return $this->_callDynamic($expression, $compilationContext); + return $reflectionFunction; } + $reflectionFunction = self::$functionReflection[$funcName]; + $this->reflection = $reflectionFunction; - return new CompiledExpression('null', null, $expression); + return $reflectionFunction; } /** - * Appends an optimizer directory to the directory list. + * Checks if the function is a built-in provided by Zephir. * - * @param string $directory + * @param string $functionName + * + * @return bool */ - public static function addOptimizerDir($directory) + public function isBuiltInFunction(string $functionName) { - self::$optimizerDirectories[] = $directory; + return match ($functionName) { + 'memstr', + 'get_class_ns', + 'get_ns_class', + 'camelize', + 'uncamelize', + 'starts_with', + 'ends_with', + 'prepare_virtual_path', + 'create_instance', + 'create_instance_params', + 'create_symbol_table', + 'globals_get', + 'globals_set', + 'merge_append', + 'get_class_lower' => true, + default => false, + }; } /** - * This method gets the reflection of a function - * to check if any of their parameters are passed by reference - * Built-in functions rarely change the parameters if they aren't passed by reference. + * @param array $expression + * @param CompilationContext $compilationContext * - * @param string $funcName - * @param array $expression + * @return CompiledExpression * * @throws CompilerException - * - * @return bool */ - protected function isReadOnly($funcName, array $expression) + protected function _callDynamic(array $expression, CompilationContext $compilationContext) { - if ($this->isBuiltInFunction($funcName)) { - return false; - } + $variable = $compilationContext->symbolTable->getVariableForRead( + $expression['name'], + $compilationContext, + $expression + ); - /* - * These functions are supposed to be read-only but they change parameters ref-count - */ - switch ($funcName) { - case 'min': - case 'max': - case 'array_fill': - case 'array_pad': - case 'call_user_func': - case 'call_user_func_array': - return false; - } + switch ($variable->getType()) { + case 'variable': + case 'string': + break; - $reflector = $this->getReflector($funcName); - if (!$reflector instanceof \ReflectionFunction) { - return false; + default: + throw new CompilerException( + 'Variable type: ' . $variable->getType() . ' cannot be used as dynamic caller', + $expression['left'] + ); } - $messageFormat = "The number of parameters passed is lesser than the number of required parameters by '%s'"; - + /** + * Resolve parameters + */ if (isset($expression['parameters'])) { - /** - * Check if the number of parameters. - */ - $numberParameters = \count($expression['parameters']); - if ('unpack' == $funcName && - (0 == version_compare(PHP_VERSION, '7.1.0') || - 0 == version_compare(PHP_VERSION, '7.1.1')) - ) { - if ($numberParameters < 2) { - throw new CompilerException(sprintf($messageFormat, $funcName), $expression); - } - } else { - if ($numberParameters < $reflector->getNumberOfRequiredParameters()) { - throw new CompilerException(sprintf($messageFormat, $funcName), $expression); - } - } + $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); } else { - if ($reflector->getNumberOfRequiredParameters() > 0) { - throw new CompilerException(sprintf($messageFormat, $funcName), $expression); - } - } - - if ($reflector->getNumberOfParameters() > 0) { - foreach ($reflector->getParameters() as $parameter) { - if ($parameter->isPassedByReference()) { - return false; - } - } + $params = []; } - return true; - } - - /** - * Once the function processes the parameters we should mark - * specific parameters to be passed by reference. - * - * @param string $funcName - * @param array $parameters - * @param CompilationContext $compilationContext - * @param array $references - * @param array $expression - */ - protected function markReferences( - $funcName, - $parameters, - CompilationContext $compilationContext, - &$references, - $expression - ) { - if ($this->isBuiltInFunction($funcName)) { - return; - } + $codePrinter = $compilationContext->codePrinter; - $reflector = $this->getReflector($funcName); - if ($reflector) { - $numberParameters = \count($parameters); - if ($numberParameters > 0) { - $n = 1; - $funcParameters = $reflector->getParameters(); - $isZendEngine3 = $compilationContext->backend->isZE3(); - foreach ($funcParameters as $parameter) { - if ($numberParameters >= $n) { - if ($parameter->isPassedByReference()) { - /* TODO hack, fix this better */ - if ($isZendEngine3 && '&' == $parameters[$n - 1][0]) { - $parameters[$n - 1] = substr($parameters[$n - 1], 1); - } + /** + * Process the expected symbol to be returned + */ + $this->processExpectedObservedReturn($compilationContext); - if (!preg_match('/^[a-zA-Z0-9$\_]+$/', $parameters[$n - 1])) { - $compilationContext->logger->warning( - 'Cannot mark complex expression as reference', - ['invalid-reference', $expression] - ); - continue; - } + /** + * At this point the function will be called in the PHP userland. + * PHP functions only return zvals, so we need to validate the target variable is also a zval. + */ + $symbolVariable = $this->getSymbolVariable(); + if ($symbolVariable) { + $this->checkNotVariable($symbolVariable, $expression); - $variable = $compilationContext->symbolTable->getVariable($parameters[$n - 1]); - if ($variable) { - $variable->setDynamicTypes('undefined'); - $referenceSymbol = $compilationContext->backend->getVariableCode($variable); - $compilationContext->codePrinter->output('ZEPHIR_MAKE_REF('.$referenceSymbol.');'); - $references[] = $parameters[$n - 1]; - } - } - } - ++$n; - } - } + /** + * We don't know the exact dynamic type returned by the method call + */ + $symbolVariable->setDynamicTypes('undefined'); } - } - /** - * Tries to find specific an specialized optimizer for function calls. - * - * @param string $funcName - * @param array $expression - * @param Call $call - * @param CompilationContext $compilationContext - * - * @throws Exception - * - * @return bool|mixed - */ - protected function optimize($funcName, array $expression, Call $call, CompilationContext $compilationContext) - { - $optimizer = false; + /** + * Include fcall header + */ + $compilationContext->headersManager->add('kernel/fcall'); - /* - * Check if the optimizer is already cached + /** + * Add the last call status to the current symbol table */ - if (!isset(self::$optimizers[$funcName])) { - $camelizeFunctionName = camelize($funcName); + $this->addCallStatusFlag($compilationContext); - /* - * Check every optimizer directory for an optimizer - */ - foreach (self::$optimizerDirectories as $directory) { - $path = $directory.\DIRECTORY_SEPARATOR.$camelizeFunctionName.'Optimizer.php'; - $className = 'Zephir\Optimizers\FunctionCall\\'.$camelizeFunctionName.'Optimizer'; + /** + * Call functions must grow the stack + */ + $compilationContext->symbolTable->mustGrownStack(true); - if (file_exists($path)) { - if (!class_exists($className, false)) { - require_once $path; + if (!isset($expression['parameters'])) { + if ($this->isExpectingReturn()) { + if ('return_value' != $symbolVariable->getName()) { + if ($this->mustInitSymbolVariable()) { + $symbolVariable->setMustInitNull(true); + $symbolVariable->trackVariant($compilationContext); } - - if (!class_exists($className, false)) { - throw new Exception("Class {$className} cannot be loaded"); + } + $compilationContext->backend->callDynamicFunction($symbolVariable, $variable, $compilationContext); + } else { + $compilationContext->backend->callDynamicFunction(null, $variable, $compilationContext); + } + } else { + if (count($params)) { + if ($this->isExpectingReturn()) { + if ('return_value' != $symbolVariable->getName()) { + if ($this->mustInitSymbolVariable()) { + $symbolVariable->setMustInitNull(true); + $symbolVariable->trackVariant($compilationContext); + } } - - $optimizer = new $className(); - - if (!($optimizer instanceof OptimizerAbstract)) { - throw new Exception("Class {$className} must be instance of OptimizerAbstract"); + $compilationContext->backend->callDynamicFunction( + $symbolVariable, + $variable, + $compilationContext, + $params + ); + } else { + $compilationContext->backend->callDynamicFunction(null, $variable, $compilationContext, $params); + } + } else { + if ($this->isExpectingReturn()) { + if ('return_value' != $symbolVariable->getName()) { + if ($this->mustInitSymbolVariable()) { + $symbolVariable->setMustInitNull(true); + $symbolVariable->trackVariant($compilationContext); + } } - - break; + $compilationContext->backend->callDynamicFunction($symbolVariable, $variable, $compilationContext); + } else { + $compilationContext->backend->callDynamicFunction(null, $variable, $compilationContext); } } + } - self::$optimizers[$funcName] = $optimizer; - } else { - $optimizer = self::$optimizers[$funcName]; + /** + * Temporary variables must be copied if they have more than one reference + */ + foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { + $codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); + } + + $this->addCallStatusOrJump($compilationContext); + + /** + * We can mark temporary variables generated as idle + */ + foreach ($this->getTemporalVariables() as $tempVariable) { + $tempVariable->setIdle(true); } - if ($optimizer) { - return $optimizer->optimize($expression, $call, $compilationContext); + if ($this->isExpectingReturn()) { + return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } - return false; + return new CompiledExpression('null', null, $expression); } /** * @param array $expression * @param CompilationContext $compilationContext * - * @throws Exception|\Zephir\Exception\CompilerException - * * @return CompiledExpression + * + * @throws Exception|CompilerException */ protected function _callNormal(array $expression, CompilationContext $compilationContext) { @@ -381,7 +345,7 @@ protected function _callNormal(array $expression, CompilationContext $compilatio * Try to optimize function calls using existing optimizers. */ $compiledExpr = $this->optimize($funcName, $expression, $this, $compilationContext); - if (\is_object($compiledExpr)) { + if (is_object($compiledExpr)) { return $compiledExpr; } @@ -429,22 +393,17 @@ protected function _callNormal(array $expression, CompilationContext $compilatio /** * At this point the function will be called in the PHP userland. - * PHP functions only return zvals so we need to validate the target variable is also a zval. + * PHP functions only return zvals, so we need to validate the target variable is also a zval. */ $symbolVariable = $this->getSymbolVariable(); if ($symbolVariable) { - if (!$symbolVariable->isVariable()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } + $this->checkNotVariable($symbolVariable, $expression); /** * We don't know the exact dynamic type returned by the method call */ $symbolVariable->setDynamicTypes('undefined'); - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } /** @@ -453,7 +412,7 @@ protected function _callNormal(array $expression, CompilationContext $compilatio $compilationContext->headersManager->add('kernel/fcall'); /** - * Call functions must grown the stack + * Call functions must grow the stack */ $compilationContext->symbolTable->mustGrownStack(true); @@ -461,18 +420,18 @@ protected function _callNormal(array $expression, CompilationContext $compilatio * Check if the function can have an inline cache. */ $functionCache = $compilationContext->cacheManager->getFunctionCache(); - $cachePointer = $functionCache->get($funcName, $compilationContext, $exists); + $cachePointer = $functionCache->get($funcName, $compilationContext, $exists); /** * Add the last call status to the current symbol table */ $this->addCallStatusFlag($compilationContext); - if (!\count($params)) { + if (!count($params)) { if ($this->isExpectingReturn()) { if ('return_value' == $symbolVariable->getName()) { $codePrinter->output( - 'ZEPHIR_RETURN_CALL_FUNCTION("'.$funcName.'", '.$cachePointer.');' + 'ZEPHIR_RETURN_CALL_FUNCTION("' . $funcName . '", ' . $cachePointer . ');' ); } else { if ($this->mustInitSymbolVariable()) { @@ -480,20 +439,20 @@ protected function _callNormal(array $expression, CompilationContext $compilatio $symbolVariable->trackVariant($compilationContext); } $codePrinter->output( - 'ZEPHIR_CALL_FUNCTION('.$symbol.', "'.$funcName.'", '.$cachePointer.');' + 'ZEPHIR_CALL_FUNCTION(' . $symbol . ', "' . $funcName . '", ' . $cachePointer . ');' ); } } else { - $codePrinter->output('ZEPHIR_CALL_FUNCTION(NULL, "'.$funcName.'", '.$cachePointer.');'); + $codePrinter->output('ZEPHIR_CALL_FUNCTION(NULL, "' . $funcName . '", ' . $cachePointer . ');'); } } else { if ($this->isExpectingReturn()) { if ('return_value' == $symbolVariable->getName()) { $codePrinter->output( strtr('ZEPHIR_RETURN_CALL_FUNCTION(":func", :pointer, :params);', [ - ':func' => $funcName, + ':func' => $funcName, ':pointer' => $cachePointer, - ':params' => implode(', ', $params), + ':params' => implode(', ', $params), ]) ); } else { @@ -504,19 +463,19 @@ protected function _callNormal(array $expression, CompilationContext $compilatio $codePrinter->output( strtr('ZEPHIR_CALL_FUNCTION(:symbol, ":func", :pointer, :params);', [ - ':symbol' => $symbol, - ':func' => $funcName, + ':symbol' => $symbol, + ':func' => $funcName, ':pointer' => $cachePointer, - ':params' => implode(', ', $params), + ':params' => implode(', ', $params), ]) ); } } else { $codePrinter->output( strtr('ZEPHIR_CALL_FUNCTION(NULL, ":func", :pointer, :params);', [ - ':func' => $funcName, + ':func' => $funcName, ':pointer' => $cachePointer, - ':params' => implode(', ', $params), + ':params' => implode(', ', $params), ]) ); } @@ -526,14 +485,14 @@ protected function _callNormal(array $expression, CompilationContext $compilatio * Temporary variables must be copied if they have more than one reference */ foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); + $codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); } - if (\is_array($references)) { + if (is_array($references)) { foreach ($references as $reference) { $variable = $compilationContext->symbolTable->getVariable($reference, $compilationContext); $compilationContext->codePrinter->output( - 'ZEPHIR_UNREF('.$compilationContext->backend->getVariableCode($variable).');' + 'ZEPHIR_UNREF(' . $compilationContext->backend->getVariableCode($variable) . ');' ); } } @@ -555,148 +514,195 @@ protected function _callNormal(array $expression, CompilationContext $compilatio } /** - * @param array $expression - * @param CompilationContext $compilationContext + * This method gets the reflection of a function + * to check if any of their parameters are passed by reference + * Built-in functions rarely change the parameters if they aren't passed by reference. * - * @throws CompilerException + * @param string $funcName + * @param array $expression * - * @return CompiledExpression + * @return bool + * + * @throws CompilerException */ - protected function _callDynamic(array $expression, CompilationContext $compilationContext) + protected function isReadOnly($funcName, array $expression) { - $variable = $compilationContext->symbolTable->getVariableForRead( - $expression['name'], - $compilationContext, - $expression - ); - - switch ($variable->getType()) { - case 'variable': - case 'string': - break; - - default: - throw new CompilerException( - 'Variable type: '.$variable->getType().' cannot be used as dynamic caller', - $expression['left'] - ); + if ($this->isBuiltInFunction($funcName)) { + return false; } - /** - * Resolve parameters + /* + * These functions are supposed to be read-only, but they change parameters ref-count */ - if (isset($expression['parameters'])) { - $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); - } else { - $params = []; + switch ($funcName) { + case 'min': + case 'max': + case 'array_fill': + case 'array_pad': + case 'call_user_func': + case 'call_user_func_array': + return false; } - $codePrinter = $compilationContext->codePrinter; - - /** - * Process the expected symbol to be returned - */ - $this->processExpectedObservedReturn($compilationContext); + $reflector = $this->getReflector($funcName); + if (!$reflector instanceof ReflectionFunction) { + return false; + } - /** - * At this point the function will be called in the PHP userland. - * PHP functions only return zvals so we need to validate the target variable is also a zval. - */ - $symbolVariable = $this->getSymbolVariable(); - if ($symbolVariable) { - if (!$symbolVariable->isVariable()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } + $messageFormat = "The number of parameters passed is lesser than the number of required parameters by '%s'"; + if (isset($expression['parameters'])) { /** - * We don't know the exact dynamic type returned by the method call + * Check if the number of parameters. */ - $symbolVariable->setDynamicTypes('undefined'); - } - - /** - * Include fcall header - */ - $compilationContext->headersManager->add('kernel/fcall'); - - /** - * Add the last call status to the current symbol table - */ - $this->addCallStatusFlag($compilationContext); - - /** - * Call functions must grown the stack - */ - $compilationContext->symbolTable->mustGrownStack(true); - - if (!isset($expression['parameters'])) { - if ($this->isExpectingReturn()) { - if ('return_value' != $symbolVariable->getName()) { - if ($this->mustInitSymbolVariable()) { - $symbolVariable->setMustInitNull(true); - $symbolVariable->trackVariant($compilationContext); - } + $numberParameters = count($expression['parameters']); + if ( + 'unpack' == $funcName && + ( + 0 == version_compare(PHP_VERSION, '7.1.0') || + 0 == version_compare(PHP_VERSION, '7.1.1') + ) + ) { + if ($numberParameters < 2) { + throw new CompilerException(sprintf($messageFormat, $funcName), $expression); } - $compilationContext->backend->callDynamicFunction($symbolVariable, $variable, $compilationContext); } else { - $compilationContext->backend->callDynamicFunction(null, $variable, $compilationContext); + if ($numberParameters < $reflector->getNumberOfRequiredParameters()) { + throw new CompilerException(sprintf($messageFormat, $funcName), $expression); + } } } else { - if (\count($params)) { - if ($this->isExpectingReturn()) { - if ('return_value' != $symbolVariable->getName()) { - if ($this->mustInitSymbolVariable()) { - $symbolVariable->setMustInitNull(true); - $symbolVariable->trackVariant($compilationContext); - } - } - $compilationContext->backend->callDynamicFunction( - $symbolVariable, - $variable, - $compilationContext, - $params - ); - } else { - $compilationContext->backend->callDynamicFunction(null, $variable, $compilationContext, $params); + if ($reflector->getNumberOfRequiredParameters() > 0) { + throw new CompilerException(sprintf($messageFormat, $funcName), $expression); + } + } + + if ($reflector->getNumberOfParameters() > 0) { + foreach ($reflector->getParameters() as $parameter) { + if ($parameter->isPassedByReference()) { + return false; } - } else { - if ($this->isExpectingReturn()) { - if ('return_value' != $symbolVariable->getName()) { - if ($this->mustInitSymbolVariable()) { - $symbolVariable->setMustInitNull(true); - $symbolVariable->trackVariant($compilationContext); + } + } + + return true; + } + + /** + * Once the function processes the parameters we should mark + * specific parameters to be passed by reference. + * + * @param string $funcName + * @param array $parameters + * @param CompilationContext $compilationContext + * @param array $references + * @param array $expression + */ + protected function markReferences( + $funcName, + $parameters, + CompilationContext $compilationContext, + &$references, + $expression + ): void { + if ($this->isBuiltInFunction($funcName)) { + return; + } + + $reflector = $this->getReflector($funcName); + if ($reflector) { + $numberParameters = count($parameters); + if ($numberParameters > 0) { + $n = 1; + $funcParameters = $reflector->getParameters(); + foreach ($funcParameters as $parameter) { + if ($numberParameters >= $n) { + if ($parameter->isPassedByReference()) { + /* TODO hack, fix this better */ + if ('&' === $parameters[$n - 1][0]) { + $parameters[$n - 1] = substr($parameters[$n - 1], 1); + } + + if (!preg_match('/^[a-zA-Z0-9$_]+$/', $parameters[$n - 1])) { + $compilationContext->logger->warning( + 'Cannot mark complex expression as reference', + ['invalid-reference', $expression] + ); + continue; + } + + $variable = $compilationContext->symbolTable->getVariable($parameters[$n - 1]); + if ($variable) { + $variable->setDynamicTypes('undefined'); + $referenceSymbol = $compilationContext->backend->getVariableCode($variable); + $compilationContext->codePrinter->output('ZEPHIR_MAKE_REF(' . $referenceSymbol . ');'); + $references[] = $parameters[$n - 1]; + } } } - $compilationContext->backend->callDynamicFunction($symbolVariable, $variable, $compilationContext); - } else { - $compilationContext->backend->callDynamicFunction(null, $variable, $compilationContext); + ++$n; } } } + } - /** - * Temporary variables must be copied if they have more than one reference + /** + * Tries to find specific a specialized optimizer for function calls. + * + * @param string $funcName + * @param array $expression + * @param Call $call + * @param CompilationContext $compilationContext + * + * @return bool|mixed + * + * @throws Exception + */ + protected function optimize($funcName, array $expression, Call $call, CompilationContext $compilationContext) + { + $optimizer = false; + + /* + * Check if the optimizer is already cached */ - foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); - } + if (!isset(self::$optimizers[$funcName])) { + $camelizeFunctionName = Name::camelize($funcName); - $this->addCallStatusOrJump($compilationContext); + /* + * Check every optimizer directory for an optimizer + */ + foreach (self::$optimizerDirectories as $directory) { + $path = $directory . DIRECTORY_SEPARATOR . $camelizeFunctionName . 'Optimizer.php'; + $className = 'Zephir\Optimizers\FunctionCall\\' . $camelizeFunctionName . 'Optimizer'; - /** - * We can mark temporary variables generated as idle - */ - foreach ($this->getTemporalVariables() as $tempVariable) { - $tempVariable->setIdle(true); + if (file_exists($path)) { + if (!class_exists($className, false)) { + require_once $path; + } + + if (!class_exists($className, false)) { + throw new Exception("Class {$className} cannot be loaded"); + } + + $optimizer = new $className(); + + if (!($optimizer instanceof OptimizerAbstract)) { + throw new Exception("Class {$className} must be instance of OptimizerAbstract"); + } + + break; + } + } + + self::$optimizers[$funcName] = $optimizer; + } else { + $optimizer = self::$optimizers[$funcName]; } - if ($this->isExpectingReturn()) { - return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); + if ($optimizer) { + return $optimizer->optimize($expression, $call, $compilationContext); } - return new CompiledExpression('null', null, $expression); + return false; } } diff --git a/Library/FunctionDefinition.php b/src/FunctionDefinition.php similarity index 54% rename from Library/FunctionDefinition.php rename to src/FunctionDefinition.php index 53116f1c75..bc3a4efd59 100644 --- a/Library/FunctionDefinition.php +++ b/src/FunctionDefinition.php @@ -13,49 +13,27 @@ namespace Zephir; +use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; + /** - * FunctionDefinition. - * * Represents a function */ -class FunctionDefinition extends ClassMethod +class FunctionDefinition extends Method { - /** - * The namespace of the function. - */ - private string $namespace; - /** * Whether the function is declared in a global or namespaced scope. - * - * @var bool */ private bool $isGlobal = false; - /** - * FunctionDefinition constructor. - * - * @param string $namespace - * @param string $name - * @param ClassMethodParameters|null $parameters - * @param StatementsBlock|null $statements - * @param array|null $returnType - * @param array|null $expression - */ public function __construct( - string $namespace, - string $name, - ClassMethodParameters $parameters = null, - StatementsBlock $statements = null, + private string $namespace, + protected string $name, + protected ?Parameters $parameters = null, + protected ?StatementsBlock $statements = null, array $returnType = null, - array $expression = null + protected ?array $expression = [], ) { - $this->namespace = $namespace; - $this->name = $name; - $this->parameters = $parameters; - $this->statements = $statements; - $this->expression = $expression; - $this->setReturnTypes($returnType); } @@ -64,36 +42,36 @@ public function __construct( */ public function getInternalName(): string { - return ($this->isGlobal() ? 'g_' : 'f_').str_replace('\\', '_', $this->namespace).'_'.$this->getName(); + return ($this->isGlobal() ? 'g_' : 'f_') . str_replace('\\', '_', $this->namespace) . '_' . $this->getName(); } - public function isGlobal(): bool + public function getNamespace(): string { - return $this->isGlobal; + return $this->namespace; } - public function setGlobal(bool $global): void + public function getVisibility(): array { - $this->isGlobal = $global; + return []; } - public function getNamespace(): string + public function hasModifier(string $modifier): bool { - return $this->namespace; + return false; } - public function setNamespace(string $namespace): void + public function isGlobal(): bool { - $this->namespace = $namespace; + return $this->isGlobal; } - public function hasModifier(string $modifier): bool + public function setGlobal(bool $global): void { - return false; + $this->isGlobal = $global; } - public function getVisibility(): array + public function setNamespace(string $namespace): void { - return []; + $this->namespace = $namespace; } } diff --git a/Library/GlobalConstant.php b/src/GlobalConstant.php similarity index 66% rename from Library/GlobalConstant.php rename to src/GlobalConstant.php index 6a5a330a51..ccdb393665 100644 --- a/Library/GlobalConstant.php +++ b/src/GlobalConstant.php @@ -9,44 +9,34 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; /** - * GlobalConstant. + * Creates a new global constant. * * Global constants are allocated one time at extension initialization * and are referenced across the C code saving memory */ class GlobalConstant { - protected $name; - - /** - * Creates a new global constant. - * - * @param string $name - */ - public function __construct($name) + public function __construct(protected string $name) { - $this->name = $name; } /** * Returns global constant name. - * - * @return string */ - public function getName() + public function getName(): string { return $this->name; } /** * Check if the global constant is temporal. - * - * @return bool */ - public function isTemporal() + public function isTemporal(): bool { return false; } diff --git a/Library/HeadersManager.php b/src/HeadersManager.php similarity index 72% rename from Library/HeadersManager.php rename to src/HeadersManager.php index 10d078cd18..2794b4d2df 100644 --- a/Library/HeadersManager.php +++ b/src/HeadersManager.php @@ -9,11 +9,16 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; +use InvalidArgumentException; + +use function array_merge; +use function is_string; + /** - * Class HeadersManager. - * * Manages the c-headers that must be added to a file */ class HeadersManager @@ -21,33 +26,33 @@ class HeadersManager /** * Insert the header at the beginning of the header list. */ - const POSITION_FIRST = 1; + public const POSITION_FIRST = 1; /** * Insert the header at the end of the header list. */ - const POSITION_LAST = 2; + public const POSITION_LAST = 2; /** * List of headers. * * @var array */ - protected $headers = []; + protected array $headers = []; /** * List of headers. * * @var array */ - protected $headersFirst = []; + protected array $headersFirst = []; /** * List of headers. * * @var array */ - protected $headersLast = []; + protected array $headersLast = []; /** * Adds a header path to the manager. @@ -55,12 +60,12 @@ class HeadersManager * @param string $path * @param int $position * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ - public function add($path, $position = 0) + public function add($path, $position = 0): void { - if (!\is_string($path)) { - throw new \InvalidArgumentException('$path must be only string type'); + if (!is_string($path)) { + throw new InvalidArgumentException('$path must be only string type'); } if (!$position) { @@ -81,10 +86,8 @@ public function add($path, $position = 0) /** * Returns a set of headers merged. - * - * @return array */ - public function get() + public function get(): array { return array_merge($this->headersFirst, $this->headers, $this->headersLast); } diff --git a/Library/LiteralCompiledExpression.php b/src/LiteralCompiledExpression.php similarity index 79% rename from Library/LiteralCompiledExpression.php rename to src/LiteralCompiledExpression.php index f8c20af30a..613a9ce6a8 100644 --- a/Library/LiteralCompiledExpression.php +++ b/src/LiteralCompiledExpression.php @@ -9,12 +9,14 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; /** * LiteralCompiledExpression. * - * This represent a compiled expression as CompiledExpression, but the contents of + * This represents a compiled expression as CompiledExpression, but the contents of * the resolved code is potentially a simple literal expression */ class LiteralCompiledExpression extends CompiledExpression diff --git a/Library/Logger/Formatter/CompilerFormatter.php b/src/Logger/Formatter/CompilerFormatter.php similarity index 80% rename from Library/Logger/Formatter/CompilerFormatter.php rename to src/Logger/Formatter/CompilerFormatter.php index edb940f9bc..20f681c7fa 100644 --- a/Library/Logger/Formatter/CompilerFormatter.php +++ b/src/Logger/Formatter/CompilerFormatter.php @@ -18,7 +18,16 @@ use function array_key_exists; use function count; +use function file; +use function file_exists; use function is_array; +use function preg_replace; +use function str_repeat; +use function str_replace; +use function strtolower; +use function ucfirst; + +use const PHP_EOL; /** * Formatter for warnings/notices/errors generated in compilation. @@ -27,30 +36,16 @@ final class CompilerFormatter extends LineFormatter { public const SIMPLE_FORMAT = " %level_name%: %message% in %file% on line %line% %type%\n"; - /** - * @var Config - */ - private Config $config; - /** * The contents of the files that are involved in the log message. - * - * @var array */ private array $filesContent = []; - public function __construct(Config $config) + public function __construct(private Config $config) { parent::__construct(); - - $this->config = $config; } - /** - * @param array $record - * - * @return string - */ public function format(array $record): string { if ($this->config->get('silent')) { @@ -67,7 +62,8 @@ public function format(array $record): string $output = str_replace('%context%', '', $output); // ignore empty context or invalid format - if (!empty($vars['context']) && + if ( + !empty($vars['context']) && is_array($vars['context']) && 2 == count($vars['context']) ) { @@ -86,14 +82,14 @@ public function format(array $record): string } else { $vars['file'] = $node['file']; $vars['line'] = $node['line']; - $output .= PHP_EOL; + $output .= PHP_EOL; $lines = $this->getFileContents($node['file']); if (isset($lines[$node['line'] - 1])) { - $line = $lines[$node['line'] - 1]; - $output .= "\t".str_replace("\t", ' ', $line); + $line = $lines[$node['line'] - 1]; + $output .= "\t" . str_replace("\t", ' ', $line); if (($node['char'] - 1) > 0) { - $output .= PHP_EOL."\t".str_repeat('-', $node['char'] - 1).'^'.PHP_EOL; + $output .= PHP_EOL . "\t" . str_repeat('-', $node['char'] - 1) . '^' . PHP_EOL; } } } @@ -108,6 +104,33 @@ public function format(array $record): string return $this->cleanExtraPlaceholders($output); } + /** + * Remove leftover %extra.xxx% and %context.xxx% (if any). + */ + private function cleanExtraPlaceholders(string $output): string + { + if (str_contains($output, '%')) { + $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output); + $output = preg_replace('/ %type%\n/', "\n", $output); + $output = preg_replace('/on line %line%/', '', $output); + $output = preg_replace('/ in %file% /', '', $output); + } + + return $output; + } + + /** + * Gets the contents of the files that are involved in the log message. + */ + private function getFileContents(string $file): array + { + if (!isset($this->filesContent[$file])) { + $this->filesContent[$file] = file_exists($file) ? file($file) : []; + } + + return $this->filesContent[$file]; + } + private function replacePlaceholders(array $vars, $output) { // WARNING -> Warning @@ -116,10 +139,10 @@ private function replacePlaceholders(array $vars, $output) } foreach ($vars as $var => $val) { - $placeholder = '%'.$var.'%'; - $realValue = $this->stringify($val); + $placeholder = '%' . $var . '%'; + $realValue = $this->stringify($val); - if (false === strpos($output, $placeholder)) { + if (!str_contains($output, $placeholder)) { continue; } @@ -133,44 +156,9 @@ private function replacePlaceholders(array $vars, $output) } } - $output = str_replace('%'.$var.'%', $realValue, $output); + $output = str_replace('%' . $var . '%', $realValue, $output); } return $output; } - - /** - * Remove leftover %extra.xxx% and %context.xxx% (if any). - * - * @param string $output - * - * @return string - */ - private function cleanExtraPlaceholders(string $output): string - { - if (false !== strpos($output, '%')) { - $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output); - $output = preg_replace('/ %type%\n/', "\n", $output); - $output = preg_replace('/on line %line%/', '', $output); - $output = preg_replace('/ in %file% /', '', $output); - } - - return $output; - } - - /** - * Gets the contents of the files that are involved in the log message. - * - * @param string $file File path - * - * @return array - */ - private function getFileContents(string $file): array - { - if (!isset($this->filesContent[$file])) { - $this->filesContent[$file] = file_exists($file) ? file($file) : []; - } - - return $this->filesContent[$file]; - } } diff --git a/Library/MethodCall.php b/src/MethodCall.php similarity index 83% rename from Library/MethodCall.php rename to src/MethodCall.php index 2046bc120a..582562246b 100644 --- a/Library/MethodCall.php +++ b/src/MethodCall.php @@ -9,40 +9,61 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; +use ReflectionException; +use ReflectionMethod; +use Zephir\Class\Method\Method; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; +use Zephir\Traits\VariablesTrait; +use Zephir\Types\AbstractType; +use Zephir\Types\Types; +use Zephir\Variable\Variable; + +use function class_exists; +use function count; +use function implode; +use function is_array; +use function is_object; +use function sprintf; +use function strtolower; +use function ucfirst; /** - * MethodCall. - * * Call methods in a non-static context */ class MethodCall extends Call { - /** - * Function is called using a normal method name. - */ - const CALL_NORMAL = 1; + use VariablesTrait; /** * Function is called using a dynamic variable as method name. */ - const CALL_DYNAMIC = 2; - + public const CALL_DYNAMIC = 2; /** * Function is called using a dynamic string as method name. */ - const CALL_DYNAMIC_STRING = 3; + public const CALL_DYNAMIC_STRING = 3; + /** + * Function is called using a normal method name. + */ + public const CALL_NORMAL = 1; /** * Compiles a method call. * * @param Expression $expr * @param CompilationContext $compilationContext + * + * @return mixed|CompiledExpression + * + * @throws Exception + * @throws ReflectionException */ - public function compile(Expression $expr, CompilationContext $compilationContext) + public function compile(Expression $expr, CompilationContext $compilationContext): mixed { $expression = $expr->getExpression(); @@ -64,16 +85,16 @@ public function compile(Expression $expr, CompilationContext $compilationContext break; default: /* Check if there is a built-in type optimizer available */ - $builtInTypeClass = 'Zephir\Types\\'.ucfirst($variableVariable->getType()).'Type'; + $builtInTypeClass = 'Zephir\Types\\' . ucfirst($variableVariable->getType()) . 'Type'; if (class_exists($builtInTypeClass)) { /** - * @var \Zephir\Types\AbstractType + * @var AbstractType $builtInType */ $builtInType = new $builtInTypeClass(); - $caller = $exprCompiledVariable; + $caller = $exprCompiledVariable; } else { throw new CompilerException( - 'Methods cannot be called on variable type: '.$variableVariable->getType(), + 'Methods cannot be called on variable type: ' . $variableVariable->getType(), $expression ); } @@ -81,13 +102,13 @@ public function compile(Expression $expr, CompilationContext $compilationContext break; default: /* Check if there is a built-in type optimizer available */ - $builtInTypeClass = 'Zephir\Types\\'.ucfirst($exprCompiledVariable->getType()).'Type'; + $builtInTypeClass = 'Zephir\Types\\' . ucfirst($exprCompiledVariable->getType()) . 'Type'; if (class_exists($builtInTypeClass)) { $builtInType = new $builtInTypeClass(); - $caller = $exprCompiledVariable; + $caller = $exprCompiledVariable; } else { throw new CompilerException( - 'Cannot use expression: '.$exprCompiledVariable->getType().' as method caller', + 'Cannot use expression: ' . $exprCompiledVariable->getType() . ' as method caller', $expression['variable'] ); } @@ -97,7 +118,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext $type = $expression['call-type']; - /* + /** * In normal method calls and dynamic string method calls we just use the name given by the user */ if (self::CALL_NORMAL == $type || self::CALL_DYNAMIC_STRING == $type) { @@ -109,16 +130,17 @@ public function compile(Expression $expr, CompilationContext $compilationContext $expression ); - if (\is_object($builtInType)) { + if (is_object($builtInType)) { throw new CompilerException( - 'Dynamic method invocation for type: '.$variableMethod->getType().' is not supported', + 'Dynamic method invocation for type: ' . $variableMethod->getType() . ' is not supported', $expression ); } if ($variableMethod->isNotVariableAndString()) { - throw new CompilerException( - 'Cannot use variable type: '.$variableMethod->getType().' as dynamic method name', + throw CompilerException::cannotUseVariableTypeAs( + $variableMethod, + 'as a dynamic method name', $expression ); } @@ -129,17 +151,16 @@ public function compile(Expression $expr, CompilationContext $compilationContext /** * Create temporary variable if needed. */ - $mustInit = false; + $mustInit = false; $isExpecting = $expr->isExpectingReturn(); if ($isExpecting) { $symbolVariable = $expr->getExpectingVariable(); - if (\is_object($symbolVariable)) { - $readDetector = new ReadDetector($expression); + if (is_object($symbolVariable)) { + $readDetector = new ReadDetector(); if ($caller == $symbolVariable || $readDetector->detect($symbolVariable->getName(), $expression)) { $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( 'variable', $compilationContext, - $expression ); } else { $mustInit = true; @@ -148,22 +169,16 @@ public function compile(Expression $expr, CompilationContext $compilationContext $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( 'variable', $compilationContext, - $expression ); } } /* - * Method calls only return zvals so we need to validate the target variable is also a zval + * Method calls only return zvals, so we need to validate the target variable is also a zval */ if (!$builtInType) { if ($isExpecting) { - if (!$symbolVariable->isVariable()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } + $this->checkNotVariable($symbolVariable, $expression); /* * At this point, we don't know the exact dynamic type returned by the method call @@ -195,7 +210,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext $interfaces = null; } - if (\is_array($interfaces)) { + if (is_array($interfaces)) { $compiler = $compilationContext->compiler; foreach ($interfaces as $interface) { $classInterfaceDefinition = $compiler->getClassDefinition($interface); @@ -204,14 +219,14 @@ public function compile(Expression $expr, CompilationContext $compilationContext $classInterfaceDefinition = $compiler->getInternalClassDefinition($interface); if (!$classInterfaceDefinition) { throw new CompilerException( - "Couldn't locate internal or external interface: ".$interface, + "Couldn't locate internal or external interface: " . $interface, $expression ); } } if ($classInterfaceDefinition->hasMethod($methodName)) { - $found = true; + $found = true; $classMethod = $classInterfaceDefinition->getMethod($methodName); break; } @@ -255,7 +270,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($classMethod->isPrivate()) { if ($classMethod->getClassDefinition() !== $classDefinition) { throw new CompilerException( - "Cannot call private method '".$expression['name']."' out of its scope", + "Cannot call private method '" . $expression['name'] . "' out of its scope", $expression ); } @@ -265,7 +280,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext * Try to produce an exception if method is called with a wrong number of parameters */ if (isset($expression['parameters'])) { - $callNumberParameters = \count($expression['parameters']); + $callNumberParameters = count($expression['parameters']); } else { $callNumberParameters = 0; } @@ -276,7 +291,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($callNumberParameters > $numberParameters) { throw new CompilerException( sprintf( - "Method '%s::%s' called with a wrong number of parameters, ". + "Method '%s::%s' called with a wrong number of parameters, " . 'the method has: %d, passed: %d', $classDefinition->getCompleteName(), $expression['name'], @@ -291,7 +306,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($callNumberParameters < $expectedNumberParameters) { throw new CompilerException( sprintf( - "Method '%s::%s' called with a wrong number of parameters, ". + "Method '%s::%s' called with a wrong number of parameters, " . 'the method has: %d, passed: %d', $classDefinition->getCompleteName(), $expression['name'], @@ -312,11 +327,12 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($check && $variableVariable->hasAnyDynamicType('object')) { $classTypes = $variableVariable->getClassTypes(); - if (\count($classTypes)) { + if (count($classTypes)) { $numberImplemented = 0; - $compiler = $compilationContext->compiler; + $compiler = $compilationContext->compiler; foreach ($classTypes as $classType) { - if ($compiler->isClass($classType) || + if ( + $compiler->isClass($classType) || $compiler->isInterface($classType) || $compiler->isBundledClass($classType) || $compiler->isBundledInterface($classType) @@ -329,14 +345,14 @@ public function compile(Expression $expr, CompilationContext $compilationContext if (!$classDefinition) { throw new CompilerException( - 'Cannot locate class definition for class '.$classType, + 'Cannot locate class definition for class ' . $classType, $expression ); } if (!$classDefinition->hasMethod($methodName)) { if (!$classDefinition->isInterface()) { - if (1 == \count($classTypes)) { + if (1 == count($classTypes)) { throw new CompilerException( sprintf( "Class '%s' does not implement method: '%s'", @@ -370,7 +386,8 @@ public function compile(Expression $expr, CompilationContext $compilationContext /* * Check visibility for protected methods */ - if ($method->isProtected() && + if ( + $method->isProtected() && $method->getClassDefinition() != $classDefinition && $method->getClassDefinition() != $classDefinition->getExtendsClass() ) { @@ -383,19 +400,19 @@ public function compile(Expression $expr, CompilationContext $compilationContext ); } - /* + /** * Try to produce an exception if a method is called with a wrong number of parameters * We only check extension parameters if methods are extension methods * Internal methods may have invalid Reflection information */ - if ($method instanceof ClassMethod && !$method->isBundled()) { + if ($method instanceof Method && !$method->isBundled()) { if (isset($expression['parameters'])) { - $callNumberParameters = \count($expression['parameters']); + $callNumberParameters = count($expression['parameters']); } else { $callNumberParameters = 0; } - $classMethod = $classDefinition->getMethod($methodName); + $classMethod = $classDefinition->getMethod($methodName); $expectedNumberParameters = $classMethod->getNumberOfRequiredParameters(); if (!$expectedNumberParameters && $callNumberParameters > 0) { @@ -404,7 +421,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext $className = $classDefinition->getCompleteName(); throw new CompilerException( sprintf( - "Method '%s::%s' called with a wrong number of parameters, ". + "Method '%s::%s' called with a wrong number of parameters, " . 'the method has: %d, passed: %s', $className, $expression['name'], @@ -419,7 +436,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($callNumberParameters < $expectedNumberParameters) { throw new CompilerException( sprintf( - "Method '%s::%s' called with a wrong number of parameters, ". + "Method '%s::%s' called with a wrong number of parameters, " . 'the method has: %d, passed: %d', $classDefinition->getCompleteName(), $expression['name'], @@ -431,7 +448,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext } } - /* + /** * The method is checked in the first class that implements the method * We could probably have collisions here */ @@ -440,7 +457,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext } else { ++$numberImplemented; $compilationContext->logger->warning( - 'Class "'.$classType.'" does not exist at compile time', + 'Class "' . $classType . '" does not exist at compile time', ['nonexistent-class', $expression] ); } @@ -448,7 +465,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if (0 == $numberImplemented) { if (!$classDefinition->isInterface()) { - if (\count($classTypes) > 1) { + if (count($classTypes) > 1) { throw new CompilerException( sprintf( "None of classes: '%s' implement method: '%s'", @@ -480,52 +497,50 @@ public function compile(Expression $expr, CompilationContext $compilationContext $this->reflection = $method; } - /* + /** * Transfer the return type-hint to the returned variable */ - if ($isExpecting) { - if (isset($method)) { - if ($method instanceof ClassMethod) { - if ($method->isVoid()) { - throw new CompilerException( - sprintf( - "Method '%s::%s' is marked as '%s' and it does not return anything", - $classDefinition->getCompleteName(), - $expression['name'], - Types::T_VOID - ), - $expression - ); - } + if ($isExpecting && isset($method)) { + if ($method instanceof Method) { + if ($method->isVoid()) { + throw new CompilerException( + sprintf( + "Method '%s::%s' is marked as '%s' and it does not return anything", + $classDefinition->getCompleteName(), + $expression['name'], + Types::T_VOID + ), + $expression + ); + } - $returnClassTypes = $method->getReturnClassTypes(); + $returnClassTypes = $method->getReturnClassTypes(); - if (null !== $returnClassTypes) { - $symbolVariable->setDynamicTypes('object'); - foreach ($returnClassTypes as &$returnClassType) { - $returnClassType = $compilationContext->getFullName($returnClassType); - } - $symbolVariable->setClassTypes($returnClassTypes); + if (null !== $returnClassTypes) { + $symbolVariable->setDynamicTypes('object'); + foreach ($returnClassTypes as &$returnClassType) { + $returnClassType = $compilationContext->getFullName($returnClassType); } + $symbolVariable->setClassTypes($returnClassTypes); + } - $returnTypes = $method->getReturnTypes(); - if (null !== $returnTypes) { - foreach ($returnTypes as $dataType => $returnType) { - $symbolVariable->setDynamicTypes($dataType); - } + $returnTypes = $method->getReturnTypes(); + if (null !== $returnTypes) { + foreach ($returnTypes as $dataType => $returnType) { + $symbolVariable->setDynamicTypes($dataType); } } } } - /* + /** * Some parameters in internal methods receive parameters as references */ if (isset($expression['parameters'])) { $references = []; if (self::CALL_NORMAL == $type || self::CALL_DYNAMIC_STRING == $type) { if (isset($method)) { - if ($method instanceof \ReflectionMethod) { + if ($method instanceof ReflectionMethod) { $position = 0; foreach ($method->getParameters() as $parameter) { if ($parameter->isPassedByReference()) { @@ -538,17 +553,17 @@ public function compile(Expression $expr, CompilationContext $compilationContext } } - /* + /** * Include fcall header */ $compilationContext->headersManager->add('kernel/fcall'); - /* + /** * Call methods must grown the stack */ $compilationContext->symbolTable->mustGrownStack(true); - /* + /** * Mark references */ $params = []; @@ -557,21 +572,21 @@ public function compile(Expression $expr, CompilationContext $compilationContext $expression['parameters'], $compilationContext, $expression, - isset($method) ? $method : null + $method ?? null ); - if (\count($references)) { + if (count($references)) { foreach ($params as $position => $param) { if (isset($references[$position])) { - $compilationContext->codePrinter->output('Z_SET_ISREF_P('.$param.');'); + $compilationContext->codePrinter->output('Z_SET_ISREF_P(' . $param . ');'); } } } // We check here if a correct parameter type is passed to the called method if (self::CALL_NORMAL == $type) { - if (isset($method) && $method instanceof ClassMethod && isset($expression['parameters'])) { - $resolvedTypes = $this->getResolvedTypes(); + if (isset($method) && $method instanceof Method && isset($expression['parameters'])) { + $resolvedTypes = $this->getResolvedTypes(); $resolvedDynamicTypes = $this->getResolvedDynamicTypes(); foreach ($method->getParameters() as $n => $parameter) { @@ -580,12 +595,12 @@ public function compile(Expression $expr, CompilationContext $compilationContext continue; } - /* + /** * If the passed parameter is different to the expected type we show a warning */ if ($resolvedTypes[$n] != $parameter['data-type']) { $template = sprintf( - 'Passing possible incorrect type for parameter: %s::%s(%s), '. + 'Passing possible incorrect type for parameter: %s::%s(%s), ' . 'passing: %s, expecting: %s', $classDefinition->getCompleteName(), $method->getName(), @@ -669,7 +684,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext } break; - /* + /** * Passing polymorphic variables to static typed parameters * could lead to potential unexpected type coercions */ @@ -678,7 +693,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ('undefined' == $resolvedDynamicTypes[$n]) { $compilationContext->logger->warning( sprintf( - 'Passing possible incorrect type for parameter: %s::%s(%s), '. + 'Passing possible incorrect type for parameter: %s::%s(%s), ' . 'passing: undefined, expecting: %s', $classDefinition->getCompleteName(), $method->getName(), @@ -712,13 +727,13 @@ public function compile(Expression $expr, CompilationContext $compilationContext $realMethod = $this->getRealCalledMethod($compilationContext, $variableVariable, $methodName); $isInternal = false; - if (\is_object($realMethod[1])) { + if (is_object($realMethod[1])) { $realMethod[1] = $realMethod[1]->getOptimizedMethod(); - $method = $realMethod[1]; - $isInternal = $realMethod[1]->isInternal(); + $method = $realMethod[1]; + $isInternal = $realMethod[1]->isInternal(); if ($isInternal && $realMethod[0] > 1) { throw new CompilerException( - "Cannot resolve method: '".$expression['name']."' in polymorphic variable", + "Cannot resolve method: '" . $expression['name'] . "' in polymorphic variable", $expression ); } @@ -739,31 +754,36 @@ public function compile(Expression $expr, CompilationContext $compilationContext $variableVariable, $methodName, $cachePointer, - \count($params) ? $params : null, + count($params) ? $params : null, $compilationContext ); } else { - //TODO: also move to backend + // TODO: also move to backend if ($isExpecting) { - $symbolCode = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbolCode = $compilationContext->backend->getVariableCode($symbolVariable); } $variableCode = $compilationContext->backend->getVariableCode($variableVariable); - $paramCount = \count($params); - $paramsStr = $paramCount ? ', '.implode(', ', $params) : ''; + $paramCount = count($params); + $paramsStr = $paramCount ? ', ' . implode(', ', $params) : ''; if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $macro = $compilationContext->backend->getFcallManager()->getMacro(false, true, $paramCount); - $codePrinter->output($macro.'('.$variableCode.', '.$method->getInternalName().$paramsStr.');'); + $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 1, $paramCount); + $codePrinter->output( + $macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');' + ); } else { $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 2, $paramCount); $codePrinter->output( - $macro.'('.$symbolCode.', '.$variableCode.', '.$method->getInternalName().$paramsStr.');' + $macro . '(' . $symbolCode . ', ' . $variableCode . ', ' . $method->getInternalName( + ) . $paramsStr . ');' ); } } else { - $macro = $compilationContext->backend->getFcallManager()->getMacro(false, false, $paramCount); - $codePrinter->output($macro.'('.$variableCode.', '.$method->getInternalName().$paramsStr.');'); + $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 0, $paramCount); + $codePrinter->output( + $macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');' + ); } } } else { @@ -773,8 +793,10 @@ public function compile(Expression $expr, CompilationContext $compilationContext case 'variable': break; default: - throw new Exception( - sprintf('Cannot use variable type: %s as method caller', $variableMethod->getType()) + throw CompilerException::cannotUseVariableTypeAs( + $variableMethod, + 'as a method caller', + $expression ); } @@ -785,7 +807,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext $variableVariable, $variableMethod, $cachePointer, - \count($params) ? $params : null, + count($params) ? $params : null, $compilationContext ); } @@ -793,7 +815,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext // Temporary variables must be copied if they have more than one reference foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); + $codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); } // We can mark temporary variables generated as idle @@ -803,10 +825,10 @@ public function compile(Expression $expr, CompilationContext $compilationContext // Release parameters marked as references if (isset($expression['parameters'])) { - if (\count($references)) { + if (count($references)) { foreach ($params as $position => $param) { if (isset($references[$position])) { - $compilationContext->codePrinter->output('Z_UNSET_ISREF_P('.$param.');'); + $compilationContext->codePrinter->output('Z_UNSET_ISREF_P(' . $param . ');'); } } } @@ -829,13 +851,18 @@ public function compile(Expression $expr, CompilationContext $compilationContext * @param string $methodName * * @return array + * + * @throws ReflectionException */ - private function getRealCalledMethod(CompilationContext $compilationContext, Variable $caller, $methodName) - { + private function getRealCalledMethod( + CompilationContext $compilationContext, + Variable $caller, + string $methodName + ): array { $compiler = $compilationContext->compiler; $numberPoly = 0; - $method = null; + $method = null; if ('this' == $caller->getRealName()) { $classDefinition = $compilationContext->classDefinition; @@ -850,7 +877,8 @@ private function getRealCalledMethod(CompilationContext $compilationContext, Var continue; } - if ($compiler->isClass($classType) || + if ( + $compiler->isClass($classType) || $compiler->isBundledClass($classType) || $compiler->isBundledInterface($classType) ) { diff --git a/src/Name.php b/src/Name.php new file mode 100644 index 0000000000..99529c6dd5 --- /dev/null +++ b/src/Name.php @@ -0,0 +1,136 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir; + +use function in_array; +use function is_numeric; +use function str_replace; +use function strlen; +use function strpos; +use function substr; +use function ucwords; + +final class Name +{ + /** + * Prepares a string to be used as a C-string. + * + * Should NOT escape next `escape sequences`: + * Escape sequence | ASCII hex value | Char represented + * --------------- | --------------- | ---------------- + * \a | 07 | Audible bell (Alert, Beep) + * \b | 08 | Backspace + * \e | 1B | Escape character + * \f | 0C | Formed page brake + * \n | 0A | Newline (Line Feed) + * \r | 0D | Carriage Return + * \t | 09 | Horizontal Tab + * \v | 0B | Vertical Tab + * \\ | 5C | Backslash + * \' | 27 | Apostrophe or single quotation mark + * \" | 22 | Double quotation mark + * \? | 3F | Question mark (used to avoid trigraphs) + * \nnn | any | The byte whose numerical value is given by nnn interpreted as an octal + * number + * \xhh… | any | The byte whose numerical value is given by hh… interpreted as a hexadecimal + * number + */ + public static function addSlashes(string $string): string + { + $escape = '\\'; + $controlChar = [ + 'a', + 'b', + 'e', + 'f', + 'n', + 'r', + 't', + 'v', + '\\', + '\'', + '"', + '?', + 'x', + ]; + + $new = ''; + $last = strlen($string) - 1; + + for ($i = 0, $next = 1; $i <= $last; ++$i, ++$next) { + $ch = $string[$i]; + $after = $i !== $last ? $string[$next] : null; + + if ($ch === $escape) { + if (in_array($after, $controlChar, true) || is_numeric($after)) { + // should not escape native C control chars + $new .= $ch . $after; + ++$i; + ++$next; + continue; + } + + $new .= $escape . $ch; + continue; + } + + if ('"' === $ch) { + $new .= $escape . $ch; + continue; + } + + $new .= $ch; + } + + return $new; + } + + public static function camelize(string $string): string + { + return str_replace(' ', '', ucwords(str_replace('_', ' ', $string))); + } + + /** + * Transform class/interface name to + * Fully qualified path name (FQN) format. + */ + public static function fetchFQN( + string $class, + string $namespace = null, + AliasManager $aliasManager = null + ): string { + /** + * Absolute class/interface name + */ + if ('\\' === $class[0]) { + return substr($class, 1); + } + + /** + * If class/interface name not begin with \ + * maybe an alias or a sub-namespace + */ + $firstSepPos = strpos($class, '\\'); + if (false !== $firstSepPos) { + $baseName = substr($class, 0, $firstSepPos); + if ($aliasManager && $aliasManager->isAlias($baseName)) { + return $aliasManager->getAlias($baseName) . '\\' . substr($class, $firstSepPos + 1); + } + } elseif ($aliasManager && $aliasManager->isAlias($class)) { + return $aliasManager->getAlias($class); + } + + return $namespace ? $namespace . '\\' . $class : $class; + } +} diff --git a/Library/Operators/AbstractOperator.php b/src/Operators/AbstractOperator.php similarity index 57% rename from Library/Operators/AbstractOperator.php rename to src/Operators/AbstractOperator.php index 50e49f3c5b..eba8bf31c8 100644 --- a/Library/Operators/AbstractOperator.php +++ b/src/Operators/AbstractOperator.php @@ -14,36 +14,24 @@ namespace Zephir\Operators; use Zephir\CompilationContext; -use Zephir\Variable; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable; + +use function is_object; abstract class AbstractOperator { - protected string $operator; - - protected bool $expecting = true; - - protected bool $readOnly = false; - - protected bool $literalOnly = true; + use VariablesTrait; + protected bool $expecting = true; protected ?Variable $expectingVariable = null; - - /** - * Sets if the variable must be resolved into a direct variable symbol - * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable - */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null) - { - $this->expecting = $expecting; - $this->expectingVariable = $expectingVariable; - } + protected bool $literalOnly = true; + protected string $operator; + protected bool $readOnly = false; /** * Returns the expected variable for assignment or creates a temporary variable to - * store the result. This method returns a variable that is always stored in the heap. + * store the result. * * @param CompilationContext $compilationContext * @param array $expression @@ -51,26 +39,60 @@ public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = * * @return Variable|null */ - public function getExpectedNonLiteral(CompilationContext $compilationContext, array $expression, bool $init = true): ?Variable + public function getExpected(CompilationContext $compilationContext, array $expression, bool $init = true): ?Variable { - $symbolVariable = $this->expectingVariable; - if (!$this->expecting) { - return $symbolVariable; + return $this->expectingVariable; } - if ($symbolVariable !== null) { - if ('variable' === $symbolVariable->getType() && !$symbolVariable->isLocalOnly()) { + $symbolVariable = $this->expectingVariable; + if (is_object($symbolVariable)) { + if ('variable' === $symbolVariable->getType()) { if (!$init) { return $symbolVariable; } - $symbolVariable->initVariant($compilationContext); } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); + if (!$this->readOnly) { + if (!$this->literalOnly) { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } else { + $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite( + 'variable', + $compilationContext + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite( + 'variable', + $compilationContext + ); + } } } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); + if (!$this->readOnly) { + if (!$this->literalOnly) { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); + } else { + $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite( + 'variable', + $compilationContext + ); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite( + 'variable', + $compilationContext + ); + } } return $symbolVariable; @@ -78,45 +100,48 @@ public function getExpectedNonLiteral(CompilationContext $compilationContext, ar /** * Returns the expected variable for assignment or creates a temporary variable to - * store the result. + * store the result, if a temporary variable is created it use whose body is only freed + * on every iteration. * * @param CompilationContext $compilationContext - * @param array $expression - * @param bool $init + * @param string $type * - * @return Variable + * @return Variable|null */ - public function getExpected(CompilationContext $compilationContext, array $expression, bool $init = true): ?Variable - { + public function getExpectedComplexLiteral( + CompilationContext $compilationContext, + string $type = 'variable' + ): ?Variable { $symbolVariable = $this->expectingVariable; if ($this->expecting) { - if (\is_object($symbolVariable)) { - if ('variable' === $symbolVariable->getType()) { - if (!$init) { - return $symbolVariable; - } + if (is_object($symbolVariable)) { + if ($symbolVariable->getType() === $type || 'return_value' === $symbolVariable->getName()) { $symbolVariable->initVariant($compilationContext); } else { if (!$this->readOnly) { - if (!$this->literalOnly) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } else { - $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite('variable', $compilationContext); - } + $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite( + $type, + $compilationContext + ); } else { - $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite('variable', $compilationContext); + $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite( + $type, + $compilationContext + ); } } } else { if (!$this->readOnly) { - if (!$this->literalOnly) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } else { - $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite('variable', $compilationContext); - } + $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite( + $type, + $compilationContext + ); } else { - $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite('variable', $compilationContext); + $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite( + $type, + $compilationContext + ); } } } @@ -126,36 +151,45 @@ public function getExpected(CompilationContext $compilationContext, array $expre /** * Returns the expected variable for assignment or creates a temporary variable to - * store the result, if a temporary variable is created it use whose body is only freed - * on every iteration. + * store the result. This method returns a variable that is always stored in the heap. * * @param CompilationContext $compilationContext - * @param string $type + * @param array $expression + * @param bool $init * - * @return Variable + * @return Variable|null */ - public function getExpectedComplexLiteral(CompilationContext $compilationContext, string $type = 'variable'): ?Variable - { + public function getExpectedNonLiteral( + CompilationContext $compilationContext, + array $expression, + bool $init = true + ): ?Variable { $symbolVariable = $this->expectingVariable; - if ($this->expecting) { - if (\is_object($symbolVariable)) { - if ($symbolVariable->getType() === $type || 'return_value' === $symbolVariable->getName()) { - $symbolVariable->initVariant($compilationContext); - } else { - if (!$this->readOnly) { - $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite($type, $compilationContext); - } else { - $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite($type, $compilationContext); - } + if (!$this->expecting) { + return $symbolVariable; + } + + if ($symbolVariable !== null) { + if ('variable' === $symbolVariable->getType() && !$symbolVariable->isLocalOnly()) { + if (!$init) { + return $symbolVariable; } + + $symbolVariable->initVariant($compilationContext); } else { - if (!$this->readOnly) { - $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite($type, $compilationContext); - } else { - $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite($type, $compilationContext); - } + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); } return $symbolVariable; @@ -172,22 +206,35 @@ public function isExpecting(): bool } /** - * Sets if the result of the evaluated expression is read only. + * Checks if the result of the evaluated expression is read only. * - * @param bool $readOnly + * @return bool */ - public function setReadOnly(bool $readOnly): void + public function isReadOnly(): bool { - $this->readOnly = $readOnly; + return $this->readOnly; } /** - * Checks if the result of the evaluated expression is read only. + * Sets if the variable must be resolved into a direct variable symbol + * create a temporary value or ignore the return value. * - * @return bool + * @param bool $expecting + * @param Variable|null $expectingVariable */ - public function isReadOnly(): bool + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { - return $this->readOnly; + $this->expecting = $expecting; + $this->expectingVariable = $expectingVariable; + } + + /** + * Sets if the result of the evaluated expression is read only. + * + * @param bool $readOnly + */ + public function setReadOnly(bool $readOnly): void + { + $this->readOnly = $readOnly; } } diff --git a/Library/Operators/Arithmetical/AddOperator.php b/src/Operators/Arithmetical/AddOperator.php similarity index 80% rename from Library/Operators/Arithmetical/AddOperator.php rename to src/Operators/Arithmetical/AddOperator.php index 5fadff453d..f7011b12e5 100644 --- a/Library/Operators/Arithmetical/AddOperator.php +++ b/src/Operators/Arithmetical/AddOperator.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Arithmetical; /** @@ -16,9 +18,7 @@ */ class AddOperator extends ArithmeticalBaseOperator { - protected string $operator = '+'; - - protected string $bitOperator = '|'; - + protected string $bitOperator = '|'; + protected string $operator = '+'; protected string $zvalOperator = 'zephir_add_function'; } diff --git a/src/Operators/Arithmetical/ArithmeticalBaseOperator.php b/src/Operators/Arithmetical/ArithmeticalBaseOperator.php new file mode 100644 index 0000000000..1787b41dab --- /dev/null +++ b/src/Operators/Arithmetical/ArithmeticalBaseOperator.php @@ -0,0 +1,911 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Arithmetical; + +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Exception as ZephirException; +use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\Operators\AbstractOperator; +use Zephir\Types\Types; +use Zephir\Variable\Variable; + +use function sprintf; + +/** + * This is the base operator for commutative, associative and distributive + * arithmetic operators + */ +class ArithmeticalBaseOperator extends AbstractOperator +{ + protected bool $literalOnly = true; + + /** + * Compiles the arithmetical operation. + * + * @param array $expression + * @param CompilationContext $compilationContext + * + * @return CompiledExpression + * + * @throws Exception + * @throws CompilerException + */ + public function compile($expression, CompilationContext $compilationContext) + { + $this->checkLeft($expression, CompilerException::class, $expression); + $this->checkRight($expression, CompilerException::class, $expression); + + // Check for constant folding optimizations + if ($optimized = $this->optimizeConstantFolding($expression, $compilationContext)) { + return $optimized; + } + + $leftExpr = new Expression($expression['left']); + $leftExpr->setReadOnly(true); + $left = $leftExpr->compile($compilationContext); + + $rightExpr = new Expression($expression['right']); + $rightExpr->setReadOnly(true); + $right = $rightExpr->compile($compilationContext); + + switch ($left->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + '((double) ' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getBooleanCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'bool': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + '(double) (' . $left->getCode( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableRight = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'int', + '(' . $left->getCode( + ) . ' ' . $this->operator . ' zephir_get_numberval(' . $variableRight . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" . $variableRight->getType() . "')", + $expression + ); + } + + default: + throw new CompilerException( + "Cannot operate 'int' with '" . $right->getType() . "'", + $expression + ); + } + + case 'bool': + return match ($right->getType()) { + Types::T_INT, + Types::T_UINT, + Types::T_LONG, + Types::T_ULONG, + Types::T_DOUBLE => new CompiledExpression( + 'long', + '(' . $left->getBooleanCode() . ' + ' . $right->getCode() . ')', + $expression + ), + Types::T_BOOL => new CompiledExpression( + 'bool', + '(' . $left->getBooleanCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode() . ')', + $expression + ), + default => throw new CompilerException( + "Cannot operate 'bool' with '" . $right->getType() . "'", + $expression + ), + }; + + case 'double': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'double', + '(' . $left->getCode() . ' ' . $this->operator . ' (double) (' . $right->getCode() . '))', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'double', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getBooleanCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'bool': + return new CompiledExpression( + 'double', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + '(double) (' . $left->getCode( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableRight = $compilationContext->backend->getVariableCode( + $variableRight, + $compilationContext + ); + + return new CompiledExpression( + 'double', + '(' . $left->getCode( + ) . ' ' . $this->operator . ' zephir_get_numberval(' . $variableRight . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('double') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate 'double' with '" . $right->getType() . "'", + $expression + ); + } + + + case 'string': + throw match ($right->getType()) { + default => new CompilerException( + 'Operation is not supported between strings', + $expression + ), + }; + + case 'variable': + $variableLeft = $compilationContext->symbolTable->getVariableForRead( + $left->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + switch ($variableLeft->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'bool': + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + '((double) ' . $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableRight = $compilationContext->backend->getVariableCode( + $variableRight, + $compilationContext + ); + + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' zephir_get_numberval(' . $variableRight . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + case 'char': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableRight = $compilationContext->backend->getVariableCode( + $variableRight, + $compilationContext + ); + + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' zephir_get_numberval(' . $variableRight . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('char') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('char') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'bool': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode( + ) . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName( + ) . ' ' . $this->bitOperator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableRight = $compilationContext->backend->getVariableCode( + $variableRight, + $compilationContext + ); + + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' zephir_get_numberval(' . $variableRight . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'double': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'double', + '(' . $left->getCode() . ' ' . $this->operator . ' (double) ' . $right->getCode( + ) . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode( + ) . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'double', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' (double) ' . $variableRight->getName() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName( + ) . ' ' . $this->bitOperator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableRight = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' zephir_get_numberval(' . $variableRight . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('double') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'string': + throw new CompilerException("Cannot operate string variables'", $expression); + + case 'array': + switch ($right->getType()) { + /* a(var) + a(x) */ + case 'array': + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + /* a(var) + a(var) */ + case 'array': + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + + $expected = $this->getExpected($compilationContext, $expression); + $compilationContext->backend->zvalOperator( + $this->zvalOperator, + $expected, + $variableLeft, + $variableRight, + $compilationContext + ); + + $this->checkVariableTemporal($variableLeft); + $this->checkVariableTemporal($variableRight); + + $expected->setDynamicTypes( + $this->getDynamicTypes($variableLeft, $variableRight) + ); + + return new CompiledExpression('variable', $expected->getName(), $expression); + + default: + throw new CompilerException( + "Cannot operate 'array with variable ('" . $variableRight->getType() . "')", + $expression + ); + } + } + // no break + + case 'variable': + switch ($right->getType()) { + /* a + 1 */ + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + $compilationContext->headersManager->add('kernel/operators'); + $op = $this->operator; + + $op1 = $compilationContext->backend->getVariableCode($variableLeft); + $op2 = $right->getCode(); + if ('double' == $right->getType()) { + return new CompiledExpression( + 'double', + '(zephir_get_numberval(' . $op1 . ') ' . $op . ' ' . $op2 . ')', + $expression + ); + } else { + return new CompiledExpression( + 'int', + '(zephir_get_numberval(' . $op1 . ') ' . $op . ' ' . $op2 . ')', + $expression + ); + } + + + /* a(var) + a(x) */ + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + /* a(var) + a(int) */ + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + $compilationContext->headersManager->add('kernel/operators'); + $variableLeft = $compilationContext->backend->getVariableCode($variableLeft); + + return new CompiledExpression( + 'double' == $variableRight->getType() ? 'double' : 'int', + sprintf( + '(zephir_get_numberval(%s) %s %s)', + $variableLeft, + $this->operator, + $variableRight->getName() + ), + $expression + ); + + + /* a(var) + a(bool) */ + case 'bool': + $compilationContext->headersManager->add('kernel/operators'); + $variableLeft = $compilationContext->backend->getVariableCode($variableLeft); + + return new CompiledExpression( + 'int', + '(zephir_get_numberval(' . $variableLeft . ') ' . $this->operator . ' ' . $variableRight->getName( + ) . ')', + $expression + ); + + + /* a(var) + a(var) */ + case 'variable': + case 'array': + $compilationContext->headersManager->add('kernel/operators'); + + $expected = $this->getExpected($compilationContext, $expression); + $compilationContext->backend->zvalOperator( + $this->zvalOperator, + $expected, + $variableLeft, + $variableRight, + $compilationContext + ); + + $this->checkVariableTemporal($variableLeft); + $this->checkVariableTemporal($variableRight); + + $expected->setDynamicTypes( + $this->getDynamicTypes($variableLeft, $variableRight) + ); + + return new CompiledExpression('variable', $expected->getName(), $expression); + + default: + throw new CompilerException( + "Cannot operate 'variable' with variable ('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate 'variable' with '" . $right->getType() . "'", + $expression + ); + } + + + default: + throw CompilerException::unknownType($variableLeft, $expression); + } + // no break + + default: + throw CompilerException::unsupportedType($left, $expression); + } + } + + /** + * This tries to perform arithmetical operations. + * + * Probably gcc/clang will optimize them without this optimization + * + * @see https://en.wikipedia.org/wiki/Constant_folding + * + * @param array $expression + * @param CompilationContext $compilationContext + * + * @return bool|CompiledExpression + */ + public function optimizeConstantFolding(array $expression, CompilationContext $compilationContext) + { + if ('int' != $expression['left']['type'] && 'double' != $expression['left']['type']) { + return false; + } + + if ($compilationContext->config->get('constant-folding', 'optimizations')) { + if ('int' == $expression['left']['type'] && 'int' == $expression['right']['type']) { + switch ($this->operator) { + case '+': + return new CompiledExpression( + 'int', + $expression['left']['value'] + $expression['right']['value'], + $expression + ); + + case '-': + return new CompiledExpression( + 'int', + $expression['left']['value'] - $expression['right']['value'], + $expression + ); + + case '*': + return new CompiledExpression( + 'int', + $expression['left']['value'] * $expression['right']['value'], + $expression + ); + } + } + + if (('double' == $expression['left']['type'] && 'double' == $expression['right']['type']) || ('double' == $expression['left']['type'] && 'int' == $expression['right']['type']) || ('int' == $expression['left']['type'] && 'double' == $expression['right']['type'])) { + switch ($this->operator) { + case '+': + return new CompiledExpression( + 'double', + $expression['left']['value'] + $expression['right']['value'], + $expression + ); + + case '-': + return new CompiledExpression( + 'double', + $expression['left']['value'] - $expression['right']['value'], + $expression + ); + + case '*': + return new CompiledExpression( + 'double', + $expression['left']['value'] * $expression['right']['value'], + $expression + ); + } + } + } + + return false; + } + + /** + * @param Variable $variable + * + * @return string + */ + protected function getIsLocal(Variable $variable): string + { + return $variable->isLocalOnly() ? '&' : ''; + } + + /** + * @param array $expression + * @param CompilationContext $compilationContext + * + * @return array + * @throws ReflectionException + * @throws ZephirException + */ + protected function preCompileChecks( + array $expression, + CompilationContext $compilationContext + ): array { + $this->checkLeft($expression); + $this->checkRight($expression); + + $leftExpr = new Expression($expression['left']); + $leftExpr->setReadOnly(true); + $left = $leftExpr->compile($compilationContext); + + $rightExpr = new Expression($expression['right']); + $rightExpr->setReadOnly(true); + $right = $rightExpr->compile($compilationContext); + + $compilationContext->headersManager->add('kernel/operators'); + return [$left, $right]; + } + + /** + * @param CompiledExpression $right + * @param CompiledExpression $left + * @param array $expression + * + * @return CompiledExpression + */ + protected function processLeftBoolean( + CompiledExpression $right, + CompiledExpression $left, + array $expression + ): CompiledExpression { + return match ($right->getType()) { + Types::T_INT, + Types::T_UINT, + Types::T_LONG, + Types::T_ULONG, + Types::T_DOUBLE => new CompiledExpression( + 'long', + '(' . $left->getBooleanCode() . ' - ' . $right->getCode() . ')', + $expression + ), + Types::T_BOOL => new CompiledExpression( + 'bool', + '(' . $left->getBooleanCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode() . ')', + $expression + ), + default => throw new CompilerException( + "Cannot operate 'bool' with '" . $right->getType() . "'", + $expression + ), + }; + } + + /** + * Returns proper dynamic types. + * + * @param Variable $left + * @param Variable $right + * + * @return string + */ + private function getDynamicTypes(Variable $left, Variable $right): string + { + if ('/' === $this->operator) { + return Types::T_DOUBLE; + } + + switch ($left->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + switch ($right->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + return Types::T_INT; + } + break; + } + + return Types::T_DOUBLE; + } +} diff --git a/src/Operators/Arithmetical/DivOperator.php b/src/Operators/Arithmetical/DivOperator.php new file mode 100644 index 0000000000..e88824dd9c --- /dev/null +++ b/src/Operators/Arithmetical/DivOperator.php @@ -0,0 +1,623 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Arithmetical; + +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Exception\CompilerException; + +/** + * Generates an arithmetical operation according to the operands + */ +class DivOperator extends ArithmeticalBaseOperator +{ + protected string $bitOperator = '-'; + protected string $operator = '/'; + protected string $zvalOperator = 'div_function'; + + /** + * Compiles the arithmetical division operation. + * + * @throws ReflectionException + * @throws Exception + */ + public function compile($expression, CompilationContext $compilationContext): CompiledExpression|bool + { + [$left, $right] = $this->preCompileChecks($expression, $compilationContext); + + switch ($left->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_long(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_double((double) ' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' - ' . $right->getBooleanCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'bool': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_long(' . $left->getCode() . ', ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_double(' . $left->getCode() . ', ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'variable': + $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_zval(' . $left->getCode() . ', ' . $variableRightCode . ')', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" . $variableRight->getType() . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate 'int' with '" . $right->getType() . "'", + $expression + ); + } + + + case 'bool': + return $this->processLeftBoolean($right, $left, $expression); + + + case 'double': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_long(' . $left->getCode() . ', (double) (' . $right->getCode( + ) . '))', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_long(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_long(' . $left->getCode() . ', ' . $right->getBooleanCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'bool': + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_long(' . $left->getCode() . ', ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_double(' . $left->getCode( + ) . ', ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $symbolRight = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_zval(' . $left->getCode() . ', ' . $symbolRight . ')', + $expression + ); + + + default: + throw new CompilerException( + "Cannot operate variable('double') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate 'double' with '" . $right->getType() . "'", + $expression + ); + } + + + case 'string': + case 'array': + throw match ($right->getType()) { + default => new CompilerException( + 'Operation is not supported between ' . $right->getType(), + $expression + ), + }; + + + case 'variable': + $variableLeft = $compilationContext->symbolTable->getVariableForRead( + $left->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + switch ($variableLeft->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_long(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_double(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'bool': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_long(' . $variableLeft->getName( + ) . ', ' . $variableRight->getName() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_double(' . $variableLeft->getName( + ) . ', ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + if ($variableRight->isLocalOnly()) { + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_zval(' . $variableLeft->getName( + ) . ', &' . $variableRight->getName() . ')', + $expression + ); + } else { + $variableRightCode = $compilationContext->backend->getVariableCode( + $variableRight + ); + + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_zval(' . $variableLeft->getName( + ) . ', ' . $variableRightCode . ')', + $expression + ); + } + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'bool': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode( + ) . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_long(' + . $variableLeft->getName() + . ', ' + . $variableRight->getName() + . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_double(' + . $variableLeft->getName() + . ', ' + . $variableRight->getName() + . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_long(' + . $variableLeft->getName() + . ' ' + . $this->bitOperator + . ' ' + . $variableRight->getName() + . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + if ($variableRight->isLocalOnly()) { + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_zval(' + . $variableLeft->getName() + . ', &' + . $variableRight->getName() + . ')', + $expression + ); + } else { + $variableRightCode = $compilationContext->backend->getVariableCode( + $variableRight + ); + + return new CompiledExpression( + 'double', + 'zephir_safe_div_long_zval(' + . $variableLeft->getName() + . ', ' + . $variableRightCode + . ')', + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" + . $variableRight->getType() + . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'double': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_long(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode( + ) . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_long(' . $variableLeft->getName( + ) . ', (double) ' . $variableRight->getName() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_long(' . $variableLeft->getName( + ) . ', ' . $variableRight->getName() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName( + ) . ' ' . $this->bitOperator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $symbolRight = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'double', + 'zephir_safe_div_double_zval(' + . $variableLeft->getName() + . ', ' + . $symbolRight + . ')', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('double') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'string': + case 'array': + throw new CompilerException( + 'Cannot operate ' . $variableLeft->getType() . " variables'", + $expression + ); + case 'variable': + $op1 = $compilationContext->backend->getVariableCode($variableLeft); + switch ($right->getType()) { + /* a + 1 */ + case 'int': + case 'uint': + case 'long': + case 'ulong': + $op2 = $right->getCode(); + + return new CompiledExpression( + 'double', + 'zephir_safe_div_zval_long(' . $op1 . ', ' . $op2 . ')', + $expression + ); + + case 'double': + $op2 = $right->getCode(); + + return new CompiledExpression( + 'double', + 'zephir_safe_div_zval_double(' . $op1 . ', ' . $op2 . ')', + $expression + ); + + /* a(var) + a(x) */ + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + /* a(var) + a(int) */ + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'double', + 'zephir_safe_div_zval_long(' . $op1 . ', ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + 'zephir_safe_div_zval_double(' . $op1 . ', ' . $variableRight->getName( + ) . ')', + $expression + ); + + /* a(var) + a(bool) */ + case 'bool': + return new CompiledExpression( + 'int', + 'zephir_safe_div_zval_long(' . $op1 . ', ' . $variableRight->getName( + ) . ')', + $expression + ); + + /* a(var) + a(var) */ + case 'variable': + $op2 = $compilationContext->backend->getVariableCode($variableRight); + + $expected = $this->getExpected($compilationContext, $expression); + $expectedCode = $compilationContext->backend->getVariableCode($expected); + $compilationContext->codePrinter->output( + $this->zvalOperator . '(' . $expectedCode . ', ' . $op1 . ', ' . $op2 . ');' + ); + + $this->checkVariableTemporal($variableLeft); + $this->checkVariableTemporal($variableRight); + + return new CompiledExpression( + 'variable', + $expected->getName(), + $expression + ); + + default: + throw new CompilerException( + "Cannot operate 'variable' with variable ('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate 'variable' with '" + . $right->getType() . "'", + $expression + ); + } + + default: + throw CompilerException::unknownType($variableLeft, $expression); + } + + default: + throw CompilerException::unsupportedType($left, $expression); + } + } +} diff --git a/src/Operators/Arithmetical/ModOperator.php b/src/Operators/Arithmetical/ModOperator.php new file mode 100644 index 0000000000..000dbdf013 --- /dev/null +++ b/src/Operators/Arithmetical/ModOperator.php @@ -0,0 +1,573 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Arithmetical; + +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception\CompilerException; +use Zephir\Types\Types; + +/** + * Generates an arithmetical operation according to the operands + */ +class ModOperator extends ArithmeticalBaseOperator +{ + protected string $bitOperator = '-'; + protected string $operator = '%'; + protected string $zvalOperator = 'mod_function'; + + /** + * Compiles the arithmetical modulus operation. + * + * @param array $expression + * @param CompilationContext $compilationContext + */ + public function compile($expression, CompilationContext $compilationContext) + { + [$left, $right] = $this->preCompileChecks($expression, $compilationContext); + + switch ($left->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + switch ($right->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_long_long(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case Types::T_DOUBLE: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_long_double((double) ' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case Types::T_BOOL: + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' - ' . $right->getBooleanCode() . ')', + $expression + ); + + case Types::T_VARIABLE: + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression + ); + return match ($variableRight->getType()) { + Types::T_INT, + Types::T_UINT, + Types::T_LONG, + Types::T_ULONG, + Types::T_BOOL => new CompiledExpression( + 'double', + 'zephir_safe_mod_long_long(' + . $left->getCode() . ', ' . $variableRight->getName() . ')', + $expression + ), + Types::T_DOUBLE => new CompiledExpression( + 'double', + 'zephir_safe_mod_long_double(' + . $left->getCode() . ', ' . $variableRight->getName() . ')', + $expression + ), + Types::T_VARIABLE => new CompiledExpression( + 'double', + 'zephir_safe_mod_long_zval(' + . $left->getCode() + . ', ' + . $this->getIsLocal($variableRight) + . $variableRight->getName() . ')', + $expression + ), + default => throw new CompilerException( + "Cannot operate variable('int') with variable('" + . $variableRight->getType() . "')", + $expression + ), + }; + + + default: + throw new CompilerException( + "Cannot operate 'int' with '" . $right->getType() . "'", + $expression + ); + } + + + case Types::T_BOOL: + return $this->processLeftBoolean($left, $right, $expression); + + case Types::T_DOUBLE: + switch ($right->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_double_long(' . $left->getCode() . ', (double) (' . $right->getCode( + ) . '))', + $expression + ); + + case Types::T_DOUBLE: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_double_long(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case Types::T_BOOL: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_double_long(' . $left->getCode() . ', ' . $right->getBooleanCode() . ')', + $expression + ); + + case Types::T_VARIABLE: + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression + ); + + return match ($variableRight->getType()) { + Types::T_INT, + Types::T_UINT, + Types::T_LONG, + Types::T_ULONG, + Types::T_BOOL => new CompiledExpression( + 'double', + 'zephir_safe_mod_double_long(' + . $left->getCode() . ', ' . $variableRight->getName() . ')', + $expression + ), + Types::T_DOUBLE => new CompiledExpression( + 'double', + 'zephir_safe_mod_double_double(' + . $left->getCode() . ', ' . $variableRight->getName() . ')', + $expression + ), + Types::T_VARIABLE => new CompiledExpression( + 'double', + 'zephir_safe_mod_double_zval(' + . $left->getCode() + . ', ' + . $this->getIsLocal($variableRight) + . $variableRight->getName() . ')', + $expression + ), + default => throw new CompilerException( + "Cannot operate variable('double') with variable('" + . $variableRight->getType() + . "')", + $expression + ), + }; + + + default: + throw new CompilerException( + "Cannot operate 'double' with '" . $right->getType() . "'", + $expression + ); + } + + + case Types::T_STRING: + case Types::T_ARRAY: + throw new CompilerException( + 'Operation is not supported between ' . $right->getType(), + $expression + ); + + case Types::T_VARIABLE: + $variableLeft = $compilationContext->symbolTable->getVariableForRead( + $left->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + switch ($variableLeft->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + switch ($right->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_long_long(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case Types::T_DOUBLE: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_long_double(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case Types::T_VARIABLE: + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + + return match ($variableRight->getType()) { + Types::T_INT, + Types::T_UINT, + Types::T_LONG, + Types::T_ULONG, + Types::T_BOOL => new CompiledExpression( + 'double', + 'zephir_safe_mod_long_long(' + . $variableLeft->getName() . ', ' . $variableRight->getName() . ')', + $expression + ), + Types::T_DOUBLE => new CompiledExpression( + 'double', + 'zephir_safe_mod_long_double(' + . $variableLeft->getName() . ', ' . $variableRight->getName() . ')', + $expression + ), + Types::T_VARIABLE => new CompiledExpression( + 'double', + 'zephir_safe_mod_long_zval(' + . $variableLeft->getName() + . ', ' + . $this->getIsLocal($variableRight) + . $variableRight->getName() . ')', + $expression + ), + default => throw new CompilerException( + "Cannot operate variable('int') with variable('" + . $variableRight->getType() + . "')", + $expression + ), + }; + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case Types::T_BOOL: + switch ($right->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case Types::T_BOOL: + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode( + ) . ')', + $expression + ); + + case Types::T_VARIABLE: + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_long_long(' + . $variableLeft->getName() + . ', ' + . $variableRight->getName() + . ')', + $expression + ); + + case Types::T_DOUBLE: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_long_double(' + . $variableLeft->getName() + . ', ' + . $variableRight->getName() + . ')', + $expression + ); + + case Types::T_BOOL: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_long_long(' + . $variableLeft->getName() + . ' ' + . $this->bitOperator + . ' ' + . $variableRight->getName() + . ')', + $expression + ); + + case Types::T_VARIABLE: + $compilationContext->headersManager->add('kernel/operators'); + return new CompiledExpression( + 'double', + 'zephir_safe_mod_long_zval(' + . $variableLeft->getName() + . ', ' + . $this->getIsLocal($variableRight) + . $variableRight->getName() + . ')', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" + . $variableRight->getType() + . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case Types::T_DOUBLE: + switch ($right->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + case Types::T_DOUBLE: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_double_long(' . $left->getCode() . ', ' . $right->getCode() . ')', + $expression + ); + + case Types::T_BOOL: + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode( + ) . ')', + $expression + ); + + case Types::T_VARIABLE: + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_double_long(' . $variableLeft->getName( + ) . ', (double) ' . $variableRight->getName() . ')', + $expression + ); + + case Types::T_DOUBLE: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_double_long(' . $variableLeft->getName( + ) . ', ' . $variableRight->getName() . ')', + $expression + ); + + case Types::T_BOOL: + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName( + ) . ' ' . $this->bitOperator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case Types::T_VARIABLE: + $compilationContext->headersManager->add('kernel/operators'); + return new CompiledExpression( + 'double', + 'zephir_safe_mod_double_zval(' + . $variableLeft->getName() + . ', ' + . $this->getIsLocal($variableRight) + . $variableRight->getName() . ')', + $expression + ); + + default: + throw new CompilerException( + "Cannot operate variable('double') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case Types::T_STRING: + case Types::T_ARRAY: + throw new CompilerException( + 'Cannot operate ' . $variableLeft->getType() . " variables'", + $expression + ); + case Types::T_VARIABLE: + $op1 = $compilationContext->backend->getVariableCode($variableLeft); + switch ($right->getType()) { + /* a + 1 */ + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + $op2 = $right->getCode(); + + return new CompiledExpression( + 'double', + 'zephir_safe_mod_zval_long(' . $op1 . ', ' . $op2 . ')', + $expression + ); + + + case Types::T_DOUBLE: + $op2 = $right->getCode(); + + return new CompiledExpression( + 'double', + 'zephir_safe_mod_zval_double(' . $op1 . ', ' . $op2 . ')', + $expression + ); + + + /* a(var) + a(x) */ + case Types::T_VARIABLE: + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + /* a(var) + a(int) */ + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + return new CompiledExpression( + 'double', + 'zephir_safe_mod_zval_long(' + . $op1 . ', ' . $variableRight->getName() . ')', + $expression + ); + + + /* a(var) + a(bool) */ + case Types::T_BOOL: + return new CompiledExpression( + 'int', + 'zephir_safe_mod_zval_long(' + . $op1 . ', ' . $variableRight->getName() . ')', + $expression + ); + + + /* a(var) + a(var) */ + case Types::T_VARIABLE: + $compilationContext->headersManager->add('kernel/operators'); + $op2 = $compilationContext->backend->getVariableCode($variableRight); + + $expected = $this->getExpected($compilationContext, $expression); + $symbol = $compilationContext->backend->getVariableCode($expected); + $compilationContext->codePrinter->output( + $this->zvalOperator . '(' . $symbol . ', ' . $op1 . ', ' . $op2 . ');' + ); + + $this->checkVariableTemporal($variableLeft); + $this->checkVariableTemporal($variableRight); + + return new CompiledExpression( + 'variable', + $expected->getName(), + $expression + ); + + default: + throw new CompilerException( + "Cannot operate 'variable' with variable ('" + . $variableRight->getType() . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate 'variable' with '" + . $right->getType() . "'", + $expression + ); + } + + default: + throw CompilerException::unknownType($variableLeft, $expression); + } + + default: + throw CompilerException::unsupportedType($left, $expression); + } + } +} diff --git a/Library/Operators/Arithmetical/MulOperator.php b/src/Operators/Arithmetical/MulOperator.php similarity index 80% rename from Library/Operators/Arithmetical/MulOperator.php rename to src/Operators/Arithmetical/MulOperator.php index 7e96db1a69..dba7fc2bd7 100644 --- a/Library/Operators/Arithmetical/MulOperator.php +++ b/src/Operators/Arithmetical/MulOperator.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Arithmetical; /** @@ -16,9 +18,7 @@ */ class MulOperator extends ArithmeticalBaseOperator { - protected string $operator = '*'; - - protected string $bitOperator = '+'; - + protected string $bitOperator = '+'; + protected string $operator = '*'; protected string $zvalOperator = 'mul_function'; } diff --git a/Library/Operators/Arithmetical/SubOperator.php b/src/Operators/Arithmetical/SubOperator.php similarity index 80% rename from Library/Operators/Arithmetical/SubOperator.php rename to src/Operators/Arithmetical/SubOperator.php index 413f5a2990..343ad5784e 100644 --- a/Library/Operators/Arithmetical/SubOperator.php +++ b/src/Operators/Arithmetical/SubOperator.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Arithmetical; /** @@ -16,9 +18,7 @@ */ class SubOperator extends ArithmeticalBaseOperator { - protected string $operator = '-'; - - protected string $bitOperator = '&'; - + protected string $bitOperator = '&'; + protected string $operator = '-'; protected string $zvalOperator = 'zephir_sub_function'; } diff --git a/Library/Operators/Bitwise/BitwiseAndOperator.php b/src/Operators/Bitwise/BitwiseAndOperator.php similarity index 78% rename from Library/Operators/Bitwise/BitwiseAndOperator.php rename to src/Operators/Bitwise/BitwiseAndOperator.php index c9f5657022..5ba88a96be 100644 --- a/Library/Operators/Bitwise/BitwiseAndOperator.php +++ b/src/Operators/Bitwise/BitwiseAndOperator.php @@ -9,13 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Bitwise; class BitwiseAndOperator extends BitwiseBaseOperator { - protected string $operator = '&'; - - protected string $bitOperator = '&'; - + protected string $bitOperator = '&'; + protected string $operator = '&'; protected string $zvalOperator = 'zephir_bitwise_and_function'; } diff --git a/src/Operators/Bitwise/BitwiseBaseOperator.php b/src/Operators/Bitwise/BitwiseBaseOperator.php new file mode 100644 index 0000000000..67495b3a92 --- /dev/null +++ b/src/Operators/Bitwise/BitwiseBaseOperator.php @@ -0,0 +1,747 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Bitwise; + +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\Operators\AbstractOperator; + +/** + * This is the base operator for commutative, associative and distributive + * arithmetic operators + */ +class BitwiseBaseOperator extends AbstractOperator +{ + protected bool $literalOnly = true; + + /** + * @param array $expression + * @param CompilationContext $compilationContext + * + * @return bool|CompiledExpression + */ + public function compile($expression, CompilationContext $compilationContext) + { + $this->checkLeft($expression, CompilerException::class, $expression); + $this->checkRight($expression, CompilerException::class, $expression); + + /** + * Check for constant folding optimizations. + */ + $optimized = $this->optimizeConstantFolding($expression, $compilationContext); + if ($optimized !== null) { + return $optimized; + } + + $leftExpr = new Expression($expression['left']); + $leftExpr->setReadOnly(true); + $left = $leftExpr->compile($compilationContext); + + $rightExpr = new Expression($expression['right']); + $rightExpr->setReadOnly(true); + $right = $rightExpr->compile($compilationContext); + + switch ($left->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' (int) (' . $right->getCode() . '))', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getBooleanCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'bool': + case 'ulong': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'int', + '(' . $left->getCode( + ) . ' ' . $this->operator . ' (int) (' . $variableRight->getName() . '))', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $symbol = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'int', + '(' . $left->getCode( + ) . ' ' . $this->operator . ' zephir_get_numberval(' . $symbol . '))', + $expression + ); + + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" . $variableRight->getType() . "')", + $expression + ); + } + + default: + throw new CompilerException( + "Cannot operate 'int' with '" . $right->getType() . "'", + $expression + ); + } + + + case 'bool': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + return new CompiledExpression( + 'int', + '(' . $left->getBooleanCode() . ' ' . $this->bitOperator . '((' . $right->getCode( + ) . ') ? 1 : 0))', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'int', + '(' . $left->getBooleanCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode( + ) . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $expression['right']['value'], + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'bool': + case 'ulong': + return new CompiledExpression( + 'int', + '((int) (' . $left->getBooleanCode( + ) . ') ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'int', + '((int) (' . $left->getBooleanCode( + ) . ') ' . $this->operator . ' (int) (' . $variableRight->getName() . '))', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $symbol = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'int', + '((int) (' . $left->getBooleanCode( + ) . ') ' . $this->operator . ' zephir_get_numberval(' . $symbol . '))', + $expression + ); + + + default: + throw new CompilerException( + "Cannot operate ('bool') with variable('" . $variableRight->getType() . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate 'bool' with '" . $right->getType() . "'", + $expression + ); + } + + + case 'double': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'int', + '((int) (' . $left->getCode() . ') ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'int', + '((int) (' . $left->getCode() . ') ' . $this->operator . ' (int) (' . $right->getCode( + ) . '))', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'int', + '((int) (' . $left->getCode() . ') ' . $this->operator . ' ' . $right->getBooleanCode( + ) . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $expression['right']['value'], + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'bool': + case 'ulong': + return new CompiledExpression( + 'int', + '((int) (' . $left->getCode( + ) . ') ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'int', + '((int) (' . $left->getCode( + ) . ') ' . $this->operator . ' (int) (' . $variableRight->getName() . '))', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $symbol = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'int', + '((int) (' . $left->getCode( + ) . ') ' . $this->operator . ' zephir_get_numberval(' . $symbol . '))', + $expression + ); + + + default: + throw new CompilerException( + "Cannot operate variable('double') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate 'double' with '" . $right->getType() . "'", + $expression + ); + } + + + case 'string': + throw match ($right->getType()) { + default => new CompilerException( + 'Operation is not supported between strings', + $expression + ), + }; + + + case 'variable': + $variableLeft = $compilationContext->symbolTable->getVariableForRead( + $left->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + switch ($variableLeft->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + case 'char': + case 'uchar': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'bool': + case 'uchar': + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' (int) (' . $variableRight->getName() . '))', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $symbol = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' (int) (zephir_get_numberval(' . $symbol . ')))', + $expression + ); + + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'bool': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->bitOperator . ' ' . $right->getBooleanCode( + ) . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' (int) (' . $variableRight->getName() . '))', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->bitOperator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $symbol = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' zephir_get_numberval(' . $symbol . '))', + $expression + ); + + + default: + throw new CompilerException( + "Cannot operate variable('int') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'double': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'int', + '((int) (' . $left->getCode() . ') ' . $this->operator . ' ' . $right->getCode( + ) . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'int', + '((int) (' . $left->getCode( + ) . ') ' . $this->operator . ' (int) (' . $right->getCode() . '))', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'int', + '((int) (' . $left->getCode( + ) . ') ' . $this->bitOperator . ' ' . $right->getBooleanCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $expression['right']['value'], + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'int', + '((int) (' . $variableLeft->getName( + ) . ') ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + case 'double': + return new CompiledExpression( + 'int', + '((int) (' . $variableLeft->getName( + ) . ') ' . $this->operator . ' (int) (' . $variableRight->getName() . '))', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'int', + '((int) (' . $variableLeft->getName( + ) . ') ' . $this->bitOperator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $symbol = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'int', + '((int) (' . $variableLeft->getName( + ) . ') ' . $this->operator . ' (int) (zephir_get_numberval(' . $symbol . ')))', + $expression + ); + + + default: + throw new CompilerException( + "Cannot operate variable('double') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'string': + throw new CompilerException("Cannot operate string variables'", $expression); + case 'variable': + switch ($right->getType()) { + /* a + 1 */ + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + $compilationContext->headersManager->add('kernel/operators'); + $op = $this->operator; + $op1 = $compilationContext->backend->getVariableCode($variableLeft); + $op2 = $right->getCode(); + if ('double' == $right->getType()) { + return new CompiledExpression( + 'int', + '((int) (zephir_get_numberval(' . $op1 . ')) ' . $op . ' (int) (' . $op2 . '))', + $expression + ); + } else { + return new CompiledExpression( + 'int', + '((int) (zephir_get_numberval(' . $op1 . ')) ' . $op . ' ' . $op2 . ')', + $expression + ); + } + + + /* a(var) + a(x) */ + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + $symbol = $compilationContext->backend->getVariableCode($variableLeft); + switch ($variableRight->getType()) { + /* a(var) + a(int) */ + case 'int': + case 'uint': + case 'long': + case 'ulong': + /* a(var) + a(bool) */ + case 'bool': + $compilationContext->headersManager->add('kernel/operators'); + + return new CompiledExpression( + 'int', + '((int) (zephir_get_numberval(' . $symbol . ')) ' . $this->operator . ' ' . $variableRight->getName( + ) . ')', + $expression + ); + + /* a(var) + a(var) */ + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $op1 = $symbol; + $op2 = $compilationContext->backend->getVariableCode($variableRight); + + $expected = $this->getExpected($compilationContext, $expression); + $expectedSymbol = $compilationContext->backend->getVariableCode($expected); + $compilationContext->codePrinter->output( + $this->zvalOperator . '(' . $expectedSymbol . ', ' . $op1 . ', ' . $op2 . ');' + ); + + $this->checkVariableTemporal($variableLeft); + $this->checkVariableTemporal($variableRight); + + return new CompiledExpression('variable', $expected->getName(), $expression); + + default: + throw new CompilerException( + "Cannot operate 'variable' with variable ('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot operate 'variable' with '" . $right->getType() . "'", + $expression + ); + } + + + default: + throw CompilerException::unknownType($variableLeft, $expression); + } + + + default: + throw CompilerException::unsupportedType($left, $expression); + } + } + + /** + * This tries to perform arithmetical operations + * Probably gcc/clang will optimize them without this optimization. + * + * @see https://en.wikipedia.org/wiki/Constant_folding + * + * @param array $expression + * @param CompilationContext $compilationContext + * + * @return CompiledExpression|null + */ + public function optimizeConstantFolding( + array $expression, + CompilationContext $compilationContext + ): ?CompiledExpression { + if (!$compilationContext->config->get('constant-folding', 'optimizations')) { + return null; + } + + switch ($expression['left']['type']) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + // continue to next switch + break; + default: + return null; + } + + switch ($expression['right']['type']) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + // continue to operator switch + break; + default: + return null; + } + + /* + * Return value will be always int + */ + return match ($this->operator) { + '&' => new CompiledExpression( + 'int', + $expression['left']['value'] & $expression['right']['value'], + $expression + ), + '|' => new CompiledExpression( + 'int', + $expression['left']['value'] | $expression['right']['value'], + $expression + ), + '^' => new CompiledExpression( + 'int', + $expression['left']['value'] ^ $expression['right']['value'], + $expression + ), + '<<' => new CompiledExpression( + 'int', + $expression['left']['value'] << $expression['right']['value'], + $expression + ), + '>>' => new CompiledExpression( + 'int', + $expression['left']['value'] >> $expression['right']['value'], + $expression + ), + default => null, + }; + } +} diff --git a/Library/Operators/Bitwise/BitwiseNotOperator.php b/src/Operators/Bitwise/BitwiseNotOperator.php similarity index 64% rename from Library/Operators/Bitwise/BitwiseNotOperator.php rename to src/Operators/Bitwise/BitwiseNotOperator.php index b40be4dc06..4dc3cbe46a 100644 --- a/Library/Operators/Bitwise/BitwiseNotOperator.php +++ b/src/Operators/Bitwise/BitwiseNotOperator.php @@ -9,10 +9,14 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Bitwise; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Operators\AbstractOperator; @@ -20,18 +24,17 @@ class BitwiseNotOperator extends AbstractOperator { /** - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws ReflectionException + * @throws Exception */ public function compile($expression, CompilationContext $compilationContext) { - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression', $expression); - } + $this->checkLeft($expression, CompilerException::class, $expression); $leftExpr = new Expression($expression['left']); $leftExpr->setReadOnly($this->readOnly); @@ -43,30 +46,37 @@ public function compile($expression, CompilationContext $compilationContext) case 'uint': case 'long': case 'ulong': - return new CompiledExpression('int', '~('.$left->getCode().')', $expression); + return new CompiledExpression('int', '~(' . $left->getCode() . ')', $expression); case 'variable': - $variable = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression['left']); + $variable = $compilationContext->symbolTable->getVariableForRead( + $left->getCode(), + $compilationContext, + $expression['left'] + ); switch ($variable->getType()) { case 'bool': case 'int': case 'uint': case 'long': - return new CompiledExpression('int', '~'.$variable->getName(), $expression); + return new CompiledExpression('int', '~' . $variable->getName(), $expression); case 'variable': case 'mixed': $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('int', '~zephir_get_intval('.$variable->getName().')', $expression); + return new CompiledExpression( + 'int', + '~zephir_get_intval(' . $variable->getName() . ')', + $expression + ); default: - throw new CompilerException('Unknown type: '.$variable->getType(), $expression); + throw new CompilerException('Unknown type: ' . $variable->getType(), $expression); } - break; default: - throw new CompilerException('Unknown type: '.$left->getType(), $expression); + throw new CompilerException('Unknown type: ' . $left->getType(), $expression); } } } diff --git a/Library/Operators/Bitwise/BitwiseOrOperator.php b/src/Operators/Bitwise/BitwiseOrOperator.php similarity index 78% rename from Library/Operators/Bitwise/BitwiseOrOperator.php rename to src/Operators/Bitwise/BitwiseOrOperator.php index 0ec3b75961..46837cdaca 100644 --- a/Library/Operators/Bitwise/BitwiseOrOperator.php +++ b/src/Operators/Bitwise/BitwiseOrOperator.php @@ -9,13 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Bitwise; class BitwiseOrOperator extends BitwiseBaseOperator { - protected string $operator = '|'; - - protected string $bitOperator = '|'; - + protected string $bitOperator = '|'; + protected string $operator = '|'; protected string $zvalOperator = 'zephir_bitwise_or_function'; } diff --git a/Library/Operators/Bitwise/BitwiseXorOperator.php b/src/Operators/Bitwise/BitwiseXorOperator.php similarity index 78% rename from Library/Operators/Bitwise/BitwiseXorOperator.php rename to src/Operators/Bitwise/BitwiseXorOperator.php index 48b7b7f661..8a882f95c2 100644 --- a/Library/Operators/Bitwise/BitwiseXorOperator.php +++ b/src/Operators/Bitwise/BitwiseXorOperator.php @@ -9,13 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Bitwise; class BitwiseXorOperator extends BitwiseBaseOperator { - protected string $operator = '^'; - - protected string $bitOperator = '^'; - + protected string $bitOperator = '^'; + protected string $operator = '^'; protected string $zvalOperator = 'zephir_bitwise_xor_function'; } diff --git a/Library/Operators/Bitwise/ShiftLeftOperator.php b/src/Operators/Bitwise/ShiftLeftOperator.php similarity index 77% rename from Library/Operators/Bitwise/ShiftLeftOperator.php rename to src/Operators/Bitwise/ShiftLeftOperator.php index 3d8a93fd28..c796e39918 100644 --- a/Library/Operators/Bitwise/ShiftLeftOperator.php +++ b/src/Operators/Bitwise/ShiftLeftOperator.php @@ -9,13 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Bitwise; class ShiftLeftOperator extends BitwiseBaseOperator { - protected string $operator = '<<'; - - protected string $bitOperator = '<<'; - + protected string $bitOperator = '<<'; + protected string $operator = '<<'; protected string $zvalOperator = 'zephir_shift_left_function'; } diff --git a/Library/Operators/Bitwise/ShiftRightOperator.php b/src/Operators/Bitwise/ShiftRightOperator.php similarity index 77% rename from Library/Operators/Bitwise/ShiftRightOperator.php rename to src/Operators/Bitwise/ShiftRightOperator.php index a8f8d9d464..c15a210850 100644 --- a/Library/Operators/Bitwise/ShiftRightOperator.php +++ b/src/Operators/Bitwise/ShiftRightOperator.php @@ -9,13 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Bitwise; class ShiftRightOperator extends BitwiseBaseOperator { - protected string $operator = '>>'; - - protected string $bitOperator = '>>'; - + protected string $bitOperator = '>>'; + protected string $operator = '>>'; protected string $zvalOperator = 'zephir_shift_right_function'; } diff --git a/src/Operators/Comparison/ComparisonBaseOperator.php b/src/Operators/Comparison/ComparisonBaseOperator.php new file mode 100644 index 0000000000..8a6cdf3095 --- /dev/null +++ b/src/Operators/Comparison/ComparisonBaseOperator.php @@ -0,0 +1,934 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Comparison; + +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\Operators\AbstractOperator; + +use function strtolower; + +/** + * This is the base operator for comparison operators + */ +class ComparisonBaseOperator extends AbstractOperator +{ + protected bool $commutative = false; + + /** + * Compile the expression. + * + * @param array $expression + * @param CompilationContext $compilationContext + * + * @return CompiledExpression + * + * @throws ReflectionException + * @throws Exception + */ + public function compile(array $expression, CompilationContext $compilationContext) + { + $conditions = $this->optimizeTypeOf($expression, $compilationContext); + if (null !== $conditions) { + return $conditions; + } + + $this->checkLeft($expression, CompilerException::class, $expression); + $this->checkRight($expression, CompilerException::class, $expression); + + $leftExpr = new Expression($expression['left']); + $leftExpr->setReadOnly(true); + $left = $leftExpr->compile($compilationContext); + + $rightExpr = new Expression($expression['right']); + $rightExpr->setReadOnly(true); + $right = $rightExpr->compile($compilationContext); + + switch ($left->getType()) { + case 'null': + switch ($right->getType()) { + case 'null': + return new CompiledExpression('bool', '(0 ' . $this->operator . ' 0)', $expression); + + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'bool', + '(0 ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'char': + case 'uchar': + return new CompiledExpression( + 'bool', + '(\'\\0\' ' . $this->operator . ' \'' . $right->getCode() . '\')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'bool', + '(0 ' . $this->operator . ' (int) ' . $right->getCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + $compilationContext->headersManager->add('kernel/operators'); + + return new CompiledExpression( + 'bool', + '0 ' . $this->operator . ' ' . $variableRight->getName(), + $expression + ); + + case 'variable': + case 'mixed': + case 'string': + $compilationContext->headersManager->add('kernel/operators'); + $condition = $compilationContext->backend->getTypeofCondition( + $variableRight, + $this->operator, + 'null' + ); + + return new CompiledExpression('bool', $condition, $expression); + + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException('Unknown type: ' . $right->getType(), $expression); + } + + + case 'int': + case 'uint': + case 'long': + case 'double': + case 'ulong': + case 'char': + case 'uchar': + switch ($right->getType()) { + case 'null': + return new CompiledExpression('bool', $left->getCode() . ' ' . $this->operator, $expression); + + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode(), + $expression + ); + + case 'char': + case 'uchar': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' \'' . $right->getCode() . '\'', + $expression + ); + + case 'double': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' (int) ' . $right->getCode(), + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + $compilationContext->headersManager->add('kernel/operators'); + + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' ' . $variableRight->getName(), + $expression + ); + + case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + $variableCode = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + $this->zvalLongNegOperator . '(' . $variableCode . ', ' . $left->getCode() . ')', + $expression + ); + + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException( + 'Cannot compare ' . $left->getType() . ' with ' . $right->getType(), + $expression + ); + } + + + case 'bool': + switch ($right->getType()) { + case 'null': + return new CompiledExpression( + 'bool', + $left->getBooleanCode() . ' ' . $this->operator . ' 0', + $expression + ); + + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'bool', + $left->getBooleanCode() . ' ' . $this->operator . ' ' . $right->getCode(), + $expression + ); + + case 'char': + case 'uchar': + return new CompiledExpression( + 'bool', + $left->getBooleanCode() . ' ' . $this->operator . ' \'' . $right->getCode() . '\'', + $expression + ); + + case 'double': + return new CompiledExpression( + 'bool', + $left->getBooleanCode() . ' ' . $this->operator . ' (int) ' . $right->getCode(), + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + $left->getBooleanCode() . ' ' . $this->operator . ' ' . $right->getBooleanCode(), + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + $compilationContext->headersManager->add('kernel/operators'); + + return new CompiledExpression( + 'bool', + $left->getBooleanCode() . ' ' . $this->operator . ' ' . $variableRight->getName(), + $expression + ); + + case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + $boolOperator = '1' == $left->getBooleanCode( + ) ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; + $variableRight = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + $boolOperator . '(' . $variableRight . ')', + $expression + ); + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException( + 'Cannot compare ' . $left->getType() . ' with ' . $right->getType(), + $expression + ); + } + + + case 'string': + $variableLeft = $compilationContext->symbolTable->getTempLocalVariableForWrite( + 'variable', + $compilationContext + ); + $variableLeftCode = $compilationContext->backend->getVariableCode($variableLeft); + $compilationContext->backend->assignString( + $variableLeft, + $left->getCode(), + $compilationContext, + true + ); + switch ($right->getType()) { + case 'null': + return new CompiledExpression( + 'bool', + $this->zvalNullOperator . '(' . $variableLeftCode . ')', + $expression['left'] + ); + + + case 'string': + $compilationContext->headersManager->add('kernel/operators'); + + return new CompiledExpression( + 'bool', + $this->zvalStringOperator . '(' . $variableLeftCode . ', "' . $right->getCode() . '")', + $expression['left'] + ); + + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + switch ($variableRight->getType()) { + case 'string': + case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + $variableRight = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + $this->zvalOperator . '(' . $variableLeftCode . ', ' . $variableRight . ')', + $expression + ); + + + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException('Unknown type: ' . $right->getType(), $expression['left']); + } + + + case 'variable': + $variable = $compilationContext->symbolTable->getVariableForRead( + $left->getCode(), + $compilationContext, + $expression['left'] + ); + $variableCode = $compilationContext->backend->getVariableCode($variable); + switch ($variable->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode(), + $expression + ); + + case 'char': + case 'uchar': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' \'' . $right->getCode() . '\'', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' ' . $right->getBooleanCode(), + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + case 'double': + return new CompiledExpression( + 'bool', + $variable->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName(), + $expression + ); + + case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + $variableRightCode = $compilationContext->backend->getVariableCode( + $variableRight + ); + $variableCode = $compilationContext->backend->getVariableCode($variable); + + return new CompiledExpression( + 'bool', + $this->zvalLongNegOperator . '(' . $variableRightCode . ', ' . $variableCode . ')', + $expression + ); + + + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException( + 'Cannot compare variable: ' . $variable->getType() . ' with: ' . $right->getType(), + $expression + ); + } + + + case 'double': + switch ($right->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode(), + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' ' . $right->getBooleanCode(), + $expression + ); + + case 'char': + case 'uchar': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' \'' . $right->getCode() . '\'', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + return new CompiledExpression( + 'bool', + $variable->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName(), + $expression + ); + + case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + $variableRightCode = $compilationContext->backend->getVariableCode( + $variableRight + ); + $variableCode = $compilationContext->backend->getVariableCode($variable); + + return new CompiledExpression( + 'bool', + $this->zvalDoubleNegOperator . '(' . $variableRightCode . ', ' . $variableCode . ')', + $expression + ); + + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException( + 'Cannot compare variable: ' . $variable->getType() . ' with: ' . $right->getType(), + $expression + ); + } + + + case 'bool': + switch ($right->getType()) { + case 'int': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode(), + $expression['left'] + ); + + case 'bool': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' ' . $right->getBooleanCode(), + $expression['left'] + ); + + case 'null': + return new CompiledExpression( + 'bool', + $left->getCode() . ' ' . $this->operator . ' 0', + $expression['left'] + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'bool': + case 'double': + return new CompiledExpression( + 'bool', + $variable->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName(), + $expression + ); + + case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + $boolOperator = '1' == $left->getBooleanCode( + ) ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; + $variableRightCode = $compilationContext->backend->getVariableCode( + $variableRight + ); + + return new CompiledExpression( + 'bool', + $boolOperator . '(' . $variableRightCode . ')', + $expression + ); + + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException( + 'Cannot compare variable: ' . $variable->getType() . ' with: ' . $right->getType(), + $expression + ); + } + + + case 'array': + switch ($right->getType()) { + case 'null': + return new CompiledExpression( + 'bool', + $this->zvalNullOperator . '(' . $variableCode . ')', + $expression['left'] + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + switch ($variableRight->getType()) { + case 'string': + case 'variable': + case 'mixed': + case 'array': + $compilationContext->headersManager->add('kernel/operators'); + $variableRight = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + $this->zvalOperator . '(' . $variableCode . ', ' . $variableRight . ')', + $expression + ); + + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException('Unknown type: ' . $right->getType(), $expression['left']); + } + + + case 'string': + $compilationContext->headersManager->add('kernel/operators'); + + switch ($right->getType()) { + case 'null': + return new CompiledExpression( + 'bool', + $this->zvalNullOperator . '(' . $variableCode . ')', + $expression['left'] + ); + + case 'string': + return new CompiledExpression( + 'bool', + $this->zvalStringOperator . '(' . $variableCode . ', "' . $right->getCode() . '")', + $expression['left'] + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + + switch ($variableRight->getType()) { + case 'string': + case 'variable': + case 'mixed': + $variableRight = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + $this->zvalOperator . '(' . $variableCode . ', ' . $variableRight . ')', + $expression + ); + + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException('Unknown type: ' . $right->getType(), $expression['left']); + } + + + case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + + switch ($right->getType()) { + case 'null': + $condition = $compilationContext->backend->getTypeofCondition( + $variable, + $this->operator, + 'null' + ); + + return new CompiledExpression('bool', $condition, $expression['left']); + + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + return new CompiledExpression( + 'bool', + $this->zvalLongOperator . '(' . $variableCode . ', ' . $right->getCode() . ')', + $expression['left'] + ); + + case 'char': + case 'uchar': + return new CompiledExpression( + 'bool', + $this->zvalLongOperator . '(' . $variableCode . ', \'' . $right->getCode() . '\')', + $expression['left'] + ); + + case 'bool': + $zvalBoolOperator = 'true' === $right->getCode( + ) ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; + + return new CompiledExpression( + 'bool', + $zvalBoolOperator . '(' . $variableCode . ')', + $expression['left'] + ); + + case 'string': + return new CompiledExpression( + 'bool', + $this->zvalStringOperator . '(' . $variableCode . ', "' . $right->getCode() . '")', + $expression['left'] + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['left'] + ); + switch ($variableRight->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + return new CompiledExpression( + 'bool', + $this->zvalLongOperator . '(' . $variableCode . ', ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'bool', + $this->zvalDoubleOperator . '(' . $variableCode . ', ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + $this->zvalBoolOperator . '(' . $variableCode . ', ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'string': + case 'variable': + case 'mixed': + case 'array': + $variableRight = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + $this->zvalOperator . '(' . $variableCode . ', ' . $variableRight . ')', + $expression + ); + + default: + throw new CompilerException( + 'Unknown type: ' . $variableRight->getType(), + $expression['right'] + ); + } + + + default: + throw new CompilerException('Unknown type: ' . $right->getType(), $expression['left']); + } + + + default: + throw new CompilerException('Unknown type: ' . $variable->getType(), $expression); + } + + + default: + throw new CompilerException('Unknown type: ' . $left->getType(), $expression); + } + } + + /** + * @param array $expr + * @param CompilationContext $compilationContext + * + * @return CompiledExpression|null + * + * @throws Exception + * @throws ReflectionException + */ + public function optimizeTypeOf(array $expr, CompilationContext $compilationContext): ?CompiledExpression + { + if (!isset($expr['left'])) { + return null; + } + + if (!isset($expr['right']) && !isset($expr['right']['value'])) { + return null; + } + + if ('typeof' !== $expr['left']['type']) { + return null; + } + + if ('string' !== $expr['right']['type']) { + $compilationContext->logger->warning( + "Possible invalid comparison for 'typeof' operator with non-string", + ['invalid-typeof-comparison', $expr['right']] + ); + + return null; + } + + switch ($expr['type']) { + case 'identical': + case 'equals': + $operator = '=='; + break; + + case 'not-identical': + case 'not-equals': + $operator = '!='; + break; + + default: + return null; + } + + $code = (new Expression($expr['left']['left']))->compile($compilationContext)->getCode(); + $variableVariable = $compilationContext->symbolTable->getVariableForRead($code, $compilationContext, $expr); + + if ('string' !== $expr['right']['type']) { + throw new CompilerException('Right expression of typeof operator must be "string" type', $expr['right']); + } + + $value = strtolower($expr['right']['value']); + + switch ($variableVariable->getType()) { + case 'double': + $condition = match ($value) { + 'double', 'float' => '1 ' . $operator . ' 1', + default => '1 ' . $operator . ' 0', + }; + break; + + case 'int': + case 'integer': + case 'long': + $condition = match ($value) { + 'int', 'integer', 'long' => '1 ' . $operator . ' 1', + default => '1 ' . $operator . ' 0', + }; + break; + + case 'bool': + $condition = match ($value) { + 'bool', 'boolean' => '1 ' . $operator . ' 1', + default => '1 ' . $operator . ' 0', + }; + break; + + case 'array': + $condition = match ($value) { + 'array' => '1 ' . $operator . ' 1', + default => '1 ' . $operator . ' 0', + }; + break; + + case 'string': + $condition = match ($value) { + 'string' => '1 ' . $operator . ' 1', + default => '1 ' . $operator . ' 0', + }; + break; + + case 'variable': + $condition = $compilationContext->backend->getTypeofCondition($variableVariable, $operator, $value); + break; + + default: + return null; + } + + return new CompiledExpression('bool', $condition, $expr); + } +} diff --git a/src/Operators/Comparison/EqualsOperator.php b/src/Operators/Comparison/EqualsOperator.php new file mode 100644 index 0000000000..acb8ff8891 --- /dev/null +++ b/src/Operators/Comparison/EqualsOperator.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Comparison; + +class EqualsOperator extends ComparisonBaseOperator +{ + protected string $bitOperator = '=='; + protected bool $commutative = true; + protected string $operator = '=='; + protected string $zvalBoolFalseOperator = 'ZEPHIR_IS_FALSE'; + protected string $zvalBoolOperator = 'ZEPHIR_IS_BOOL_VALUE'; + protected string $zvalBoolTrueOperator = 'ZEPHIR_IS_TRUE'; + protected string $zvalLongNegOperator = 'ZEPHIR_IS_LONG'; + protected string $zvalLongOperator = 'ZEPHIR_IS_LONG'; + protected string $zvalNullOperator = 'ZEPHIR_IS_NULL'; + protected string $zvalOperator = 'ZEPHIR_IS_EQUAL'; + protected string $zvalStringOperator = 'ZEPHIR_IS_STRING'; +} diff --git a/Library/Operators/Comparison/GreaterEqualOperator.php b/src/Operators/Comparison/GreaterEqualOperator.php similarity index 50% rename from Library/Operators/Comparison/GreaterEqualOperator.php rename to src/Operators/Comparison/GreaterEqualOperator.php index c852bb2a1f..54595fe554 100644 --- a/Library/Operators/Comparison/GreaterEqualOperator.php +++ b/src/Operators/Comparison/GreaterEqualOperator.php @@ -9,21 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Comparison; class GreaterEqualOperator extends ComparisonBaseOperator { - protected string $operator = '>='; - - protected string $bitOperator = '>='; - - protected string $zvalOperator = 'ZEPHIR_GE'; - - protected string $zvalLongOperator = 'ZEPHIR_GE_LONG'; - - protected string $zvalLongNegOperator = 'ZEPHIR_LE_LONG'; - - protected string $zvalDoubleOperator = '!ZEPHIR_LT_DOUBLE'; - + protected string $bitOperator = '>='; + protected string $operator = '>='; protected string $zvalDoubleNegOperator = '!ZEPHIR_GT_DOUBLE'; + protected string $zvalDoubleOperator = '!ZEPHIR_LT_DOUBLE'; + protected string $zvalLongNegOperator = 'ZEPHIR_LE_LONG'; + protected string $zvalLongOperator = 'ZEPHIR_GE_LONG'; + protected string $zvalOperator = 'ZEPHIR_GE'; } diff --git a/Library/Operators/Comparison/GreaterOperator.php b/src/Operators/Comparison/GreaterOperator.php similarity index 50% rename from Library/Operators/Comparison/GreaterOperator.php rename to src/Operators/Comparison/GreaterOperator.php index fe4be1eb7e..b4dbae682c 100644 --- a/Library/Operators/Comparison/GreaterOperator.php +++ b/src/Operators/Comparison/GreaterOperator.php @@ -9,21 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Comparison; class GreaterOperator extends ComparisonBaseOperator { - protected string $operator = '>'; - - protected string $bitOperator = '>'; - - protected string $zvalOperator = 'ZEPHIR_GT'; - - protected string $zvalLongOperator = 'ZEPHIR_GT_LONG'; - - protected string $zvalLongNegOperator = 'ZEPHIR_LT_LONG'; - - protected string $zvalDoubleOperator = 'ZEPHIR_GT_DOUBLE'; - + protected string $bitOperator = '>'; + protected string $operator = '>'; protected string $zvalDoubleNegOperator = 'ZEPHIR_LT_DOUBLE'; + protected string $zvalDoubleOperator = 'ZEPHIR_GT_DOUBLE'; + protected string $zvalLongNegOperator = 'ZEPHIR_LT_LONG'; + protected string $zvalLongOperator = 'ZEPHIR_GT_LONG'; + protected string $zvalOperator = 'ZEPHIR_GT'; } diff --git a/src/Operators/Comparison/IdenticalOperator.php b/src/Operators/Comparison/IdenticalOperator.php new file mode 100644 index 0000000000..c67a1f71e6 --- /dev/null +++ b/src/Operators/Comparison/IdenticalOperator.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Comparison; + +class IdenticalOperator extends ComparisonBaseOperator +{ + protected string $bitOperator = '=='; + protected bool $commutative = true; + protected string $operator = '=='; + protected string $zvalBoolFalseOperator = 'ZEPHIR_IS_FALSE_IDENTICAL'; + protected string $zvalBoolOperator = 'ZEPHIR_IS_BOOL_IDENTICAL'; + protected string $zvalBoolTrueOperator = 'ZEPHIR_IS_TRUE_IDENTICAL'; + protected string $zvalLongNegOperator = 'ZEPHIR_IS_LONG_IDENTICAL'; + protected string $zvalLongOperator = 'ZEPHIR_IS_LONG_IDENTICAL'; + protected string $zvalNullOperator = 'ZEPHIR_IS_NULL'; + protected string $zvalOperator = 'ZEPHIR_IS_IDENTICAL'; + protected string $zvalStringOperator = 'ZEPHIR_IS_STRING_IDENTICAL'; +} diff --git a/Library/Operators/Comparison/LessEqualOperator.php b/src/Operators/Comparison/LessEqualOperator.php similarity index 50% rename from Library/Operators/Comparison/LessEqualOperator.php rename to src/Operators/Comparison/LessEqualOperator.php index 0f0ed73ade..f2a1d31fdf 100644 --- a/Library/Operators/Comparison/LessEqualOperator.php +++ b/src/Operators/Comparison/LessEqualOperator.php @@ -9,21 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Comparison; class LessEqualOperator extends ComparisonBaseOperator { - protected string $operator = '<='; - - protected string $bitOperator = '<='; - - protected string $zvalOperator = 'ZEPHIR_LE'; - - protected string $zvalLongOperator = 'ZEPHIR_LE_LONG'; - - protected string $zvalLongNegOperator = 'ZEPHIR_GE_LONG'; - - protected string $zvalDoubleOperator = '!ZEPHIR_GT_DOUBLE'; - + protected string $bitOperator = '<='; + protected string $operator = '<='; protected string $zvalDoubleNegOperator = '!ZEPHIR_LT_DOUBLE'; + protected string $zvalDoubleOperator = '!ZEPHIR_GT_DOUBLE'; + protected string $zvalLongNegOperator = 'ZEPHIR_GE_LONG'; + protected string $zvalLongOperator = 'ZEPHIR_LE_LONG'; + protected string $zvalOperator = 'ZEPHIR_LE'; } diff --git a/Library/Operators/Comparison/LessOperator.php b/src/Operators/Comparison/LessOperator.php similarity index 50% rename from Library/Operators/Comparison/LessOperator.php rename to src/Operators/Comparison/LessOperator.php index 92a66f57e6..675f72c62e 100644 --- a/Library/Operators/Comparison/LessOperator.php +++ b/src/Operators/Comparison/LessOperator.php @@ -9,21 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Comparison; class LessOperator extends ComparisonBaseOperator { - protected string $operator = '<'; - - protected string $bitOperator = '<'; - - protected string $zvalOperator = 'ZEPHIR_LT'; - - protected string $zvalLongOperator = 'ZEPHIR_LT_LONG'; - - protected string $zvalLongNegOperator = 'ZEPHIR_GT_LONG'; - - protected string $zvalDoubleOperator = 'ZEPHIR_LT_DOUBLE'; - + protected string $bitOperator = '<'; + protected string $operator = '<'; protected string $zvalDoubleNegOperator = 'ZEPHIR_GT_DOUBLE'; + protected string $zvalDoubleOperator = 'ZEPHIR_LT_DOUBLE'; + protected string $zvalLongNegOperator = 'ZEPHIR_GT_LONG'; + protected string $zvalLongOperator = 'ZEPHIR_LT_LONG'; + protected string $zvalOperator = 'ZEPHIR_LT'; } diff --git a/src/Operators/Comparison/NotEqualsOperator.php b/src/Operators/Comparison/NotEqualsOperator.php new file mode 100644 index 0000000000..e51c936067 --- /dev/null +++ b/src/Operators/Comparison/NotEqualsOperator.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Comparison; + +class NotEqualsOperator extends ComparisonBaseOperator +{ + protected string $bitOperator = '!='; + protected bool $commutative = true; + protected bool $inverse = true; + protected string $operator = '!='; + protected string $zvalBoolFalseOperator = '!ZEPHIR_IS_FALSE'; + protected string $zvalBoolOperator = '!ZEPHIR_IS_BOOL_VALUE'; + protected string $zvalBoolTrueOperator = '!ZEPHIR_IS_TRUE'; + protected string $zvalDoubleOperator = '!ZEPHIR_IS_DOUBLE'; + protected string $zvalLongNegOperator = '!ZEPHIR_IS_LONG'; + protected string $zvalLongOperator = '!ZEPHIR_IS_LONG'; + protected string $zvalNullOperator = '!ZEPHIR_IS_NULL'; + protected string $zvalOperator = '!ZEPHIR_IS_EQUAL'; + protected string $zvalStringOperator = '!ZEPHIR_IS_STRING'; +} diff --git a/src/Operators/Comparison/NotIdenticalOperator.php b/src/Operators/Comparison/NotIdenticalOperator.php new file mode 100644 index 0000000000..45c3e39aad --- /dev/null +++ b/src/Operators/Comparison/NotIdenticalOperator.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Comparison; + +class NotIdenticalOperator extends ComparisonBaseOperator +{ + protected string $bitOperator = '!='; + protected bool $commutative = true; + protected bool $inverse = true; + protected string $operator = '!='; + protected string $zvalBoolFalseOperator = '!ZEPHIR_IS_FALSE_IDENTICAL'; + protected string $zvalBoolOperator = '!ZEPHIR_IS_BOOL_IDENTICAL'; + protected string $zvalBoolTrueOperator = '!ZEPHIR_IS_TRUE_IDENTICAL'; + protected string $zvalLongNegOperator = '!ZEPHIR_IS_LONG_IDENTICAL'; + protected string $zvalLongOperator = '!ZEPHIR_IS_LONG_IDENTICAL'; + protected string $zvalNullOperator = '!ZEPHIR_IS_NULL'; + protected string $zvalOperator = '!ZEPHIR_IS_IDENTICAL'; + protected string $zvalStringOperator = '!ZEPHIR_IS_STRING_IDENTICAL'; +} diff --git a/src/Operators/Logical/AndOperator.php b/src/Operators/Logical/AndOperator.php new file mode 100644 index 0000000000..fb6fa93624 --- /dev/null +++ b/src/Operators/Logical/AndOperator.php @@ -0,0 +1,151 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Logical; + +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\Statements\LetStatement; +use Zephir\Types\Types; +use Zephir\Variable\Variable; + +class AndOperator extends LogicalBaseOperator +{ + protected string $bitOperator = '&&'; + protected string $operator = '&&'; + + /** + * @param $expression + * @param CompilationContext $compilationContext + * + * @return CompiledExpression + * + * @throws ReflectionException + * @throws Exception + */ + public function compile($expression, CompilationContext $compilationContext): CompiledExpression + { + $this->checkLeft($expression); + $this->checkRight($expression); + + $leftExpr = new Expression($expression['left']); + $leftExpr->setReadOnly($this->readOnly); + $left = $leftExpr->compile($compilationContext); + + /** + * This variable is used to check if the compound and expression is evaluated as true or false. + */ + $flagVariable = $compilationContext->symbolTable->getTempVariableForWrite('bool', $compilationContext); + + $assignExprLeft = $this->getAssignmentExpression($left, $expression['left']); + + /** + * Create an implicit 'let' operation to update the evaluated left operator. + */ + $statement = new LetStatement([ + 'type' => 'let', + 'assignments' => [ + [ + 'assign-type' => 'variable', + 'variable' => $flagVariable->getName(), + 'operator' => 'assign', + 'expr' => $assignExprLeft, + 'file' => $expression['left']['file'], + 'line' => $expression['left']['line'], + 'char' => $expression['left']['char'], + ], + ], + ]); + $statement->compile($compilationContext); + + $compilationContext->codePrinter->output($this->getOutput($flagVariable)); + $compilationContext->codePrinter->increaseLevel(); + + $rightExpr = new Expression($expression['right']); + $rightExpr->setReadOnly($this->readOnly); + $right = $rightExpr->compile($compilationContext); + + $assignExprRight = $this->getAssignmentExpression($right, $expression['right']); + + /** + * Create an implicit 'let' operation to update the evaluated right operator. + */ + $statement = new LetStatement([ + 'type' => 'let', + 'assignments' => [ + [ + 'assign-type' => 'variable', + 'variable' => $flagVariable->getName(), + 'operator' => 'assign', + 'expr' => $assignExprRight, + 'file' => $expression['right']['file'], + 'line' => $expression['right']['line'], + 'char' => $expression['right']['char'], + ], + ], + ]); + $statement->compile($compilationContext); + + $compilationContext->codePrinter->decreaseLevel(); + $compilationContext->codePrinter->output('}'); + + return new CompiledExpression('bool', $flagVariable->getName(), $expression); + } + + /** + * @param Variable $variable + * + * @return string + */ + protected function getOutput(Variable $variable): string + { + return 'if (' . $variable->getName() . ') {'; + } + + /** + * @param CompiledExpression $left + * @param array $expression + * + * @return array + */ + private function getAssignmentExpression(CompiledExpression $left, array $expression): array + { + return match ($left->getType()) { + Types::T_INT, + Types::T_BOOL, + Types::T_CHAR, + Types::T_DOUBLE, + Types::T_UINT, + Types::T_UCHAR => [ + 'type' => $left->getType(), + 'value' => $left->getCode(), + ], + Types::T_VARIABLE => [ + 'type' => 'variable', + 'value' => $left->getCode(), + ], + Types::T_NULL => [ + 'type' => 'null', + 'value' => null, + ], + default => throw new CompilerException( + $left->getType(), + $expression + ), + }; + } +} diff --git a/src/Operators/Logical/LogicalBaseOperator.php b/src/Operators/Logical/LogicalBaseOperator.php new file mode 100644 index 0000000000..62e3d67285 --- /dev/null +++ b/src/Operators/Logical/LogicalBaseOperator.php @@ -0,0 +1,571 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Logical; + +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\Operators\AbstractOperator; +use Zephir\Types\Types; + +/** + * This is the base operator for logical operators + */ +class LogicalBaseOperator extends AbstractOperator +{ + public function compile($expression, CompilationContext $compilationContext): CompiledExpression + { + $this->checkLeft($expression, CompilerException::class, $expression); + $this->checkRight($expression, CompilerException::class, $expression); + + $leftExpr = new Expression($expression['left']); + $leftExpr->setReadOnly($this->readOnly); + $left = $leftExpr->compile($compilationContext); + + $rightExpr = new Expression($expression['right']); + $rightExpr->setReadOnly($this->readOnly); + $right = $rightExpr->compile($compilationContext); + + switch ($left->getType()) { + case 'int': + switch ($right->getType()) { + case 'int': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'double': + return new CompiledExpression( + 'double', + '((double) ' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'int', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getBooleanCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + case 'bool': + case 'double': + case 'int': + return new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $variableRight->getName( + ) . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableCode = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + '(' . $left->getCode( + ) . ' ' . $this->operator . ' zephir_is_true(' . $variableCode . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot compare variable('int') with variable('" . $variableRight->getType() . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot compare 'int' with '" . $right->getType() . "'", + $expression + ); + } + + + case 'bool': + switch ($right->getType()) { + case 'int': + case 'double': + return new CompiledExpression( + 'bool', + '(' . $left->getBooleanCode() . ' ((' . $right->getCode() . ') ? 1 : 0))', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $left->getBooleanCode() . ' ' . $right->getBooleanCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression + ); + switch ($variableRight->getType()) { + case 'bool': + case 'double': + case 'int': + return new CompiledExpression( + 'bool', + '(' . $left->getBooleanCode( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $variableCode = $compilationContext->backend->getVariableCode($variableRight); + $compilationContext->headersManager->add('kernel/operators'); + + return new CompiledExpression( + 'bool', + '(' . $left->getBooleanCode( + ) . ' ' . $this->operator . ' zephir_is_true(' . $variableCode . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot add variable('int') with variable('" . $variableRight->getType() . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot compare 'bool' with '" . $right->getType() . "'", + $expression + ); + } + + case 'double': + return match ($right->getType()) { + Types::T_DOUBLE, + Types::T_INT => new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getCode() . ')', + $expression + ), + Types::T_BOOL => new CompiledExpression( + 'bool', + '(' . $left->getCode() . ' ' . $this->operator . ' ' . $right->getBooleanCode() . ')', + $expression + ), + default => throw new CompilerException( + "Cannot compare 'double' with '" . $right->getType() . "'", + $expression + ), + }; + + + case 'string': + throw new CompilerException('Operation is not supported between strings', $expression); + + + case 'variable': + $variableLeft = $compilationContext->symbolTable->getVariableForRead( + $left->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + switch ($variableLeft->getType()) { + case 'int': + switch ($right->getType()) { + case 'int': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' ' . $this->operator . ' ' . $right->getCode( + ) . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'bool': + case 'double': + case 'int': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableCode = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'int', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' zephir_is_true(' . $variableCode . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot compare variable('int') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot compare variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'bool': + switch ($right->getType()) { + case 'int': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' ' . $this->operator . ' ' . $right->getCode( + ) . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' ' . $right->getBooleanCode() . ')', + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' ' . $variableRight->getName() . ')', + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableCode = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName( + ) . ' ' . $this->operator . ' zephir_is_true(' . $variableCode . '))', + $expression + ); + + default: + throw new CompilerException( + "Cannot compare variable('int') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot compare variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'double': + switch ($right->getType()) { + case 'double': + case 'int': + return new CompiledExpression( + 'bool', + $variableLeft->getName() . ' ' . $this->operator . ' ' . $right->getCode(), + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + $variableLeft->getName() . ' ' . $right->getBooleanCode(), + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + return new CompiledExpression( + 'bool', + $variableLeft->getName( + ) . ' ' . $this->operator . ' (double) ' . $variableRight->getName(), + $expression + ); + + case 'double': + return new CompiledExpression( + 'bool', + $variableLeft->getName( + ) . ' ' . $this->operator . ' ' . $variableRight->getName(), + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + $variableLeft->getName() . ' ' . $variableRight->getName(), + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableCode = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + $variableLeft->getName( + ) . ' ' . $this->operator . ' zephir_is_true(' . $variableCode . ')', + $expression + ); + + default: + throw new CompilerException( + "Cannot compare variable('double') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot compare variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'string': + switch ($right->getType()) { + case 'double': + case 'int': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' && Z_STRLEN_P(' . $variableLeft->getName( + ) . ')) ' . $this->operator . ' ' . $right->getCode(), + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' && Z_STRLEN_P(' . $variableLeft->getName( + ) . ')) ' . $right->getBooleanCode(), + $expression + ); + + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); + switch ($variableRight->getType()) { + case 'int': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' && Z_STRLEN_P(' . $variableLeft->getName( + ) . ')) ' . $this->operator . ' ' . $variableRight->getName(), + $expression + ); + + case 'double': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' && Z_STRLEN_P(' . $variableLeft->getName( + ) . ')) ' . $this->operator . ' ' . $variableRight->getName(), + $expression + ); + + case 'string': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' && Z_STRLEN_P(' . $variableLeft->getName( + ) . ')) ' . $this->operator . ' (' . $variableRight->getName( + ) . ' && Z_STRLEN_P(' . $variableRight->getName() . '))', + $expression + ); + + case 'bool': + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' && Z_STRLEN_P(' . $variableLeft->getName( + ) . ')) ' . $variableRight->getName(), + $expression + ); + + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $variableCode = $compilationContext->backend->getVariableCode($variableRight); + + return new CompiledExpression( + 'bool', + '(' . $variableLeft->getName() . ' && Z_STRLEN_P(' . $variableLeft->getName( + ) . ')) ' . $this->operator . ' zephir_is_true(' . $variableCode . ')', + $expression + ); + + default: + throw new CompilerException( + "Cannot compare variable('double') with variable('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot compare variable('int') with '" . $right->getType() . "'", + $expression + ); + } + + + case 'variable': + $variableLeftCode = $compilationContext->backend->getVariableCode($variableLeft); + switch ($right->getType()) { + /* a && 1 */ + case 'int': + case 'bool': + case 'double': + $compilationContext->headersManager->add('kernel/operators'); + $op = $this->operator; + $op1 = $variableLeftCode; + $op2 = $right->getCode(); + $compilationContext->headersManager->add('kernel/operators'); + + return new CompiledExpression( + 'bool', + 'zephir_is_true(' . $op1 . ') ' . $op . ' ' . $op2, + $expression + ); + + /* a(var) && a(x) */ + case 'variable': + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->resolve(null, $compilationContext), + $compilationContext, + $expression + ); + $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); + switch ($variableRight->getType()) { + /* a(var) && a(int) */ + /* a(var) && a(bool) */ + case 'bool': + case 'int': + $compilationContext->headersManager->add('kernel/operators'); + + return new CompiledExpression( + 'bool', + 'zephir_is_true(' . $variableLeftCode . ') ' . $this->operator . ' ' . $variableRightCode, + $expression + ); + + /* a(var) && a(var) */ + case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + $op1 = $variableLeftCode; + $op2 = $variableRightCode; + + $expected = $this->getExpected($compilationContext, $expression); + if ($expected->isLocalOnly()) { + $compilationContext->codePrinter->output( + 'add_function(&' . $expected->getName( + ) . ', ' . $op1 . ', ' . $op2 . ');' + ); + } else { + $compilationContext->codePrinter->output( + 'add_function(' . $expected->getName( + ) . ', ' . $op1 . ', ' . $op2 . ');' + ); + } + + return new CompiledExpression('variable', $expected->getName(), $expression); + + default: + throw new CompilerException( + "Cannot compare 'variable' with variable ('" . $variableRight->getType( + ) . "')", + $expression + ); + } + + + default: + throw new CompilerException( + "Cannot compare 'variable' with '" . $right->getType() . "'", + $expression + ); + } + + + default: + throw CompilerException::unknownType($variableLeft, $expression); + } + + + default: + throw CompilerException::unsupportedType($left, $expression); + } + } +} diff --git a/src/Operators/Logical/OrOperator.php b/src/Operators/Logical/OrOperator.php new file mode 100644 index 0000000000..966e1d2225 --- /dev/null +++ b/src/Operators/Logical/OrOperator.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Logical; + +use Zephir\Variable\Variable; + +class OrOperator extends AndOperator +{ + protected string $bitOperator = '||'; + protected string $operator = '||'; + + /** + * @param Variable $variable + * + * @return string + */ + protected function getOutput(Variable $variable): string + { + return 'if (!(' . $variable->getName() . ')) {'; + } +} diff --git a/Library/Operators/Other/CastOperator.php b/src/Operators/Other/CastOperator.php similarity index 85% rename from Library/Operators/Other/CastOperator.php rename to src/Operators/Other/CastOperator.php index 26b8ac9724..b8811a6660 100644 --- a/Library/Operators/Other/CastOperator.php +++ b/src/Operators/Other/CastOperator.php @@ -22,7 +22,7 @@ use Zephir\Expression; use Zephir\Operators\AbstractOperator; use Zephir\Statements\Let\Variable as LetVariable; -use Zephir\Types; +use Zephir\Types\Types; /** * Converts a value into another of a different type @@ -42,7 +42,7 @@ class CastOperator extends AbstractOperator public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { try { - $expr = new Expression($expression['right']); + $expr = new Expression($expression['right']); $resolved = $expr->compile($compilationContext); } catch (Exception $e) { throw new CompilerException($e->getMessage(), $expression, $e->getCode(), $e); @@ -62,7 +62,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('int', $resolved->getCode(), $expression); case Types::T_DOUBLE: - return new CompiledExpression('int', '(int) '.$resolved->getCode(), $expression); + return new CompiledExpression('int', '(int) ' . $resolved->getCode(), $expression); case Types::T_BOOL: return new CompiledExpression('int', $resolved->getBooleanCode(), $expression); @@ -81,7 +81,7 @@ public function compile(array $expression, CompilationContext $compilationContex $compilationContext ); - $original = $resolved->getOriginal(); + $original = $resolved->getOriginal(); $original['operator'] = 'assign'; $let = new LetVariable(); @@ -97,7 +97,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression( 'int', - 'zephir_get_intval_ex('.$symbol.')', + 'zephir_get_intval_ex(' . $symbol . ')', $expression ); @@ -108,9 +108,9 @@ public function compile(array $expression, CompilationContext $compilationContex $compilationContext, $expression ); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); - return new CompiledExpression('int', 'zephir_get_intval('.$symbol.')', $expression); + return new CompiledExpression('int', 'zephir_get_intval(' . $symbol . ')', $expression); case Types::T_VARIABLE: $compilationContext->headersManager->add('kernel/operators'); @@ -129,7 +129,7 @@ public function compile(array $expression, CompilationContext $compilationContex case Types::T_BOOL: return new CompiledExpression( 'int', - '(int) ('.$symbolVariable->getName().')', + '(int) (' . $symbolVariable->getName() . ')', $expression ); @@ -141,7 +141,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression( 'int', - 'zephir_get_intval('.$symbol.')', + 'zephir_get_intval(' . $symbol . ')', $expression ); @@ -156,7 +156,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + default: throw new CompilerException( @@ -164,7 +164,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + case Types::T_LONG: switch ($resolved->getType()) { @@ -180,7 +180,7 @@ public function compile(array $expression, CompilationContext $compilationContex ); case Types::T_DOUBLE: - return new CompiledExpression('long', '(long) '.$resolved->getCode(), $expression); + return new CompiledExpression('long', '(long) ' . $resolved->getCode(), $expression); case Types::T_BOOL: return new CompiledExpression('long', $resolved->getBooleanCode(), $expression); @@ -195,7 +195,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression( 'long', - 'zephir_get_intval('.$symbolVariable->getName().')', + 'zephir_get_intval(' . $symbolVariable->getName() . ')', $expression ); @@ -215,7 +215,7 @@ public function compile(array $expression, CompilationContext $compilationContex case Types::T_DOUBLE: return new CompiledExpression( 'long', - '(long) ('.$symbolVariable->getName().')', + '(long) (' . $symbolVariable->getName() . ')', $expression ); @@ -225,7 +225,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression( 'long', - 'zephir_get_intval('.$symbol.')', + 'zephir_get_intval(' . $symbol . ')', $expression ); @@ -240,7 +240,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + default: throw new CompilerException( @@ -248,7 +248,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + case Types::T_DOUBLE: switch ($resolved->getType()) { @@ -278,11 +278,11 @@ public function compile(array $expression, CompilationContext $compilationContex $compilationContext, $expression ); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); return new CompiledExpression( 'double', - 'zephir_get_doubleval('.$symbol.')', + 'zephir_get_doubleval(' . $symbol . ')', $expression ); @@ -334,7 +334,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + default: throw new CompilerException( @@ -342,14 +342,14 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + case Types::T_BOOL: switch ($resolved->getType()) { case Types::T_INT: return new CompiledExpression( 'bool', - '(zend_bool) '.$resolved->getCode(), + '(zend_bool) ' . $resolved->getCode(), $expression ); @@ -371,41 +371,35 @@ public function compile(array $expression, CompilationContext $compilationContex $compilationContext, $expression ); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + + $this->checkVariableTemporal($symbolVariable); + + return match ($symbolVariable->getType()) { + Types::T_INT, + Types::T_CHAR, + Types::T_UCHAR => new CompiledExpression( + 'bool', + sprintf('(zend_bool) %s', $symbolVariable->getName()), + $expression + ), + Types::T_VARIABLE, + Types::T_MIXED => new CompiledExpression( + 'bool', + sprintf('zephir_get_boolval(%s)', $symbol), + $expression + ), + default => throw new CompilerException( + sprintf( + 'Cannot cast: %s(%s) to %s', + $resolved->getType(), + $symbolVariable->getType(), + $expression['left'] + ), + $expression + ), + }; - if ($symbolVariable->isTemporal()) { - $symbolVariable->setIdle(true); - } - switch ($symbolVariable->getType()) { - case Types::T_INT: - case Types::T_CHAR: - case Types::T_UCHAR: - return new CompiledExpression( - 'bool', - sprintf('(zend_bool) %s', $symbolVariable->getName()), - $expression - ); - - case Types::T_VARIABLE: - case Types::T_MIXED: - return new CompiledExpression( - 'bool', - sprintf('zephir_get_boolval(%s)', $symbol), - $expression - ); - - default: - throw new CompilerException( - sprintf( - 'Cannot cast: %s(%s) to %s', - $resolved->getType(), - $symbolVariable->getType(), - $expression['left'] - ), - $expression - ); - } - break; default: throw new CompilerException( @@ -413,7 +407,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + case Types::T_CHAR: switch ($resolved->getType()) { @@ -462,7 +456,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + case Types::T_STRING: switch ($resolved->getType()) { @@ -488,7 +482,7 @@ public function compile(array $expression, CompilationContext $compilationContex $compilationContext ); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); $resolvedCode = $compilationContext->backend->getVariableCode($resolvedVariable); $compilationContext->codePrinter->output( @@ -512,16 +506,14 @@ public function compile(array $expression, CompilationContext $compilationContex $symbolVariable->setMustInitNull(true); $symbolVariable->setIsInitialized(true, $compilationContext); $symbolVariable->increaseUses(); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); $resolvedCode = $compilationContext->backend->getVariableCode($resolvedVariable); $compilationContext->codePrinter->output( sprintf('zephir_cast_to_string(%s, %s);', $symbol, $resolvedCode) ); - if ($symbolVariable->isTemporal()) { - $symbolVariable->setIdle(true); - } + $this->checkVariableTemporal($symbolVariable); return new CompiledExpression( 'variable', @@ -530,14 +522,14 @@ public function compile(array $expression, CompilationContext $compilationContex ); } - break; + default: throw new CompilerException( sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } - break; + case Types::T_ARRAY: switch ($resolved->getType()) { @@ -554,20 +546,18 @@ public function compile(array $expression, CompilationContext $compilationContex $symbolVariable->setMustInitNull(true); $symbolVariable->setIsInitialized(true, $compilationContext); $symbolVariable->increaseUses(); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); $resolvedVariable = $compilationContext->symbolTable->getVariableForRead( $resolved->getCode(), $compilationContext ); - $resolvedCode = $compilationContext->backend->getVariableCode($resolvedVariable); + $resolvedCode = $compilationContext->backend->getVariableCode($resolvedVariable); $compilationContext->codePrinter->output( sprintf('zephir_get_arrval(%s, %s);', $symbol, $resolvedCode) ); - if ($symbolVariable->isTemporal()) { - $symbolVariable->setIdle(true); - } + $this->checkVariableTemporal($symbolVariable); return new CompiledExpression('variable', $symbolVariable->getName(), $expression); @@ -577,7 +567,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + case Types::T_OBJECT: switch ($resolved->getType()) { @@ -593,14 +583,14 @@ public function compile(array $expression, CompilationContext $compilationContex 'variable', $compilationContext ); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); /** * zephir_convert_to_object use zval variable - * before use with it we create a new variable and assign value of literal. + * before use it we create a new variable and assign value of literal. */ - $let = new LetVariable(); - $original = $resolved->getOriginal(); + $let = new LetVariable(); + $original = $resolved->getOriginal(); $original['operator'] = 'assign'; $let->assign( $symbolVariable->getName(), @@ -611,7 +601,7 @@ public function compile(array $expression, CompilationContext $compilationContex $original ); - $compilationContext->codePrinter->output('zephir_convert_to_object('.$symbol.');'); + $compilationContext->codePrinter->output('zephir_convert_to_object(' . $symbol . ');'); return new CompiledExpression('variable', $symbolVariable->getName(), $expression); @@ -623,12 +613,10 @@ public function compile(array $expression, CompilationContext $compilationContex $compilationContext, $expression ); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); - if ($symbolVariable->isTemporal()) { - $symbolVariable->setIdle(true); - } + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $this->checkVariableTemporal($symbolVariable); - $compilationContext->codePrinter->output('zephir_convert_to_object('.$symbol.');'); + $compilationContext->codePrinter->output('zephir_convert_to_object(' . $symbol . ');'); return new CompiledExpression('variable', $symbolVariable->getName(), $expression); @@ -638,7 +626,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expression ); } - break; + default: throw new CompilerException( diff --git a/Library/Operators/Other/CloneOperator.php b/src/Operators/Other/CloneOperator.php similarity index 77% rename from Library/Operators/Other/CloneOperator.php rename to src/Operators/Other/CloneOperator.php index 742430d903..47d149e360 100644 --- a/Library/Operators/Other/CloneOperator.php +++ b/src/Operators/Other/CloneOperator.php @@ -43,12 +43,19 @@ public function compile(array $expression, CompilationContext $compilationContex $exprCompiledVariable = $exprVariable->compile($compilationContext); if ('variable' !== $exprCompiledVariable->getType()) { - throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as array', $expression); + throw new CompilerException( + 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as array', + $expression + ); } - $clonedVariable = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariable->getCode(), $compilationContext, $expression); + $clonedVariable = $compilationContext->symbolTable->getVariableForRead( + $exprCompiledVariable->getCode(), + $compilationContext, + $expression + ); if ('variable' !== $clonedVariable->getType()) { - throw new CompilerException('Variable type: '.$exprVariable->getType().' cannot be cloned'); + throw new CompilerException('Variable type: ' . $exprVariable->getType() . ' cannot be cloned'); } if ($clonedVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { @@ -64,18 +71,19 @@ public function compile(array $expression, CompilationContext $compilationContex } $symbolVariable->setDynamicTypes('object'); - $symbolVariable->setIsInitialized(true, $compilationContext); /* Inherit the dynamic type data from the cloned object */ $symbolVariable->setDynamicTypes($clonedVariable->getDynamicTypes()); $symbolVariable->setClassTypes($clonedVariable->getClassTypes()); - $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); $clonedSymbol = $compilationContext->backend->getVariableCode($clonedVariable); - $compilationContext->codePrinter->output('if (zephir_clone('.$symbol.', '.$clonedSymbol.') == FAILURE) {'); - $compilationContext->codePrinter->output("\t".'RETURN_MM();'); + $compilationContext->codePrinter->output( + 'if (zephir_clone(' . $symbol . ', ' . $clonedSymbol . ') == FAILURE) {' + ); + $compilationContext->codePrinter->output("\t" . 'RETURN_MM();'); $compilationContext->codePrinter->output('}'); return new CompiledExpression('variable', $symbolVariable->getName(), $expression); diff --git a/Library/Operators/Other/ConcatOperator.php b/src/Operators/Other/ConcatOperator.php similarity index 79% rename from Library/Operators/Other/ConcatOperator.php rename to src/Operators/Other/ConcatOperator.php index 3f5ab4b7b5..473d6f7fa1 100644 --- a/Library/Operators/Other/ConcatOperator.php +++ b/src/Operators/Other/ConcatOperator.php @@ -18,8 +18,10 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; +use Zephir\Name; use Zephir\Operators\AbstractOperator; -use function Zephir\add_slashes; + +use function is_array; /** * Perform concatenations and optimizations @@ -38,13 +40,8 @@ class ConcatOperator extends AbstractOperator */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression', $expression); - } - - if (!isset($expression['right'])) { - throw new CompilerException('Missing right part of the expression', $expression); - } + $this->checkLeft($expression, CompilerException::class, $expression); + $this->checkRight($expression, CompilerException::class, $expression); $compilationContext->headersManager->add('kernel/concat'); @@ -52,7 +49,7 @@ public function compile(array $expression, CompilationContext $compilationContex * Try to optimize the concatenation. */ $optimized = $this->_getOptimizedConcat($expression, $compilationContext, $isFullString); - if (\is_array($optimized)) { + if (is_array($optimized)) { if (!$isFullString) { $expected = $this->getExpectedComplexLiteral($compilationContext); } else { @@ -72,34 +69,48 @@ public function compile(array $expression, CompilationContext $compilationContex * If the expression cannot be optimized, fall back to the standard compilation. */ $leftExpr = new Expression($expression['left']); - $left = $this->compileExpression($leftExpr, $compilationContext, $expression['left']['type']); + $left = $this->compileExpression($leftExpr, $compilationContext, $expression['left']['type']); if ('variable' == $left->getType()) { - $variableLeft = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression['right']); + $variableLeft = $compilationContext->symbolTable->getVariableForRead( + $left->getCode(), + $compilationContext, + $expression['right'] + ); $variableLeft = $compilationContext->backend->getVariableCode($variableLeft); } $rightExpr = new Expression($expression['right']); - $right = $this->compileExpression($rightExpr, $compilationContext, $expression['left']['type']); + $right = $this->compileExpression($rightExpr, $compilationContext, $expression['left']['type']); if ('variable' == $right->getType()) { - $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $right->getCode(), + $compilationContext, + $expression['right'] + ); $variableRight = $compilationContext->backend->getVariableCode($variableRight); } - $expected = $this->getExpectedComplexLiteral($compilationContext); + $expected = $this->getExpectedComplexLiteral($compilationContext); $expectedCode = $compilationContext->backend->getVariableCode($expected); if ('string' == $left->getType() && 'variable' == $right->getType()) { - $compilationContext->codePrinter->output('ZEPHIR_CONCAT_SV('.$expectedCode.', "'.$left->getCode().'", '.$variableRight.');'); + $compilationContext->codePrinter->output( + 'ZEPHIR_CONCAT_SV(' . $expectedCode . ', "' . $left->getCode() . '", ' . $variableRight . ');' + ); } if ('variable' == $left->getType() && 'string' == $right->getType()) { - $compilationContext->codePrinter->output('ZEPHIR_CONCAT_VS('.$expectedCode.', '.$variableLeft.', "'.$right->getCode().'");'); + $compilationContext->codePrinter->output( + 'ZEPHIR_CONCAT_VS(' . $expectedCode . ', ' . $variableLeft . ', "' . $right->getCode() . '");' + ); } if ('variable' == $left->getType() && 'variable' == $right->getType()) { - $compilationContext->codePrinter->output('zephir_concat_function('.$expectedCode.', '.$variableLeft.', '.$variableRight.');'); + $compilationContext->codePrinter->output( + 'zephir_concat_function(' . $expectedCode . ', ' . $variableLeft . ', ' . $variableRight . ');' + ); } $expected->setDynamicTypes('string'); @@ -116,8 +127,11 @@ public function compile(array $expression, CompilationContext $compilationContex * * @throws CompilerException */ - private function _getOptimizedConcat(array $expression, CompilationContext $compilationContext, &$isFullString): array - { + private function _getOptimizedConcat( + array $expression, + CompilationContext $compilationContext, + &$isFullString + ): array { $originalExpr = $expression; $isFullString = true; @@ -127,7 +141,7 @@ private function _getOptimizedConcat(array $expression, CompilationContext $comp if ('concat' == $expression['left']['type']) { $expression = $expression['left']; } else { - $parts[] = $expression['left']; + $parts[] = $expression['left']; $expression = null; } } @@ -136,11 +150,11 @@ private function _getOptimizedConcat(array $expression, CompilationContext $comp $parts[] = $expression['left']; } - $key = ''; + $key = ''; $concatParts = []; - $parts = array_reverse($parts); + $parts = array_reverse($parts); foreach ($parts as $part) { - $expr = new Expression($part); + $expr = new Expression($part); $compiledExpr = $this->compileExpression($expr, $compilationContext, $part['type']); switch ($compiledExpr->getType()) { @@ -152,13 +166,13 @@ private function _getOptimizedConcat(array $expression, CompilationContext $comp ); switch ($variable->getType()) { case 'variable': - $key .= 'v'; + $key .= 'v'; $concatParts[] = $compilationContext->backend->getVariableCode($variable); - $isFullString = false; + $isFullString = false; break; case 'string': - $key .= 'v'; + $key .= 'v'; $concatParts[] = $compilationContext->backend->getVariableCode($variable); break; @@ -166,7 +180,7 @@ private function _getOptimizedConcat(array $expression, CompilationContext $comp case 'uint': case 'long': case 'ulong': - $key .= 'v'; + $key .= 'v'; $tempVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite( 'variable', $compilationContext @@ -180,7 +194,7 @@ private function _getOptimizedConcat(array $expression, CompilationContext $comp break; case 'double': - $key .= 'v'; + $key .= 'v'; $tempVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite( 'variable', $compilationContext @@ -205,15 +219,15 @@ private function _getOptimizedConcat(array $expression, CompilationContext $comp break; case 'string': - $key .= 's'; - $concatParts[] = '"'.add_slashes($compiledExpr->getCode()).'"'; + $key .= 's'; + $concatParts[] = '"' . Name::addSlashes($compiledExpr->getCode()) . '"'; break; case 'int': case 'uint': case 'long': case 'ulong': - $key .= 'v'; + $key .= 'v'; $tempVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite( 'variable', $compilationContext @@ -225,11 +239,11 @@ private function _getOptimizedConcat(array $expression, CompilationContext $comp $compiledExpr->getCode() ) ); - $concatParts[] = '&'.$tempVariable->getName(); + $concatParts[] = '&' . $tempVariable->getName(); break; case 'double': - $key .= 'v'; + $key .= 'v'; $tempVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite( 'variable', $compilationContext @@ -241,7 +255,7 @@ private function _getOptimizedConcat(array $expression, CompilationContext $comp $compiledExpr->getCode() ) ); - $concatParts[] = '&'.$tempVariable->getName(); + $concatParts[] = '&' . $tempVariable->getName(); break; default: diff --git a/Library/Operators/Other/EmptyOperator.php b/src/Operators/Other/EmptyOperator.php similarity index 77% rename from Library/Operators/Other/EmptyOperator.php rename to src/Operators/Other/EmptyOperator.php index a2499d599a..8a7eb6a573 100644 --- a/Library/Operators/Other/EmptyOperator.php +++ b/src/Operators/Other/EmptyOperator.php @@ -49,11 +49,22 @@ public function compile(array $expression, CompilationContext $compilationContex throw new CompilerException("'empty' operand only can be a variable", $expression['left']); } - $variableLeft = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression['left']); + $variableLeft = $compilationContext->symbolTable->getVariableForRead( + $left->getCode(), + $compilationContext, + $expression['left'] + ); if (!$variableLeft->isVariable() && !$variableLeft->isString() && !$variableLeft->isArray()) { - throw new CompilerException("Only dynamic/string variables can be used in 'empty' operators", $expression['left']); + throw new CompilerException( + "Only dynamic/string variables can be used in 'empty' operators", + $expression['left'] + ); } - return new CompiledExpression('bool', 'ZEPHIR_IS_EMPTY('.$compilationContext->backend->getVariableCode($variableLeft).')', $expression); + return new CompiledExpression( + 'bool', + 'ZEPHIR_IS_EMPTY(' . $compilationContext->backend->getVariableCode($variableLeft) . ')', + $expression + ); } } diff --git a/Library/Operators/Other/FetchOperator.php b/src/Operators/Other/FetchOperator.php similarity index 60% rename from Library/Operators/Other/FetchOperator.php rename to src/Operators/Other/FetchOperator.php index 4bb93c1f57..b78e96eb2c 100644 --- a/Library/Operators/Other/FetchOperator.php +++ b/src/Operators/Other/FetchOperator.php @@ -21,8 +21,6 @@ use Zephir\Operators\AbstractOperator; /** - * FetchOperator. - * * Fetch is a special operator that checks if an expression 'isset' and then obtain the value * without calculating the hash key twice */ @@ -40,9 +38,17 @@ public function compile(array $expression, CompilationContext $compilationContex { $compilationContext->headersManager->add('kernel/array'); - $variable = $compilationContext->symbolTable->getVariableForWrite($expression['left']['value'], $compilationContext, $expression['left']); + $variable = $compilationContext->symbolTable->getVariableForWrite( + $expression['left']['value'], + $compilationContext, + $expression['left'] + ); if ('variable' != $variable->getType()) { - throw new CompilerException('Cannot use variable type: '.$variable->gettype().' in "fetch" operator', $expression); + throw CompilerException::cannotUseVariableTypeAs( + $variable, + 'in "fetch" operator', + $expression + ); } /** @@ -53,7 +59,10 @@ public function compile(array $expression, CompilationContext $compilationContex * TODO: use a read detector here */ $readOnly = false; - $line = max($compilationContext->symbolTable->getLastCallLine(), $compilationContext->symbolTable->getLastUnsetLine()); + $line = max( + $compilationContext->symbolTable->getLastCallLine(), + $compilationContext->symbolTable->getLastUnsetLine() + ); if (false === $line || ($line > 0 && $line < $expression['line'])) { $numberMutations = $compilationContext->symbolTable->getExpectedMutations($variable->getName()); if (1 == $numberMutations) { @@ -86,12 +95,22 @@ public function compile(array $expression, CompilationContext $compilationContex $exprCompiledVariable = $exprVariable->compile($compilationContext); if ('variable' != $exprCompiledVariable->getType()) { - throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as array', $expression['right']['left']); + throw new CompilerException( + 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as array', + $expression['right']['left'] + ); } - $evalVariable = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariable->getCode(), $compilationContext, $expression['right']['left']); + $evalVariable = $compilationContext->symbolTable->getVariableForRead( + $exprCompiledVariable->getCode(), + $compilationContext, + $expression['right']['left'] + ); if ('variable' != $evalVariable->getType() && 'array' != $evalVariable->getType()) { - throw new CompilerException('Variable type: '.$variable->getType().' cannot be used as array', $expression['right']['left']); + throw new CompilerException( + 'Variable type: ' . $variable->getType() . ' cannot be used as array', + $expression['right']['left'] + ); } if ('variable' == $evalVariable->getType()) { @@ -108,8 +127,14 @@ public function compile(array $expression, CompilationContext $compilationContex $expr->setNoisy(false); $resolvedExpr = $expr->compile($compilationContext); - return $compilationContext->backend->arrayIssetFetch($variable, $evalVariable, $resolvedExpr, $flags, $expression, $compilationContext); - break; + return $compilationContext->backend->arrayIssetFetch( + $variable, + $evalVariable, + $resolvedExpr, + $flags, + $expression, + $compilationContext + ); case 'property-access': $exprVariable = new Expression($expression['right']['left']); @@ -118,12 +143,22 @@ public function compile(array $expression, CompilationContext $compilationContex $exprCompiledVariable = $exprVariable->compile($compilationContext); if ('variable' != $exprCompiledVariable->getType()) { - throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as object', $expression['right']['left']); + throw new CompilerException( + 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as object', + $expression['right']['left'] + ); } - $evalVariable = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariable->getCode(), $compilationContext, $expression['right']['left']); + $evalVariable = $compilationContext->symbolTable->getVariableForRead( + $exprCompiledVariable->getCode(), + $compilationContext, + $expression['right']['left'] + ); if ('variable' != $evalVariable->getType()) { - throw new CompilerException('Variable type: '.$variable->getType().' cannot be used as object', $expression['right']['left']); + throw new CompilerException( + 'Variable type: ' . $variable->getType() . ' cannot be used as object', + $expression['right']['left'] + ); } if ($evalVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { @@ -136,10 +171,14 @@ public function compile(array $expression, CompilationContext $compilationContex $property = $expression['right']['right']['value']; $compilationContext->headersManager->add('kernel/object'); - $symbol = $compilationContext->backend->getVariableCodePointer($variable); + $symbol = $compilationContext->backend->getVariableCode($variable); $evalSymbol = $compilationContext->backend->getVariableCode($evalVariable); - return new CompiledExpression('bool', 'zephir_fetch_property('.$symbol.', '.$evalSymbol.', SL("'.$property.'"), PH_SILENT_CC)', $expression); + return new CompiledExpression( + 'bool', + 'zephir_fetch_property(' . $symbol . ', ' . $evalSymbol . ', SL("' . $property . '"), PH_SILENT_CC)', + $expression + ); case 'property-dynamic-access': $exprVariable = new Expression($expression['right']['left']); @@ -148,12 +187,22 @@ public function compile(array $expression, CompilationContext $compilationContex $exprCompiledVariable = $exprVariable->compile($compilationContext); if ('variable' != $exprCompiledVariable->getType()) { - throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as object', $expression['right']['left']); + throw new CompilerException( + 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as object', + $expression['right']['left'] + ); } - $evalVariable = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariable->getCode(), $compilationContext, $expression['right']['left']); + $evalVariable = $compilationContext->symbolTable->getVariableForRead( + $exprCompiledVariable->getCode(), + $compilationContext, + $expression['right']['left'] + ); if ('variable' != $evalVariable->getType()) { - throw new CompilerException('Variable type: '.$evalVariable->getType().' cannot be used as object', $expression['right']['left']); + throw new CompilerException( + 'Variable type: ' . $evalVariable->getType() . ' cannot be used as object', + $expression['right']['left'] + ); } if ($evalVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { @@ -168,24 +217,43 @@ public function compile(array $expression, CompilationContext $compilationContex $exprCompiledVariableProperty = $exprVariableProperty->compile($compilationContext); if ('variable' != $exprCompiledVariableProperty->getType()) { - throw new CompilerException('Expression type: '.$exprCompiledVariableProperty->getType().' cannot be used in property-dynamic-access', $expression['right']['right']); + throw new CompilerException( + 'Expression type: ' . $exprCompiledVariableProperty->getType( + ) . ' cannot be used in property-dynamic-access', + $expression['right']['right'] + ); } - $evalVariableProperty = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariableProperty->getCode(), $compilationContext, $expression['right']['right']); + $evalVariableProperty = $compilationContext->symbolTable->getVariableForRead( + $exprCompiledVariableProperty->getCode(), + $compilationContext, + $expression['right']['right'] + ); if ('variable' != $evalVariableProperty->getType() && 'string' != $evalVariableProperty->getType()) { - throw new CompilerException('Variable type: '.$evalVariableProperty->getType().' cannot be used in property-dynamic-access', $expression['right']['right']); + throw new CompilerException( + 'Variable type: ' . $evalVariableProperty->getType( + ) . ' cannot be used in property-dynamic-access', + $expression['right']['right'] + ); } $compilationContext->headersManager->add('kernel/object'); - $symbol = $compilationContext->backend->getVariableCodePointer($variable); - $evalSymbol = $compilationContext->backend->getVariableCode($evalVariable); + $symbol = $compilationContext->backend->getVariableCode($variable); + $evalSymbol = $compilationContext->backend->getVariableCode($evalVariable); $evalPropertySymbol = $compilationContext->backend->getVariableCode($evalVariableProperty); - return new CompiledExpression('bool', 'zephir_fetch_property_zval('.$symbol.', '.$evalSymbol.', '.$evalPropertySymbol.', PH_SILENT_CC)', $expression); + return new CompiledExpression( + 'bool', + 'zephir_fetch_property_zval(' . $symbol . ', ' . $evalSymbol . ', ' . $evalPropertySymbol . ', PH_SILENT_CC)', + $expression + ); default: - throw new CompilerException('Cannot use this expression for "fetch" operators: '.$expression['right']['type'], $expression); + throw new CompilerException( + 'Cannot use this expression for "fetch" operators: ' . $expression['right']['type'], + $expression + ); } } } diff --git a/Library/Operators/Other/InstanceOfOperator.php b/src/Operators/Other/InstanceOfOperator.php similarity index 73% rename from Library/Operators/Other/InstanceOfOperator.php rename to src/Operators/Other/InstanceOfOperator.php index 1a7bc683e0..ab91a4a1d2 100644 --- a/Library/Operators/Other/InstanceOfOperator.php +++ b/src/Operators/Other/InstanceOfOperator.php @@ -14,7 +14,7 @@ namespace Zephir\Operators\Other; use ReflectionException; -use Zephir\Classes\Entry; +use Zephir\Class\Entry; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -22,15 +22,13 @@ use Zephir\Expression; use Zephir\Operators\AbstractOperator; -use function Zephir\escape_class; - /** * Checks if a variable is an instance of a class */ class InstanceOfOperator extends AbstractOperator { /** - * @param $expression + * @param $expression * @param CompilationContext $context * * @return CompiledExpression @@ -40,7 +38,7 @@ class InstanceOfOperator extends AbstractOperator */ public function compile($expression, CompilationContext $context): CompiledExpression { - $left = new Expression($expression['left']); + $left = new Expression($expression['left']); $resolved = $left->compile($context); if ('variable' != $resolved->getType()) { @@ -52,8 +50,8 @@ public function compile($expression, CompilationContext $context): CompiledExpre throw new CompilerException("InstanceOf requires a 'dynamic variable' in the left operand", $expression); } - $right = new Expression($expression['right']); - $resolved = $right->compile($context); + $right = new Expression($expression['right']); + $resolved = $right->compile($context); $resolvedVariable = $resolved->getCode(); switch ($resolved->getType()) { @@ -74,25 +72,29 @@ public function compile($expression, CompilationContext $context): CompiledExpre if ('Traversable' === $className) { $symbol = $context->backend->getVariableCode($symbolVariable); - return new CompiledExpression('bool', 'zephir_zval_is_traversable('.$symbol.')', $expression); + return new CompiledExpression( + 'bool', + 'zephir_zval_is_traversable(' . $symbol . ')', + $expression + ); } if ($context->compiler->isClass($className)) { $classDefinition = $context->compiler->getClassDefinition($className); - $classEntry = $classDefinition->getClassEntry($context); + $classEntry = $classDefinition->getClassEntry($context); } else { if ($context->compiler->isInterface($className)) { $classDefinition = $context->compiler->getClassDefinition($className); - $classEntry = $classDefinition->getClassEntry($context); + $classEntry = $classDefinition->getClassEntry($context); } else { if (!class_exists($className, false)) { - $code = 'SL("'.trim(escape_class($className), '\\').'")'; + $code = 'SL("' . trim(Entry::escape($className), '\\') . '")'; } else { - $entry = (new Entry($resolvedVariable, $context)); + $entry = (new Entry($resolvedVariable, $context)); $classEntry = $entry->get(); if (!$entry->isInternal()) { - $code = 'SL("'.trim(escape_class($className), '\\').'")'; + $code = 'SL("' . trim(Entry::escape($className), '\\') . '")'; } } } @@ -108,12 +110,17 @@ public function compile($expression, CompilationContext $context): CompiledExpre $tempVariable = $context->symbolTable->getTempVariableForWrite('string', $context); $tempVariable->setMustInitNull(true); $tempVariableName = $tempVariable->getName(); - $context->codePrinter->output('zephir_get_strval('.$tempVariableName.', '.$resolvedVariable.');'); + $context->codePrinter->output( + 'zephir_get_strval(' . $tempVariableName . ', ' . $resolvedVariable . ');' + ); $code = $this->prepareBackendSpecificCode($tempVariableName, $context); break; default: - throw new CompilerException("InstanceOf requires a 'variable' or a 'string' in the right operand", $expression); + throw new CompilerException( + "InstanceOf requires a 'variable' or a 'string' in the right operand", + $expression + ); } } @@ -121,17 +128,21 @@ public function compile($expression, CompilationContext $context): CompiledExpre $context->headersManager->add('kernel/object'); $symbol = $context->backend->getVariableCode($symbolVariable); if (isset($code)) { - return new CompiledExpression('bool', 'zephir_is_instance_of('.$symbol.', '.$code.')', $expression); + return new CompiledExpression('bool', 'zephir_is_instance_of(' . $symbol . ', ' . $code . ')', $expression); } - return new CompiledExpression('bool', 'zephir_instance_of_ev('.$symbol.', '.$classEntry.')', $expression); + return new CompiledExpression( + 'bool', + 'zephir_instance_of_ev(' . $symbol . ', ' . $classEntry . ')', + $expression + ); } private function prepareBackendSpecificCode($variable, CompilationContext $context): string { return strtr('Z_STRVAL_P(:p:name), Z_STRLEN_P(:p:name)', [ ':name' => $variable, - ':p' => $context->backend->isZE3() ? '&' : '', + ':p' => '&', ]); } } diff --git a/Library/Operators/Other/IssetOperator.php b/src/Operators/Other/IssetOperator.php similarity index 65% rename from Library/Operators/Other/IssetOperator.php rename to src/Operators/Other/IssetOperator.php index 061ce042a4..4c96265ba4 100644 --- a/Library/Operators/Other/IssetOperator.php +++ b/src/Operators/Other/IssetOperator.php @@ -29,7 +29,7 @@ class IssetOperator extends AbstractOperator /** * Compiles an 'isset' operator. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression @@ -51,18 +51,27 @@ public function compile(array $expression, CompilationContext $compilationContex $exprCompiledVariable = $exprVariable->compile($compilationContext); if (!in_array($exprCompiledVariable->getType(), ['variable', 'array'], true)) { - throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as array', $left['left']); + throw new CompilerException( + 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as array', + $left['left'] + ); } - $variable = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariable->getCode(), $compilationContext, $left['left']); + $variable = $compilationContext->symbolTable->getVariableForRead( + $exprCompiledVariable->getCode(), + $compilationContext, + $left['left'] + ); switch ($variable->getType()) { case 'array': case 'variable': break; default: - throw new CompilerException('Variable type: '.$variable->getType().' cannot be used as array', $left['left']); - break; + throw new CompilerException( + 'Variable type: ' . $variable->getType() . ' cannot be used as array', + $left['left'] + ); } if ('variable' === $variable->getType()) { @@ -83,19 +92,33 @@ public function compile(array $expression, CompilationContext $compilationContex case 'int': case 'long': case 'string': - return $compilationContext->backend->arrayIsset($variable, $resolvedExpr, $left['right'], $compilationContext); + return $compilationContext->backend->arrayIsset( + $variable, + $resolvedExpr, + $left['right'], + $compilationContext + ); case 'variable': case 'mixed': - $indexVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $left['right']); + $indexVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $left['right'] + ); + + return $compilationContext->backend->arrayIsset( + $variable, + $indexVariable, + $left['right'], + $compilationContext + ); - return $compilationContext->backend->arrayIsset($variable, $indexVariable, $left['right'], $compilationContext); - break; default: - throw new CompilerException('['.$left['right']['type'].']', $expression); + throw new CompilerException('[' . $left['right']['type'] . ']', $expression); } - break; + case 'property-access': case 'property-dynamic-access': @@ -106,12 +129,22 @@ public function compile(array $expression, CompilationContext $compilationContex $exprCompiledVariable = $exprVariable->compile($compilationContext); if ('variable' !== $exprCompiledVariable->getType()) { - throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as object', $left['left']); + throw new CompilerException( + 'Expression type: ' . $exprCompiledVariable->getType() . ' cannot be used as object', + $left['left'] + ); } - $variable = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariable->getCode(), $compilationContext, $left['left']); + $variable = $compilationContext->symbolTable->getVariableForRead( + $exprCompiledVariable->getCode(), + $compilationContext, + $left['left'] + ); if ('variable' !== $variable->getType()) { - throw new CompilerException('Variable type: '.$variable->getType().' cannot be used as object', $left['left']); + throw new CompilerException( + 'Variable type: ' . $variable->getType() . ' cannot be used as object', + $left['left'] + ); } if ($variable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { @@ -123,7 +156,7 @@ public function compile(array $expression, CompilationContext $compilationContex $variableCode = $compilationContext->backend->getVariableCode($variable); if ('property-access' === $left['type']) { - return $compilationContext->backend->propertyIsset($variable, $left['right']['value'], $compilationContext); + return $compilationContext->backend->propertyIsset($variable, $left['right']['value']); } $expr = new Expression($left['right']); @@ -133,24 +166,32 @@ public function compile(array $expression, CompilationContext $compilationContex switch ($resolvedExpr->getType()) { case 'variable': - $indexVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $left['right']); + $indexVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $left['right'] + ); switch ($indexVariable->getType()) { case 'variable': case 'mixed': case 'string': $indexVariableCode = $compilationContext->backend->getVariableCode($indexVariable); - return new CompiledExpression('bool', 'zephir_isset_property_zval('.$variableCode.', '.$indexVariableCode.')', $left['right']); + return new CompiledExpression( + 'bool', + 'zephir_isset_property_zval(' . $variableCode . ', ' . $indexVariableCode . ')', + $left['right'] + ); default: - throw new CompilerException('['.$indexVariable->getType().']', $expression); + throw new CompilerException('[' . $indexVariable->getType() . ']', $expression); } - break; + default: - throw new CompilerException('['.$expression['left']['right']['type'].']', $expression); + throw new CompilerException('[' . $expression['left']['right']['type'] . ']', $expression); } - break; + case 'property-string-access': case 'static-property-access': diff --git a/src/Operators/Other/LikelyOperator.php b/src/Operators/Other/LikelyOperator.php new file mode 100644 index 0000000000..0986947f9e --- /dev/null +++ b/src/Operators/Other/LikelyOperator.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Other; + +/** + * Adds a branch prediction hint when evaluating an expression + */ +class LikelyOperator extends UnlikelyOperator +{ + protected string $operator = 'likely'; + protected string $zephirMethod = 'EXPECTED'; +} diff --git a/Library/Operators/Other/NewInstanceOperator.php b/src/Operators/Other/NewInstanceOperator.php similarity index 73% rename from Library/Operators/Other/NewInstanceOperator.php rename to src/Operators/Other/NewInstanceOperator.php index f459fbab66..6933331e29 100644 --- a/Library/Operators/Other/NewInstanceOperator.php +++ b/src/Operators/Other/NewInstanceOperator.php @@ -15,7 +15,7 @@ use ReflectionClass; use ReflectionException; -use Zephir\Classes\Entry; +use Zephir\Class\Entry; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -24,7 +24,7 @@ use Zephir\MethodCall; use Zephir\Operators\AbstractOperator; -use function Zephir\escape_class; +use function count; /** * Creates a new instance of a class @@ -52,7 +52,7 @@ public function compile(array $expression, CompilationContext $compilationContex * Resolves the symbol that expects the value */ $this->literalOnly = false; - $symbolVariable = $this->getExpectedNonLiteral($compilationContext, $expression); + $symbolVariable = $this->getExpectedNonLiteral($compilationContext, $expression); if (!$symbolVariable->isVariable()) { throw new CompilerException('Objects can only be instantiated into dynamic variables', $expression); } @@ -80,7 +80,7 @@ public function compile(array $expression, CompilationContext $compilationContex $className = $compilationContext->classDefinition->getCompleteName(); } else { $className = $expression['class']; - $dynamic = $expression['dynamic']; + $dynamic = $expression['dynamic']; if (!$dynamic) { $className = $compilationContext->getFullName($expression['class']); } @@ -94,10 +94,10 @@ public function compile(array $expression, CompilationContext $compilationContex * stdclass doesn't have constructors. */ $lowerClassName = strtolower($className); - $isStdClass = 'stdclass' === $lowerClassName || '\stdclass' === $lowerClassName; + $isStdClass = 'stdclass' === $lowerClassName || '\stdclass' === $lowerClassName; if ($isStdClass) { - if (isset($expression['parameters']) && \count($expression['parameters']) > 0) { + if (isset($expression['parameters']) && count($expression['parameters']) > 0) { throw new CompilerException('stdclass does not receive parameters in its constructor', $expression); } @@ -113,7 +113,11 @@ public function compile(array $expression, CompilationContext $compilationContex * Classes inside the same extension */ if ($classDefinition) { - $compilationContext->backend->initObject($symbolVariable, $classDefinition->getClassEntry($compilationContext), $compilationContext); + $compilationContext->backend->initObject( + $symbolVariable, + $classDefinition->getClassEntry($compilationContext), + $compilationContext + ); $symbolVariable->setClassTypes($className); $symbolVariable->setAssociatedClass($classDefinition); } else { @@ -121,28 +125,45 @@ public function compile(array $expression, CompilationContext $compilationContex * Classes outside the extension */ if ($dynamic) { - $classNameVariable = $compilationContext->symbolTable->getVariableForRead($className, $compilationContext, $expression); + $classNameVariable = $compilationContext->symbolTable->getVariableForRead( + $className, + $compilationContext, + $expression + ); if ($classNameVariable->isNotVariableAndString()) { - throw new CompilerException('Only dynamic/string variables can be used in new operator. '.$classNameVariable->getName(), $expression); + throw new CompilerException( + 'Only dynamic/string variables can be used in new operator. ' . $classNameVariable->getName( + ), + $expression + ); } /** * Use a safe string version of the variable to avoid segfaults */ $compilationContext->headersManager->add('kernel/object'); - $safeSymbolVariable = $compilationContext->symbolTable->getTempVariable('variable', $compilationContext); + $safeSymbolVariable = $compilationContext->symbolTable->getTempVariable( + 'variable', + $compilationContext + ); $safeSymbolVariable->setMustInitNull(true); $safeSymbolVariable->setIsInitialized(true, $compilationContext); $safeSymbolVariable->increaseUses(); - $safeSymbol = $compilationContext->backend->getVariableCode($safeSymbolVariable); + $safeSymbol = $compilationContext->backend->getVariableCode($safeSymbolVariable); $classNameSymbol = $compilationContext->backend->getVariableCode($classNameVariable); - $compilationContext->codePrinter->output('zephir_fetch_safe_class('.$safeSymbol.', '.$classNameSymbol.');'); - $classNameToFetch = 'Z_STRVAL_P('.$safeSymbol.'), Z_STRLEN_P('.$safeSymbol.')'; - $zendClassEntry = $compilationContext->cacheManager->getClassEntryCache()->get($classNameToFetch, true, $compilationContext); - $classEntry = $zendClassEntry->getName(); - - $compilationContext->codePrinter->output('if(!'.$classEntry.') {'); + $compilationContext->codePrinter->output( + 'zephir_fetch_safe_class(' . $safeSymbol . ', ' . $classNameSymbol . ');' + ); + $classNameToFetch = 'Z_STRVAL_P(' . $safeSymbol . '), Z_STRLEN_P(' . $safeSymbol . ')'; + $zendClassEntry = $compilationContext->cacheManager->getClassEntryCache()->get( + $classNameToFetch, + true, + $compilationContext + ); + $classEntry = $zendClassEntry->getName(); + + $compilationContext->codePrinter->output('if(!' . $classEntry . ') {'); $compilationContext->codePrinter->increaseLevel(); $compilationContext->codePrinter->output('RETURN_MM_NULL();'); $compilationContext->codePrinter->decreaseLevel(); @@ -150,13 +171,17 @@ public function compile(array $expression, CompilationContext $compilationContex } else { if (!class_exists($className, false)) { $compilationContext->logger->warning( - 'Class "'.$className.'" does not exist at compile time', + 'Class "' . $className . '" does not exist at compile time', ['nonexistent-class', $expression] ); - $classNameToFetch = 'SL("'.escape_class($className).'")'; + $classNameToFetch = 'SL("' . Entry::escape($className) . '")'; - $zendClassEntry = $compilationContext->cacheManager->getClassEntryCache()->get($classNameToFetch, false, $compilationContext); - $classEntry = $zendClassEntry->getName(); + $zendClassEntry = $compilationContext->cacheManager->getClassEntryCache()->get( + $classNameToFetch, + false, + $compilationContext + ); + $classEntry = $zendClassEntry->getName(); } else { $reflectionClass = new ReflectionClass($className); if ($reflectionClass->isInterface()) { @@ -214,24 +239,24 @@ public function compile(array $expression, CompilationContext $compilationContex /* TODO: use the MethodBuilder here */ if (isset($expression['parameters'])) { $callExpr = new Expression([ - 'variable' => ['type' => 'variable', 'value' => $symbolVariable->getRealName()], - 'name' => '__construct', + 'variable' => ['type' => 'variable', 'value' => $symbolVariable->getRealName()], + 'name' => '__construct', 'parameters' => $expression['parameters'], - 'call-type' => MethodCall::CALL_NORMAL, - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], - 'check' => $callConstructor, + 'call-type' => MethodCall::CALL_NORMAL, + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], + 'check' => $callConstructor, ]); } else { $callExpr = new Expression([ - 'variable' => ['type' => 'variable', 'value' => $symbolVariable->getRealName()], - 'name' => '__construct', + 'variable' => ['type' => 'variable', 'value' => $symbolVariable->getRealName()], + 'name' => '__construct', 'call-type' => MethodCall::CALL_NORMAL, - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], - 'check' => $callConstructor, + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], + 'check' => $callConstructor, ]); } diff --git a/Library/Operators/Other/NewInstanceTypeOperator.php b/src/Operators/Other/NewInstanceTypeOperator.php similarity index 100% rename from Library/Operators/Other/NewInstanceTypeOperator.php rename to src/Operators/Other/NewInstanceTypeOperator.php diff --git a/Library/Operators/Other/RangeExclusiveOperator.php b/src/Operators/Other/RangeExclusiveOperator.php similarity index 87% rename from Library/Operators/Other/RangeExclusiveOperator.php rename to src/Operators/Other/RangeExclusiveOperator.php index c98ec91d09..21afa4eacc 100644 --- a/Library/Operators/Other/RangeExclusiveOperator.php +++ b/src/Operators/Other/RangeExclusiveOperator.php @@ -49,8 +49,11 @@ public function compile(array $expression, CompilationContext $compilationContex /** * Implicit type coercing. */ - $castBuilder = $exprBuilder->operators()->cast('array', $exprBuilder->statements() - ->functionCall('range', [$expression['left'], $expression['right']])); + $castBuilder = $exprBuilder->operators()->cast( + 'array', + $exprBuilder->statements() + ->functionCall('range', [$expression['left'], $expression['right']]) + ); $expression = new Expression($castBuilder->build()); $expression->setReadOnly($this->readOnly); diff --git a/Library/Operators/Other/RangeInclusiveOperator.php b/src/Operators/Other/RangeInclusiveOperator.php similarity index 85% rename from Library/Operators/Other/RangeInclusiveOperator.php rename to src/Operators/Other/RangeInclusiveOperator.php index e8a1815260..0ac26ca7a3 100644 --- a/Library/Operators/Other/RangeInclusiveOperator.php +++ b/src/Operators/Other/RangeInclusiveOperator.php @@ -19,7 +19,7 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Operators\AbstractOperator; -use Zephir\Types; +use Zephir\Types\Types; /** * Inclusive range operator @@ -49,8 +49,11 @@ public function compile(array $expression, CompilationContext $compilationContex /** * Implicit type coercing. */ - $castBuilder = $exprBuilder->operators()->cast(Types::T_ARRAY, $exprBuilder->statements() - ->functionCall('range', [$expression['left'], $expression['right']])); + $castBuilder = $exprBuilder->operators()->cast( + Types::T_ARRAY, + $exprBuilder->statements() + ->functionCall('range', [$expression['left'], $expression['right']]) + ); $expression = new Expression($castBuilder->build()); $expression->setReadOnly($this->readOnly); diff --git a/src/Operators/Other/RequireOnceOperator.php b/src/Operators/Other/RequireOnceOperator.php new file mode 100644 index 0000000000..c83c1b5d8b --- /dev/null +++ b/src/Operators/Other/RequireOnceOperator.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Operators\Other; + +/** + * Includes once a plain PHP file + */ +class RequireOnceOperator extends RequireOperator +{ + protected string $operator = 'require_once'; + protected string $warningName = 'non-valid-require-once'; + protected string $zephirMethod = 'zephir_require_once_zval'; + protected string $zephirMethodRet = 'zephir_require_once_zval_ret'; +} diff --git a/Library/Operators/Other/RequireOperator.php b/src/Operators/Other/RequireOperator.php similarity index 66% rename from Library/Operators/Other/RequireOperator.php rename to src/Operators/Other/RequireOperator.php index 29ce296d2c..e823b14ac4 100644 --- a/Library/Operators/Other/RequireOperator.php +++ b/src/Operators/Other/RequireOperator.php @@ -13,6 +13,7 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -24,6 +25,11 @@ */ class RequireOperator extends AbstractOperator { + protected string $operator = 'require'; + protected string $warningName = 'non-valid-require'; + protected string $zephirMethod = 'zephir_require_zval'; + protected string $zephirMethodRet = 'zephir_require_zval_ret'; + /** * @param array $expression * @param CompilationContext $compilationContext @@ -31,6 +37,7 @@ class RequireOperator extends AbstractOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { @@ -40,25 +47,36 @@ public function compile(array $expression, CompilationContext $compilationContex $exprPath = $expr->compile($compilationContext); if ('variable' === $exprPath->getType()) { - $exprVariable = $compilationContext->symbolTable->getVariableForRead($exprPath->getCode(), $compilationContext, $expression); - $exprVar = $compilationContext->backend->getVariableCode($exprVariable); + $exprVariable = $compilationContext->symbolTable->getVariableForRead( + $exprPath->getCode(), + $compilationContext, + $expression + ); + $exprVar = $compilationContext->backend->getVariableCode($exprVariable); if ('variable' === $exprVariable->getType()) { if ($exprVariable->hasDifferentDynamicType(['undefined', 'string'])) { $compilationContext->logger->warning( - 'Possible attempt to use invalid type as path in "require" operator', - ['non-valid-require', $expression] + 'Possible attempt to use invalid type as path in "' . $this->operator . '" operator', + [$this->warningName, $expression] ); } } } else { - $exprVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); + $exprVar = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $expression + ); $compilationContext->backend->assignString($exprVar, $exprPath->getCode(), $compilationContext); $exprVar = $compilationContext->backend->getVariableCode($exprVar); } $symbolVariable = false; if ($this->isExpecting()) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( + 'variable', + $compilationContext + ); } $compilationContext->headersManager->add('kernel/memory'); @@ -67,13 +85,15 @@ public function compile(array $expression, CompilationContext $compilationContex $codePrinter = $compilationContext->codePrinter; if ($symbolVariable) { - $codePrinter->output('ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&'.$symbolVariable->getName().');'); - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); - $codePrinter->output('if (zephir_require_zval_ret('.$symbol.', '.$exprVar.') == FAILURE) {'); + $codePrinter->output('ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&' . $symbolVariable->getName() . ');'); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $codePrinter->output( + 'if (' . $this->zephirMethodRet . '(' . $symbol . ', ' . $exprVar . ') == FAILURE) {' + ); } else { - $codePrinter->output('if (zephir_require_zval('.$exprVar.') == FAILURE) {'); + $codePrinter->output('if (' . $this->zephirMethod . '(' . $exprVar . ') == FAILURE) {'); } - $codePrinter->output("\t".'RETURN_MM_NULL();'); + $codePrinter->output("\t" . 'RETURN_MM_NULL();'); $codePrinter->output('}'); if ($symbolVariable) { diff --git a/Library/Operators/Other/ShortTernaryOperator.php b/src/Operators/Other/ShortTernaryOperator.php similarity index 74% rename from Library/Operators/Other/ShortTernaryOperator.php rename to src/Operators/Other/ShortTernaryOperator.php index 2efa139671..56dcb075d1 100644 --- a/Library/Operators/Other/ShortTernaryOperator.php +++ b/src/Operators/Other/ShortTernaryOperator.php @@ -32,7 +32,7 @@ class ShortTernaryOperator extends AbstractOperator /** * Compile ternary operator. * - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression @@ -49,10 +49,11 @@ public function compile($expression, CompilationContext $compilationContext): Co $returnVariable->setLocalOnly(false); if ('variable' != $returnVariable->getType() || 'return_value' == $returnVariable->getName()) { - $returnVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - if ($returnVariable->isTemporal()) { - $returnVariable->skipInitVariant(2); - } + $returnVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $this->checkVariableTemporal($returnVariable); } $ifBuilder = new IfStatementBuilder( @@ -66,12 +67,12 @@ public function compile($expression, CompilationContext $compilationContext): Co */ new LetStatementBuilder([ 'assign-type' => 'variable', - 'variable' => $returnVariable->getName(), - 'operator' => 'assign', - 'expr' => $expression['extra'], - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], + 'variable' => $returnVariable->getName(), + 'operator' => 'assign', + 'expr' => $expression['extra'], + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], ], $expression['extra']), ]), new StatementsBlockBuilder([ @@ -80,12 +81,12 @@ public function compile($expression, CompilationContext $compilationContext): Co */ new LetStatementBuilder([ 'assign-type' => 'variable', - 'variable' => $returnVariable->getName(), - 'operator' => 'assign', - 'expr' => $expression['left'], - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], + 'variable' => $returnVariable->getName(), + 'operator' => 'assign', + 'expr' => $expression['left'], + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], ], $expression['extra']), ]) ); diff --git a/Library/Operators/Other/TernaryOperator.php b/src/Operators/Other/TernaryOperator.php similarity index 71% rename from Library/Operators/Other/TernaryOperator.php rename to src/Operators/Other/TernaryOperator.php index e3d0054aae..0797e4ad89 100644 --- a/Library/Operators/Other/TernaryOperator.php +++ b/src/Operators/Other/TernaryOperator.php @@ -27,7 +27,7 @@ class TernaryOperator extends AbstractOperator /** * Compile ternary operator. * - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression @@ -44,15 +44,16 @@ public function compile($expression, CompilationContext $compilationContext): Co $returnVariable->setLocalOnly(false); if ('variable' != $returnVariable->getType() || 'return_value' == $returnVariable->getName()) { - $returnVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - if ($returnVariable->isTemporal()) { - $returnVariable->skipInitVariant(2); - } + $returnVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $this->checkVariableTemporal($returnVariable); } - $expr = new EvalExpression(); + $expr = new EvalExpression(); $condition = $expr->optimize($expression['left'], $compilationContext); - $compilationContext->codePrinter->output('if ('.$condition.') {'); + $compilationContext->codePrinter->output('if (' . $condition . ') {'); $compilationContext->codePrinter->increaseLevel(); @@ -60,16 +61,16 @@ public function compile($expression, CompilationContext $compilationContext): Co * Create an implicit 'let' operation to update the evaluated left operator. */ $statement = new LetStatement([ - 'type' => 'let', + 'type' => 'let', 'assignments' => [ [ 'assign-type' => 'variable', - 'variable' => $returnVariable->getName(), - 'operator' => 'assign', - 'expr' => $expression['right'], - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], + 'variable' => $returnVariable->getName(), + 'operator' => 'assign', + 'expr' => $expression['right'], + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], ], ], ]); @@ -83,16 +84,16 @@ public function compile($expression, CompilationContext $compilationContext): Co * Create an implicit 'let' operation to update the evaluated left operator. */ $statement = new LetStatement([ - 'type' => 'let', + 'type' => 'let', 'assignments' => [ [ 'assign-type' => 'variable', - 'variable' => $returnVariable->getName(), - 'operator' => 'assign', - 'expr' => $expression['extra'], - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], + 'variable' => $returnVariable->getName(), + 'operator' => 'assign', + 'expr' => $expression['extra'], + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], ], ], ]); diff --git a/Library/Operators/Other/TypeHintOperator.php b/src/Operators/Other/TypeHintOperator.php similarity index 86% rename from Library/Operators/Other/TypeHintOperator.php rename to src/Operators/Other/TypeHintOperator.php index a9ffeb9cd7..c687bbc42e 100644 --- a/Library/Operators/Other/TypeHintOperator.php +++ b/src/Operators/Other/TypeHintOperator.php @@ -13,6 +13,7 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -22,18 +23,6 @@ class TypeHintOperator extends AbstractOperator { - private bool $strict = false; - - /** - * Sets if the type hint is strict or not. - * - * @param $strict - */ - public function setStrict($strict) - { - $this->strict = (bool) $strict; - } - /** * Performs type-hint compilation. * @@ -43,6 +32,7 @@ public function setStrict($strict) * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { @@ -50,7 +40,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expr->setReadOnly(true); $resolved = $expr->compile($compilationContext); - if ('variable' != $resolved->getType()) { + if ('variable' !== $resolved->getType()) { throw new CompilerException('Type-Hints only can be applied to dynamic variables.', $expression); } diff --git a/Library/Operators/Other/TypeOfOperator.php b/src/Operators/Other/TypeOfOperator.php similarity index 92% rename from Library/Operators/Other/TypeOfOperator.php rename to src/Operators/Other/TypeOfOperator.php index 6ac240678e..e029e7c51f 100644 --- a/Library/Operators/Other/TypeOfOperator.php +++ b/src/Operators/Other/TypeOfOperator.php @@ -28,7 +28,7 @@ class TypeOfOperator extends AbstractOperator { /** - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression @@ -43,7 +43,7 @@ public function compile($expression, CompilationContext $compilationContext): Co } $functionCall = BuilderFactory::getInstance()->statements()->functionCall('gettype', [$expression['left']]); - $expression = new Expression($functionCall->build()); + $expression = new Expression($functionCall->build()); return $expression->compile($compilationContext); } diff --git a/Library/Operators/Other/UnlikelyOperator.php b/src/Operators/Other/UnlikelyOperator.php similarity index 59% rename from Library/Operators/Other/UnlikelyOperator.php rename to src/Operators/Other/UnlikelyOperator.php index 587d0b060f..4869a5db11 100644 --- a/Library/Operators/Other/UnlikelyOperator.php +++ b/src/Operators/Other/UnlikelyOperator.php @@ -26,10 +26,13 @@ */ class UnlikelyOperator extends AbstractOperator { + protected string $operator = 'unlikely'; + protected string $zephirMethod = 'UNEXPECTED'; + /** - * Compile unlikely operator + * Compile likely/unlikely operator * - * @param $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression @@ -40,7 +43,10 @@ class UnlikelyOperator extends AbstractOperator public function compile($expression, CompilationContext $compilationContext): CompiledExpression { if (!isset($expression['left'])) { - throw new CompilerException("Invalid 'left' operand for 'unlikely' expression", $expression['left']); + throw new CompilerException( + "Invalid 'left' operand for '" . $this->operator . "' expression", + $expression['left'] + ); } $leftExpr = new Expression($expression['left']); @@ -48,23 +54,38 @@ public function compile($expression, CompilationContext $compilationContext): Co $left = $leftExpr->compile($compilationContext); if ('bool' === $left->getType()) { - return new CompiledExpression('bool', 'UNEXPECTED('.$left->getCode().')', $expression); + return new CompiledExpression( + 'bool', + $this->zephirMethod . '(' . $left->getCode() . ')', + $expression + ); } if ('variable' === $left->getType()) { - $variable = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression['left']); + $variable = $compilationContext->symbolTable->getVariableForRead( + $left->getCode(), + $compilationContext, + $expression['left'] + ); switch ($variable->getType()) { case 'bool': - return new CompiledExpression('bool', 'UNEXPECTED('.$variable->getName().')', $expression); + return new CompiledExpression( + 'bool', + $this->zephirMethod . '(' . $variable->getName() . ')', + $expression + ); default: $compilationContext->headersManager->add('kernel/operators'); $symbol = $compilationContext->backend->getVariableCode($variable); - return new CompiledExpression('bool', 'UNEXPECTED(zephir_is_true('.$symbol.'))', $expression); + return new CompiledExpression('bool', 'UNEXPECTED(zephir_is_true(' . $symbol . '))', $expression); } } - throw new CompilerException("Cannot use expression type: '".$left->getType()."' in 'unlikely' operator", $expression['left']); + throw new CompilerException( + "Cannot use expression type: '" . $left->getType() . "' in '" . $this->operator . "' operator", + $expression['left'] + ); } } diff --git a/Library/Operators/Unary/MinusOperator.php b/src/Operators/Unary/MinusOperator.php similarity index 79% rename from Library/Operators/Unary/MinusOperator.php rename to src/Operators/Unary/MinusOperator.php index 5532bba95c..1de04b35a7 100644 --- a/Library/Operators/Unary/MinusOperator.php +++ b/src/Operators/Unary/MinusOperator.php @@ -26,7 +26,7 @@ class MinusOperator extends AbstractOperator /** * Compile expression. * - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression @@ -36,9 +36,7 @@ class MinusOperator extends AbstractOperator */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression'); - } + $this->checkLeft($expression); $leftExpr = new Expression($expression['left']); $leftExpr->setReadOnly($this->readOnly); @@ -50,7 +48,7 @@ public function compile($expression, CompilationContext $compilationContext): Co case 'long': case 'ulong': case 'double': - return new CompiledExpression($left->getType(), '-'.$left->getCode(), $expression); + return new CompiledExpression($left->getType(), '-' . $left->getCode(), $expression); case 'variable': $variable = $compilationContext->symbolTable->getVariable($left->getCode()); @@ -60,21 +58,24 @@ public function compile($expression, CompilationContext $compilationContext): Co case 'long': case 'ulong': case 'double': - return new CompiledExpression($variable->getType(), '-'.$variable->getName(), $expression); + return new CompiledExpression($variable->getType(), '-' . $variable->getName(), $expression); case 'variable': $compilationContext->headersManager->add('kernel/operators'); - $compilationContext->codePrinter->output('zephir_negate('.$compilationContext->backend->getVariableCode($variable).');'); + $compilationContext->codePrinter->output( + 'zephir_negate(' . $compilationContext->backend->getVariableCode($variable) . ');' + ); return new CompiledExpression('variable', $variable->getName(), $expression); default: - throw new CompilerException("Cannot operate minus with variable of '".$left->getType()."' type"); + throw new CompilerException( + "Cannot operate minus with variable of '" . $left->getType() . "' type" + ); } - break; default: - throw new CompilerException("Cannot operate minus with '".$left->getType()."' type"); + throw new CompilerException("Cannot operate minus with '" . $left->getType() . "' type"); } } } diff --git a/Library/Operators/Unary/NotOperator.php b/src/Operators/Unary/NotOperator.php similarity index 77% rename from Library/Operators/Unary/NotOperator.php rename to src/Operators/Unary/NotOperator.php index 2d5eee5b57..2d40787140 100644 --- a/Library/Operators/Unary/NotOperator.php +++ b/src/Operators/Unary/NotOperator.php @@ -24,7 +24,7 @@ class NotOperator extends AbstractOperator { /** - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression @@ -34,9 +34,7 @@ class NotOperator extends AbstractOperator */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression', $expression); - } + $this->checkLeft($expression); $leftExpr = new Expression($expression['left']); $leftExpr->setReadOnly($this->readOnly); @@ -48,31 +46,34 @@ public function compile($expression, CompilationContext $compilationContext): Co case 'uint': case 'long': case 'ulong': - return new CompiledExpression('bool', '!('.$left->getCode().')', $expression); + return new CompiledExpression('bool', '!(' . $left->getCode() . ')', $expression); case 'variable': - $variable = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression['left']); + $variable = $compilationContext->symbolTable->getVariableForRead( + $left->getCode(), + $compilationContext, + $expression['left'] + ); switch ($variable->getType()) { case 'bool': case 'int': case 'uint': case 'long': - return new CompiledExpression('bool', '!'.$variable->getName(), $expression); + return new CompiledExpression('bool', '!' . $variable->getName(), $expression); case 'variable': case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $symbol = $compilationContext->backend->getVariableCode($variable); - return new CompiledExpression('bool', '!zephir_is_true('.$symbol.')', $expression); + return new CompiledExpression('bool', '!zephir_is_true(' . $symbol . ')', $expression); default: - throw new CompilerException('Unknown type: '.$variable->getType(), $expression); + throw new CompilerException('Unknown type: ' . $variable->getType(), $expression); } - break; default: - throw new CompilerException('Unknown type: '.$left->getType(), $expression); + throw new CompilerException('Unknown type: ' . $left->getType(), $expression); } } } diff --git a/Library/Optimizers/EvalExpression.php b/src/Optimizers/EvalExpression.php similarity index 68% rename from Library/Optimizers/EvalExpression.php rename to src/Optimizers/EvalExpression.php index f0d19b9faf..2d8a49764f 100644 --- a/Library/Optimizers/EvalExpression.php +++ b/src/Optimizers/EvalExpression.php @@ -19,53 +19,64 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\LiteralCompiledExpression; -use Zephir\Variable; +use Zephir\Variable\Variable; + +use function end; +use function is_numeric; +use function is_object; /** - * Resolves evaluation of expressions returning a C-int expression that can be used by 'if'/'while'/'do-while' statements + * Resolves evaluation of expressions returning a C-int expression that can be used by 'if'/'while'/'do-while' + * statements */ class EvalExpression { - protected ?bool $unreachable = null; + protected ?bool $unreachable = null; protected ?bool $unreachableElse = null; - protected array $usedVariables = []; + protected array $usedVariables = []; /** - * Skips the not operator by recursively optimizing the expression at its right. - * - * @param array $expr - * @param CompilationContext $compilationContext - * - * @return string|null + * Returns the variable evaluated by the EvalExpression. * - * @throws Exception + * @return Variable */ - public function optimizeNot(array $expr, CompilationContext $compilationContext): ?string + public function getEvalVariable() { - /** - * Compile the expression negating the evaluated expression - */ - if ('not' == $expr['type']) { - $conditions = $this->optimize($expr['left'], $compilationContext); - if (false !== $conditions) { - if (null !== $this->unreachable) { - $this->unreachable = !$this->unreachable; - } - if (null !== $this->unreachableElse) { - $this->unreachableElse = !$this->unreachableElse; - } + return end($this->usedVariables); + } - return '!('.$conditions.')'; - } - } + /** + * @return array + */ + public function getUsedVariables(): array + { + return $this->usedVariables; + } - return null; + /** + * Checks if the evaluation produce unreachable code. + * + * @return bool|null + */ + public function isUnreachable(): ?bool + { + return $this->unreachable; + } + + /** + * Checks if the evaluation not produce unreachable code. + * + * @return bool|null + */ + public function isUnreachableElse(): ?bool + { + return $this->unreachableElse; } /** * Optimizes expressions. * - * @param $exprRaw + * @param $exprRaw * @param CompilationContext $compilationContext * * @return bool|string @@ -96,8 +107,8 @@ public function optimize($exprRaw, CompilationContext $compilationContext) /** * Possible corrupted expression? */ - if (!\is_object($compiledExpression)) { - throw new CompilerException('Corrupted expression: '.$exprRaw['type'], $exprRaw); + if (!is_object($compiledExpression)) { + throw new CompilerException('Corrupted expression: ' . $exprRaw['type'], $exprRaw); } /** @@ -142,48 +153,47 @@ public function optimize($exprRaw, CompilationContext $compilationContext) return $code; case 'variable': - $variableRight = $compilationContext->symbolTable->getVariableForRead($compiledExpression->getCode(), $compilationContext, $exprRaw); + $variableRight = $compilationContext->symbolTable->getVariableForRead( + $compiledExpression->getCode(), + $compilationContext, + $exprRaw + ); $possibleValue = $variableRight->getPossibleValue(); - if (\is_object($possibleValue)) { + if ($possibleValue instanceof LiteralCompiledExpression) { $possibleValueBranch = $variableRight->getPossibleValueBranch(); if ($possibleValueBranch instanceof Branch) { /** * Check if the possible value was assigned in the root branch */ if (Branch::TYPE_ROOT == $possibleValueBranch->getType()) { - if ($possibleValue instanceof LiteralCompiledExpression) { - switch ($possibleValue->getType()) { - case 'null': + switch ($possibleValue->getType()) { + case 'null': + $this->unreachable = true; + break; + + case 'bool': + if ('0' == $possibleValue->getBooleanCode()) { $this->unreachable = true; - break; - - case 'bool': - if ('0' == $possibleValue->getBooleanCode()) { - $this->unreachable = true; - } else { - $this->unreachableElse = true; - } - break; - - case 'int': - if (!(int) ($possibleValue->getCode())) { - $this->unreachable = true; - } else { - $this->unreachableElse = true; - } - break; - - case 'double': - if (!(float) ($possibleValue->getCode())) { - $this->unreachable = true; - } else { - $this->unreachableElse = true; - } - break; - - default: - //echo $possibleValue->getType(); - } + } else { + $this->unreachableElse = true; + } + break; + + case 'int': + if (!(int)$possibleValue->getCode()) { + $this->unreachable = true; + } else { + $this->unreachableElse = true; + } + break; + + case 'double': + if (!(float)$possibleValue->getCode()) { + $this->unreachable = true; + } else { + $this->unreachableElse = true; + } + break; } } } @@ -206,59 +216,66 @@ public function optimize($exprRaw, CompilationContext $compilationContext) return $variableRight->getName(); case 'string': - return '!('.$compilationContext->backend->ifVariableValueUndefined($variableRight, $compilationContext, true, false).')'; + return '!(' + . $compilationContext->backend->ifVariableValueUndefined( + $variableRight, + $compilationContext, + true, + false + ) + . ')'; case 'variable': $compilationContext->headersManager->add('kernel/operators'); $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); - return 'zephir_is_true('.$variableRightCode.')'; + return 'zephir_is_true(' . $variableRightCode . ')'; default: - throw new CompilerException("Variable can't be evaluated ".$variableRight->getType(), $exprRaw); + throw new CompilerException( + "Variable can't be evaluated " . $variableRight->getType(), + $exprRaw + ); } break; default: - throw new CompilerException('Expression '.$compiledExpression->getType()." can't be evaluated", $exprRaw); + throw new CompilerException( + 'Expression ' . $compiledExpression->getType() . " can't be evaluated", + $exprRaw + ); } } /** - * Checks if the evaluation produce unreachable code. + * Skips the not operator by recursively optimizing the expression at its right. * - * @return bool|null - */ - public function isUnreachable(): ?bool - { - return $this->unreachable; - } - - /** - * Checks if the evaluation not produce unreachable code. + * @param array $expr + * @param CompilationContext $compilationContext * - * @return bool|null - */ - public function isUnreachableElse(): ?bool - { - return $this->unreachableElse; - } - - /** - * Returns the variable evaluated by the EvalExpression. + * @return string|null * - * @return Variable + * @throws Exception */ - public function getEvalVariable() + public function optimizeNot(array $expr, CompilationContext $compilationContext): ?string { - return end($this->usedVariables); - } + /** + * Compile the expression negating the evaluated expression + */ + if ('not' == $expr['type']) { + $conditions = $this->optimize($expr['left'], $compilationContext); + if (false !== $conditions) { + if (null !== $this->unreachable) { + $this->unreachable = !$this->unreachable; + } + if (null !== $this->unreachableElse) { + $this->unreachableElse = !$this->unreachableElse; + } - /** - * @return array - */ - public function getUsedVariables(): array - { - return $this->usedVariables; + return '!(' . $conditions . ')'; + } + } + + return null; } } diff --git a/Library/Optimizers/FunctionCall/ACosOptimizer.php b/src/Optimizers/FunctionCall/ACosOptimizer.php similarity index 85% rename from Library/Optimizers/FunctionCall/ACosOptimizer.php rename to src/Optimizers/FunctionCall/ACosOptimizer.php index 7559a086e1..23b7f537d4 100644 --- a/Library/Optimizers/FunctionCall/ACosOptimizer.php +++ b/src/Optimizers/FunctionCall/ACosOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\MathOptimizer; @@ -20,8 +22,5 @@ */ class ACosOptimizer extends MathOptimizer { - public function getFunctionName() - { - return 'acos'; - } + protected string $zephirMethod = 'acos'; } diff --git a/Library/Optimizers/FunctionCall/ASinOptimizer.php b/src/Optimizers/FunctionCall/ASinOptimizer.php similarity index 85% rename from Library/Optimizers/FunctionCall/ASinOptimizer.php rename to src/Optimizers/FunctionCall/ASinOptimizer.php index cc1bf8b0cf..0fdb16b1f6 100644 --- a/Library/Optimizers/FunctionCall/ASinOptimizer.php +++ b/src/Optimizers/FunctionCall/ASinOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\MathOptimizer; @@ -20,8 +22,5 @@ */ class ASinOptimizer extends MathOptimizer { - public function getFunctionName() - { - return 'asin'; - } + protected string $zephirMethod = 'asin'; } diff --git a/Library/Optimizers/FunctionCall/InArrayOptimizer.php b/src/Optimizers/FunctionCall/AddslashesOptimizer.php similarity index 53% rename from Library/Optimizers/FunctionCall/InArrayOptimizer.php rename to src/Optimizers/FunctionCall/AddslashesOptimizer.php index 58727048a7..9ff2a92193 100644 --- a/Library/Optimizers/FunctionCall/InArrayOptimizer.php +++ b/src/Optimizers/FunctionCall/AddslashesOptimizer.php @@ -9,29 +9,32 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; +use Zephir\Exception; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** - * InArrayOptimizer. + * AddslashesOptimizer. * - * Optimizes calls to 'in_array' using internal function + * Optimizes calls to 'addslashes' using internal function */ -class InArrayOptimizer extends OptimizerAbstract +class AddslashesOptimizer extends OptimizerAbstract { /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed + * @return false|CompiledExpression + * @throws Exception */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,14 +42,18 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (count($expression['parameters']) > 1) { return false; } - $context->headersManager->add('kernel/array'); + [$symbolVariable, $resolvedParams, $symbol] = $this->processStringOptimizer( + $call, + $context, + $expression + ); - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); + $context->codePrinter->output('zephir_addslashes(' . $symbol . ', ' . $resolvedParams[0] . ');'); - return new CompiledExpression('bool', 'zephir_fast_in_array('.$resolvedParams[0].', '.$resolvedParams[1].')', $expression); + return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } } diff --git a/src/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php b/src/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php new file mode 100644 index 0000000000..83e4e28d67 --- /dev/null +++ b/src/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +use Zephir\Call; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Optimizers\OptimizerAbstract; + +use function count; + +/** + * ArrayKeysExistsOptimizer. + * + * Optimizes calls to 'array_key_exists' using internal function + */ +class ArrayKeyExistsOptimizer extends OptimizerAbstract +{ + /** + * @param array $expression + * @param Call $call + * @param CompilationContext $context + * + * @return false|CompiledExpression + * @throws Exception + */ + public function optimize(array $expression, Call $call, CompilationContext $context) + { + if (!isset($expression['parameters'])) { + return false; + } + + if (2 != count($expression['parameters'])) { + return false; + } + + $context->headersManager->add('kernel/array'); + + $resolvedParams = $call->getReadOnlyResolvedParams( + $expression['parameters'], + $context, + $expression + ); + + // Note: the first parameter is key in php array_key_exists + return new CompiledExpression( + 'bool', + $this->getCode($resolvedParams), + $expression + ); + } + + /** + * @param array $resolvedParams + * + * @return string + */ + protected function getCode(array $resolvedParams): string + { + return 'zephir_array_key_exists(' + . $resolvedParams[1] . ', ' + . $resolvedParams[0] . ')'; + } +} diff --git a/Library/Optimizers/FunctionCall/ArrayKeysOptimizer.php b/src/Optimizers/FunctionCall/ArrayKeysOptimizer.php similarity index 66% rename from Library/Optimizers/FunctionCall/ArrayKeysOptimizer.php rename to src/Optimizers/FunctionCall/ArrayKeysOptimizer.php index f6ae4fdd06..07474bd162 100644 --- a/Library/Optimizers/FunctionCall/ArrayKeysOptimizer.php +++ b/src/Optimizers/FunctionCall/ArrayKeysOptimizer.php @@ -9,14 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * ArrayKeysOptimizer. * @@ -24,14 +27,17 @@ */ class ArrayKeysOptimizer extends OptimizerAbstract { + protected int $parameterCount = 1; + /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @return false|CompiledExpression + * @throws Exception */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +45,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if ($this->parameterCount !== count($expression['parameters'])) { return false; } @@ -49,23 +55,34 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariable($symbolVariable, $expression); $context->headersManager->add('kernel/array'); $symbolVariable->setDynamicTypes('array'); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_array_keys('.$symbol.', '.$resolvedParams[0].');'); + + $context->codePrinter->output($this->getOutput($symbol, $resolvedParams)); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } + + /** + * @param string $symbol + * @param array $resolvedParams + * + * @return string + */ + protected function getOutput(string $symbol, $resolvedParams): string + { + return sprintf( + 'zephir_array_keys(%s, %s);', + $symbol, + $resolvedParams[0] + ); + } } diff --git a/src/Optimizers/FunctionCall/ArrayMergeOptimizer.php b/src/Optimizers/FunctionCall/ArrayMergeOptimizer.php new file mode 100644 index 0000000000..d357cd2ad0 --- /dev/null +++ b/src/Optimizers/FunctionCall/ArrayMergeOptimizer.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +use function sprintf; + +/** + * ArrayMergeOptimizer. + * + * Optimizes calls to 'array_merge' using internal function + */ +class ArrayMergeOptimizer extends ArrayKeysOptimizer +{ + protected int $parameterCount = 2; + + /** + * @param string $symbol + * @param array $resolvedParams + * + * @return string + */ + protected function getOutput(string $symbol, $resolvedParams): string + { + return sprintf( + 'zephir_fast_array_merge(%s, %s, %s);', + $symbol, + $resolvedParams[0], + $resolvedParams[1] + ); + } +} diff --git a/Library/Optimizers/FunctionCall/BasenameOptimizer.php b/src/Optimizers/FunctionCall/BasenameOptimizer.php similarity index 71% rename from Library/Optimizers/FunctionCall/BasenameOptimizer.php rename to src/Optimizers/FunctionCall/BasenameOptimizer.php index 8a0c34c9fd..e27c91cbdf 100644 --- a/Library/Optimizers/FunctionCall/BasenameOptimizer.php +++ b/src/Optimizers/FunctionCall/BasenameOptimizer.php @@ -9,14 +9,18 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; +use Zephir\Exception; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * BasenameOptimizer. * @@ -24,14 +28,17 @@ */ class BasenameOptimizer extends OptimizerAbstract { + protected string $zephirMethod = 'zephir_basename'; + /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @return false|CompiledExpression + * @throws Exception */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +46,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -51,20 +58,17 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable) { - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - } + $this->checkNotVariableString($symbolVariable, $expression); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_basename('.$symbol.', '.$resolvedParams[0].');'); + $context->codePrinter->output( + $this->zephirMethod . '(' . $symbol . ', ' . $resolvedParams[0] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/src/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php b/src/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php new file mode 100644 index 0000000000..9151a9bb1e --- /dev/null +++ b/src/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +/** + * CallUserFuncArrayOptimizer. + * + * Optimizer for 'call_user_func_array' + */ +class CallUserFuncArrayOptimizer extends CallUserFuncOptimizer +{ + protected int $parameterCount = 2; + protected string $zephirMethod = 'ZEPHIR_CALL_USER_FUNC_ARRAY'; + + /** + * @param string $symbol + * @param array $resolvedParams + * + * @return string + */ + protected function getOutput(string $symbol, array $resolvedParams): string + { + return $this->zephirMethod + . '(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');'; + } +} diff --git a/Library/Optimizers/FunctionCall/CallUserFuncOptimizer.php b/src/Optimizers/FunctionCall/CallUserFuncOptimizer.php similarity index 65% rename from Library/Optimizers/FunctionCall/CallUserFuncOptimizer.php rename to src/Optimizers/FunctionCall/CallUserFuncOptimizer.php index 28da362202..007f35b9ff 100644 --- a/Library/Optimizers/FunctionCall/CallUserFuncOptimizer.php +++ b/src/Optimizers/FunctionCall/CallUserFuncOptimizer.php @@ -9,14 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * CallUserFuncOptimizer. * @@ -24,6 +27,9 @@ */ class CallUserFuncOptimizer extends OptimizerAbstract { + protected int $parameterCount = 1; + protected string $zephirMethod = 'ZEPHIR_CALL_USER_FUNC'; + /** * @param array $expression * @param Call $call @@ -37,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if ($this->parameterCount !== count($expression['parameters'])) { return false; } @@ -47,11 +53,8 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable) { - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - } else { + $this->checkNotVariable($symbolVariable, $expression); + if (!$symbolVariable) { $symbolVariable = $context->symbolTable->addTemp('variable', $context); $symbolVariable->initVariant($context); } @@ -61,7 +64,11 @@ public function optimize(array $expression, Call $call, CompilationContext $cont */ $call->addCallStatusFlag($context); - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); + $resolvedParams = $call->getReadOnlyResolvedParams( + $expression['parameters'], + $context, + $expression + ); $context->headersManager->add('kernel/fcall'); @@ -70,14 +77,25 @@ public function optimize(array $expression, Call $call, CompilationContext $cont */ $call->addCallStatusFlag($context); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('ZEPHIR_CALL_USER_FUNC('.$symbol.', '.$resolvedParams[0].');'); + $context->codePrinter->output($this->getOutput($symbol, $resolvedParams)); $call->addCallStatusOrJump($context); return new CompiledExpression('variable', $symbolVariable->getName(), $expression); } + + /** + * @param string $symbol + * @param array $resolvedParams + * + * @return string + */ + protected function getOutput(string $symbol, array $resolvedParams): string + { + return $this->zephirMethod + . '(' . $symbol . ', ' . $resolvedParams[0] . ');'; + } } diff --git a/src/Optimizers/FunctionCall/CamelizeOptimizer.php b/src/Optimizers/FunctionCall/CamelizeOptimizer.php new file mode 100644 index 0000000000..13f2543670 --- /dev/null +++ b/src/Optimizers/FunctionCall/CamelizeOptimizer.php @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +use Zephir\Call; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception\CompilerException; +use Zephir\Optimizers\OptimizerAbstract; +use Zephir\Variable\Variable; + +use function count; + +/** + * CamelizeOptimizer. + * + * Optimizes calls to 'camelize' using internal function + */ +class CamelizeOptimizer extends OptimizerAbstract +{ + protected string $trimWhere = ''; + protected string $warningName = 'camelize'; + protected string $zephirMethod = 'zephir_camelize'; + + /** + * @param array $expression + * @param Call $call + * @param CompilationContext $context + * + * @return bool|CompiledExpression|mixed + * + * @throws CompilerException + */ + public function optimize(array $expression, Call $call, CompilationContext $context) + { + if (!isset($expression['parameters'])) { + return false; + } + + $this->checkParameters($expression['parameters']); + + $charlist = 'NULL '; + if (2 == count($expression['parameters'])) { + if ('null' == $expression['parameters'][1]['parameter']['type']) { + unset($expression['parameters'][1]); + } + } + + /* + * Process the expected symbol to be returned + */ + $call->processExpectedReturn($context); + + $symbolVariable = $call->getSymbolVariable(true, $context); + $this->checkNotVariableString($symbolVariable, $expression); + + $this->symbolVariablePre($call, $symbolVariable, $context); + + $context->headersManager->add('kernel/string'); + + $symbolVariable->setDynamicTypes('string'); + + $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); + + if (isset($resolvedParams[1])) { + $charlist = $resolvedParams[1]; + } + + $this->symbolVariablePost($call, $symbolVariable, $context); + + $symbol = $context->backend->getVariableCode($symbolVariable); + $context->codePrinter->output( + $this->zephirMethod . '(' . $symbol . ', ' + . $resolvedParams[0] . ', ' + . $charlist . $this->trimWhere . ');' + ); + + return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); + } + + /** + * @param $parameters + * + * @return void + */ + protected function checkParameters($parameters): void + { + if (count($parameters) < 1 || count($parameters) > 2) { + throw new CompilerException( + "'" . $this->warningName . "' only accepts one or two parameters" + ); + } + } + + /** + * @param Call $call + * @param Variable|null $symbolVariable + * @param CompilationContext $context + * + * @return void + */ + protected function symbolVariablePost( + Call $call, + ?Variable $symbolVariable, + CompilationContext $context + ): void { + // empty + } + + /** + * @param Call $call + * @param Variable|null $symbolVariable + * @param CompilationContext $context + * + * @return void + */ + protected function symbolVariablePre( + Call $call, + ?Variable $symbolVariable, + CompilationContext $context + ): void { + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + } +} diff --git a/Library/Optimizers/FunctionCall/CeilOptimizer.php b/src/Optimizers/FunctionCall/CeilOptimizer.php similarity index 85% rename from Library/Optimizers/FunctionCall/CeilOptimizer.php rename to src/Optimizers/FunctionCall/CeilOptimizer.php index 6c05009847..2139d3d059 100644 --- a/Library/Optimizers/FunctionCall/CeilOptimizer.php +++ b/src/Optimizers/FunctionCall/CeilOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * CeilOptimizer. * @@ -29,9 +33,9 @@ class CeilOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -47,6 +51,6 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('double', 'zephir_ceil('.$resolvedParams[0].')', $expression); + return new CompiledExpression('double', 'zephir_ceil(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/ClassExistsOptimizer.php b/src/Optimizers/FunctionCall/ClassExistsOptimizer.php similarity index 78% rename from Library/Optimizers/FunctionCall/ClassExistsOptimizer.php rename to src/Optimizers/FunctionCall/ClassExistsOptimizer.php index a448ca560d..817b5426d2 100644 --- a/Library/Optimizers/FunctionCall/ClassExistsOptimizer.php +++ b/src/Optimizers/FunctionCall/ClassExistsOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * ClassExistsOptimizer. * @@ -29,9 +33,9 @@ class ClassExistsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (\count($expression['parameters']) < 1) { + if (count($expression['parameters']) < 1) { throw new CompilerException("'class_exists' require one or two parameters"); } @@ -48,15 +52,19 @@ public function optimize(array $expression, Call $call, CompilationContext $cont /* * Process autoload */ - if (2 == \count($resolvedParams)) { + if (2 == count($resolvedParams)) { $context->headersManager->add('kernel/operators'); - $autoload = 'zephir_is_true('.$resolvedParams[1].') '; + $autoload = 'zephir_is_true(' . $resolvedParams[1] . ') '; } else { $autoload = '1'; } $context->headersManager->add('kernel/object'); - return new CompiledExpression('bool', 'zephir_class_exists('.$resolvedParams[0].', '.$autoload.')', $expression); + return new CompiledExpression( + 'bool', + 'zephir_class_exists(' . $resolvedParams[0] . ', ' . $autoload . ')', + $expression + ); } } diff --git a/Library/Optimizers/FunctionCall/CompareMtimeOptimizer.php b/src/Optimizers/FunctionCall/CompareMtimeOptimizer.php similarity index 82% rename from Library/Optimizers/FunctionCall/CompareMtimeOptimizer.php rename to src/Optimizers/FunctionCall/CompareMtimeOptimizer.php index bc18878f5f..767483fd08 100644 --- a/Library/Optimizers/FunctionCall/CompareMtimeOptimizer.php +++ b/src/Optimizers/FunctionCall/CompareMtimeOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * CompareMtimeOptimizer. * @@ -29,9 +33,9 @@ class CompareMtimeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { return false; } @@ -52,6 +56,10 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('bool', 'zephir_compare_mtime('.$resolvedParams[0].', '.$resolvedParams[1].')', $expression); + return new CompiledExpression( + 'bool', + 'zephir_compare_mtime(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ')', + $expression + ); } } diff --git a/Library/Optimizers/FunctionCall/CosOptimizer.php b/src/Optimizers/FunctionCall/CosOptimizer.php similarity index 85% rename from Library/Optimizers/FunctionCall/CosOptimizer.php rename to src/Optimizers/FunctionCall/CosOptimizer.php index 0af47c7870..0dcd924381 100644 --- a/Library/Optimizers/FunctionCall/CosOptimizer.php +++ b/src/Optimizers/FunctionCall/CosOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\MathOptimizer; @@ -20,8 +22,5 @@ */ class CosOptimizer extends MathOptimizer { - public function getFunctionName() - { - return 'cos'; - } + protected string $zephirMethod = 'cos'; } diff --git a/Library/Optimizers/FunctionCall/CountOptimizer.php b/src/Optimizers/FunctionCall/CountOptimizer.php similarity index 88% rename from Library/Optimizers/FunctionCall/CountOptimizer.php rename to src/Optimizers/FunctionCall/CountOptimizer.php index ded7d391ea..b0174a5352 100644 --- a/Library/Optimizers/FunctionCall/CountOptimizer.php +++ b/src/Optimizers/FunctionCall/CountOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -16,6 +18,8 @@ use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * CountOptimizer. * @@ -36,12 +40,12 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('int', 'zephir_fast_count_int('.$resolvedParams[0].')', $expression); + return new CompiledExpression('int', 'zephir_fast_count_int(' . $resolvedParams[0] . ')', $expression); } } diff --git a/src/Optimizers/FunctionCall/Crc32Optimizer.php b/src/Optimizers/FunctionCall/Crc32Optimizer.php new file mode 100644 index 0000000000..e69712d152 --- /dev/null +++ b/src/Optimizers/FunctionCall/Crc32Optimizer.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +/** + * Crc32Optimizer. + * + * Optimizes calls to 'crc32' using internal function + */ +class Crc32Optimizer extends StrtoupperOptimizer +{ + protected string $type = 'long'; + protected string $zephirMethod = 'zephir_crc32'; +} diff --git a/Library/Optimizers/FunctionCall/CreateArrayOptimizer.php b/src/Optimizers/FunctionCall/CreateArrayOptimizer.php similarity index 80% rename from Library/Optimizers/FunctionCall/CreateArrayOptimizer.php rename to src/Optimizers/FunctionCall/CreateArrayOptimizer.php index bb4d76ec5a..7940e8cd67 100644 --- a/Library/Optimizers/FunctionCall/CreateArrayOptimizer.php +++ b/src/Optimizers/FunctionCall/CreateArrayOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * CreateArrayOptimizer. * @@ -29,14 +33,14 @@ class CreateArrayOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { if (isset($expression['parameters'])) { - if (\count($expression['parameters']) > 1) { + if (count($expression['parameters']) > 1) { throw new CompilerException('This function only requires one parameter', $expression); } } @@ -47,9 +51,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariable($symbolVariable, $expression); /* * Add the last call status to the current symbol table @@ -66,15 +68,16 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = null; } - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); if ($resolvedParams) { - $context->codePrinter->output('zephir_create_array('.$symbol.', zephir_get_intval('.$resolvedParams[0].'), 1);'); + $context->codePrinter->output( + 'zephir_create_array(' . $symbol . ', zephir_get_intval(' . $resolvedParams[0] . '), 1);' + ); } else { - $context->codePrinter->output('zephir_create_array('.$symbol.', 0, 1);'); + $context->codePrinter->output('zephir_create_array(' . $symbol . ', 0, 1);'); } return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); diff --git a/Library/Optimizers/FunctionCall/CreateInstanceOptimizer.php b/src/Optimizers/FunctionCall/CreateInstanceOptimizer.php similarity index 62% rename from Library/Optimizers/FunctionCall/CreateInstanceOptimizer.php rename to src/Optimizers/FunctionCall/CreateInstanceOptimizer.php index 70117105f2..2dfd042b92 100644 --- a/Library/Optimizers/FunctionCall/CreateInstanceOptimizer.php +++ b/src/Optimizers/FunctionCall/CreateInstanceOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * CreateInstanceOptimizer. * @@ -24,14 +28,17 @@ */ class CreateInstanceOptimizer extends OptimizerAbstract { + protected string $exceptionMessage = 'This function only accepts one parameter'; + protected int $parameterCount = 1; + /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,8 +46,11 @@ public function optimize(array $expression, Call $call, CompilationContext $cont throw new CompilerException('This function requires parameters', $expression); } - if (1 != \count($expression['parameters'])) { - throw new CompilerException('This function only requires one parameter', $expression); + if ($this->parameterCount !== count($expression['parameters'])) { + throw new CompilerException( + $this->exceptionMessage, + $expression + ); } /* @@ -49,9 +59,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariable($symbolVariable, $expression); /* * Add the last call status to the current symbol table @@ -64,9 +72,8 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + /* * Add the last call status to the current symbol table @@ -74,11 +81,34 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->addCallStatusFlag($context); $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('ZEPHIR_LAST_CALL_STATUS = zephir_create_instance('.$symbol.', '.$resolvedParams[0].');'); + $context->codePrinter->output($this->getOutput($symbol, $resolvedParams)); - $call->checkTempParameters($context); + $this->getTempParameters($call, $context); $call->addCallStatusOrJump($context); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } + + /** + * @param string $symbol + * @param array $resolvedParams + * + * @return string + */ + protected function getOutput(string $symbol, array $resolvedParams): string + { + return 'ZEPHIR_LAST_CALL_STATUS = ' + . 'zephir_create_instance(' . $symbol . ', ' . $resolvedParams[0] . ');'; + } + + /** + * @param Call $call + * @param CompilationContext $context + * + * @return void + */ + protected function getTempParameters(Call $call, CompilationContext $context): void + { + $call->checkTempParameters($context); + } } diff --git a/src/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php b/src/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php new file mode 100644 index 0000000000..9c99c296af --- /dev/null +++ b/src/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +use Zephir\Call; +use Zephir\CompilationContext; + +/** + * CreateInstanceParamsOptimizer. + * + * Built-in function that creates new instances of objects from its class name passing parameters as an array + */ +class CreateInstanceParamsOptimizer extends CreateInstanceOptimizer +{ + protected string $exceptionMessage = 'This function only requires two parameter'; + protected int $parameterCount = 2; + + /** + * @param string $symbol + * @param array $resolvedParams + * + * @return string + */ + protected function getOutput(string $symbol, array $resolvedParams): string + { + return 'ZEPHIR_LAST_CALL_STATUS = ' + . 'zephir_create_instance_params(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');'; + } + + /** + * @param Call $call + * @param CompilationContext $context + * + * @return void + */ + protected function getTempParameters(Call $call, CompilationContext $context): void + { + // Not needed here + } +} diff --git a/Library/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php b/src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php similarity index 78% rename from Library/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php rename to src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php index f4d164c949..1bdef8af97 100644 --- a/Library/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php +++ b/src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * CreateSymbolTableOptimizer. * @@ -29,36 +33,31 @@ class CreateSymbolTableOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { if (isset($expression['parameters'])) { - if (0 != \count($expression['parameters'])) { + if (0 != count($expression['parameters'])) { throw new CompilerException("This function doesn't require parameters", $expression); } } - /* + /** * Process the expected symbol to be returned */ $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable) { - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - } + $this->checkNotVariable($symbolVariable, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); - $context->symbolTable->mustGrownStack(true); + // TODO: Still needed? + $context->symbolTable->mustGrownStack(true); $context->codePrinter->output('ZEPHIR_CREATE_SYMBOL_TABLE();'); $context->codePrinter->output(''); diff --git a/Library/Optimizers/FunctionCall/DieOptimizer.php b/src/Optimizers/FunctionCall/DieOptimizer.php similarity index 94% rename from Library/Optimizers/FunctionCall/DieOptimizer.php rename to src/Optimizers/FunctionCall/DieOptimizer.php index de596f138d..25f983a4de 100644 --- a/Library/Optimizers/FunctionCall/DieOptimizer.php +++ b/src/Optimizers/FunctionCall/DieOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; /** diff --git a/Library/Optimizers/FunctionCall/DoublevalOptimizer.php b/src/Optimizers/FunctionCall/DoublevalOptimizer.php similarity index 89% rename from Library/Optimizers/FunctionCall/DoublevalOptimizer.php rename to src/Optimizers/FunctionCall/DoublevalOptimizer.php index 6cfde21ea5..d3e274050e 100644 --- a/Library/Optimizers/FunctionCall/DoublevalOptimizer.php +++ b/src/Optimizers/FunctionCall/DoublevalOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * DoublevalOptimizer. * @@ -29,9 +33,9 @@ class DoublevalOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -47,6 +51,6 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('double', 'zephir_get_doubleval('.$resolvedParams[0].')', $expression); + return new CompiledExpression('double', 'zephir_get_doubleval(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/EndsWithOptimizer.php b/src/Optimizers/FunctionCall/EndsWithOptimizer.php similarity index 52% rename from Library/Optimizers/FunctionCall/EndsWithOptimizer.php rename to src/Optimizers/FunctionCall/EndsWithOptimizer.php index d33507ca8e..37e6292d24 100644 --- a/Library/Optimizers/FunctionCall/EndsWithOptimizer.php +++ b/src/Optimizers/FunctionCall/EndsWithOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -16,6 +18,8 @@ use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * EndsWithOptimizer. * @@ -23,6 +27,9 @@ */ class EndsWithOptimizer extends OptimizerAbstract { + protected string $zephirMethod = 'zephir_end_with'; + protected string $zephirMethodStr = 'zephir_end_with_str'; + /** * @param array $expression * @param Call $call @@ -36,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters']) && 3 != \count($expression['parameters'])) { + if (2 != count($expression['parameters']) && 3 != count($expression['parameters'])) { return false; } @@ -45,18 +52,36 @@ public function optimize(array $expression, Call $call, CompilationContext $cont unset($expression['parameters'][1]); } - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); + $resolvedParams = $call->getReadOnlyResolvedParams( + $expression['parameters'], + $context, + $expression + ); $context->headersManager->add('kernel/string'); if (isset($str)) { - return new CompiledExpression('bool', 'zephir_end_with_str('.$resolvedParams[0].', SL("'.$str.'"))', $expression); + return new CompiledExpression( + 'bool', + $this->zephirMethodStr . '(' . $resolvedParams[0] . ', SL("' . $str . '"))', + $expression + ); } - if (2 == \count($expression['parameters'])) { - return new CompiledExpression('bool', 'zephir_end_with('.$resolvedParams[0].', '.$resolvedParams[1].', NULL)', $expression); + if (2 == count($expression['parameters'])) { + return new CompiledExpression( + 'bool', + $this->zephirMethod + . '(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', NULL)', + $expression + ); } else { - return new CompiledExpression('bool', 'zephir_end_with('.$resolvedParams[0].', '.$resolvedParams[1].', '.$resolvedParams[2].')', $expression); + return new CompiledExpression( + 'bool', + $this->zephirMethod + . '(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', ' . $resolvedParams[2] . ')', + $expression + ); } } } diff --git a/Library/Optimizers/FunctionCall/EvalOptimizer.php b/src/Optimizers/FunctionCall/EvalOptimizer.php similarity index 74% rename from Library/Optimizers/FunctionCall/EvalOptimizer.php rename to src/Optimizers/FunctionCall/EvalOptimizer.php index 143c06a619..b87771373c 100644 --- a/Library/Optimizers/FunctionCall/EvalOptimizer.php +++ b/src/Optimizers/FunctionCall/EvalOptimizer.php @@ -9,14 +9,19 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * Zephir\Optimizers\FunctionCall\EvalOptimizer. */ @@ -29,14 +34,14 @@ class EvalOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * @throws \Zephir\Exception - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException + * @throws Exception */ public function optimize(array $expression, Call $call, CompilationContext $context) { - if (!isset($expression['parameters']) || \count($expression['parameters']) > 1) { + if (!isset($expression['parameters']) || count($expression['parameters']) > 1) { return false; } @@ -46,25 +51,19 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/fcall'); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $evalContext = str_replace( - [getcwd().'\\', getcwd().'/'], + [getcwd() . '\\', getcwd() . '/'], '', - $expression['file'].':'.$expression['line'] + $expression['file'] . ':' . $expression['line'] ); $symbol = $context->backend->getVariableCode($symbolVariable); diff --git a/Library/Optimizers/FunctionCall/ExitOptimizer.php b/src/Optimizers/FunctionCall/ExitOptimizer.php similarity index 76% rename from Library/Optimizers/FunctionCall/ExitOptimizer.php rename to src/Optimizers/FunctionCall/ExitOptimizer.php index b2f6084c90..8396872898 100644 --- a/Library/Optimizers/FunctionCall/ExitOptimizer.php +++ b/src/Optimizers/FunctionCall/ExitOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,9 +19,9 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** - * ExitOptimizer. - * * Optimizes calls to 'exit' using internal function */ class ExitOptimizer extends OptimizerAbstract @@ -29,27 +31,27 @@ class ExitOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { - if (isset($expression['parameters']) && \count($expression['parameters']) > 1) { + if (isset($expression['parameters']) && count($expression['parameters']) > 1) { return false; } $context->headersManager->add('kernel/exit'); if (isset($expression['parameters'])) { - //TODO: protect resolvedParams[0] from restore + // TODO: protect resolvedParams[0] from restore } if (!isset($expression['parameters'])) { - $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); + // $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); $context->codePrinter->output('zephir_exit_empty();'); } else { $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); - $context->codePrinter->output('zephir_exit('.$resolvedParams[0].');'); + // $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); + $context->codePrinter->output('zephir_exit(' . $resolvedParams[0] . ');'); } return new CompiledExpression('void ', '', $expression); diff --git a/Library/Optimizers/FunctionCall/ExplodeOptimizer.php b/src/Optimizers/FunctionCall/ExplodeOptimizer.php similarity index 68% rename from Library/Optimizers/FunctionCall/ExplodeOptimizer.php rename to src/Optimizers/FunctionCall/ExplodeOptimizer.php index 3ad81dc9d6..b5d2853237 100644 --- a/Library/Optimizers/FunctionCall/ExplodeOptimizer.php +++ b/src/Optimizers/FunctionCall/ExplodeOptimizer.php @@ -9,19 +9,20 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; -use function Zephir\add_slashes; +use function count; /** - * ExplodeOptimizer. - * * Optimizes calls to 'explode' using internal function */ class ExplodeOptimizer extends OptimizerAbstract @@ -31,16 +32,16 @@ class ExplodeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { if (!isset($expression['parameters'])) { return false; } - if (\count($expression['parameters']) < 2) { + if (count($expression['parameters']) < 2) { throw new CompilerException("'explode' require two parameter"); } @@ -50,24 +51,22 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); /** * Process limit. */ - $limit = 'LONG_MAX'; + $limit = 'LONG_MAX'; $limitOffset = 2; - if (3 == \count($expression['parameters']) && 'int' == $expression['parameters'][2]['parameter']['type']) { - $limit = $expression['parameters'][2]['parameter']['value'].' '; + if (3 == count($expression['parameters']) && 'int' == $expression['parameters'][2]['parameter']['type']) { + $limit = $expression['parameters'][2]['parameter']['value'] . ' '; unset($expression['parameters'][2]); } if ('string' == $expression['parameters'][0]['parameter']['type']) { - $str = add_slashes($expression['parameters'][0]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][0]['parameter']['value']); unset($expression['parameters'][0]); - if (2 == \count($expression['parameters'])) { + if (2 == count($expression['parameters'])) { $limitOffset = 1; } } @@ -76,23 +75,26 @@ public function optimize(array $expression, Call $call, CompilationContext $cont if (isset($resolvedParams[$limitOffset])) { $context->headersManager->add('kernel/operators'); - $limit = 'zephir_get_intval('.$resolvedParams[$limitOffset].') '; + $limit = 'zephir_get_intval(' . $resolvedParams[$limitOffset] . ') '; } $context->headersManager->add('kernel/string'); $symbolVariable->setDynamicTypes('array'); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); if (isset($str)) { - $context->codePrinter->output('zephir_fast_explode_str('.$symbol.', SL("'.$str.'"), '.$resolvedParams[0].', '.$limit.');'); + $context->codePrinter->output( + 'zephir_fast_explode_str(' . $symbol . ', SL("' . $str . '"), ' . $resolvedParams[0] . ', ' . $limit . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } - $context->codePrinter->output('zephir_fast_explode('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].', '.$limit.');'); + $context->codePrinter->output( + 'zephir_fast_explode(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', ' . $limit . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/FcloseOptimizer.php b/src/Optimizers/FunctionCall/FcloseOptimizer.php similarity index 85% rename from Library/Optimizers/FunctionCall/FcloseOptimizer.php rename to src/Optimizers/FunctionCall/FcloseOptimizer.php index af5db2b021..209b2db340 100644 --- a/Library/Optimizers/FunctionCall/FcloseOptimizer.php +++ b/src/Optimizers/FunctionCall/FcloseOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * FcloseOptimizer. * @@ -29,9 +33,9 @@ class FcloseOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -47,6 +51,6 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('bool', 'zephir_fclose('.$resolvedParams[0].')', $expression); + return new CompiledExpression('bool', 'zephir_fclose(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/FeofOptimizer.php b/src/Optimizers/FunctionCall/FeofOptimizer.php similarity index 84% rename from Library/Optimizers/FunctionCall/FeofOptimizer.php rename to src/Optimizers/FunctionCall/FeofOptimizer.php index bde9374bcd..7cc8289ab2 100644 --- a/Library/Optimizers/FunctionCall/FeofOptimizer.php +++ b/src/Optimizers/FunctionCall/FeofOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -16,6 +18,8 @@ use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * FeofOptimizer. * @@ -36,7 +40,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -44,6 +48,6 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('bool', 'zephir_feof('.$resolvedParams[0].')', $expression); + return new CompiledExpression('bool', 'zephir_feof(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/FileExistsOptimizer.php b/src/Optimizers/FunctionCall/FileExistsOptimizer.php similarity index 81% rename from Library/Optimizers/FunctionCall/FileExistsOptimizer.php rename to src/Optimizers/FunctionCall/FileExistsOptimizer.php index d06e1e562c..fc515e1988 100644 --- a/Library/Optimizers/FunctionCall/FileExistsOptimizer.php +++ b/src/Optimizers/FunctionCall/FileExistsOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * FileExistsOptimizer. * @@ -29,9 +33,9 @@ class FileExistsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -47,6 +51,10 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('bool', '(zephir_file_exists('.$resolvedParams[0].') == SUCCESS)', $expression); + return new CompiledExpression( + 'bool', + '(zephir_file_exists(' . $resolvedParams[0] . ') == SUCCESS)', + $expression + ); } } diff --git a/Library/Optimizers/FunctionCall/FileGetContentsOptimizer.php b/src/Optimizers/FunctionCall/FileGetContentsOptimizer.php similarity index 78% rename from Library/Optimizers/FunctionCall/FileGetContentsOptimizer.php rename to src/Optimizers/FunctionCall/FileGetContentsOptimizer.php index 6b2b6abd97..4d391100d3 100644 --- a/Library/Optimizers/FunctionCall/FileGetContentsOptimizer.php +++ b/src/Optimizers/FunctionCall/FileGetContentsOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * FileGetContentsOptimizer. * @@ -29,9 +33,9 @@ class FileGetContentsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -51,23 +55,18 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable) { - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - } + $this->checkNotVariableString($symbolVariable, $expression); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + if ($symbolVariable) { $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_file_get_contents('.$symbol.', '.$resolvedParams[0].');'); + $context->codePrinter->output('zephir_file_get_contents(' . $symbol . ', ' . $resolvedParams[0] . ');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } else { - $context->codePrinter->output('zephir_file_get_contents(NULL, '.$resolvedParams[0].');'); + $context->codePrinter->output('zephir_file_get_contents(NULL, ' . $resolvedParams[0] . ');'); } return new CompiledExpression('null', 'null', $expression); diff --git a/Library/Optimizers/FunctionCall/FilePutContentsOptimizer.php b/src/Optimizers/FunctionCall/FilePutContentsOptimizer.php similarity index 76% rename from Library/Optimizers/FunctionCall/FilePutContentsOptimizer.php rename to src/Optimizers/FunctionCall/FilePutContentsOptimizer.php index 894bc0b16d..209afa9d1d 100644 --- a/Library/Optimizers/FunctionCall/FilePutContentsOptimizer.php +++ b/src/Optimizers/FunctionCall/FilePutContentsOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * FilePutContentsOptimizer. * @@ -29,9 +33,9 @@ class FilePutContentsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { return false; } @@ -51,11 +55,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(); - if ($symbolVariable) { - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - } + $this->checkNotVariableString($symbolVariable, $expression); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); if ($symbolVariable) { @@ -63,11 +63,15 @@ public function optimize(array $expression, Call $call, CompilationContext $cont if ($call->mustInitSymbolVariable()) { $symbolVariable->initVariant($context); } - $context->codePrinter->output('zephir_file_put_contents('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].');'); + $context->codePrinter->output( + 'zephir_file_put_contents(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } else { - $context->codePrinter->output('zephir_file_put_contents(NULL, '.$resolvedParams[0].', '.$resolvedParams[1].');'); + $context->codePrinter->output( + 'zephir_file_put_contents(NULL, ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');' + ); } return new CompiledExpression('null', 'null', $expression); diff --git a/src/Optimizers/FunctionCall/FilemtimeOptimizer.php b/src/Optimizers/FunctionCall/FilemtimeOptimizer.php new file mode 100644 index 0000000000..db5205b200 --- /dev/null +++ b/src/Optimizers/FunctionCall/FilemtimeOptimizer.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +/** + * FilemtimeOptimizer. + * + * Optimizes calls to 'filemtime' using internal function + */ +class FilemtimeOptimizer extends BasenameOptimizer +{ + protected string $zephirMethod = 'zephir_filemtime'; +} diff --git a/Library/Optimizers/FunctionCall/FloorOptimizer.php b/src/Optimizers/FunctionCall/FloorOptimizer.php similarity index 85% rename from Library/Optimizers/FunctionCall/FloorOptimizer.php rename to src/Optimizers/FunctionCall/FloorOptimizer.php index e3296ffe94..fd9bc9188e 100644 --- a/Library/Optimizers/FunctionCall/FloorOptimizer.php +++ b/src/Optimizers/FunctionCall/FloorOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * FloorOptimizer. * @@ -29,9 +33,9 @@ class FloorOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -47,6 +51,6 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('double', 'zephir_floor('.$resolvedParams[0].')', $expression); + return new CompiledExpression('double', 'zephir_floor(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/FuncGetArgOptimizer.php b/src/Optimizers/FunctionCall/FuncGetArgOptimizer.php similarity index 78% rename from Library/Optimizers/FunctionCall/FuncGetArgOptimizer.php rename to src/Optimizers/FunctionCall/FuncGetArgOptimizer.php index 44ce4ca16d..8099bedf24 100644 --- a/Library/Optimizers/FunctionCall/FuncGetArgOptimizer.php +++ b/src/Optimizers/FunctionCall/FuncGetArgOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * Zephir\Optimizers\FunctionCall\FuncGetArgOptimizer. * @@ -31,17 +35,17 @@ class FuncGetArgOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { - if (!isset($expression['parameters']) || 1 != \count($expression['parameters'])) { + if (!isset($expression['parameters']) || 1 != count($expression['parameters'])) { throw new CompilerException( sprintf( 'func_get_arg() expects at exactly 1 parameter, %d given', - isset($expression['parameters']) ? \count($expression['parameters']) : 0 + isset($expression['parameters']) ? count($expression['parameters']) : 0 ), $expression ); @@ -53,16 +57,10 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables.', - $expression - ); - } + $this->checkNotVariableString($symbolVariable, $expression); + + $this->checkInitSymbolVariable($call, $symbolVariable, $context); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } $symbol = $context->backend->getVariableCode($symbolVariable); diff --git a/Library/Optimizers/FunctionCall/FuncGetArgsOptimizer.php b/src/Optimizers/FunctionCall/FuncGetArgsOptimizer.php similarity index 76% rename from Library/Optimizers/FunctionCall/FuncGetArgsOptimizer.php rename to src/Optimizers/FunctionCall/FuncGetArgsOptimizer.php index 05c566024e..2ad1da012a 100644 --- a/Library/Optimizers/FunctionCall/FuncGetArgsOptimizer.php +++ b/src/Optimizers/FunctionCall/FuncGetArgsOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -29,9 +31,9 @@ class FuncGetArgsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -41,19 +43,13 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } - - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkNotVariableString($symbolVariable, $expression); + + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); $context->headersManager->add('kernel/main'); - $context->codePrinter->output('zephir_get_args('.$symbol.');'); + $context->codePrinter->output('zephir_get_args(' . $symbol . ');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/FuncNumArgsOptimizer.php b/src/Optimizers/FunctionCall/FuncNumArgsOptimizer.php similarity index 97% rename from Library/Optimizers/FunctionCall/FuncNumArgsOptimizer.php rename to src/Optimizers/FunctionCall/FuncNumArgsOptimizer.php index 82a1864755..93eb084f89 100644 --- a/Library/Optimizers/FunctionCall/FuncNumArgsOptimizer.php +++ b/src/Optimizers/FunctionCall/FuncNumArgsOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; diff --git a/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php b/src/Optimizers/FunctionCall/FunctionExistsOptimizer.php similarity index 82% rename from Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php rename to src/Optimizers/FunctionCall/FunctionExistsOptimizer.php index ace5a2b80e..d75f825b55 100644 --- a/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php +++ b/src/Optimizers/FunctionCall/FunctionExistsOptimizer.php @@ -9,19 +9,19 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; use function count; -use function Zephir\add_slashes; /** - * FunctionExistsOptimizer. - * * Optimizes calls to 'function_exists' using internal function */ class FunctionExistsOptimizer extends OptimizerAbstract @@ -40,7 +40,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } if ('string' === $expression['parameters'][0]['parameter']['type']) { - $str = add_slashes($expression['parameters'][0]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][0]['parameter']['value']); unset($expression['parameters'][0]); } @@ -50,14 +50,14 @@ public function optimize(array $expression, Call $call, CompilationContext $cont if (isset($str)) { return new CompiledExpression( 'bool', - '(zephir_function_exists_ex(ZEND_STRL("'.strtolower($str).'")) == SUCCESS)', + '(zephir_function_exists_ex(ZEND_STRL("' . strtolower($str) . '")) == SUCCESS)', $expression ); } return new CompiledExpression( 'bool', - '(zephir_function_exists('.$resolvedParams[0].') == SUCCESS)', + '(zephir_function_exists(' . $resolvedParams[0] . ') == SUCCESS)', $expression ); } diff --git a/Library/Optimizers/FunctionCall/FwriteOptimizer.php b/src/Optimizers/FunctionCall/FwriteOptimizer.php similarity index 76% rename from Library/Optimizers/FunctionCall/FwriteOptimizer.php rename to src/Optimizers/FunctionCall/FwriteOptimizer.php index d77cf01b3e..ef2ff1a310 100644 --- a/Library/Optimizers/FunctionCall/FwriteOptimizer.php +++ b/src/Optimizers/FunctionCall/FwriteOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * FwriteOptimizer. * @@ -29,9 +33,9 @@ class FwriteOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { return false; } @@ -51,11 +55,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(); - if ($symbolVariable) { - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - } + $this->checkNotVariableString($symbolVariable, $expression); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); if ($symbolVariable) { @@ -63,11 +63,15 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $symbolVariable->initVariant($context); } $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_fwrite('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].');'); + $context->codePrinter->output( + 'zephir_fwrite(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } else { - $context->codePrinter->output('zephir_fwrite(NULL, '.$resolvedParams[0].', '.$resolvedParams[1].');'); + $context->codePrinter->output( + 'zephir_fwrite(NULL, ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');' + ); } return new CompiledExpression('null', 'null', $expression); diff --git a/Library/Optimizers/FunctionCall/GetCalledClassOptimizer.php b/src/Optimizers/FunctionCall/GetCalledClassOptimizer.php similarity index 80% rename from Library/Optimizers/FunctionCall/GetCalledClassOptimizer.php rename to src/Optimizers/FunctionCall/GetCalledClassOptimizer.php index a771b5099d..d944f354ab 100644 --- a/Library/Optimizers/FunctionCall/GetCalledClassOptimizer.php +++ b/src/Optimizers/FunctionCall/GetCalledClassOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * GetCalledClassOptimizer. * @@ -29,14 +33,14 @@ class GetCalledClassOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { if (isset($expression['parameters'])) { - $numberParameters = \count($expression['parameters']); + $numberParameters = count($expression['parameters']); if (0 != $numberParameters) { return false; } @@ -48,20 +52,17 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); + + $this->checkInitSymbolVariable($call, $symbolVariable, $context); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } $context->headersManager->add('kernel/object'); $symbolVariable->setDynamicTypes('string'); $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_get_called_class('.$symbol.');'); + $context->codePrinter->output('zephir_get_called_class(' . $symbol . ');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Exception/BadMethodCallException.php b/src/Optimizers/FunctionCall/GetClassLowerOptimizer.php similarity index 52% rename from Library/Exception/BadMethodCallException.php rename to src/Optimizers/FunctionCall/GetClassLowerOptimizer.php index 0c4d903d2c..bee6bdf45d 100644 --- a/Library/Exception/BadMethodCallException.php +++ b/src/Optimizers/FunctionCall/GetClassLowerOptimizer.php @@ -9,12 +9,14 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Exception; +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; /** - * Zephir\Exception\BadMethodCallException. + * Optimizes calls to 'get_class_lower' using internal function */ -class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface +class GetClassLowerOptimizer extends GetClassOptimizer { - use ExceptionExtraAwareTrait; + protected bool $lower = true; } diff --git a/src/Optimizers/FunctionCall/GetClassNsOptimizer.php b/src/Optimizers/FunctionCall/GetClassNsOptimizer.php new file mode 100644 index 0000000000..949c1844b2 --- /dev/null +++ b/src/Optimizers/FunctionCall/GetClassNsOptimizer.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +use Zephir\CompilationContext; +use Zephir\Exception\CompilerException; + +use function count; + +/** + * GetClassNsOptimizer. + * + * Optimizes calls to 'get_class_ns' using internal function + */ +class GetClassNsOptimizer extends GetClassOptimizer +{ + /** + * @param array $expression + * + * @return void + */ + protected function checkParameters(array $expression): void + { + $numberParameters = count($expression['parameters']); + if (1 != $numberParameters && 2 != $numberParameters) { + throw new CompilerException( + "'get_class_ns' only accepts one or two parameters", + $expression + ); + } + } + + /** + * @param CompilationContext $context + * @param string $symbol + * @param array $resolvedParams + * + * @return void + */ + protected function getOutput( + CompilationContext $context, + string $symbol, + array $resolvedParams + ): void { + $output = 'zephir_get_class_ns(' . $symbol . ', ' . $resolvedParams[0]; + + if (!isset($resolvedParams[1])) { + $output .= ', 0);'; + } else { + $output .= ', ' . $resolvedParams[1] . ');'; + } + + $context->codePrinter->output($output); + } +} diff --git a/Library/Optimizers/FunctionCall/GetClassOptimizer.php b/src/Optimizers/FunctionCall/GetClassOptimizer.php similarity index 54% rename from Library/Optimizers/FunctionCall/GetClassOptimizer.php rename to src/Optimizers/FunctionCall/GetClassOptimizer.php index c7afeab546..6813368e90 100644 --- a/Library/Optimizers/FunctionCall/GetClassOptimizer.php +++ b/src/Optimizers/FunctionCall/GetClassOptimizer.php @@ -9,29 +9,28 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** - * GetClassOptimizer. - * * Optimizes calls to 'get_class' using internal function */ class GetClassOptimizer extends OptimizerAbstract { + protected bool $lower = false; + /** - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return bool|CompiledExpression|mixed + * @throws Exception */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,33 +38,63 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - $numberParameters = \count($expression['parameters']); - if (1 != $numberParameters && 2 != $numberParameters) { - throw new CompilerException("'get_class' only accepts one or two parameters", $expression); - } + $this->checkParameters($expression); - /* + /** * Process the expected symbol to be returned */ $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); + $context->headersManager->add('kernel/object'); $symbolVariable->setDynamicTypes('string'); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_get_class('.$symbol.', '.$resolvedParams[0].', 0);'); + $this->getOutput($context, $symbol, $resolvedParams); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } + + /** + * @param array $expression + * + * @return void + */ + protected function checkParameters(array $expression): void + { + $numberParameters = count($expression['parameters']); + if (1 != $numberParameters && 2 != $numberParameters) { + throw new CompilerException( + "'get_class' only accepts one or two parameters", + $expression + ); + } + } + + /** + * @param CompilationContext $context + * @param string $symbol + * @param array $resolvedParams + * + * @return void + */ + protected function getOutput( + CompilationContext $context, + string $symbol, + array $resolvedParams + ): void { + $lower = $this->lower ? 1 : 0; + + $context->codePrinter->output( + 'zephir_get_class(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $lower . ');' + ); + } } diff --git a/Library/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php b/src/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php similarity index 75% rename from Library/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php rename to src/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php index 7c410ee3e3..b97b50d3b1 100644 --- a/Library/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php +++ b/src/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php @@ -9,12 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; /** @@ -35,20 +36,14 @@ public function optimize(array $expression, Call $call, CompilationContext $cont { $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } + $this->checkNotVariableString($symbolVariable, $expression); + + $this->checkInitSymbolVariable($call, $symbolVariable, $context); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } $symbol = $context->backend->getVariableCode($symbolVariable); $context->headersManager->add('kernel/variables'); - $context->codePrinter->output('zephir_get_defined_vars('.$symbol.');'); + $context->codePrinter->output('zephir_get_defined_vars(' . $symbol . ');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/GetNsClassOptimizer.php b/src/Optimizers/FunctionCall/GetNsClassOptimizer.php similarity index 78% rename from Library/Optimizers/FunctionCall/GetNsClassOptimizer.php rename to src/Optimizers/FunctionCall/GetNsClassOptimizer.php index d6d0208cc9..da498a828e 100644 --- a/Library/Optimizers/FunctionCall/GetNsClassOptimizer.php +++ b/src/Optimizers/FunctionCall/GetNsClassOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * GetNsClassOptimizer. * @@ -29,9 +33,9 @@ class GetNsClassOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { throw new CompilerException("'get_class_ns' only accepts one parameter"); } @@ -49,20 +53,17 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/object'); $symbolVariable->setDynamicTypes('string'); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_get_ns_class('.$symbol.', '.$resolvedParams[0].', 0);'); + $context->codePrinter->output('zephir_get_ns_class(' . $symbol . ', ' . $resolvedParams[0] . ', 0);'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/GettypeOptimizer.php b/src/Optimizers/FunctionCall/GettypeOptimizer.php similarity index 77% rename from Library/Optimizers/FunctionCall/GettypeOptimizer.php rename to src/Optimizers/FunctionCall/GettypeOptimizer.php index 3cb217ec27..0b5c5b1bea 100644 --- a/Library/Optimizers/FunctionCall/GettypeOptimizer.php +++ b/src/Optimizers/FunctionCall/GettypeOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * GettypeOptimizer. * @@ -29,9 +33,9 @@ class GettypeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -49,19 +53,16 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $symbolVariable->setDynamicTypes('string'); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_gettype('.$symbol.', '.$resolvedParams[0].');'); + $context->codePrinter->output('zephir_gettype(' . $symbol . ', ' . $resolvedParams[0] . ');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/GlobalsGetOptimizer.php b/src/Optimizers/FunctionCall/GlobalsGetOptimizer.php similarity index 82% rename from Library/Optimizers/FunctionCall/GlobalsGetOptimizer.php rename to src/Optimizers/FunctionCall/GlobalsGetOptimizer.php index d71f69fb46..5051573b60 100644 --- a/Library/Optimizers/FunctionCall/GlobalsGetOptimizer.php +++ b/src/Optimizers/FunctionCall/GlobalsGetOptimizer.php @@ -54,17 +54,20 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $globalName = $expression['parameters'][0]['parameter']['value']; if (!$context->compiler->isExtensionGlobal($globalName)) { - throw new CompilerException("Global '".$globalName."' cannot be read because it isn't defined", $expression); + throw new CompilerException( + "Global '" . $globalName . "' cannot be read because it isn't defined", + $expression + ); } $type = $context->compiler->getExtensionGlobal($globalName)['type']; - if (false !== strpos($globalName, '.')) { + if (str_contains($globalName, '.')) { $parts = explode('.', $globalName); - return new CompiledExpression($type, 'ZEPHIR_GLOBAL('.$parts[0].').'.$parts[1], $expression); + return new CompiledExpression($type, 'ZEPHIR_GLOBAL(' . $parts[0] . ').' . $parts[1], $expression); } - return new CompiledExpression($type, 'ZEPHIR_GLOBAL('.$globalName.')', $expression); + return new CompiledExpression($type, 'ZEPHIR_GLOBAL(' . $globalName . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/GlobalsSetOptimizer.php b/src/Optimizers/FunctionCall/GlobalsSetOptimizer.php similarity index 72% rename from Library/Optimizers/FunctionCall/GlobalsSetOptimizer.php rename to src/Optimizers/FunctionCall/GlobalsSetOptimizer.php index 5ff8573b52..89d3fd4f6e 100644 --- a/Library/Optimizers/FunctionCall/GlobalsSetOptimizer.php +++ b/src/Optimizers/FunctionCall/GlobalsSetOptimizer.php @@ -19,8 +19,10 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use Zephir\Types\Types; use function count; +use function is_string; /** * `globals_set()` internal function. @@ -34,9 +36,9 @@ class GlobalsSetOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context): CompiledExpression { @@ -65,9 +67,9 @@ public function optimize(array $expression, Call $call, CompilationContext $cont try { $globalDefinition = $context->compiler->getExtensionGlobal($globalName); - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); + $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if (!isset($resolvedParams[0]) || empty($resolvedParams[0]) || !\is_string($resolvedParams[0])) { + if (!isset($resolvedParams[0]) || empty($resolvedParams[0]) || !is_string($resolvedParams[0])) { throw new CompilerException( "Unable to reslove value for '{$globalName}' global variable.", $expression @@ -82,7 +84,12 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } $internalAccessor = $this->resolveInternalAccessor($globalName); - $internalValue = $this->resolveInternalValue($globalDefinition, $expression, $globalName, $resolvedParams[0]); + $internalValue = $this->resolveInternalValue( + $globalDefinition, + $expression, + $globalName, + $resolvedParams[0] + ); $context->codePrinter->output("{$internalAccessor} = {$internalValue};"); @@ -117,32 +124,26 @@ private function resolveInternalValue(array $definition, array $expression, stri { $type = $definition['type']; - switch ($type) { - case 'boolean': - case 'bool': - return strtr('zend_is_true(:v)', [':v' => $value]); - case 'int': - case 'uint': - case 'integer': - case 'long': - case 'ulong': - return strtr('zval_get_long(:v)', [':v' => $value]); - case 'string': - return strtr('ZSTR_VAL(zval_get_string(:v))', [':v' => $value]); - case 'char': - case 'uchar': - return strtr( - '(Z_TYPE_P(:v) == IS_STRING ? (Z_STRLEN_P(:v) ? Z_STRVAL_P(:v)[0] : NULL) : zval_get_long(:v))', - [':v' => $value] - ); - case 'double': - case 'float': - return strtr('zval_get_double(:v)', [':v' => $value]); - default: - throw new CompilerException( - "Unknown type '{$type}' to setting global variable '{$name}'.", - $expression - ); - } + return match ($type) { + Types::T_BOOLEAN, + Types::T_BOOL => strtr('zend_is_true(:v)', [':v' => $value]), + Types::T_INT, + Types::T_UINT, + Types::T_INTEGER, + Types::T_LONG, + Types::T_ULONG => strtr('zval_get_long(:v)', [':v' => $value]), + Types::T_STRING => strtr('ZSTR_VAL(zval_get_string(:v))', [':v' => $value]), + Types::T_CHAR, + Types::T_UCHAR => strtr( + '(Z_TYPE_P(:v) == IS_STRING ? (Z_STRLEN_P(:v) ? Z_STRVAL_P(:v)[0] : NULL) : zval_get_long(:v))', + [':v' => $value] + ), + Types::T_DOUBLE, + Types::T_FLOAT => strtr('zval_get_double(:v)', [':v' => $value]), + default => throw new CompilerException( + "Unknown type '$type' to setting global variable '$name'.", + $expression + ), + }; } } diff --git a/Library/Optimizers/FunctionCall/HashEqualsOptimizer.php b/src/Optimizers/FunctionCall/HashEqualsOptimizer.php similarity index 73% rename from Library/Optimizers/FunctionCall/HashEqualsOptimizer.php rename to src/Optimizers/FunctionCall/HashEqualsOptimizer.php index ed0840c3e6..7d88a43785 100644 --- a/Library/Optimizers/FunctionCall/HashEqualsOptimizer.php +++ b/src/Optimizers/FunctionCall/HashEqualsOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * HashEqualsOptimizer. * @@ -29,13 +33,13 @@ class HashEqualsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { - if (!isset($expression['parameters']) || 2 != \count($expression['parameters'])) { + if (!isset($expression['parameters']) || 2 != count($expression['parameters'])) { throw new CompilerException("'hash_equals' requires two parameters", $expression); } @@ -45,9 +49,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/string'); @@ -56,10 +58,13 @@ public function optimize(array $expression, Call $call, CompilationContext $cont */ $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + - return new CompiledExpression('bool', 'zephir_hash_equals('.$resolvedParams[0].', '.$resolvedParams[1].')', $expression); + return new CompiledExpression( + 'bool', + 'zephir_hash_equals(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ')', + $expression + ); } } diff --git a/Library/Optimizers/FunctionCall/ImplodeOptimizer.php b/src/Optimizers/FunctionCall/ImplodeOptimizer.php similarity index 71% rename from Library/Optimizers/FunctionCall/ImplodeOptimizer.php rename to src/Optimizers/FunctionCall/ImplodeOptimizer.php index 651c15b55e..4a512dbd99 100644 --- a/Library/Optimizers/FunctionCall/ImplodeOptimizer.php +++ b/src/Optimizers/FunctionCall/ImplodeOptimizer.php @@ -9,19 +9,20 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; -use function Zephir\add_slashes; +use function count; /** - * ImplodeOptimizer. - * * Optimizes calls to 'implode' using internal function */ class ImplodeOptimizer extends OptimizerAbstract @@ -31,9 +32,9 @@ class ImplodeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -41,7 +42,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { return false; } @@ -51,12 +52,10 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); if ('string' == $expression['parameters'][0]['parameter']['type']) { - $str = add_slashes($expression['parameters'][0]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][0]['parameter']['value']); unset($expression['parameters'][0]); } @@ -65,18 +64,21 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $context->headersManager->add('kernel/string'); $symbolVariable->setDynamicTypes('string'); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); if (isset($str)) { - $context->codePrinter->output('zephir_fast_join_str('.$symbol.', SL("'.$str.'"), '.$resolvedParams[0].');'); + $context->codePrinter->output( + 'zephir_fast_join_str(' . $symbol . ', SL("' . $str . '"), ' . $resolvedParams[0] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } - $context->codePrinter->output('zephir_fast_join('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].');'); + $context->codePrinter->output( + 'zephir_fast_join(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/src/Optimizers/FunctionCall/InArrayOptimizer.php b/src/Optimizers/FunctionCall/InArrayOptimizer.php new file mode 100644 index 0000000000..ab675298de --- /dev/null +++ b/src/Optimizers/FunctionCall/InArrayOptimizer.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +/** + * InArrayOptimizer. + * + * Optimizes calls to 'in_array' using internal function + */ +class InArrayOptimizer extends ArrayKeyExistsOptimizer +{ + /** + * @param array $resolvedParams + * + * @return string + */ + protected function getCode(array $resolvedParams): string + { + return 'zephir_fast_in_array(' + . $resolvedParams[0] . ', ' + . $resolvedParams[1] . ')'; + } +} diff --git a/Library/Optimizers/FunctionCall/InterfaceExistsOptimizer.php b/src/Optimizers/FunctionCall/InterfaceExistsOptimizer.php similarity index 69% rename from Library/Optimizers/FunctionCall/InterfaceExistsOptimizer.php rename to src/Optimizers/FunctionCall/InterfaceExistsOptimizer.php index 5ffb906e13..b0db2203ef 100644 --- a/Library/Optimizers/FunctionCall/InterfaceExistsOptimizer.php +++ b/src/Optimizers/FunctionCall/InterfaceExistsOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * InterfaceExistsOptimizer. * @@ -29,9 +33,9 @@ class InterfaceExistsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (\count($expression['parameters']) < 1) { + if (count($expression['parameters']) < 1) { throw new CompilerException("'class_exists' require one or two parameters"); } @@ -47,20 +51,30 @@ public function optimize(array $expression, Call $call, CompilationContext $cont * Process autoload. */ $autoload = '1 '; - if (2 == \count($expression['parameters']) && ('int' == $expression['parameters'][1]['parameter']['type'] || 'bool' == $expression['parameters'][1]['parameter']['type'])) { - $autoload = $expression['parameters'][1]['parameter']['value'].' '; + if ( + 2 == count($expression['parameters']) && + ( + 'int' == $expression['parameters'][1]['parameter']['type'] || + 'bool' == $expression['parameters'][1]['parameter']['type'] + ) + ) { + $autoload = $expression['parameters'][1]['parameter']['value'] . ' '; unset($expression['parameters'][1]); } $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if (2 == \count($resolvedParams)) { + if (2 == count($resolvedParams)) { $context->headersManager->add('kernel/operators'); - $autoload = 'zephir_is_true('.$resolvedParams[1].') '; + $autoload = 'zephir_is_true(' . $resolvedParams[1] . ') '; } $context->headersManager->add('kernel/object'); - return new CompiledExpression('bool', 'zephir_interface_exists('.$resolvedParams[0].', '.$autoload.')', $expression); + return new CompiledExpression( + 'bool', + 'zephir_interface_exists(' . $resolvedParams[0] . ', ' . $autoload . ')', + $expression + ); } } diff --git a/Library/Optimizers/FunctionCall/IntvalOptimizer.php b/src/Optimizers/FunctionCall/IntvalOptimizer.php similarity index 89% rename from Library/Optimizers/FunctionCall/IntvalOptimizer.php rename to src/Optimizers/FunctionCall/IntvalOptimizer.php index 081d8c37ca..5e238548d4 100644 --- a/Library/Optimizers/FunctionCall/IntvalOptimizer.php +++ b/src/Optimizers/FunctionCall/IntvalOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * IntvalOptimizer. * @@ -29,9 +33,9 @@ class IntvalOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -47,6 +51,6 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('long', 'zephir_get_intval('.$resolvedParams[0].')', $expression); + return new CompiledExpression('long', 'zephir_get_intval(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/IsArrayOptimizer.php b/src/Optimizers/FunctionCall/IsArrayOptimizer.php similarity index 95% rename from Library/Optimizers/FunctionCall/IsArrayOptimizer.php rename to src/Optimizers/FunctionCall/IsArrayOptimizer.php index 16fc60201a..31efa1df97 100644 --- a/Library/Optimizers/FunctionCall/IsArrayOptimizer.php +++ b/src/Optimizers/FunctionCall/IsArrayOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\IsTypeOptimizerAbstract; diff --git a/Library/Optimizers/FunctionCall/IsBoolOptimizer.php b/src/Optimizers/FunctionCall/IsBoolOptimizer.php similarity index 95% rename from Library/Optimizers/FunctionCall/IsBoolOptimizer.php rename to src/Optimizers/FunctionCall/IsBoolOptimizer.php index 9680b0b333..7904b7696d 100644 --- a/Library/Optimizers/FunctionCall/IsBoolOptimizer.php +++ b/src/Optimizers/FunctionCall/IsBoolOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\IsTypeOptimizerAbstract; diff --git a/Library/Optimizers/FunctionCall/IsCallableOptimizer.php b/src/Optimizers/FunctionCall/IsCallableOptimizer.php similarity index 88% rename from Library/Optimizers/FunctionCall/IsCallableOptimizer.php rename to src/Optimizers/FunctionCall/IsCallableOptimizer.php index b872479940..dfe5b7dcdd 100644 --- a/Library/Optimizers/FunctionCall/IsCallableOptimizer.php +++ b/src/Optimizers/FunctionCall/IsCallableOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -16,6 +18,8 @@ use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * IsCallableOptimizer. * @@ -36,12 +40,12 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('bool', 'zephir_is_callable('.$resolvedParams[0].')', $expression); + return new CompiledExpression('bool', 'zephir_is_callable(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/IsIntOptimizer.php b/src/Optimizers/FunctionCall/IsIntOptimizer.php similarity index 95% rename from Library/Optimizers/FunctionCall/IsIntOptimizer.php rename to src/Optimizers/FunctionCall/IsIntOptimizer.php index d73ca18549..f8a51646f2 100644 --- a/Library/Optimizers/FunctionCall/IsIntOptimizer.php +++ b/src/Optimizers/FunctionCall/IsIntOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\IsTypeOptimizerAbstract; diff --git a/Library/Optimizers/FunctionCall/IsNullOptimizer.php b/src/Optimizers/FunctionCall/IsNullOptimizer.php similarity index 95% rename from Library/Optimizers/FunctionCall/IsNullOptimizer.php rename to src/Optimizers/FunctionCall/IsNullOptimizer.php index 7df7542f47..771bf773a0 100644 --- a/Library/Optimizers/FunctionCall/IsNullOptimizer.php +++ b/src/Optimizers/FunctionCall/IsNullOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\IsTypeOptimizerAbstract; diff --git a/Library/Optimizers/FunctionCall/IsNumericOptimizer.php b/src/Optimizers/FunctionCall/IsNumericOptimizer.php similarity index 89% rename from Library/Optimizers/FunctionCall/IsNumericOptimizer.php rename to src/Optimizers/FunctionCall/IsNumericOptimizer.php index ccd11448fb..31911055c1 100644 --- a/Library/Optimizers/FunctionCall/IsNumericOptimizer.php +++ b/src/Optimizers/FunctionCall/IsNumericOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -16,6 +18,8 @@ use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * IsNumericOptimizer. * @@ -36,7 +40,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -44,6 +48,6 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('bool', 'zephir_is_numeric('.$resolvedParams[0].')', $expression); + return new CompiledExpression('bool', 'zephir_is_numeric(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/IsObjectOptimizer.php b/src/Optimizers/FunctionCall/IsObjectOptimizer.php similarity index 95% rename from Library/Optimizers/FunctionCall/IsObjectOptimizer.php rename to src/Optimizers/FunctionCall/IsObjectOptimizer.php index 29e6c5223c..4532e87929 100644 --- a/Library/Optimizers/FunctionCall/IsObjectOptimizer.php +++ b/src/Optimizers/FunctionCall/IsObjectOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\IsTypeOptimizerAbstract; diff --git a/Library/Optimizers/FunctionCall/IsPhpVersionOptimizer.php b/src/Optimizers/FunctionCall/IsPhpVersionOptimizer.php similarity index 68% rename from Library/Optimizers/FunctionCall/IsPhpVersionOptimizer.php rename to src/Optimizers/FunctionCall/IsPhpVersionOptimizer.php index 72ba194672..2418904aca 100644 --- a/Library/Optimizers/FunctionCall/IsPhpVersionOptimizer.php +++ b/src/Optimizers/FunctionCall/IsPhpVersionOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * IsPhpVersionOptimizer. * @@ -25,12 +29,12 @@ class IsPhpVersionOptimizer extends OptimizerAbstract { protected $allowedTypes = [ - 'string' => true, - 'int' => true, - 'long' => true, - 'double' => true, - 'uint' => true, - 'ulong' => true, + 'string' => true, + 'int' => true, + 'long' => true, + 'double' => true, + 'uint' => true, + 'ulong' => true, 'istring' => true, ]; @@ -47,22 +51,29 @@ public function optimize(array $expression, Call $call, CompilationContext $cont throw new CompilerException('This function requires parameters', $expression); } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { throw new CompilerException('This function only requires one parameter', $expression); } $variableType = $expression['parameters'][0]['parameter']['type']; if (!isset($this->allowedTypes[$variableType])) { - throw new CompilerException("This function requires a scalar types parameter, $variableType given", $expression); + throw new CompilerException( + "This function requires a scalar types parameter, $variableType given", + $expression + ); } - preg_match('/^(?\d+)(?:\.(?!?\d+))?(?:\.(?!?\d+))?(?:[^Ee0-9.]+.*)?$/', $expression['parameters'][0]['parameter']['value'], $matches); - if (!\count($matches)) { + preg_match( + '/^(?\d+)(?:\.(?!?\d+))?(?:\.(?!?\d+))?(?:[^Ee0-9.]+.*)?$/', + $expression['parameters'][0]['parameter']['value'], + $matches + ); + if (!count($matches)) { throw new CompilerException('Could not parse PHP version', $expression); } - $minorVersion = 0; + $minorVersion = 0; $releaseVersion = 0; $majorVersion = $matches['major'] * 10000; @@ -75,8 +86,8 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $releaseVersion = $matches['patch']; } - $versionId = (int) ($majorVersion + $minorVersion + $releaseVersion); + $versionId = (int)($majorVersion + $minorVersion + $releaseVersion); - return new CompiledExpression('bool', 'zephir_is_php_version('.$versionId.')', $expression); + return new CompiledExpression('bool', 'zephir_is_php_version(' . $versionId . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php b/src/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php similarity index 90% rename from Library/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php rename to src/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php index 61e3612774..97b5c5586a 100644 --- a/Library/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php +++ b/src/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -18,6 +20,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * Zephir\Optimizers\FunctionCall\IsPrivatePropertyOptimizer. * @@ -30,9 +34,9 @@ class IsPrivatePropertyOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -40,7 +44,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -49,7 +53,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont try { $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('bool', 'zephir_is_private_prop('.$resolvedParams[0].')', $expression); + return new CompiledExpression('bool', 'zephir_is_private_prop(' . $resolvedParams[0] . ')', $expression); } catch (Exception $e) { throw new CompilerException($e->getMessage(), $expression); } diff --git a/Library/Optimizers/FunctionCall/IsResourceOptimizer.php b/src/Optimizers/FunctionCall/IsResourceOptimizer.php similarity index 95% rename from Library/Optimizers/FunctionCall/IsResourceOptimizer.php rename to src/Optimizers/FunctionCall/IsResourceOptimizer.php index b43643ebd3..8b4968f06d 100644 --- a/Library/Optimizers/FunctionCall/IsResourceOptimizer.php +++ b/src/Optimizers/FunctionCall/IsResourceOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\IsTypeOptimizerAbstract; diff --git a/Library/Optimizers/FunctionCall/IsScalarOptimizer.php b/src/Optimizers/FunctionCall/IsScalarOptimizer.php similarity index 89% rename from Library/Optimizers/FunctionCall/IsScalarOptimizer.php rename to src/Optimizers/FunctionCall/IsScalarOptimizer.php index 3795da2ff9..d91eda7efd 100644 --- a/Library/Optimizers/FunctionCall/IsScalarOptimizer.php +++ b/src/Optimizers/FunctionCall/IsScalarOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -16,6 +18,8 @@ use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * IsScalarOptimizer. * @@ -38,12 +42,12 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('bool', 'zephir_is_scalar('.$resolvedParams[0].')', $expression); + return new CompiledExpression('bool', 'zephir_is_scalar(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/IsStringOptimizer.php b/src/Optimizers/FunctionCall/IsStringOptimizer.php similarity index 95% rename from Library/Optimizers/FunctionCall/IsStringOptimizer.php rename to src/Optimizers/FunctionCall/IsStringOptimizer.php index 1e6f718234..42bfd00834 100644 --- a/Library/Optimizers/FunctionCall/IsStringOptimizer.php +++ b/src/Optimizers/FunctionCall/IsStringOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\IsTypeOptimizerAbstract; diff --git a/Library/Optimizers/FunctionCall/JoinOptimizer.php b/src/Optimizers/FunctionCall/JoinOptimizer.php similarity index 94% rename from Library/Optimizers/FunctionCall/JoinOptimizer.php rename to src/Optimizers/FunctionCall/JoinOptimizer.php index 1d6354b0bd..30f33dee90 100644 --- a/Library/Optimizers/FunctionCall/JoinOptimizer.php +++ b/src/Optimizers/FunctionCall/JoinOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; /** diff --git a/Library/Optimizers/FunctionCall/JsonDecodeOptimizer.php b/src/Optimizers/FunctionCall/JsonDecodeOptimizer.php similarity index 72% rename from Library/Optimizers/FunctionCall/JsonDecodeOptimizer.php rename to src/Optimizers/FunctionCall/JsonDecodeOptimizer.php index 844d4fbf50..4cda227d2b 100644 --- a/Library/Optimizers/FunctionCall/JsonDecodeOptimizer.php +++ b/src/Optimizers/FunctionCall/JsonDecodeOptimizer.php @@ -9,14 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * JsonDecodeOptimizer. * @@ -43,14 +46,8 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(); - if ($symbolVariable) { - if (!$symbolVariable->isVariable()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } - } else { + $this->checkNotVariable($symbolVariable, $expression); + if (!$symbolVariable) { $symbolVariable = $context->symbolTable->addTemp('variable', $context); $symbolVariable->initVariant($context); } @@ -62,19 +59,20 @@ public function optimize(array $expression, Call $call, CompilationContext $cont /* * Process encode options */ - if (\count($resolvedParams) >= 2) { + if (count($resolvedParams) >= 2) { $context->headersManager->add('kernel/operators'); - $options = 'zephir_get_intval('.$resolvedParams[1].') '; + $options = 'zephir_get_intval(' . $resolvedParams[1] . ') '; } else { $options = '0 '; } - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_json_decode('.$symbol.', '.$resolvedParams[0].', '.$options.');'); + $context->codePrinter->output( + 'zephir_json_decode(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $options . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/JsonEncodeOptimizer.php b/src/Optimizers/FunctionCall/JsonEncodeOptimizer.php similarity index 72% rename from Library/Optimizers/FunctionCall/JsonEncodeOptimizer.php rename to src/Optimizers/FunctionCall/JsonEncodeOptimizer.php index 60d59b42bd..5dfb974a88 100644 --- a/Library/Optimizers/FunctionCall/JsonEncodeOptimizer.php +++ b/src/Optimizers/FunctionCall/JsonEncodeOptimizer.php @@ -9,14 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * JsonEncodeOptimizer. * @@ -43,12 +46,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if (!$symbolVariable->isVariable()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } + $this->checkNotVariable($symbolVariable, $expression); $context->headersManager->add('kernel/string'); @@ -57,19 +55,20 @@ public function optimize(array $expression, Call $call, CompilationContext $cont /* * Process encode options */ - if (\count($resolvedParams) >= 2) { + if (count($resolvedParams) >= 2) { $context->headersManager->add('kernel/operators'); - $options = 'zephir_get_intval('.$resolvedParams[1].') '; + $options = 'zephir_get_intval(' . $resolvedParams[1] . ') '; } else { $options = '0 '; } - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_json_encode('.$symbol.', '.$resolvedParams[0].', '.$options.');'); + $context->codePrinter->output( + 'zephir_json_encode(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $options . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/LdexpOptimizer.php b/src/Optimizers/FunctionCall/LdexpOptimizer.php similarity index 61% rename from Library/Optimizers/FunctionCall/LdexpOptimizer.php rename to src/Optimizers/FunctionCall/LdexpOptimizer.php index 847b919b20..1e542ffb66 100644 --- a/Library/Optimizers/FunctionCall/LdexpOptimizer.php +++ b/src/Optimizers/FunctionCall/LdexpOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\MathOptimizer; +use function count; + /** * LdexpOptimizer. * @@ -24,38 +28,40 @@ */ class LdexpOptimizer extends MathOptimizer { - /** - * {@inheritdoc} - * - * @return string - */ - public function getFunctionName() - { - return 'ldexp'; - } + protected string $zephirMethod = 'ldexp'; /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { - if (!isset($expression['parameters']) || 2 != \count($expression['parameters'])) { - throw new CompilerException(sprintf("'%s' requires two parameters", $this->getFunctionName()), $expression); + if (!isset($expression['parameters']) || 2 != count($expression['parameters'])) { + throw new CompilerException( + sprintf( + "'%s' requires two parameters", + $this->zephirMethod + ), + $expression + ); } - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); + $resolvedParams = $call->getReadOnlyResolvedParams( + $expression['parameters'], + $context, + $expression + ); $context->headersManager->add('kernel/math'); return new CompiledExpression( 'double', - 'zephir_'.$this->getFunctionName().'('.$resolvedParams[0].', '.$resolvedParams[1].')', + 'zephir_' . $this->zephirMethod . '(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ')', $expression ); } diff --git a/Library/Optimizers/FunctionCall/LtrimOptimizer.php b/src/Optimizers/FunctionCall/LtrimOptimizer.php similarity index 83% rename from Library/Optimizers/FunctionCall/LtrimOptimizer.php rename to src/Optimizers/FunctionCall/LtrimOptimizer.php index 75b413d23b..c1d89c0d80 100644 --- a/Library/Optimizers/FunctionCall/LtrimOptimizer.php +++ b/src/Optimizers/FunctionCall/LtrimOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; /** @@ -18,5 +20,5 @@ */ class LtrimOptimizer extends TrimOptimizer { - protected static $TRIM_WHERE = 'ZEPHIR_TRIM_LEFT'; + protected string $trimWhere = ', ZEPHIR_TRIM_LEFT'; } diff --git a/src/Optimizers/FunctionCall/Md5Optimizer.php b/src/Optimizers/FunctionCall/Md5Optimizer.php new file mode 100644 index 0000000000..66858ca2cf --- /dev/null +++ b/src/Optimizers/FunctionCall/Md5Optimizer.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +/** + * MD5Optimizer. + * + * Optimizes calls to 'md5' using internal function + */ +class Md5Optimizer extends UcfirstOptimizer +{ + protected string $zephirMethod = 'zephir_md5'; +} diff --git a/Library/Optimizers/FunctionCall/MemstrOptimizer.php b/src/Optimizers/FunctionCall/MemstrOptimizer.php similarity index 61% rename from Library/Optimizers/FunctionCall/MemstrOptimizer.php rename to src/Optimizers/FunctionCall/MemstrOptimizer.php index e15e454e52..c5fc3456ae 100644 --- a/Library/Optimizers/FunctionCall/MemstrOptimizer.php +++ b/src/Optimizers/FunctionCall/MemstrOptimizer.php @@ -9,15 +9,18 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Compiler; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; -use function Zephir\add_slashes; +use function count; /** * MemnstrOptimizer. @@ -39,12 +42,12 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { return false; } if ('string' == $expression['parameters'][1]['parameter']['type']) { - $str = add_slashes($expression['parameters'][1]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][1]['parameter']['value']); unset($expression['parameters'][1]); } @@ -53,9 +56,21 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $context->headersManager->add('kernel/string'); if (isset($str)) { - return new CompiledExpression('bool', 'zephir_memnstr_str('.$resolvedParams[0].', SL("'.$str.'"), "'.Compiler::getShortUserPath($expression['file']).'", '.$expression['line'].')', $expression); + return new CompiledExpression( + 'bool', + 'zephir_memnstr_str(' . $resolvedParams[0] . ', SL("' . $str . '"), "' . Compiler::getShortUserPath( + $expression['file'] + ) . '", ' . $expression['line'] . ')', + $expression + ); } - return new CompiledExpression('bool', 'zephir_memnstr('.$resolvedParams[0].', '.$resolvedParams[1].', "'.Compiler::getShortUserPath($expression['file']).'", '.$expression['line'].')', $expression); + return new CompiledExpression( + 'bool', + 'zephir_memnstr(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', "' . Compiler::getShortUserPath( + $expression['file'] + ) . '", ' . $expression['line'] . ')', + $expression + ); } } diff --git a/Library/Optimizers/FunctionCall/MergeAppendOptimizer.php b/src/Optimizers/FunctionCall/MergeAppendOptimizer.php similarity index 86% rename from Library/Optimizers/FunctionCall/MergeAppendOptimizer.php rename to src/Optimizers/FunctionCall/MergeAppendOptimizer.php index ab708d1b3e..ba782c0fca 100644 --- a/Library/Optimizers/FunctionCall/MergeAppendOptimizer.php +++ b/src/Optimizers/FunctionCall/MergeAppendOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * MergeAppendOptimizer. * @@ -29,9 +33,9 @@ class MergeAppendOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { return false; } @@ -51,7 +55,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $context->headersManager->add('kernel/array'); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - $context->codePrinter->output('zephir_merge_append('.$resolvedParams[0].', '.$resolvedParams[1].');'); + $context->codePrinter->output('zephir_merge_append(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');'); return new CompiledExpression('null', null, $expression); } diff --git a/Library/Optimizers/FunctionCall/MethodExistsOptimizer.php b/src/Optimizers/FunctionCall/MethodExistsOptimizer.php similarity index 75% rename from Library/Optimizers/FunctionCall/MethodExistsOptimizer.php rename to src/Optimizers/FunctionCall/MethodExistsOptimizer.php index 362a22596d..dcee158063 100644 --- a/Library/Optimizers/FunctionCall/MethodExistsOptimizer.php +++ b/src/Optimizers/FunctionCall/MethodExistsOptimizer.php @@ -9,18 +9,19 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; -use function Zephir\add_slashes; +use function count; /** - * MethodExistsOptimizer. - * * Optimizes calls to 'method_exists' using internal function */ class MethodExistsOptimizer extends OptimizerAbstract @@ -38,12 +39,12 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { return false; } if ('string' == $expression['parameters'][1]['parameter']['type']) { - $str = add_slashes($expression['parameters'][1]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][1]['parameter']['value']); unset($expression['parameters'][1]); } @@ -53,14 +54,16 @@ public function optimize(array $expression, Call $call, CompilationContext $cont if (isset($str)) { return new CompiledExpression( 'bool', - '(zephir_method_exists_ex('.$resolvedParams[0].', ZEND_STRL("'.strtolower($str).'")) == SUCCESS)', + '(zephir_method_exists_ex(' . $resolvedParams[0] . ', ZEND_STRL("' . strtolower( + $str + ) . '")) == SUCCESS)', $expression ); } return new CompiledExpression( 'bool', - '(zephir_method_exists('.$resolvedParams[0].', '.$resolvedParams[1].') == SUCCESS)', + '(zephir_method_exists(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ') == SUCCESS)', $expression ); } diff --git a/Library/Optimizers/FunctionCall/MicrotimeOptimizer.php b/src/Optimizers/FunctionCall/MicrotimeOptimizer.php similarity index 80% rename from Library/Optimizers/FunctionCall/MicrotimeOptimizer.php rename to src/Optimizers/FunctionCall/MicrotimeOptimizer.php index 18e97c0f61..5aa2bb8032 100644 --- a/Library/Optimizers/FunctionCall/MicrotimeOptimizer.php +++ b/src/Optimizers/FunctionCall/MicrotimeOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * MicrotimeOptimizer. * @@ -29,14 +33,14 @@ class MicrotimeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { /* microtime has one optional parameter (get_as_float) */ - if (isset($expression['parameters']) && \count($expression['parameters']) > 2) { + if (isset($expression['parameters']) && count($expression['parameters']) > 2) { return false; } @@ -46,9 +50,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/time'); @@ -58,14 +60,14 @@ public function optimize(array $expression, Call $call, CompilationContext $cont if ($call->mustInitSymbolVariable()) { $symbolVariable->initVariant($context); } - $context->codePrinter->output('zephir_microtime('.$symbol.', NULL);'); + $context->codePrinter->output('zephir_microtime(' . $symbol . ', NULL);'); } else { $symbolVariable->setDynamicTypes('double'); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); if ($call->mustInitSymbolVariable()) { $symbolVariable->initVariant($context); } - $context->codePrinter->output('zephir_microtime('.$symbol.', '.$resolvedParams[0].');'); + $context->codePrinter->output('zephir_microtime(' . $symbol . ', ' . $resolvedParams[0] . ');'); } return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); diff --git a/Library/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php b/src/Optimizers/FunctionCall/PowOptimizer.php similarity index 56% rename from Library/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php rename to src/Optimizers/FunctionCall/PowOptimizer.php index 940864f57f..09b652f959 100644 --- a/Library/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php +++ b/src/Optimizers/FunctionCall/PowOptimizer.php @@ -9,29 +9,35 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; -use Zephir\Optimizers\OptimizerAbstract; +use Zephir\Variable\Variable; + +use function count; /** - * ArrayKeysExistsOptimizer. + * PowOptimizer. * - * Optimizes calls to 'array_key_exists' using internal function + * Optimizes calls to 'pow' using internal function */ -class ArrayKeyExistsOptimizer extends OptimizerAbstract +class PowOptimizer extends UniqueKeyOptimizer { + protected string $zephirMethod = 'zephir_pow_function'; + /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,15 +45,20 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { return false; } + } - $context->headersManager->add('kernel/array'); - - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - //Note: the first parameter is key in php array_key_exists - return new CompiledExpression('bool', 'zephir_array_key_exists('.$resolvedParams[1].', '.$resolvedParams[0].')', $expression); + /** + * @param CompilationContext $context + * @param Variable|null $symbolVariable + * + * @return void + */ + protected function setHeaders(CompilationContext $context, ?Variable $symbolVariable): void + { + $context->headersManager->add('kernel/operators'); + $symbolVariable->setDynamicTypes('variable'); } } diff --git a/Library/Optimizers/FunctionCall/PregMatchAllOptimizer.php b/src/Optimizers/FunctionCall/PregMatchAllOptimizer.php similarity index 87% rename from Library/Optimizers/FunctionCall/PregMatchAllOptimizer.php rename to src/Optimizers/FunctionCall/PregMatchAllOptimizer.php index c3006186c0..ba9ab34a4d 100644 --- a/Library/Optimizers/FunctionCall/PregMatchAllOptimizer.php +++ b/src/Optimizers/FunctionCall/PregMatchAllOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; /** @@ -18,5 +20,5 @@ */ class PregMatchAllOptimizer extends PregMatchOptimizer { - const GLOBAL_MATCH = 1; + public const GLOBAL_MATCH = 1; } diff --git a/Library/Optimizers/FunctionCall/PregMatchOptimizer.php b/src/Optimizers/FunctionCall/PregMatchOptimizer.php similarity index 84% rename from Library/Optimizers/FunctionCall/PregMatchOptimizer.php rename to src/Optimizers/FunctionCall/PregMatchOptimizer.php index c5d96ae52d..9193e7ce59 100644 --- a/Library/Optimizers/FunctionCall/PregMatchOptimizer.php +++ b/src/Optimizers/FunctionCall/PregMatchOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,7 +19,10 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; -use Zephir\Variable; +use Zephir\Variable\Variable; + +use function count; +use function in_array; /** * Zephir\Optimizers\FunctionCall\PregMatchOptimizer. @@ -26,7 +31,7 @@ */ class PregMatchOptimizer extends OptimizerAbstract { - const GLOBAL_MATCH = 0; + public const GLOBAL_MATCH = 0; /** * {@inheritdoc} @@ -35,34 +40,34 @@ class PregMatchOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { - if (!isset($expression['parameters']) || \count($expression['parameters']) < 2) { + if (!isset($expression['parameters']) || count($expression['parameters']) < 2) { throw new CompilerException( sprintf( 'preg_match() expects at least 2 parameters, %d given', - isset($expression['parameters']) ? \count($expression['parameters']) : 0 + isset($expression['parameters']) ? count($expression['parameters']) : 0 ), $expression ); } - if (\count($expression['parameters']) > 5) { + if (count($expression['parameters']) > 5) { throw new CompilerException( sprintf( 'preg_match() expects at most 5 parameters, %d given', - \count($expression['parameters']) + count($expression['parameters']) ), $expression ); } $matches = $this->createMatches($expression, $context); - list($flags, $offset) = $this->processOptionals($expression, $call, $context); + [$flags, $offset] = $this->processOptionals($expression, $call, $context); /* * Process the expected symbol to be returned @@ -70,12 +75,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if (!$symbolVariable->isVariable()) { - throw new CompilerException( - 'Returned values by functions can only be assigned to variant variables', - $expression - ); - } + $this->checkNotVariable($symbolVariable, $expression); // zephir_preg_match $context->headersManager->add('kernel/string'); @@ -87,7 +87,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $symbolVariable->initVariant($context); } - $symbol = $context->backend->getVariableCode($symbolVariable); + $symbol = $context->backend->getVariableCode($symbolVariable); $matchesSymbol = $context->backend->getVariableCode($matches); $context->codePrinter->output( @@ -109,63 +109,6 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } } - /** - * Process optional parameters. - * - * preg_match(pattern, subject, matches, flags, offset) - * - * @param array $expression - * @param Call $call - * @param CompilationContext $context - * - * @throws CompilerException - * - * @return array - */ - private function processOptionals(array &$expression, Call $call, CompilationContext $context) - { - $flags = null; - $offset = null; - - $offsetParamOffset = 4; - if (isset($expression['parameters'][4]) && 'int' === $expression['parameters'][4]['parameter']['type']) { - $offset = $expression['parameters'][4]['parameter']['value'].' '; - unset($expression['parameters'][4]); - } - - if (isset($expression['parameters'][3]) && 'int' === $expression['parameters'][3]['parameter']['type']) { - $flags = $expression['parameters'][3]['parameter']['value'].' '; - $offsetParamOffset = 3; - unset($expression['parameters'][3]); - } - - try { - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - - if (null === $offset && isset($resolvedParams[$offsetParamOffset])) { - $context->headersManager->add('kernel/operators'); - $offset = 'zephir_get_intval('.$resolvedParams[$offsetParamOffset].') '; - } - - if (null === $flags && isset($resolvedParams[3])) { - $context->headersManager->add('kernel/operators'); - $flags = 'zephir_get_intval('.$resolvedParams[3].') '; - } - } catch (Exception $e) { - throw new CompilerException($e->getMessage(), $expression, $e->getCode(), $e); - } - - if (null === $flags) { - $flags = '0 '; - } - - if (null === $offset) { - $offset = '0 '; - } - - return [$flags, $offset]; - } - /** * Process the matches result. * @@ -194,7 +137,7 @@ private function createMatches(array $expression, CompilationContext $context) ); } - if (!\in_array($variable->getType(), ['variable', 'array'], true)) { + if (!in_array($variable->getType(), ['variable', 'array'], true)) { throw new CompilerException( sprintf( "The '%s' variable must be either a variable or an array, got %s", @@ -218,4 +161,61 @@ private function createMatches(array $expression, CompilationContext $context) return $variable; } + + /** + * Process optional parameters. + * + * preg_match(pattern, subject, matches, flags, offset) + * + * @param array $expression + * @param Call $call + * @param CompilationContext $context + * + * @return array + * + * @throws CompilerException + */ + private function processOptionals(array &$expression, Call $call, CompilationContext $context) + { + $flags = null; + $offset = null; + + $offsetParamOffset = 4; + if (isset($expression['parameters'][4]) && 'int' === $expression['parameters'][4]['parameter']['type']) { + $offset = $expression['parameters'][4]['parameter']['value'] . ' '; + unset($expression['parameters'][4]); + } + + if (isset($expression['parameters'][3]) && 'int' === $expression['parameters'][3]['parameter']['type']) { + $flags = $expression['parameters'][3]['parameter']['value'] . ' '; + $offsetParamOffset = 3; + unset($expression['parameters'][3]); + } + + try { + $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); + + if (null === $offset && isset($resolvedParams[$offsetParamOffset])) { + $context->headersManager->add('kernel/operators'); + $offset = 'zephir_get_intval(' . $resolvedParams[$offsetParamOffset] . ') '; + } + + if (null === $flags && isset($resolvedParams[3])) { + $context->headersManager->add('kernel/operators'); + $flags = 'zephir_get_intval(' . $resolvedParams[3] . ') '; + } + } catch (Exception $e) { + throw new CompilerException($e->getMessage(), $expression, $e->getCode(), $e); + } + + if (null === $flags) { + $flags = '0 '; + } + + if (null === $offset) { + $offset = '0 '; + } + + return [$flags, $offset]; + } } diff --git a/Library/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php b/src/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php similarity index 76% rename from Library/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php rename to src/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php index fa175f9464..a56b9a3475 100644 --- a/Library/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php +++ b/src/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * PrepareVirtualPathOptimizer. * @@ -29,9 +33,9 @@ class PrepareVirtualPathOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { return false; } @@ -51,19 +55,17 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_prepare_virtual_path('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].');'); + $context->codePrinter->output( + 'zephir_prepare_virtual_path(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/RoundOptimizer.php b/src/Optimizers/FunctionCall/RoundOptimizer.php similarity index 75% rename from Library/Optimizers/FunctionCall/RoundOptimizer.php rename to src/Optimizers/FunctionCall/RoundOptimizer.php index 7dcd0b0962..9b407d6ff2 100644 --- a/Library/Optimizers/FunctionCall/RoundOptimizer.php +++ b/src/Optimizers/FunctionCall/RoundOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * RoundOptimizer. * @@ -30,9 +34,9 @@ class RoundOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -40,7 +44,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (\count($expression['parameters']) > 4) { + if (count($expression['parameters']) > 4) { return false; } @@ -50,27 +54,24 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/math'); $symbolVariable->setDynamicTypes('double'); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + /* Todo: move var return type -> double as with round, floor */ $symbol = $context->backend->getVariableCode($symbolVariable); - switch (\count($expression['parameters'])) { + switch (count($expression['parameters'])) { /* * Only float $val */ case 1: $context->codePrinter->output( - 'zephir_round('.$symbol.', '.$resolvedParams[0].', NULL, NULL);' + 'zephir_round(' . $symbol . ', ' . $resolvedParams[0] . ', NULL, NULL);' ); break; @@ -79,13 +80,13 @@ public function optimize(array $expression, Call $call, CompilationContext $cont */ case 2: $context->codePrinter->output( - 'zephir_round('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].', NULL);' + 'zephir_round(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', NULL);' ); break; default: $context->codePrinter->output( - 'zephir_round('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].', '.$resolvedParams[2].');' + 'zephir_round(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', ' . $resolvedParams[2] . ');' ); break; } diff --git a/Library/Optimizers/FunctionCall/RtrimOptimizer.php b/src/Optimizers/FunctionCall/RtrimOptimizer.php similarity index 82% rename from Library/Optimizers/FunctionCall/RtrimOptimizer.php rename to src/Optimizers/FunctionCall/RtrimOptimizer.php index 83edf4360e..e562c37a91 100644 --- a/Library/Optimizers/FunctionCall/RtrimOptimizer.php +++ b/src/Optimizers/FunctionCall/RtrimOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; /** @@ -18,5 +20,5 @@ */ class RtrimOptimizer extends TrimOptimizer { - protected static $TRIM_WHERE = 'ZEPHIR_TRIM_RIGHT'; + protected string $trimWhere = ', ZEPHIR_TRIM_RIGHT'; } diff --git a/Library/Optimizers/FunctionCall/SinOptimizer.php b/src/Optimizers/FunctionCall/SinOptimizer.php similarity index 85% rename from Library/Optimizers/FunctionCall/SinOptimizer.php rename to src/Optimizers/FunctionCall/SinOptimizer.php index e4d4363c1c..2db9c3745e 100644 --- a/Library/Optimizers/FunctionCall/SinOptimizer.php +++ b/src/Optimizers/FunctionCall/SinOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\MathOptimizer; @@ -20,8 +22,5 @@ */ class SinOptimizer extends MathOptimizer { - public function getFunctionName() - { - return 'sin'; - } + protected string $zephirMethod = 'sin'; } diff --git a/Library/Optimizers/FunctionCall/SqrtOptimizer.php b/src/Optimizers/FunctionCall/SqrtOptimizer.php similarity index 85% rename from Library/Optimizers/FunctionCall/SqrtOptimizer.php rename to src/Optimizers/FunctionCall/SqrtOptimizer.php index c8a347831c..bfebca23cd 100644 --- a/Library/Optimizers/FunctionCall/SqrtOptimizer.php +++ b/src/Optimizers/FunctionCall/SqrtOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\MathOptimizer; @@ -20,8 +22,5 @@ */ class SqrtOptimizer extends MathOptimizer { - public function getFunctionName() - { - return 'sqrt'; - } + protected string $zephirMethod = 'sqrt'; } diff --git a/src/Optimizers/FunctionCall/StartsWithOptimizer.php b/src/Optimizers/FunctionCall/StartsWithOptimizer.php new file mode 100644 index 0000000000..5679aa663b --- /dev/null +++ b/src/Optimizers/FunctionCall/StartsWithOptimizer.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +/** + * StartsWithOptimizer. + * + * Checks if a string starts with another + */ +class StartsWithOptimizer extends EndsWithOptimizer +{ + protected string $zephirMethod = 'zephir_start_with'; + protected string $zephirMethodStr = 'zephir_start_with_str'; +} diff --git a/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php b/src/Optimizers/FunctionCall/StrReplaceOptimizer.php similarity index 78% rename from Library/Optimizers/FunctionCall/StrReplaceOptimizer.php rename to src/Optimizers/FunctionCall/StrReplaceOptimizer.php index 4b6e666a1f..c6e1538b00 100644 --- a/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php +++ b/src/Optimizers/FunctionCall/StrReplaceOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * StrReplaceOptimizer. * @@ -29,9 +33,9 @@ class StrReplaceOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,8 +43,8 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (3 != \count($expression['parameters'])) { - if (4 == \count($expression['parameters'])) { + if (3 != count($expression['parameters'])) { + if (4 == count($expression['parameters'])) { return false; } throw new CompilerException("'str_replace' only accepts three parameter", $expression); @@ -52,9 +56,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/string'); @@ -70,9 +72,11 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } } - $symbol = $context->backend->getVariableCodePointer($symbolVariable); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_fast_str_replace('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].', '.$resolvedParams[2].');'); + $context->codePrinter->output( + 'zephir_fast_str_replace(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', ' . $resolvedParams[2] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/src/Optimizers/FunctionCall/StripcslashesOptimizer.php b/src/Optimizers/FunctionCall/StripcslashesOptimizer.php new file mode 100644 index 0000000000..6669a3e9ef --- /dev/null +++ b/src/Optimizers/FunctionCall/StripcslashesOptimizer.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +/** + * StripcslashesOptimizer. + * + * Optimizes calls to 'stripcslashes' using internal function + */ +class StripcslashesOptimizer extends StripslashesOptimizer +{ + protected string $zephirMethod = 'zephir_stripcslashes'; +} diff --git a/Library/Optimizers/FunctionCall/StripslashesOptimizer.php b/src/Optimizers/FunctionCall/StripslashesOptimizer.php similarity index 66% rename from Library/Optimizers/FunctionCall/StripslashesOptimizer.php rename to src/Optimizers/FunctionCall/StripslashesOptimizer.php index 1095fe306b..b5a40e3582 100644 --- a/Library/Optimizers/FunctionCall/StripslashesOptimizer.php +++ b/src/Optimizers/FunctionCall/StripslashesOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * StripslashesOptimizer. * @@ -24,14 +28,16 @@ */ class StripslashesOptimizer extends OptimizerAbstract { + protected string $zephirMethod = 'zephir_stripslashes'; + /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +45,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (\count($expression['parameters']) > 1) { + if (count($expression['parameters']) > 1) { return false; } @@ -49,25 +55,24 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/string'); $symbolVariable->setDynamicTypes('string'); - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); + $resolvedParams = $call->getReadOnlyResolvedParams( + $expression['parameters'], + $context, + $expression + ); + + $this->checkInitSymbolVariable($call, $symbolVariable, $context); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } $symbol = $context->backend->getVariableCode($symbolVariable); - if ('ZendEngine2' == $context->backend->getName()) { - $context->codePrinter->output('zephir_stripslashes('.$symbol.', '.$resolvedParams[0].');'); - } else { - $context->codePrinter->output('zephir_stripslashes('.$symbol.', '.$resolvedParams[0].');'); - } + $context->codePrinter->output( + $this->zephirMethod . '(' . $symbol . ', ' . $resolvedParams[0] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/StrlenOptimizer.php b/src/Optimizers/FunctionCall/StrlenOptimizer.php similarity index 88% rename from Library/Optimizers/FunctionCall/StrlenOptimizer.php rename to src/Optimizers/FunctionCall/StrlenOptimizer.php index ec5f211dca..a27c098c2a 100644 --- a/Library/Optimizers/FunctionCall/StrlenOptimizer.php +++ b/src/Optimizers/FunctionCall/StrlenOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -16,6 +18,8 @@ use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * StrlenOptimizer. * @@ -36,7 +40,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -44,6 +48,6 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - return new CompiledExpression('int', 'zephir_fast_strlen_ev('.$resolvedParams[0].')', $expression); + return new CompiledExpression('int', 'zephir_fast_strlen_ev(' . $resolvedParams[0] . ')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/StrposOptimizer.php b/src/Optimizers/FunctionCall/StrposOptimizer.php similarity index 72% rename from Library/Optimizers/FunctionCall/StrposOptimizer.php rename to src/Optimizers/FunctionCall/StrposOptimizer.php index 6a68d4f294..1f06a95ac2 100644 --- a/Library/Optimizers/FunctionCall/StrposOptimizer.php +++ b/src/Optimizers/FunctionCall/StrposOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * StrposOptimizer. * @@ -29,9 +33,9 @@ class StrposOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (\count($expression['parameters']) < 2) { + if (count($expression['parameters']) < 2) { throw new CompilerException("'strpos' require two or three parameters"); } @@ -47,15 +51,15 @@ public function optimize(array $expression, Call $call, CompilationContext $cont * Process offset. */ $offset = '0 '; - if (\count($expression['parameters']) >= 3 && 'int' == $expression['parameters'][2]['parameter']['type']) { - $offset = $expression['parameters'][2]['parameter']['value'].' '; + if (count($expression['parameters']) >= 3 && 'int' == $expression['parameters'][2]['parameter']['type']) { + $offset = $expression['parameters'][2]['parameter']['value'] . ' '; unset($expression['parameters'][2]); } $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if (\count($resolvedParams) >= 3) { + if (count($resolvedParams) >= 3) { $context->headersManager->add('kernel/operators'); - $offset = 'zephir_get_intval('.$resolvedParams[2].') '; + $offset = 'zephir_get_intval(' . $resolvedParams[2] . ') '; } /* @@ -64,18 +68,17 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/string'); $symbolVariable->setDynamicTypes('int'); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_fast_strpos('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].', '.$offset.');'); + $context->codePrinter->output( + 'zephir_fast_strpos(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', ' . $offset . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/StrtokOptimizer.php b/src/Optimizers/FunctionCall/StrtokOptimizer.php similarity index 88% rename from Library/Optimizers/FunctionCall/StrtokOptimizer.php rename to src/Optimizers/FunctionCall/StrtokOptimizer.php index e3b5040570..de10a7bc9f 100644 --- a/Library/Optimizers/FunctionCall/StrtokOptimizer.php +++ b/src/Optimizers/FunctionCall/StrtokOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * Class StrtokOptimizer. * @@ -29,9 +33,9 @@ class StrtokOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,11 +43,11 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } - if (1 == \count($expression['parameters'])) { + if (1 == count($expression['parameters'])) { return new CompiledExpression('bool', 'false', $expression); } diff --git a/src/Optimizers/FunctionCall/StrtolowerOptimizer.php b/src/Optimizers/FunctionCall/StrtolowerOptimizer.php new file mode 100644 index 0000000000..8a1eaae824 --- /dev/null +++ b/src/Optimizers/FunctionCall/StrtolowerOptimizer.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +/** + * StrtolowerOptimizer. + * + * Optimizes calls to 'strtolower' using internal function + */ +class StrtolowerOptimizer extends StrtoupperOptimizer +{ + protected string $zephirMethod = 'zephir_fast_strtolower'; +} diff --git a/Library/Optimizers/FunctionCall/StrtoupperOptimizer.php b/src/Optimizers/FunctionCall/StrtoupperOptimizer.php similarity index 67% rename from Library/Optimizers/FunctionCall/StrtoupperOptimizer.php rename to src/Optimizers/FunctionCall/StrtoupperOptimizer.php index 8c95e9d45e..60e05930ed 100644 --- a/Library/Optimizers/FunctionCall/StrtoupperOptimizer.php +++ b/src/Optimizers/FunctionCall/StrtoupperOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * StrtoupperOptimizer. * @@ -24,14 +28,17 @@ */ class StrtoupperOptimizer extends OptimizerAbstract { + protected string $type = 'string'; + protected string $zephirMethod = 'zephir_fast_strtoupper'; + /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +46,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { return false; } @@ -49,20 +56,23 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/string'); - $symbolVariable->setDynamicTypes('string'); + $symbolVariable->setDynamicTypes($this->type); - $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); + $resolvedParams = $call->getReadOnlyResolvedParams( + $expression['parameters'], + $context, + $expression + ); + + $this->checkInitSymbolVariable($call, $symbolVariable, $context); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_fast_strtoupper('.$symbol.', '.$resolvedParams[0].');'); + $context->codePrinter->output( + $this->zephirMethod . '(' . $symbol . ', ' . $resolvedParams[0] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/SubstrOptimizer.php b/src/Optimizers/FunctionCall/SubstrOptimizer.php similarity index 76% rename from Library/Optimizers/FunctionCall/SubstrOptimizer.php rename to src/Optimizers/FunctionCall/SubstrOptimizer.php index 8dc69b8a5e..30e46f37a6 100644 --- a/Library/Optimizers/FunctionCall/SubstrOptimizer.php +++ b/src/Optimizers/FunctionCall/SubstrOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * SubstrOptimizer. * @@ -29,9 +33,9 @@ class SubstrOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (\count($expression['parameters']) < 2 || \count($expression['parameters']) > 3) { + if (count($expression['parameters']) < 2 || count($expression['parameters']) > 3) { throw new CompilerException("'substr' require two or three parameters"); } @@ -47,8 +51,8 @@ public function optimize(array $expression, Call $call, CompilationContext $cont * Process parameters. */ $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - $params = []; - $flags = '0'; + $params = []; + $flags = '0'; for ($param = 1; $param <= 2; ++$param) { if (!isset($expression['parameters'][$param])) { @@ -59,10 +63,10 @@ public function optimize(array $expression, Call $call, CompilationContext $cont continue; } if ('int' == $expression['parameters'][$param]['parameter']['type']) { - $params[] = $expression['parameters'][$param]['parameter']['value'].' '; + $params[] = $expression['parameters'][$param]['parameter']['value'] . ' '; } else { $context->headersManager->add('kernel/operators'); - $params[] = 'zephir_get_intval('.$resolvedParams[$param].')'; + $params[] = 'zephir_get_intval(' . $resolvedParams[$param] . ')'; } } @@ -72,19 +76,18 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/string'); $symbolVariable->setDynamicTypes('string'); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_substr('.$symbol.', '.$resolvedParams[0].', '.$params[0].', '.$params[1].', '.$flags.');'); + $context->codePrinter->output( + 'zephir_substr(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $params[0] . ', ' . $params[1] . ', ' . $flags . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/TanOptimizer.php b/src/Optimizers/FunctionCall/TanOptimizer.php similarity index 85% rename from Library/Optimizers/FunctionCall/TanOptimizer.php rename to src/Optimizers/FunctionCall/TanOptimizer.php index 0598352a6f..69cdf18060 100644 --- a/Library/Optimizers/FunctionCall/TanOptimizer.php +++ b/src/Optimizers/FunctionCall/TanOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Optimizers\MathOptimizer; @@ -20,8 +22,5 @@ */ class TanOptimizer extends MathOptimizer { - public function getFunctionName() - { - return 'tan'; - } + protected string $zephirMethod = 'tan'; } diff --git a/Library/Optimizers/FunctionCall/TimeOptimizer.php b/src/Optimizers/FunctionCall/TimeOptimizer.php similarity index 79% rename from Library/Optimizers/FunctionCall/TimeOptimizer.php rename to src/Optimizers/FunctionCall/TimeOptimizer.php index a96dfa2db5..a1e96921db 100644 --- a/Library/Optimizers/FunctionCall/TimeOptimizer.php +++ b/src/Optimizers/FunctionCall/TimeOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -29,9 +31,9 @@ class TimeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -45,18 +47,15 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/time'); $symbolVariable->setDynamicTypes('long'); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_time('.$symbol.');'); + $context->codePrinter->output('zephir_time(' . $symbol . ');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/src/Optimizers/FunctionCall/TrimOptimizer.php b/src/Optimizers/FunctionCall/TrimOptimizer.php new file mode 100644 index 0000000000..5083c5fe68 --- /dev/null +++ b/src/Optimizers/FunctionCall/TrimOptimizer.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +/** + * TrimOptimizer. + * + * Optimizes calls to 'trim' using internal function + */ +class TrimOptimizer extends UncamelizeOptimizer +{ + protected string $trimWhere = ', ZEPHIR_TRIM_BOTH'; + protected string $warningName = ''; + protected string $zephirMethod = 'zephir_fast_trim'; + + /** + * @param $parameters + * + * @return void + */ + protected function checkParameters($parameters): void + { + // empty + } +} diff --git a/src/Optimizers/FunctionCall/UcfirstOptimizer.php b/src/Optimizers/FunctionCall/UcfirstOptimizer.php new file mode 100644 index 0000000000..5d1817a80f --- /dev/null +++ b/src/Optimizers/FunctionCall/UcfirstOptimizer.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +use Zephir\Call; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Optimizers\OptimizerAbstract; + +use function count; + +/** + * UcfirstOptimizer. + * + * Optimizes calls to 'ucfirst' using internal function + */ +class UcfirstOptimizer extends OptimizerAbstract +{ + protected string $zephirMethod = 'zephir_ucfirst'; + + /** + * @param array $expression + * @param Call $call + * @param CompilationContext $context + * + * @return false|CompiledExpression + * @throws Exception + */ + public function optimize(array $expression, Call $call, CompilationContext $context) + { + if (!isset($expression['parameters'])) { + return false; + } + + if (1 != count($expression['parameters'])) { + return false; + } + + [$symbolVariable, $resolvedParams, $symbol] = $this->processStringOptimizer( + $call, + $context, + $expression + ); + + $context->codePrinter->output( + $this->zephirMethod + . '(' . $symbol . ', ' . $resolvedParams[0] . ');' + ); + + return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); + } +} diff --git a/src/Optimizers/FunctionCall/UncamelizeOptimizer.php b/src/Optimizers/FunctionCall/UncamelizeOptimizer.php new file mode 100644 index 0000000000..1696c66180 --- /dev/null +++ b/src/Optimizers/FunctionCall/UncamelizeOptimizer.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers\FunctionCall; + +use Zephir\Call; +use Zephir\CompilationContext; +use Zephir\Variable\Variable; + +/** + * UncamelizeOptimizer. + * + * Optimizes calls to 'uncamelize' using internal function + */ +class UncamelizeOptimizer extends CamelizeOptimizer +{ + protected string $warningName = 'uncamelize'; + protected string $zephirMethod = 'zephir_uncamelize'; + + /** + * @param Call $call + * @param Variable|null $symbolVariable + * @param CompilationContext $context + * + * @return void + */ + protected function symbolVariablePost( + Call $call, + ?Variable $symbolVariable, + CompilationContext $context + ): void { + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + } + + /** + * @param Call $call + * @param Variable|null $symbolVariable + * @param CompilationContext $context + * + * @return void + */ + protected function symbolVariablePre( + Call $call, + ?Variable $symbolVariable, + CompilationContext $context + ): void { + // empty + } +} diff --git a/Library/Optimizers/FunctionCall/UniqueKeyOptimizer.php b/src/Optimizers/FunctionCall/UniqueKeyOptimizer.php similarity index 57% rename from Library/Optimizers/FunctionCall/UniqueKeyOptimizer.php rename to src/Optimizers/FunctionCall/UniqueKeyOptimizer.php index 69e4e3852a..3f683cadb6 100644 --- a/Library/Optimizers/FunctionCall/UniqueKeyOptimizer.php +++ b/src/Optimizers/FunctionCall/UniqueKeyOptimizer.php @@ -9,13 +9,19 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use Zephir\Variable\Variable; + +use function count; /** * UniqueKeyOptimizer. @@ -24,14 +30,16 @@ */ class UniqueKeyOptimizer extends OptimizerAbstract { + protected string $zephirMethod = 'zephir_unique_key'; + /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,32 +47,53 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (2 != \count($expression['parameters'])) { + if (2 != count($expression['parameters'])) { throw new CompilerException("'unique_key' only accepts two parameter", $expression); } + return $this->processOptimizer($call, $context, $expression); + } - /* + /** + * @param Call $call + * @param CompilationContext $context + * @param array $expression + * + * @return CompiledExpression + * @throws Exception + */ + protected function processOptimizer(Call $call, CompilationContext $context, array $expression): CompiledExpression + { + /** * Process the expected symbol to be returned */ $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - - $context->headersManager->add('kernel/string'); + $this->checkNotVariableString($symbolVariable, $expression); - $symbolVariable->setDynamicTypes('string'); + $this->setHeaders($context, $symbolVariable); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_unique_key('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].');'); + $context->codePrinter->output( + $this->zephirMethod + . '(' . $symbol . ', ' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ');' + ); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } + + /** + * @param CompilationContext $context + * @param Variable|null $symbolVariable + * + * @return void + */ + protected function setHeaders(CompilationContext $context, ?Variable $symbolVariable): void + { + $context->headersManager->add('kernel/string'); + $symbolVariable->setDynamicTypes('string'); + } } diff --git a/Library/Optimizers/FunctionCall/UniquePathKeyOptimizer.php b/src/Optimizers/FunctionCall/UniquePathKeyOptimizer.php similarity index 78% rename from Library/Optimizers/FunctionCall/UniquePathKeyOptimizer.php rename to src/Optimizers/FunctionCall/UniquePathKeyOptimizer.php index b241f3528a..e8d3987537 100644 --- a/Library/Optimizers/FunctionCall/UniquePathKeyOptimizer.php +++ b/src/Optimizers/FunctionCall/UniquePathKeyOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * UniquePathKeyOptimizer. * @@ -29,9 +33,9 @@ class UniquePathKeyOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (1 != \count($expression['parameters'])) { + if (1 != count($expression['parameters'])) { throw new CompilerException("'unique_path_key' only accepts one parameter", $expression); } @@ -49,20 +53,17 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); + + $this->checkInitSymbolVariable($call, $symbolVariable, $context); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } $context->headersManager->add('kernel/file'); $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_unique_path_key('.$symbol.', '.$resolvedParams[0].');'); + $context->codePrinter->output('zephir_unique_path_key(' . $symbol . ', ' . $resolvedParams[0] . ');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/VarDumpOptimizer.php b/src/Optimizers/FunctionCall/VarDumpOptimizer.php similarity index 68% rename from Library/Optimizers/FunctionCall/VarDumpOptimizer.php rename to src/Optimizers/FunctionCall/VarDumpOptimizer.php index a628fedfee..d59fc4db4b 100644 --- a/Library/Optimizers/FunctionCall/VarDumpOptimizer.php +++ b/src/Optimizers/FunctionCall/VarDumpOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -16,6 +18,7 @@ use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; use Zephir\Statements\LetStatement; +use Zephir\Types\Types; /** * VarDumpOptimizer. @@ -46,35 +49,31 @@ public function optimize(array $expression, Call $call, CompilationContext $cont /* * Complex expressions require a temporary variable */ - switch ($resolvedParam->getType()) { - case 'array': - $type = 'array'; - break; - default: - $type = 'variable'; - break; - } + $type = match ($resolvedParam->getType()) { + Types::T_ARRAY => 'array', + default => 'variable', + }; $variable = $context->symbolTable->addTemp($type, $context); $variable->initVariant($context); $statement = new LetStatement([ - 'type' => 'let', + 'type' => 'let', 'assignments' => [ [ 'assign-type' => $type, - 'variable' => $variable->getName(), - 'operator' => 'assign', - 'expr' => [ - 'type' => $resolvedParam->getType(), + 'variable' => $variable->getName(), + 'operator' => 'assign', + 'expr' => [ + 'type' => $resolvedParam->getType(), 'value' => $resolvedParam->getCode(), - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], ], - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], ], ], ]); @@ -86,8 +85,8 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $variable = $context->symbolTable->getVariableForRead($resolvedParam->getCode(), $context, $expression); } - $symbol = $context->backend->getVariableCodePointer($variable); - $context->codePrinter->output('zephir_var_dump('.$symbol.');'); + $symbol = $context->backend->getVariableCode($variable); + $context->codePrinter->output('zephir_var_dump(' . $symbol . ');'); } return new CompiledExpression('null', 'null', $expression); diff --git a/Library/Optimizers/FunctionCall/VarExportOptimizer.php b/src/Optimizers/FunctionCall/VarExportOptimizer.php similarity index 68% rename from Library/Optimizers/FunctionCall/VarExportOptimizer.php rename to src/Optimizers/FunctionCall/VarExportOptimizer.php index bd92e6cab0..520e281862 100644 --- a/Library/Optimizers/FunctionCall/VarExportOptimizer.php +++ b/src/Optimizers/FunctionCall/VarExportOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,7 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; use Zephir\Statements\LetStatement; +use Zephir\Types\Types; /** * VarExportOptimizer. @@ -30,9 +33,9 @@ class VarExportOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -46,49 +49,41 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(); - if ($symbolVariable) { - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } - } + $this->checkNotVariable($symbolVariable, $expression); $context->headersManager->add('kernel/variables'); $resolvedParams = $call->getResolvedParamsAsExpr($expression['parameters'], $context, $expression); - $resolvedParam = $resolvedParams[0]; + $resolvedParam = $resolvedParams[0]; if (!$symbolVariable || !$symbolVariable->isVariable()) { /* * Complex expressions require a temporary variable */ - switch ($resolvedParam->getType()) { - case 'array': - $type = 'array'; - break; - default: - $type = 'variable'; - break; - } + $type = match ($resolvedParam->getType()) { + Types::T_ARRAY => 'array', + default => 'variable', + }; $variable = $context->symbolTable->addTemp($type, $context); $variable->initVariant($context); $statement = new LetStatement([ - 'type' => 'let', + 'type' => 'let', 'assignments' => [ [ 'assign-type' => $type, - 'variable' => $variable->getName(), - 'operator' => 'assign', - 'expr' => [ - 'type' => $resolvedParam->getType(), + 'variable' => $variable->getName(), + 'operator' => 'assign', + 'expr' => [ + 'type' => $resolvedParam->getType(), 'value' => $resolvedParam->getCode(), - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], ], - 'file' => $expression['file'], - 'line' => $expression['line'], - 'char' => $expression['char'], + 'file' => $expression['file'], + 'line' => $expression['line'], + 'char' => $expression['char'], ], ], ]); @@ -99,7 +94,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont */ $variable = $context->symbolTable->getVariableForRead($resolvedParam->getCode(), $context, $expression); } - $variableSymbol = $context->backend->getVariableCodePointer($variable); + $variableSymbol = $context->backend->getVariableCode($variable); /* * let a = var_export(val); @@ -111,12 +106,12 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $symbolVariable->initVariant($context); } $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_var_export_ex('.$symbol.', '.$variableSymbol.');'); + $context->codePrinter->output('zephir_var_export_ex(' . $symbol . ', ' . $variableSymbol . ');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } - $context->codePrinter->output('zephir_var_export('.$variableSymbol.');'); + $context->codePrinter->output('zephir_var_export(' . $variableSymbol . ');'); return new CompiledExpression('null', 'null', $expression); } diff --git a/Library/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php b/src/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php similarity index 78% rename from Library/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php rename to src/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php index 8b19da0264..4389904656 100644 --- a/Library/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php +++ b/src/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; @@ -17,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; +use function count; + /** * ZephirStringToHexOptimizer. * @@ -29,9 +33,9 @@ class ZephirStringToHexOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -39,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (\count($expression['parameters']) > 1) { + if (count($expression['parameters']) > 1) { return false; } @@ -49,10 +53,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $call->processExpectedReturn($context); $symbolVariable = $call->getSymbolVariable(true, $context); - - if ($symbolVariable->isNotVariableAndString()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariableString($symbolVariable, $expression); $context->headersManager->add('kernel/string'); @@ -60,12 +61,11 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - if ($call->mustInitSymbolVariable()) { - $symbolVariable->initVariant($context); - } + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + $symbol = $context->backend->getVariableCode($symbolVariable); - $context->codePrinter->output('zephir_string_to_hex('.$symbol.', '.$resolvedParams[0].');'); + $context->codePrinter->output('zephir_string_to_hex(' . $symbol . ', ' . $resolvedParams[0] . ');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/IsTypeOptimizerAbstract.php b/src/Optimizers/IsTypeOptimizerAbstract.php similarity index 93% rename from Library/Optimizers/IsTypeOptimizerAbstract.php rename to src/Optimizers/IsTypeOptimizerAbstract.php index 9b1e0b92b1..0777736506 100644 --- a/Library/Optimizers/IsTypeOptimizerAbstract.php +++ b/src/Optimizers/IsTypeOptimizerAbstract.php @@ -19,6 +19,7 @@ use Zephir\Exception; use function count; +use function sprintf; abstract class IsTypeOptimizerAbstract extends OptimizerAbstract { @@ -46,7 +47,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParam, ); } else { - $condition = 'Z_TYPE_P('.$resolvedParam.') == '.$this->getType(); + $condition = 'Z_TYPE_P(' . $resolvedParam . ') == ' . $this->getType(); } return new CompiledExpression('bool', $condition, $expression); diff --git a/Library/Optimizers/MathOptimizer.php b/src/Optimizers/MathOptimizer.php similarity index 83% rename from Library/Optimizers/MathOptimizer.php rename to src/Optimizers/MathOptimizer.php index 36e7ba3da8..af64138a34 100644 --- a/Library/Optimizers/MathOptimizer.php +++ b/src/Optimizers/MathOptimizer.php @@ -18,23 +18,20 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; +use function count; + abstract class MathOptimizer extends OptimizerAbstract { - /** - * Gets function name. - * - * @return string - */ - abstract public function getFunctionName(); + protected string $zephirMethod = ''; /** * @param array $expression * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -42,7 +39,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return false; } - if (\count($expression['parameters']) > 1) { + if (count($expression['parameters']) > 1) { return false; } @@ -53,7 +50,11 @@ public function optimize(array $expression, Call $call, CompilationContext $cont /** * Get CompiledExpression(s) for resolved var(s). */ - $resolvedParams = $call->getResolvedParamsAsExpr($expression['parameters'], $context, $expression); + $resolvedParams = $call->getResolvedParamsAsExpr( + $expression['parameters'], + $context, + $expression + ); $compiledExpression = $resolvedParams[0]; switch ($compiledExpression->getType()) { @@ -83,12 +84,11 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return new CompiledExpression( 'double', - 'zephir_'.$this->getFunctionName().'('.$context->backend->getVariableCode($variable).')', + 'zephir_' . $this->zephirMethod + . '(' . $context->backend->getVariableCode($variable) . ')', $expression ); - break; } - break; } return false; @@ -104,7 +104,7 @@ protected function passNativeFCall($compiledExpression, $expression) { return new CompiledExpression( 'double', - $this->getFunctionName().'('.$compiledExpression->getCode().')', + $this->zephirMethod . '(' . $compiledExpression->getCode() . ')', $expression ); } diff --git a/src/Optimizers/OptimizerAbstract.php b/src/Optimizers/OptimizerAbstract.php new file mode 100644 index 0000000000..414fbc4cf7 --- /dev/null +++ b/src/Optimizers/OptimizerAbstract.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Optimizers; + +use Zephir\Call; +use Zephir\CompilationContext; +use Zephir\Exception; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable; + +abstract class OptimizerAbstract +{ + use VariablesTrait; + + /** + * @param array $expression + * @param Call $call + * @param CompilationContext $context + * + * @return mixed + */ + abstract public function optimize(array $expression, Call $call, CompilationContext $context); + + /** + * @param Call $call + * @param Variable|null $symbolVariable + * @param CompilationContext $context + * + * @return void + */ + protected function checkInitSymbolVariable( + Call $call, + ?Variable $symbolVariable, + CompilationContext $context + ): void { + if ($call->mustInitSymbolVariable()) { + $symbolVariable->initVariant($context); + } + } + + /** + * @param Call $call + * @param CompilationContext $context + * @param array $expression + * + * @return array + * @throws Exception + */ + protected function processStringOptimizer(Call $call, CompilationContext $context, array $expression): array + { + /** + * Process the expected symbol to be returned + */ + $call->processExpectedReturn($context); + + $symbolVariable = $call->getSymbolVariable(true, $context); + $this->checkNotVariableString($symbolVariable, $expression); + + $context->headersManager->add('kernel/string'); + $symbolVariable->setDynamicTypes('string'); + + $resolvedParams = $call->getReadOnlyResolvedParams( + $expression['parameters'], + $context, + $expression + ); + + $this->checkInitSymbolVariable($call, $symbolVariable, $context); + + $symbol = $context->backend->getVariableCode($symbolVariable); + + return [$symbolVariable, $resolvedParams, $symbol]; + } +} diff --git a/src/Os.php b/src/Os.php new file mode 100644 index 0000000000..28412c5acb --- /dev/null +++ b/src/Os.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir; + +use function stripos; + +use const PHP_OS; + +class Os +{ + /** + * Checks if currently running under MS Windows. + */ + public static function isWindows(): bool + { + return 0 === stripos(PHP_OS, 'WIN'); + } +} diff --git a/Library/Parser/Manager.php b/src/Parser/Manager.php similarity index 62% rename from Library/Parser/Manager.php rename to src/Parser/Manager.php index 8d746db18a..5956de1a42 100644 --- a/Library/Parser/Manager.php +++ b/src/Parser/Manager.php @@ -9,36 +9,23 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Parser; +use function sprintf; +use function version_compare; + class Manager { - const MINIMUM_PARSER_VERSION = '1.5.0'; - const PARSER_HOME_PAGE = 'https://github.com/zephir-lang/php-zephir-parser'; + public const MINIMUM_PARSER_VERSION = '1.5.0'; + public const PARSER_HOME_PAGE = 'https://github.com/zephir-lang/php-zephir-parser'; - /** - * Zephir Parser. - * - * @var Parser - */ - protected $parser; - - /** - * Manager constructor. - * - * @param Parser $parser The Zephir Parser - */ - public function __construct(Parser $parser) + public function __construct(protected Parser $parser) { - $this->parser = $parser; } - /** - * Get Zephir Parser. - * - * @return Parser - */ - public function getParser() + public function getParser(): Parser { return $this->parser; } @@ -48,21 +35,13 @@ public function getParser() * * @return bool */ - public function isAvailable() - { - return $this->parser->isAvailable() && - version_compare(self::MINIMUM_PARSER_VERSION, $this->parser->getVersion(), '<='); - } - - /** - * @return string|null - */ - public function getParserVersion() + public function isAvailable(): bool { - return $this->parser->getVersion(); + return $this->parser->isAvailable() + && version_compare(self::MINIMUM_PARSER_VERSION, $this->parser->getVersion(), '<='); } - public function requirements() + public function requirements(): string { $template = <<compilationContext = $compilationContext; } /** @@ -60,11 +56,7 @@ public function getCompilationContext(): CompilationContext */ public function getNumberOfFunctionCalls(string $funcName): int { - if (isset($this->functionCalls[$funcName])) { - return $this->functionCalls[$funcName]; - } - - return 0; + return $this->functionCalls[$funcName] ?? 0; } /** @@ -77,21 +69,7 @@ public function getNumberOfFunctionCalls(string $funcName): int */ public function getNumberOfMethodCalls(string $className, string $methodName): int { - if (isset($this->methodCalls[$className][$methodName])) { - return $this->methodCalls[$className][$methodName]; - } - - return 0; - } - - /** - * Returns all the method calls. - * - * @return array - */ - public function getAllMethodCalls(): array - { - return $this->methodCalls; + return $this->methodCalls[$className][$methodName] ?? 0; } /** @@ -99,55 +77,19 @@ public function getAllMethodCalls(): array * * @param StatementsBlock $block */ - public function pass(StatementsBlock $block) + public function pass(StatementsBlock $block): void { $this->passStatementBlock($block->getStatements()); } - public function passLetStatement(array $statement) - { - foreach ($statement['assignments'] as $assignment) { - if (isset($assignment['expr'])) { - $this->passExpression($assignment['expr']); - } - } - } - - public function passCall(array $expression) - { - if (isset($expression['parameters'])) { - foreach ($expression['parameters'] as $parameter) { - $this->passExpression($parameter['parameter']); - } - } - } - - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { $this->passExpression($item['value']); } } - public function passNew(array $expression) - { - if (!$expression['dynamic']) { - $className = $this->compilationContext->getFullName($expression['class']); - if (!isset($this->methodCalls[$className]['__construct'])) { - $this->methodCalls[$className]['__construct'] = 1; - } else { - ++$this->methodCalls[$className]['__construct']; - } - } - - if (isset($expression['parameters'])) { - foreach ($expression['parameters'] as $parameter) { - $this->passExpression($parameter['parameter']); - } - } - } - - public function passNewType(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -156,7 +98,7 @@ public function passNewType(array $expression) } } - public function passExpression(array $expression) + public function passExpression(array $expression): void { switch ($expression['type']) { case 'bool': @@ -165,34 +107,29 @@ public function passExpression(array $expression) case 'uint': case 'long': case 'ulong': + case 'string': + case 'istring': case 'null': case 'char': case 'uchar': - case 'string': - case 'istring': - case 'static-constant-access': + case 'empty-array': case 'variable': case 'constant': - case 'empty-array': + case 'static-constant-access': case 'closure': case 'closure-arrow': case 'reference': case 'short-ternary': break; - case 'div': - case 'mod': case 'sub': case 'add': + case 'div': case 'mul': - case 'bitwise_and': - case 'bitwise_or': - case 'bitwise_xor': - case 'bitwise_shiftleft': - case 'bitwise_shiftright': - case 'concat': + case 'mod': case 'and': case 'or': + case 'concat': case 'equals': case 'identical': case 'not-identical': @@ -201,6 +138,11 @@ public function passExpression(array $expression) case 'greater': case 'greater-equal': case 'less-equal': + case 'bitwise_and': + case 'bitwise_or': + case 'bitwise_xor': + case 'bitwise_shiftleft': + case 'bitwise_shiftright': case 'irange': case 'erange': $this->passExpression($expression['left']); @@ -232,7 +174,7 @@ public function passExpression(array $expression) if (isset($expression['variable']['value'])) { if ('this' == $expression['variable']['value']) { $methodName = $expression['name']; - $className = $this->compilationContext->classDefinition->getCompleteName(); + $className = $this->compilationContext->classDefinition->getCompleteName(); if (!isset($this->methodCalls[$className][$methodName])) { $this->methodCalls[$className][$methodName] = 1; } else { @@ -285,7 +227,53 @@ public function passExpression(array $expression) } } - public function passStatementBlock(array $statements) + /** + * Pass let statements. + * + * @param array $statement + */ + public function passLetStatement(array $statement): void + { + foreach ($statement['assignments'] as $assignment) { + if (isset($assignment['expr'])) { + $this->passExpression($assignment['expr']); + } + } + } + + /** + * Pass "new" expressions. + * + * @param array $expression + */ + public function passNew(array $expression): void + { + if (!$expression['dynamic']) { + $className = $this->compilationContext->getFullName($expression['class']); + if (!isset($this->methodCalls[$className]['__construct'])) { + $this->methodCalls[$className]['__construct'] = 1; + } else { + ++$this->methodCalls[$className]['__construct']; + } + } + + if (isset($expression['parameters'])) { + foreach ($expression['parameters'] as $parameter) { + $this->passExpression($parameter['parameter']); + } + } + } + + public function passNewType(array $expression): void + { + if (isset($expression['parameters'])) { + foreach ($expression['parameters'] as $parameter) { + $this->passExpression($parameter['parameter']); + } + } + } + + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { diff --git a/Library/Passes/LocalContextPass.php b/src/Passes/LocalContextPass.php similarity index 85% rename from Library/Passes/LocalContextPass.php rename to src/Passes/LocalContextPass.php index 206c4e3d18..b72008ae5f 100644 --- a/Library/Passes/LocalContextPass.php +++ b/src/Passes/LocalContextPass.php @@ -9,59 +9,55 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Passes; use Zephir\StatementsBlock; +use function constant; +use function defined; +use function gettype; + +use const PHP_EOL; + /** - * LocalContextPass. - * * This pass tries to check whether variables only do exist in the local context of the method block - * or if they're used externally which will unallow variables to be placed in the stack + * or if they're used externally which will un allow variables to be placed in the stack * * This pass also tracks the number of initializations a variable may have, this allows * to mark variables as read-only after their last initialization. The number of - * mutations is relative, since assignments inside cycles/loops may perform a n-number of + * mutations is relative, since assignments inside cycles/loops may perform an n-number of * mutations * * @see https://en.wikipedia.org/wiki/Escape_analysis */ class LocalContextPass { - protected $variables = []; - - protected $mutations = []; - - protected $uses = []; - - protected $lastCallLine = false; - - protected $lastUnsetLine = false; - - /** - * Do the compilation pass. - * - * @param StatementsBlock $block - */ - public function pass(StatementsBlock $block) - { - $this->passStatementBlock($block->getStatements()); - } + protected int $lastCallLine = 0; + protected int $lastUnsetLine = 0; + protected array $mutations = []; + protected array $uses = []; + protected array $variables = []; - public function declareVariables(array $statement) + public function declareVariables(array $statement): void { - if (isset($statement['data-type'])) { - if ('variable' != $statement['data-type']) { - return; - } + if (isset($statement['data-type']) && 'variable' !== $statement['data-type']) { + return; } + foreach ($statement['variables'] as $variable) { if (isset($variable['expr'])) { - if ('string' == $variable['expr']['type'] || 'empty-array' == $variable['expr']['type'] || 'array' == $variable['expr']['type']) { + if ( + 'string' === $variable['expr']['type'] || + 'empty-array' === $variable['expr']['type'] || + 'array' === $variable['expr']['type'] + ) { $this->variables[$variable['variable']] = false; continue; } } + if (!isset($this->variables[$variable['variable']])) { $this->variables[$variable['variable']] = true; } @@ -69,46 +65,35 @@ public function declareVariables(array $statement) } /** - * Marks a variable to mandatory be stored in the heap. + * Returns the line where the latest call in the method was made. * - * @param string $variable + * @return int */ - public function markVariableNoLocal($variable) + public function getLastCallLine(): int { - if (isset($this->variables[$variable])) { - $this->variables[$variable] = false; - } + return $this->lastCallLine; } /** - * Marks the latest use/read of a variable. + * Returns the line where the latest unset operation was made. * - * @param string $variable - * @param array $node + * @return int */ - public function markLastUse($variable, $node) + public function getLastUnsetLine(): int { - if (isset($node['line'])) { - $this->uses[$variable] = $node['line']; - } + return $this->lastUnsetLine; } /** - * Asks the local context information whether a variable can be stored in the stack instead of the heap. + * Returns the number of assignment instructions that mutated a variable. * * @param string $variable * - * @return bool + * @return int */ - public function shouldBeLocal($variable) + public function getNumberOfMutations(string $variable): int { - if (isset($this->variables[$variable])) { - if ($this->variables[$variable]) { - return true; - } - } - - return false; + return $this->mutations[$variable] ?? 0; } /** @@ -116,7 +101,7 @@ public function shouldBeLocal($variable) * * @param string $variable */ - public function increaseMutations($variable) + public function increaseMutations(string $variable): void { if (isset($this->mutations[$variable])) { ++$this->mutations[$variable]; @@ -126,174 +111,41 @@ public function increaseMutations($variable) } /** - * Returns the number of assignment instructions that mutated a variable. + * Marks the latest use/read of a variable. * * @param string $variable - * - * @return int + * @param array $node */ - public function getNumberOfMutations($variable) + public function markLastUse(string $variable, array $node): void { - if (isset($this->mutations[$variable])) { - return $this->mutations[$variable]; + if (isset($node['line'])) { + $this->uses[$variable] = $node['line']; } - - return 0; } /** - * Returns the latest line where a variable was read. + * Marks a variable to mandatory be stored in the heap. * * @param string $variable - * - * @return int */ - public function getLastVariableUseLine($variable) + public function markVariableNoLocal(string $variable): void { - if (isset($this->uses[$variable])) { - return $this->uses[$variable]; + if (isset($this->variables[$variable])) { + $this->variables[$variable] = false; } - - return 0; - } - - /** - * Returns the line where the latest call in the method was made. - * - * @return int - */ - public function getLastCallLine() - { - return $this->lastCallLine; } /** - * Returns the line where the latest unset operation was made. + * Do the compilation pass. * - * @return int + * @param StatementsBlock $block */ - public function getLastUnsetLine() - { - return $this->lastUnsetLine; - } - - public function passLetStatement(array $statement) - { - foreach ($statement['assignments'] as $assignment) { - if (isset($assignment['expr'])) { - $this->passExpression($assignment['expr']); - } - $this->increaseMutations($assignment['variable']); - - switch ($assignment['assign-type']) { - case 'variable': - switch ($assignment['operator']) { - case 'mul-assign': - case 'sub-assign': - case 'add-assign': - $this->markVariableNoLocal($assignment['variable']); - break; - } - - switch ($assignment['expr']['type']) { - case 'property-access': - case 'property-dynamic-access': - case 'property-string-access': - case 'array-access': - case 'static-property-access': - case 'static-constant-access': - case 'string': - case 'array': - case 'empty-array': - case 'fcall': - case 'mcall': - case 'scall': - case 'concat': - case 'clone': - case 'require': - case 'require_once': - case 'type-hint': - case 'minus': - case 'new': - case 'new-type': - case 'closure': - case 'closure-arrow': - case 'reference': - case 'irange': - case 'erange': - $this->markVariableNoLocal($assignment['variable']); - break; - - case 'constant': - if (\defined($assignment['expr']['value'])) { - if ('string' == \gettype(\constant($assignment['expr']['value']))) { - $this->markVariableNoLocal($assignment['variable']); - } - } - break; - - case 'variable': - $this->markVariableNoLocal($assignment['expr']['value']); - $this->markVariableNoLocal($assignment['variable']); - break; - - case 'cast': - switch ($assignment['expr']['left']) { - case 'array': - case 'string': - $this->markVariableNoLocal($assignment['variable']); - break; - } - break; - - default: - //echo '[', $assignment['expr']['type'], ']', PHP_EOL; - } - break; - - case 'object-property': - case 'array-index': - case 'object-property-array-index': - case 'object-property-append': - switch ($assignment['expr']['type']) { - case 'variable': - $this->markVariableNoLocal($assignment['expr']['value']); - break; - } - $this->markVariableNoLocal($assignment['variable']); - break; - - case 'variable-append': - $this->markVariableNoLocal($assignment['variable']); - switch ($assignment['expr']['type']) { - case 'variable': - $this->markVariableNoLocal($assignment['expr']['value']); - break; - default: - //echo '[', $assignment['assign-type'], ']'; - } - break; - - default: - //echo $assignment['assign-type']; - } - } - } - - public function passCall(array $expression) + public function pass(StatementsBlock $block): void { - if (isset($expression['parameters'])) { - foreach ($expression['parameters'] as $parameter) { - if ('variable' == $parameter['parameter']['type']) { - $this->markVariableNoLocal($parameter['parameter']['value']); - } else { - $this->passExpression($parameter['parameter']); - } - } - } + $this->passStatementBlock($block->getStatements()); } - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { if ('variable' == $item['value']['type']) { @@ -304,7 +156,7 @@ public function passArray(array $expression) } } - public function passNew(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -317,7 +169,7 @@ public function passNew(array $expression) } } - public function passExpression(array $expression) + public function passExpression(array $expression): void { switch ($expression['type']) { case 'bool': @@ -377,6 +229,23 @@ public function passExpression(array $expression) case 'typeof': case 'bitwise_not': + case 'array-access': + case 'static-property-access': + case 'property-string-access': + case 'short-ternary': + case 'property-dynamic-access': + case 'property-access': + case 'ternary': + case 'unlikely': + case 'likely': + case 'clone': + case 'require_once': + case 'list': + case 'minus': + case 'require': + case 'instanceof': + case 'empty': + case 'isset': case 'not': $this->passExpression($expression['left']); break; @@ -404,42 +273,12 @@ public function passExpression(array $expression) $this->passNew($expression); break; - case 'property-access': - case 'property-dynamic-access': - case 'property-string-access': - case 'static-property-access': - case 'array-access': - $this->passExpression($expression['left']); - break; - - case 'isset': - case 'empty': - case 'instanceof': - case 'require': - case 'require_once': - case 'clone': - case 'likely': - case 'unlikely': - /* do special pass later */ - case 'ternary': - case 'short-ternary': - $this->passExpression($expression['left']); - break; - case 'fetch': $this->increaseMutations($expression['left']['value']); $this->markVariableNoLocal($expression['left']['value']); $this->passExpression($expression['right']); break; - case 'minus': - $this->passExpression($expression['left']); - break; - - case 'list': - $this->passExpression($expression['left']); - break; - case 'cast': case 'type-hint': $this->passExpression($expression['right']); @@ -451,7 +290,113 @@ public function passExpression(array $expression) } } - public function passStatementBlock(array $statements) + public function passLetStatement(array $statement): void + { + foreach ($statement['assignments'] as $assignment) { + if (isset($assignment['expr'])) { + $this->passExpression($assignment['expr']); + } + $this->increaseMutations($assignment['variable']); + + switch ($assignment['assign-type']) { + case 'variable': + switch ($assignment['operator']) { + case 'mul-assign': + case 'sub-assign': + case 'add-assign': + $this->markVariableNoLocal($assignment['variable']); + break; + } + + switch ($assignment['expr']['type']) { + case 'property-access': + case 'property-dynamic-access': + case 'property-string-access': + case 'array-access': + case 'static-property-access': + case 'static-constant-access': + case 'string': + case 'array': + case 'empty-array': + case 'fcall': + case 'mcall': + case 'scall': + case 'concat': + case 'clone': + case 'require': + case 'require_once': + case 'type-hint': + case 'minus': + case 'new': + case 'new-type': + case 'closure': + case 'closure-arrow': + case 'reference': + case 'irange': + case 'erange': + $this->markVariableNoLocal($assignment['variable']); + break; + + case 'constant': + if (defined($assignment['expr']['value'])) { + if ('string' === gettype(constant($assignment['expr']['value']))) { + $this->markVariableNoLocal($assignment['variable']); + } + } + break; + + case 'variable': + $this->markVariableNoLocal($assignment['expr']['value']); + $this->markVariableNoLocal($assignment['variable']); + break; + + case 'cast': + switch ($assignment['expr']['left']) { + case 'array': + case 'string': + $this->markVariableNoLocal($assignment['variable']); + break; + } + break; + } + break; + + case 'object-property': + case 'array-index': + case 'object-property-array-index': + case 'object-property-append': + if ($assignment['expr']['type'] == 'variable') { + $this->markVariableNoLocal($assignment['expr']['value']); + } + $this->markVariableNoLocal($assignment['variable']); + break; + + case 'variable-append': + $this->markVariableNoLocal($assignment['variable']); + switch ($assignment['expr']['type']) { + case 'variable': + $this->markVariableNoLocal($assignment['expr']['value']); + break; + } + break; + } + } + } + + public function passNew(array $expression): void + { + if (isset($expression['parameters'])) { + foreach ($expression['parameters'] as $parameter) { + if ('variable' == $parameter['parameter']['type']) { + $this->markVariableNoLocal($parameter['parameter']['value']); + } else { + $this->passExpression($parameter['parameter']); + } + } + } + } + + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { @@ -615,4 +560,16 @@ public function passStatementBlock(array $statements) } } } + + /** + * Asks the local context information whether a variable can be stored in the stack instead of the heap. + * + * @param string $variable + * + * @return bool + */ + public function shouldBeLocal(string $variable): bool + { + return !empty($this->variables[$variable]); + } } diff --git a/Library/Passes/LoopBreakPass.php b/src/Passes/LoopBreakPass.php similarity index 85% rename from Library/Passes/LoopBreakPass.php rename to src/Passes/LoopBreakPass.php index 99528b4b74..f41e9ebaca 100644 --- a/Library/Passes/LoopBreakPass.php +++ b/src/Passes/LoopBreakPass.php @@ -9,31 +9,36 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Passes; use Zephir\StatementsBlock; /** - * LoopBreakPass. - * * This pass checks if the statement block related to a 'loop' loop has at least a 'break' * statement disallowing full infinite loops */ class LoopBreakPass { - protected $hasBreak = false; + protected bool $hasBreak = false; + + public function hasBreak(): bool + { + return $this->hasBreak; + } /** * Do the compilation pass. * * @param StatementsBlock $block */ - public function pass(StatementsBlock $block) + public function pass(StatementsBlock $block): void { $this->passStatementBlock($block->getStatements()); } - public function passStatementBlock(array $statements) + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { @@ -54,9 +59,4 @@ public function passStatementBlock(array $statements) } } } - - public function hasBreak() - { - return $this->hasBreak; - } } diff --git a/Library/Passes/MutateGathererPass.php b/src/Passes/MutateGathererPass.php similarity index 91% rename from Library/Passes/MutateGathererPass.php rename to src/Passes/MutateGathererPass.php index e7cdc4a212..b15eccfc75 100644 --- a/Library/Passes/MutateGathererPass.php +++ b/src/Passes/MutateGathererPass.php @@ -9,33 +9,24 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Passes; use Zephir\StatementsBlock; +use const PHP_EOL; + /** - * MutateGathererPass. - * * Counts variables mutated inside a specific statement block * Non-mutated variables can be promoted to use an inline cache */ class MutateGathererPass { - protected $variables = []; - - protected $mutations = []; - - /** - * Do the compilation pass. - * - * @param StatementsBlock $block - */ - public function pass(StatementsBlock $block) - { - $this->passStatementBlock($block->getStatements()); - } + protected array $mutations = []; + protected array $variables = []; - public function declareVariables(array $statement) + public function declareVariables(array $statement): void { foreach ($statement['variables'] as $variable) { if (!isset($this->variables[$variable['variable']])) { @@ -45,70 +36,43 @@ public function declareVariables(array $statement) } /** - * Increase the number of mutations a variable has inside a statement block. + * Returns the number of assignment instructions that mutated a variable. * * @param string $variable * - * @return MutateGathererPass + * @return int */ - public function increaseMutations($variable) + public function getNumberOfMutations(string $variable): int { - if (isset($this->mutations[$variable])) { - ++$this->mutations[$variable]; - } else { - $this->mutations[$variable] = 1; - } - - return $this; + return $this->mutations[$variable] ?? 0; } /** - * Returns the number of assignment instructions that mutated a variable. + * Increase the number of mutations a variable has inside a statement block. * * @param string $variable * - * @return int + * @return MutateGathererPass */ - public function getNumberOfMutations($variable) + public function increaseMutations(string $variable): static { if (isset($this->mutations[$variable])) { - return $this->mutations[$variable]; + ++$this->mutations[$variable]; + } else { + $this->mutations[$variable] = 1; } - return 0; - } - - /** - * Pass let statements. - * - * @param array $statement - */ - public function passLetStatement(array $statement) - { - foreach ($statement['assignments'] as $assignment) { - if (isset($assignment['expr'])) { - $this->passExpression($assignment['expr']); - } - $this->increaseMutations($assignment['variable']); - } + return $this; } /** - * Pass call expressions. + * Do the compilation pass. * - * @param array $expression + * @param StatementsBlock $block */ - public function passCall(array $expression) + public function pass(StatementsBlock $block): void { - if (isset($expression['parameters'])) { - foreach ($expression['parameters'] as $parameter) { - if ('variable' == $parameter['parameter']['type']) { - $this->increaseMutations($parameter['parameter']['value']); - } else { - $this->passExpression($parameter['parameter']); - } - } - } + $this->passStatementBlock($block->getStatements()); } /** @@ -116,7 +80,7 @@ public function passCall(array $expression) * * @param array $expression */ - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { if ('variable' != $item['value']['type']) { @@ -126,15 +90,17 @@ public function passArray(array $expression) } /** - * Pass "new" expressions. + * Pass call expressions. * * @param array $expression */ - public function passNew(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { - if ('variable' != $parameter['parameter']['type']) { + if ('variable' == $parameter['parameter']['type']) { + $this->increaseMutations($parameter['parameter']['value']); + } else { $this->passExpression($parameter['parameter']); } } @@ -146,7 +112,7 @@ public function passNew(array $expression) * * @param array $expression */ - public function passExpression(array $expression) + public function passExpression(array $expression): void { switch ($expression['type']) { case 'bool': @@ -196,8 +162,15 @@ public function passExpression(array $expression) $this->passExpression($expression['right']); break; - case 'typeof': + case 'minus': case 'not': + case 'static-property-access': + case 'array-access': + case 'property-string-access': + case 'property-dynamic-access': + case 'property-access': + case 'list': + case 'typeof': $this->passExpression($expression['left']); break; @@ -215,14 +188,6 @@ public function passExpression(array $expression) $this->passNew($expression); break; - case 'property-access': - case 'property-dynamic-access': - case 'property-string-access': - case 'static-property-access': - case 'array-access': - $this->passExpression($expression['left']); - break; - case 'isset': case 'empty': case 'instanceof': @@ -241,14 +206,6 @@ public function passExpression(array $expression) $this->passExpression($expression['right']); break; - case 'minus': - $this->passExpression($expression['left']); - break; - - case 'list': - $this->passExpression($expression['left']); - break; - case 'cast': case 'type-hint': $this->passExpression($expression['right']); @@ -260,12 +217,43 @@ public function passExpression(array $expression) } } + /** + * Pass let statements. + * + * @param array $statement + */ + public function passLetStatement(array $statement): void + { + foreach ($statement['assignments'] as $assignment) { + if (isset($assignment['expr'])) { + $this->passExpression($assignment['expr']); + } + $this->increaseMutations($assignment['variable']); + } + } + + /** + * Pass "new" expressions. + * + * @param array $expression + */ + public function passNew(array $expression): void + { + if (isset($expression['parameters'])) { + foreach ($expression['parameters'] as $parameter) { + if ('variable' != $parameter['parameter']['type']) { + $this->passExpression($parameter['parameter']); + } + } + } + } + /** * Pass statement block. * * @param array $statements */ - public function passStatementBlock(array $statements) + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { @@ -341,6 +329,7 @@ public function passStatementBlock(array $statements) } break; + case 'throw': case 'return': if (isset($statement['expr'])) { $this->passExpression($statement['expr']); @@ -369,12 +358,6 @@ public function passStatementBlock(array $statements) } break; - case 'throw': - if (isset($statement['expr'])) { - $this->passExpression($statement['expr']); - } - break; - case 'fetch': $this->passExpression($statement['expr']); break; diff --git a/Library/Passes/SkipVariantInit.php b/src/Passes/SkipVariantInit.php similarity index 50% rename from Library/Passes/SkipVariantInit.php rename to src/Passes/SkipVariantInit.php index e6ad7beb83..3fba77353a 100644 --- a/Library/Passes/SkipVariantInit.php +++ b/src/Passes/SkipVariantInit.php @@ -9,31 +9,57 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Passes; use Zephir\StatementsBlock; +use function count; +use function in_array; + /** - * SkipVariantInit. - * * In 'if'/'else' statements sometimes dynamical variables are initialized in every branch * Same case in 'switch' statements */ class SkipVariantInit { - protected $branches = []; + protected array $branches = []; - protected $variablesToSkip = []; + protected array $variablesToSkip = []; - protected $ignoredVariables; + /** + * Returns a list of variables that are initialized in every analyzed branch. + */ + public function getVariables(): array + { + $variableStats = []; + + foreach ($this->variablesToSkip as $variables) { + foreach ($variables as $variable => $one) { + if (!isset($variableStats[$variable])) { + $variableStats[$variable] = 1; + } else { + ++$variableStats[$variable]; + } + } + } + + $variables = []; + $numberBranches = count($this->branches); + foreach ($variableStats as $variable => $number) { + if ($number == $numberBranches) { + $variables[] = $variable; + } + } + + return $variables; + } /** * Do the compilation pass. - * - * @param int $branchNumber - * @param StatementsBlock $block */ - public function pass($branchNumber, StatementsBlock $block) + public function pass(int $branchNumber, StatementsBlock $block): void { $this->passStatementBlock($branchNumber, $block->getStatements()); $this->branches[$branchNumber] = 0; @@ -41,83 +67,46 @@ public function pass($branchNumber, StatementsBlock $block) /** * Check assignment types for possible skip. - * - * @param int $branchNumber - * @param array $statement */ - public function passLetStatement($branchNumber, $statement) + public function passLetStatement(int $branchNumber, array $statement): void { + $skipTypes = [ + 'variable', + 'array-access', + 'property-access', + 'static-property-access', + 'fcall', + 'mcall', + 'scall', + ]; + foreach ($statement['assignments'] as $assignment) { - if ('variable' == $assignment['assign-type']) { - if ('assign' == $assignment['operator']) { - switch ($assignment['expr']['type']) { - case 'variable': - case 'array-access': - case 'property-access': - case 'static-property-access': - case 'fcall': - case 'mcall': - case 'scall': - break; - default: - $this->variablesToSkip[$branchNumber][$assignment['variable']] = 1; - break; - } - } + if ($assignment['assign-type'] !== 'variable' || $assignment['operator'] !== 'assign') { + continue; } - } - } - public function passStatementBlock($branchNumber, array $statements) - { - foreach ($statements as $statement) { - if (!isset($statement['type'])) { + if (in_array($assignment['expr']['type'], $skipTypes, true)) { continue; } - switch ($statement['type']) { - case 'let': - $this->passLetStatement($branchNumber, $statement); - break; - } + $this->variablesToSkip[$branchNumber][$assignment['variable']] = 1; } } - /** - * Returns a list of variables that are initialized in every analyzed branch. - * - * @return array - */ - public function getVariables() + public function passStatementBlock($branchNumber, array $statements): void { - $variableStats = []; - - foreach ($this->variablesToSkip as $branchNumber => $variables) { - foreach ($variables as $variable => $one) { - if (!isset($variableStats[$variable])) { - $variableStats[$variable] = 1; - } else { - ++$variableStats[$variable]; - } + foreach ($statements as $statement) { + if (!isset($statement['type'])) { + continue; } - } - $variables = []; - $numberBranches = \count($this->branches); - foreach ($variableStats as $variable => $number) { - if ($number == $numberBranches) { - $variables[] = $variable; + if ($statement['type'] === 'let') { + $this->passLetStatement($branchNumber, $statement); } } - - return $variables; } - /** - * @param int $branchNumber - * @param array $variablesToSkip - */ - public function setVariablesToSkip($branchNumber, $variablesToSkip) + public function setVariablesToSkip(int $branchNumber, array $variablesToSkip): void { $this->variablesToSkip[$branchNumber] = $variablesToSkip; } diff --git a/Library/Passes/StaticTypeInference.php b/src/Passes/StaticTypeInference.php similarity index 92% rename from Library/Passes/StaticTypeInference.php rename to src/Passes/StaticTypeInference.php index 0b58a7ba90..e2285ece39 100644 --- a/Library/Passes/StaticTypeInference.php +++ b/src/Passes/StaticTypeInference.php @@ -9,31 +9,26 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Passes; use Zephir\StatementsBlock; +use function is_string; + +use const PHP_EOL; + /** * This pass try to infer typing on dynamic variables so the compiler * can replace them by low level types automatically */ class StaticTypeInference { + protected array $infered = []; protected array $variables = []; - protected array $infered = []; - - /** - * Do the compilation pass. - * - * @param StatementsBlock $block - */ - public function pass(StatementsBlock $block) - { - $this->passStatementBlock($block->getStatements()); - } - - public function declareVariables(array $statement) + public function declareVariables(array $statement): void { foreach ($statement['variables'] as $variable) { if (!isset($this->variables[$variable['variable']])) { @@ -49,15 +44,23 @@ public function declareVariables(array $statement) } /** - * Marks a variable to mandatory be stored in the heap if a type has not been defined for it. + * Asks the local context information whether a variable can be stored in the stack instead of the heap. * * @param string $variable - * @param string $type + * + * @return bool */ - public function markVariableIfUnknown($variable, $type) + public function getInferedType($variable) { - $this->variables[$variable] = $type; - $this->infered[$variable] = $type; + if (isset($this->variables[$variable])) { + $type = $this->variables[$variable]; + if ('variable' != $type && 'undefined' != $type && 'string' != $type && 'istring' != $type && 'array' != $type && 'null' != $type && 'numeric' != $type) { + // echo $variable, ' ', $type, PHP_EOL; + return $type; + } + } + + return false; } /** @@ -66,7 +69,7 @@ public function markVariableIfUnknown($variable, $type) * @param string $variable * @param string $type */ - public function markVariable($variable, $type) + public function markVariable($variable, $type): void { if (isset($this->variables[$variable])) { $currentType = $this->variables[$variable]; @@ -167,91 +170,35 @@ public function markVariable($variable, $type) } /** - * Process the found infered types and schedule a new pass. + * Marks a variable to mandatory be stored in the heap if a type has not been defined for it. * - * @return bool + * @param string $variable + * @param string $type */ - public function reduce() + public function markVariableIfUnknown($variable, $type): void { - $pass = false; - foreach ($this->variables as $variable => $type) { - if ('variable' == $type || 'string' == $type || 'istring' == $type || 'array' == $type || 'null' == $type || 'numeric' == $type) { - unset($this->variables[$variable]); - } else { - $pass = true; - $this->infered[$variable] = $type; - } - } - - return $pass; + $this->variables[$variable] = $type; + $this->infered[$variable] = $type; } /** - * Asks the local context information whether a variable can be stored in the stack instead of the heap. - * - * @param string $variable + * Do the compilation pass. * - * @return bool + * @param StatementsBlock $block */ - public function getInferedType($variable) + public function pass(StatementsBlock $block): void { - if (isset($this->variables[$variable])) { - $type = $this->variables[$variable]; - if ('variable' != $type && 'undefined' != $type && 'string' != $type && 'istring' != $type && 'array' != $type && 'null' != $type && 'numeric' != $type) { - //echo $variable, ' ', $type, PHP_EOL; - return $type; - } - } - - return false; - } - - public function passLetStatement(array $statement) - { - foreach ($statement['assignments'] as $assignment) { - switch ($assignment['assign-type']) { - case 'variable': - $type = $this->passExpression($assignment['expr']); - if (\is_string($type)) { - $this->markVariable($assignment['variable'], $type); - } - break; - - case 'object-property': - case 'array-index': - case 'object-property-array-index': - case 'object-property-append': - case 'static-property-access': - $this->markVariable($assignment['variable'], 'variable'); - break; - - case 'variable-append': - $this->markVariable($assignment['variable'], 'variable'); - break; - - default: - // echo $assignment['assign-type']; - } - } - } - - public function passCall(array $expression) - { - if (isset($expression['parameters'])) { - foreach ($expression['parameters'] as $parameter) { - $this->passExpression($parameter['parameter']); - } - } + $this->passStatementBlock($block->getStatements()); } - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { $this->passExpression($item['value']); } } - public function passNew(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -279,6 +226,12 @@ public function passExpression(array $expression) case 'closure': case 'closure-arrow': case 'static-constant-access': + case 'irange': + case 'erange': + case 'empty-array': + case 'clone': + case 'require': + case 'require_once': return 'variable'; case 'reference': @@ -299,7 +252,7 @@ public function passExpression(array $expression) case 'bitwise_xor': case 'bitwise_shiftleft': case 'bitwise_shiftright': - $left = $this->passExpression($expression['left']); + $left = $this->passExpression($expression['left']); $right = $this->passExpression($expression['right']); if ('int' == $left && 'int' == $right) { return 'int'; @@ -338,7 +291,7 @@ public function passExpression(array $expression) return 'numeric'; case 'mod': - $left = $this->passExpression($expression['left']); + $left = $this->passExpression($expression['left']); $right = $this->passExpression($expression['right']); if ('long' == $left && 'long' == $right) { return 'long'; @@ -349,13 +302,12 @@ public function passExpression(array $expression) return 'int'; - case 'and': - case 'or': - return 'bool'; case 'concat': return 'string'; + case 'and': + case 'or': case 'equals': case 'identical': case 'not-identical': @@ -366,10 +318,6 @@ public function passExpression(array $expression) case 'less-equal': return 'bool'; - case 'irange': - case 'erange': - return 'variable'; - case 'typeof': $this->passExpression($expression['left']); @@ -382,6 +330,11 @@ public function passExpression(array $expression) case 'not': case 'bitwise_not': + case 'isset': + case 'empty': + case 'instanceof': + case 'likely': + case 'unlikely': $this->passExpression($expression['left']); return 'bool'; @@ -398,9 +351,6 @@ public function passExpression(array $expression) return 'variable'; - case 'empty-array': - return 'variable'; - case 'new': case 'new-type': $this->passNew($expression); @@ -422,15 +372,6 @@ public function passExpression(array $expression) return 'bool'; - case 'isset': - case 'empty': - case 'instanceof': - case 'likely': - case 'unlikely': - $this->passExpression($expression['left']); - - return 'bool'; - case 'list': return $this->passExpression($expression['left']); @@ -450,15 +391,10 @@ public function passExpression(array $expression) case 'constant': return null; - case 'clone': - case 'require': - case 'require_once': - return 'variable'; - case 'ternary': case 'short-ternary': - //$right = $this->passExpression($expression['right']); - //$extra = $this->passExpression($expression['extra']); + // $right = $this->passExpression($expression['right']); + // $extra = $this->passExpression($expression['extra']); /*if ($right == $extra) { if ($right != 'string' && $right != 'array') { return $right; @@ -472,7 +408,42 @@ public function passExpression(array $expression) } } - public function passStatementBlock(array $statements) + public function passLetStatement(array $statement): void + { + foreach ($statement['assignments'] as $assignment) { + switch ($assignment['assign-type']) { + case 'variable': + $type = $this->passExpression($assignment['expr']); + if (is_string($type)) { + $this->markVariable($assignment['variable'], $type); + } + break; + + case 'object-property': + case 'array-index': + case 'object-property-array-index': + case 'object-property-append': + case 'static-property-access': + case 'variable-append': + $this->markVariable($assignment['variable'], 'variable'); + break; + + default: + // echo $assignment['assign-type']; + } + } + } + + public function passNew(array $expression): void + { + if (isset($expression['parameters'])) { + foreach ($expression['parameters'] as $parameter) { + $this->passExpression($parameter['parameter']); + } + } + } + + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { @@ -576,7 +547,7 @@ public function passStatementBlock(array $statements) case 'unset': case 'cblock': case 'comment': - // empty statement != empty operator + // empty statement != empty operator case 'empty': break; @@ -585,4 +556,24 @@ public function passStatementBlock(array $statements) } } } + + /** + * Process the found infered types and schedule a new pass. + * + * @return bool + */ + public function reduce(): bool + { + $pass = false; + foreach ($this->variables as $variable => $type) { + if ('variable' == $type || 'string' == $type || 'istring' == $type || 'array' == $type || 'null' == $type || 'numeric' == $type) { + unset($this->variables[$variable]); + } else { + $pass = true; + $this->infered[$variable] = $type; + } + } + + return $pass; + } } diff --git a/Library/Statements/BreakStatement.php b/src/Statements/BreakStatement.php similarity index 94% rename from Library/Statements/BreakStatement.php rename to src/Statements/BreakStatement.php index 5876df9cc0..3f6ea3d9ff 100644 --- a/Library/Statements/BreakStatement.php +++ b/src/Statements/BreakStatement.php @@ -9,16 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; use Zephir\CompilationContext; use Zephir\Exception\CompilerException; -/** - * BreakStatement. - * - * Break statement - */ class BreakStatement extends StatementAbstract { /** @@ -26,7 +23,7 @@ class BreakStatement extends StatementAbstract * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { if ($compilationContext->insideCycle || $compilationContext->insideSwitch) { $compilationContext->codePrinter->output('break;'); diff --git a/Library/Statements/ContinueStatement.php b/src/Statements/ContinueStatement.php similarity index 93% rename from Library/Statements/ContinueStatement.php rename to src/Statements/ContinueStatement.php index dcccf2d09b..deb8ed1612 100644 --- a/Library/Statements/ContinueStatement.php +++ b/src/Statements/ContinueStatement.php @@ -9,16 +9,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; use Zephir\CompilationContext; use Zephir\Exception\CompilerException; -/** - * ContinueStatement. - * - * Continue statement - */ class ContinueStatement extends StatementAbstract { /** @@ -26,7 +23,7 @@ class ContinueStatement extends StatementAbstract * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { if ($compilationContext->insideCycle) { $compilationContext->codePrinter->output('continue;'); diff --git a/Library/Statements/DeclareStatement.php b/src/Statements/DeclareStatement.php similarity index 72% rename from Library/Statements/DeclareStatement.php rename to src/Statements/DeclareStatement.php index 6095d2ca86..b0ec7bb6cb 100644 --- a/Library/Statements/DeclareStatement.php +++ b/src/Statements/DeclareStatement.php @@ -9,15 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; use Zephir\CompilationContext; use Zephir\Exception\CompilerException; use Zephir\Expression\Builder\BuilderFactory; +use function is_string; + /** - * DeclareStatement. - * * This creates variables in the current symbol table */ class DeclareStatement extends StatementAbstract @@ -27,7 +29,7 @@ class DeclareStatement extends StatementAbstract * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $statement = $this->statement; @@ -36,23 +38,23 @@ public function compile(CompilationContext $compilationContext) } $typeInference = $compilationContext->typeInference; - $symbolTable = $compilationContext->symbolTable; + $symbolTable = $compilationContext->symbolTable; foreach ($statement['variables'] as $variable) { $varName = $variable['variable']; if ($symbolTable->hasVariableInBranch($varName, $compilationContext->branchManager->getCurrentBranch())) { - throw new CompilerException("Variable '".$varName."' is already defined", $variable); + throw new CompilerException("Variable '" . $varName . "' is already defined", $variable); } $currentType = $statement['data-type']; - /* + /** * Replace original data type by the pre-processed infered type */ if ($typeInference) { - if ('variable' == $currentType) { + if ('variable' === $currentType) { $type = $typeInference->getInferedType($varName); - if (\is_string($type)) { + if (is_string($type)) { $currentType = $type; } } @@ -74,27 +76,24 @@ public function compile(CompilationContext $compilationContext) * Variables are added to the symbol table. */ $symbolVariable = $symbolTable->addVariable($currentType, $varName, $compilationContext); - $varName = $symbolVariable->getName(); + $varName = $symbolVariable->getName(); - /* + /** * Set the node where the variable is declared */ $symbolVariable->setOriginal($variable); - $symbolVariable->setIsInitialized(true, $compilationContext); - //$symbolVariable->increaseMutates(); - if ('variable' == $currentType) { + if ('variable' === $currentType) { $symbolVariable->setMustInitNull(true); $symbolVariable->setLocalOnly(false); } - //$symbolVariable->increaseVariantIfNull(); if (isset($variable['expr'])) { - $builder = BuilderFactory::getInstance(); + $builder = BuilderFactory::getInstance(); $letBuilder = $builder->statements()->let([ $builder->operators() - ->assignVariable($varName, $builder->raw($variable['expr'])), + ->assignVariable($varName, $builder->raw($variable['expr'])), ]); $letStatement = new LetStatement($letBuilder->build()); @@ -104,18 +103,4 @@ public function compile(CompilationContext $compilationContext) } } } - - /** - * throw exception for invalid default type. - * - * @param $defaultType - * @param $dateType - * @param $variable - * - * @throws CompilerException - */ - public static function invalidDefaultTypeException($defaultType, $dateType, $variable) - { - throw new CompilerException('Invalid default type: '.$defaultType.' for data type: '.$dateType, $variable); - } } diff --git a/Library/Statements/DoWhileStatement.php b/src/Statements/DoWhileStatement.php similarity index 77% rename from Library/Statements/DoWhileStatement.php rename to src/Statements/DoWhileStatement.php index 1654a64be1..5f3838084e 100644 --- a/Library/Statements/DoWhileStatement.php +++ b/src/Statements/DoWhileStatement.php @@ -9,35 +9,40 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; +use ReflectionException; use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Optimizers\EvalExpression; use Zephir\StatementsBlock; /** - * DoWhileStatement. - * * DoWhile statement, the same as in PHP/C */ class DoWhileStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext + * + * @throws ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { - $exprRaw = $this->statement['expr']; + $exprRaw = $this->statement['expr']; $codePrinter = $compilationContext->codePrinter; $codePrinter->output('do {'); - /* + /** * Variables are initialized in a different way inside cycle */ ++$compilationContext->insideCycle; - /* + /** * Compile statements in the 'while' block */ if (isset($this->statement['statements'])) { @@ -46,18 +51,17 @@ public function compile(CompilationContext $compilationContext) } $compilationContext->codePrinter->increaseLevel(); - $expr = new EvalExpression(); - $condition = $expr->optimize($exprRaw, $compilationContext); + $condition = (new EvalExpression())->optimize($exprRaw, $compilationContext); $compilationContext->codePrinter->decreaseLevel(); - /* + /** * Restore the cycle counter */ --$compilationContext->insideCycle; - /* + /** * Compound conditions can be evaluated in a single line of the C-code */ - $codePrinter->output('} while ('.$condition.');'); + $codePrinter->output('} while (' . $condition . ');'); } } diff --git a/Library/Statements/EchoStatement.php b/src/Statements/EchoStatement.php similarity index 67% rename from Library/Statements/EchoStatement.php rename to src/Statements/EchoStatement.php index 216efe6032..df203af1e4 100644 --- a/Library/Statements/EchoStatement.php +++ b/src/Statements/EchoStatement.php @@ -9,17 +9,18 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; +use ReflectionException; use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; - -use function Zephir\add_slashes; +use Zephir\Name; /** - * EchoStatement. - * * Produce output according to the type */ class EchoStatement extends StatementAbstract @@ -27,9 +28,10 @@ class EchoStatement extends StatementAbstract /** * @param CompilationContext $compilationContext * - * @throws CompilerException + * @throws ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { foreach ($this->statement['expressions'] as $echoExpr) { $expr = new Expression($echoExpr); @@ -38,29 +40,31 @@ public function compile(CompilationContext $compilationContext) switch ($resolvedExpr->getType()) { case 'int': - $compilationContext->codePrinter->output('php_printf("%d", '.$resolvedExpr->getCode().');'); + $compilationContext->codePrinter->output('php_printf("%d", ' . $resolvedExpr->getCode() . ');'); break; case 'bool': - $compilationContext->codePrinter->output('php_printf("%s", '.$resolvedExpr->getBooleanCode().' ? "1": "");'); + $compilationContext->codePrinter->output( + 'php_printf("%s", ' . $resolvedExpr->getBooleanCode() . ' ? "1": "");' + ); break; case 'double': - $compilationContext->codePrinter->output('php_printf("%f", '.$resolvedExpr->getCode().');'); + $compilationContext->codePrinter->output('php_printf("%f", ' . $resolvedExpr->getCode() . ');'); break; case 'char': case 'uchar': - $compilationContext->codePrinter->output('php_printf("%c", \''.$resolvedExpr->getCode().'\');'); + $compilationContext->codePrinter->output('php_printf("%c", \'' . $resolvedExpr->getCode() . '\');'); break; case 'long': - $compilationContext->codePrinter->output('php_printf("%ld", '.$resolvedExpr->getCode().');'); + $compilationContext->codePrinter->output('php_printf("%ld", ' . $resolvedExpr->getCode() . ');'); break; case 'string': $compilationContext->codePrinter->output( - 'php_printf("%s", "'.add_slashes($resolvedExpr->getCode()).'");' + 'php_printf("%s", "' . Name::addSlashes($resolvedExpr->getCode()) . '");' ); break; @@ -68,45 +72,55 @@ public function compile(CompilationContext $compilationContext) break; case 'variable': - $variable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $echoExpr); + $variable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $echoExpr + ); switch ($variable->getType()) { case 'int': - $compilationContext->codePrinter->output('php_printf("%d", '.$variable->getName().');'); + $compilationContext->codePrinter->output('php_printf("%d", ' . $variable->getName() . ');'); break; case 'long': - $compilationContext->codePrinter->output('php_printf("%ld", '.$variable->getName().');'); + $compilationContext->codePrinter->output( + 'php_printf("%ld", ' . $variable->getName() . ');' + ); break; case 'double': - $compilationContext->codePrinter->output('php_printf("%f", '.$variable->getName().');'); + $compilationContext->codePrinter->output('php_printf("%f", ' . $variable->getName() . ');'); break; case 'uchar': case 'char': - $compilationContext->codePrinter->output('php_printf("%c", '.$variable->getName().');'); + $compilationContext->codePrinter->output('php_printf("%c", ' . $variable->getName() . ');'); break; case 'bool': - $compilationContext->codePrinter->output('php_printf("%s", '.$variable->getName().' ? "1": "");'); + $compilationContext->codePrinter->output( + 'php_printf("%s", ' . $variable->getName() . ' ? "1": "");' + ); break; case 'string': case 'variable': case 'mixed': - $compilationContext->codePrinter->output('zend_print_zval('.$compilationContext->backend->getVariableCode($variable).', 0);'); + $compilationContext->codePrinter->output( + 'zend_print_zval(' . $compilationContext->backend->getVariableCode($variable) . ', 0);' + ); break; case 'null': break; default: - throw new CompilerException('Unknown type: '.$variable->getType(), $echoExpr); + throw new CompilerException('Unknown type: ' . $variable->getType(), $echoExpr); } break; default: - throw new CompilerException('Unknown type: '.$resolvedExpr->getType(), $echoExpr); + throw new CompilerException('Unknown type: ' . $resolvedExpr->getType(), $echoExpr); } } } diff --git a/Library/Statements/ForStatement.php b/src/Statements/ForStatement.php similarity index 51% rename from Library/Statements/ForStatement.php rename to src/Statements/ForStatement.php index f528947fbb..dc3a3e4f31 100644 --- a/Library/Statements/ForStatement.php +++ b/src/Statements/ForStatement.php @@ -9,27 +9,393 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; +use ReflectionException; +use Zephir\Code\Printer; use Zephir\CompilationContext; +use Zephir\CompiledExpression; use Zephir\Detectors\ForValueUseDetector; +use Zephir\Detectors\WriteDetector; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; use Zephir\FunctionCall; +use Zephir\Name; use Zephir\Optimizers\EvalExpression; use Zephir\StatementsBlock; -use Zephir\Variable; +use Zephir\Variable\Variable; -use function Zephir\add_slashes; +use function count; -/** - * ForStatement. - * - * For statement - */ class ForStatement extends StatementAbstract { + /** + * @param CompilationContext $compilationContext + * + * @throws Exception + * @throws ReflectionException + */ + public function compile(CompilationContext $compilationContext): void + { + $exprRaw = $this->statement['expr']; + + /* + * TODO: implement optimizers here + */ + if ('fcall' === $exprRaw['type']) { + if ('range' === $exprRaw['name']) { + $status = $this->compileRange($exprRaw, $compilationContext); + if (false !== $status) { + return; + } + } + + if ('iterator' === $exprRaw['name']) { + $status = $this->compileIterator($exprRaw, $compilationContext); + if (false !== $status) { + return; + } + } + } + + $expr = new Expression($exprRaw); + $expr->setReadOnly(true); + $expression = $expr->compile($compilationContext); + + /** + * Check for traversing a constant string + */ + if ('string' === $expression->getType()) { + $this->compileStringTraverse($expression, $compilationContext); + + return; + } + + if ('variable' !== $expression->getType() && 'array' !== $expression->getType()) { + throw new CompilerException('Unknown type: ' . $expression->getType(), $exprRaw); + } + + $exprVariable = $compilationContext->symbolTable->getVariableForRead( + $expression->getCode(), + $compilationContext, + $this->statement['expr'], + ); + switch ($exprVariable->getType()) { + case 'variable': + case 'array': + $this->compileHashTraverse($compilationContext, $exprVariable); + break; + + case 'string': + $this->compileStringTraverse($expression, $compilationContext, $exprVariable); + break; + + default: + throw new CompilerException('Cannot traverse value type: ' . $exprVariable->getType(), $exprRaw); + } + } + + /** + * Compiles traversing of hash values. + * + * - Evaluated expression must be a zval + * - A key must be a zval + * - A value must be a zval + * + * @param CompilationContext $compilationContext + * @param Variable $exprVariable + */ + public function compileHashTraverse( + CompilationContext $compilationContext, + Variable $exprVariable + ): void { + /** + * Initialize 'key' variable + */ + if (isset($this->statement['key'])) { + if ('_' != $this->statement['key']) { + $keyVariable = $compilationContext->symbolTable->getVariableForWrite( + $this->statement['key'], + $compilationContext, + $this->statement['expr'] + ); + if ('variable' != $keyVariable->getType()) { + throw new CompilerException( + 'Cannot use variable: ' + . $this->statement['key'] + . ' type: ' + . $keyVariable->getType() + . ' as key in hash traversal', + $this->statement['expr'] + ); + } + } else { + $keyVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + } + + $keyVariable->setMustInitNull(true); + $keyVariable->setIsInitialized(true, $compilationContext); + $keyVariable->setDynamicTypes('undefined'); + } + + /** + * Initialize 'value' variable + */ + if (isset($this->statement['value'])) { + if ('_' != $this->statement['value']) { + $variable = $compilationContext->symbolTable->getVariableForWrite( + $this->statement['value'], + $compilationContext, + $this->statement['expr'] + ); + if ('variable' != $variable->getType()) { + throw new CompilerException( + 'Cannot use variable: ' + . $this->statement['value'] + . ' type: ' + . $variable->getType() + . ' as value in hash traversal', + $this->statement['expr'] + ); + } + } else { + $variable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); + } + + $variable->setMustInitNull(true); + $variable->setIsInitialized(true, $compilationContext); + $variable->increaseVariantIfNull(); + $variable->setDynamicTypes('undefined'); + } + + /** + * Variables are initialized in a different way inside cycle + */ + ++$compilationContext->insideCycle; + + $duplicateHash = '0'; + $duplicateKey = true; + + /** + * We have to check if hashes are modified within the for's block. + */ + $st = null; + if (isset($this->statement['statements'])) { + /** + * Create the statements block here to obtain the last use line. + */ + $st = new StatementsBlock($this->statement['statements']); + + $detector = new ForValueUseDetector(); + if ($detector->detect($exprVariable->getName(), $this->statement['statements'])) { + $duplicateHash = '1'; + } + + /** + * Detect if the key is modified or passed to an external scope + */ + if (isset($this->statement['key'])) { + if (!$keyVariable->isTemporal()) { + $detector->setDetectionFlags(WriteDetector::DETECT_ALL); + if ($detector->detect($keyVariable->getName(), $this->statement['statements'])) { + $duplicateKey = true; + } + } + } + } + + $compilationContext->backend->forStatement( + $exprVariable, + isset($this->statement['key']) ? $keyVariable : null, + isset($this->statement['value']) ? $variable : null, + $duplicateKey, + $duplicateHash, + $this->statement, + $st, + $compilationContext + ); + + /** + * Restore the cycle counter + */ + --$compilationContext->insideCycle; + } + + /** + * Compiles a 'for' statement that use an 'iterator' as expression. + * + * @param array $exprRaw + * @param CompilationContext $compilationContext + * + * @return void + * + * @throws Exception + * @throws ReflectionException + */ + public function compileIterator(array $exprRaw, CompilationContext $compilationContext): void + { + $iteratorVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'zend_object_iterator', + $compilationContext + ); + $compilationContext->headersManager->add('kernel/iterator'); + $codePrinter = $compilationContext->codePrinter; + + /** + * Resolve first parameter of iterator(p). + */ + $expr = new Expression($exprRaw['parameters'][0]['parameter']); + $expr->setReadOnly(false); + $expression = $expr->compile($compilationContext); + + if ('variable' != $expression->getType()) { + throw new CompilerException('Unknown type: ' . $expression->getType(), $exprRaw); + } + + $exprVariable = $compilationContext->symbolTable->getVariableForRead( + $expression->getCode(), + $compilationContext, + $this->statement['expr'] + ); + + /** + * Initialize 'key' variable + */ + if (isset($this->statement['key'])) { + if ('_' != $this->statement['key']) { + $keyVariable = $compilationContext->symbolTable->getVariableForWrite( + $this->statement['key'], + $compilationContext, + $this->statement['expr'] + ); + if ('variable' != $keyVariable->getType()) { + throw new CompilerException( + 'Cannot use variable: ' + . $this->statement['key'] + . ' type: ' + . $keyVariable->getType() + . ' as key in hash traversal', + $this->statement['expr'] + ); + } + } else { + /** + * Anonymous key variable. + */ + $keyVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $keyVariable->increaseUses(); + } + + $keyVariable->setMustInitNull(true); + $keyVariable->setIsInitialized(true, $compilationContext); + $keyVariable->setDynamicTypes('undefined'); + } + + /** + * Initialize 'value' variable + */ + if (isset($this->statement['value'])) { + if ('_' != $this->statement['value']) { + $variable = $compilationContext->symbolTable->getVariableForWrite( + $this->statement['value'], + $compilationContext, + $this->statement['expr'] + ); + if ('variable' != $variable->getType()) { + throw new CompilerException( + 'Cannot use variable: ' + . $this->statement['value'] + . ' type: ' + . $variable->getType() + . ' as value in hash traversal', + $this->statement['expr'] + ); + } + } else { + /** + * Anonymous value variable. + */ + $variable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); + $variable->increaseUses(); + } + + $variable->setMustInitNull(true); + $variable->setIsInitialized(true, $compilationContext); + $variable->setDynamicTypes('undefined'); + } + + /** + * Variables are initialized in a different way inside cycle + */ + ++$compilationContext->insideCycle; + + $codePrinter->output( + $iteratorVariable->getName() . ' = zephir_get_iterator(' . $compilationContext->backend->getVariableCode( + $exprVariable + ) . ');' + ); + + $codePrinter->output($iteratorVariable->getName() . '->funcs->rewind(' . $iteratorVariable->getName() . ');'); + $codePrinter->output( + 'for (;' + . $iteratorVariable->getName() + . '->funcs->valid(' + . $iteratorVariable->getName() + . ') == SUCCESS && !EG(exception); ' + . $iteratorVariable->getName() + . '->funcs->move_forward(' + . $iteratorVariable->getName() + . ')) {' + ); + + if (isset($this->statement['key'])) { + $compilationContext->symbolTable->mustGrownStack(true); + $codePrinter->output( + "\t" + . 'ZEPHIR_GET_IMKEY(' + . $this->statement['key'] + . ', ' + . $iteratorVariable->getName() + . ');' + ); + } + + if (isset($this->statement['value'])) { + $compilationContext->symbolTable->mustGrownStack(true); + $codePrinter->increaseLevel(); + $codePrinter->output('{'); + $codePrinter->increaseLevel(); + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->codePrinter->output( + 'ZEPHIR_ITERATOR_COPY(' + . $compilationContext->backend->getVariableCode($variable) + . ', ' + . $iteratorVariable->getName() + . ');' + ); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + $codePrinter->decreaseLevel(); + } + + /** + * Compile statements in the 'for' block + */ + $this->compileStatementsForBlock($compilationContext, $codePrinter); + + $compilationContext->backend->destroyIterator($iteratorVariable, $compilationContext); + } + /** * Compiles a for statement that use a 'range' as expression. * @@ -37,22 +403,28 @@ class ForStatement extends StatementAbstract * @param CompilationContext $compilationContext * * @return bool + * + * @throws ReflectionException + * @throws Exception */ - public function compileRange($exprRaw, CompilationContext $compilationContext) + public function compileRange(array $exprRaw, CompilationContext $compilationContext): bool { - if (!\count($exprRaw['parameters'])) { + if (!count($exprRaw['parameters'])) { return false; } - if (\count($exprRaw['parameters']) > 3) { + if (count($exprRaw['parameters']) > 3) { return false; } $functionCall = new FunctionCall(); - $parameters = $functionCall->getResolvedParamsAsExpr($exprRaw['parameters'], $compilationContext, $exprRaw); + $parameters = $functionCall->getResolvedParamsAsExpr($exprRaw['parameters'], $compilationContext, $exprRaw); - if (2 != \count($parameters) && 3 != \count($parameters)) { - throw new CompilerException('Wrong number of parameters', $this->statement['expr']); + if (2 != count($parameters) && 3 != count($parameters)) { + throw new CompilerException( + 'Wrong number of parameters', + $this->statement['expr'] + ); } if ('variable' != $parameters[0]->getType()) { @@ -70,118 +442,151 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $codePrinter = $compilationContext->codePrinter; $exprBuilder = BuilderFactory::getInstance(); - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { /** * This variable is used to check if the loop is in its first iteration. */ - $keyVariable = $compilationContext->symbolTable->getTempVariableForWrite('long', $compilationContext, $this->statement); + $keyVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'long', + $compilationContext, + $this->statement + ); $keyVariable->increaseUses(); } /** * This variable is used to check if the loop is in its first iteration. */ - $flagVariable = $compilationContext->symbolTable->getTempVariableForWrite('bool', $compilationContext, $this->statement); + $flagVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'bool', + $compilationContext, + $this->statement + ); if ('variable' != $parameters[0]->getType()) { $tempVariable = $compilationContext->symbolTable->addTemp($parameters[0]->getType(), $compilationContext); } else { - $rangeVariable = $compilationContext->symbolTable->getVariableForRead($parameters[0]->getCode(), $compilationContext, $this->statement['expr']); - $tempVariable = $compilationContext->symbolTable->addTemp($rangeVariable->getType(), $compilationContext); + $rangeVariable = $compilationContext->symbolTable->getVariableForRead( + $parameters[0]->getCode(), + $compilationContext, + $this->statement['expr'] + ); + $tempVariable = $compilationContext->symbolTable->addTemp($rangeVariable->getType(), $compilationContext); } - /* + /** * Create a copy of the current value in the end of the range to avoid modify the range * inside the cycle */ if ('variable' != $parameters[1]->getType()) { - $upperBoundVariable = $compilationContext->symbolTable->getTempVariable($parameters[1]->getType(), $compilationContext); + $upperBoundVariable = $compilationContext->symbolTable->getTempVariable( + $parameters[1]->getType(), + $compilationContext + ); } else { - $rangeVariable = $compilationContext->symbolTable->getVariableForRead($parameters[1]->getCode(), $compilationContext, $this->statement['expr']); - $upperBoundVariable = $compilationContext->symbolTable->getTempVariable($rangeVariable->getType(), $compilationContext); + $rangeVariable = $compilationContext->symbolTable->getVariableForRead( + $parameters[1]->getCode(), + $compilationContext, + $this->statement['expr'] + ); + $upperBoundVariable = $compilationContext->symbolTable->getTempVariable( + $rangeVariable->getType(), + $compilationContext + ); } /** * Create an implicit 'let' operation to set the current value in the upper bound of the range. */ $builderLet = $exprBuilder->statements()->let(); - $builderLet->setAssignments([$exprBuilder->operators() - ->assignVariable($upperBoundVariable->getName(), $exprBuilder->literal($parameters[1]->getType(), $parameters[1]->getCode()) - ->setFile($this->statement['file']) - ->setLine($this->statement['line']) - ->setChar($this->statement['char'])) - ->setFile($this->statement['file']) - ->setLine($this->statement['line']) - ->setChar($this->statement['char']), + $builderLet->setAssignments([ + $exprBuilder->operators() + ->assignVariable( + $upperBoundVariable->getName(), + $exprBuilder->literal($parameters[1]->getType(), $parameters[1]->getCode()) + ->setFile($this->statement['file']) + ->setLine($this->statement['line']) + ->setChar($this->statement['char']) + ) + ->setFile($this->statement['file']) + ->setLine($this->statement['line']) + ->setChar($this->statement['char']), ]); $statement = new LetStatement($builderLet->build()); $statement->compile($compilationContext); if ($this->statement['reverse']) { - /* + /** * Create an implicit 'let' operation for the initialize expression */ - $builderLet->setAssignments([$exprBuilder->operators() - ->assignVariable($tempVariable->getName(), $exprBuilder->variable($upperBoundVariable->getName()) - ->setFile($this->statement['file']) - ->setLine($this->statement['line']) - ->setChar($this->statement['char'])) - ->setFile($this->statement['file']) - ->setLine($this->statement['line']) - ->setChar($this->statement['char']), + $builderLet->setAssignments([ + $exprBuilder->operators() + ->assignVariable( + $tempVariable->getName(), + $exprBuilder->variable($upperBoundVariable->getName()) + ->setFile($this->statement['file']) + ->setLine($this->statement['line']) + ->setChar($this->statement['char']) + ) + ->setFile($this->statement['file']) + ->setLine($this->statement['line']) + ->setChar($this->statement['char']), ]); - $statement = new LetStatement($builderLet->build()); } else { - /* + /** * Create an implicit 'let' operation for the initialize expression */ - $builderLet->setAssignments([$exprBuilder->operators() - ->assignVariable($tempVariable->getName(), $exprBuilder->literal($parameters[0]->getType(), $parameters[0]->getCode()) - ->setFile($this->statement['file']) - ->setLine($this->statement['line']) - ->setChar($this->statement['char'])) - ->setFile($this->statement['file']) - ->setLine($this->statement['line']) - ->setChar($this->statement['char']), + $builderLet->setAssignments([ + $exprBuilder->operators() + ->assignVariable( + $tempVariable->getName(), + $exprBuilder->literal($parameters[0]->getType(), $parameters[0]->getCode()) + ->setFile($this->statement['file']) + ->setLine($this->statement['line']) + ->setChar($this->statement['char']) + ) + ->setFile($this->statement['file']) + ->setLine($this->statement['line']) + ->setChar($this->statement['char']), ]); - $statement = new LetStatement($builderLet->build()); } + $statement = new LetStatement($builderLet->build()); $statement->compile($compilationContext); - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { - $codePrinter->output($keyVariable->getName().' = 0;'); + $codePrinter->output($keyVariable->getName() . ' = 0;'); } - $codePrinter->output($flagVariable->getName().' = 0;'); + $codePrinter->output($flagVariable->getName() . ' = 0;'); if ($this->statement['reverse']) { $conditionExpr = [ - 'type' => 'greater-equal', - 'left' => ['type' => 'variable', 'value' => $tempVariable->getName()], + 'type' => 'greater-equal', + 'left' => ['type' => 'variable', 'value' => $tempVariable->getName()], 'right' => ['type' => $parameters[0]->getType(), 'value' => $parameters[0]->getCode()], ]; } else { $conditionExpr = [ - 'type' => 'less-equal', - 'left' => ['type' => 'variable', 'value' => $tempVariable->getName()], + 'type' => 'less-equal', + 'left' => ['type' => 'variable', 'value' => $tempVariable->getName()], 'right' => ['type' => 'variable', 'value' => $upperBoundVariable->getName()], ]; } - $expr = new EvalExpression(); + $expr = new EvalExpression(); $condition = $expr->optimize($conditionExpr, $compilationContext); - $codePrinter->output('if ('.$condition.') {'); + $codePrinter->output('if (' . $condition . ') {'); $codePrinter->increaseLevel(); - /* + /** * Inside a cycle */ ++$compilationContext->insideCycle; @@ -189,46 +594,46 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $codePrinter->output('while (1) {'); $codePrinter->increaseLevel(); - $codePrinter->output('if ('.$flagVariable->getName().') {'); + $codePrinter->output('if (' . $flagVariable->getName() . ') {'); $codePrinter->increaseLevel(); if (isset($this->statement['key'])) { - $codePrinter->output($keyVariable->getName().'++;'); + $codePrinter->output($keyVariable->getName() . '++;'); } if ($this->statement['reverse']) { if (!isset($parameters[2])) { $statement = new LetStatement([ - 'type' => 'let', + 'type' => 'let', 'assignments' => [ [ 'assign-type' => 'decr', - 'variable' => $tempVariable->getName(), - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], + 'variable' => $tempVariable->getName(), + 'file' => $this->statement['file'], + 'line' => $this->statement['line'], + 'char' => $this->statement['char'], ], ], ]); } else { $statement = new LetStatement([ - 'type' => 'let', + 'type' => 'let', 'assignments' => [ [ 'assign-type' => 'variable', - 'operator' => 'sub-assign', - 'variable' => $tempVariable->getName(), - 'expr' => [ - 'type' => $parameters[2]->getType(), + 'operator' => 'sub-assign', + 'variable' => $tempVariable->getName(), + 'expr' => [ + 'type' => $parameters[2]->getType(), 'value' => $parameters[2]->getCode(), - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], + 'file' => $this->statement['file'], + 'line' => $this->statement['line'], + 'char' => $this->statement['char'], ], - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], + 'file' => $this->statement['file'], + 'line' => $this->statement['line'], + 'char' => $this->statement['char'], ], ], ]); @@ -236,35 +641,35 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) } else { if (!isset($parameters[2])) { $statement = new LetStatement([ - 'type' => 'let', + 'type' => 'let', 'assignments' => [ [ 'assign-type' => 'incr', - 'variable' => $tempVariable->getName(), - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], + 'variable' => $tempVariable->getName(), + 'file' => $this->statement['file'], + 'line' => $this->statement['line'], + 'char' => $this->statement['char'], ], ], ]); } else { $statement = new LetStatement([ - 'type' => 'let', + 'type' => 'let', 'assignments' => [ [ 'assign-type' => 'variable', - 'operator' => 'add-assign', - 'variable' => $tempVariable->getName(), - 'expr' => [ - 'type' => $parameters[2]->getType(), + 'operator' => 'add-assign', + 'variable' => $tempVariable->getName(), + 'expr' => [ + 'type' => $parameters[2]->getType(), 'value' => $parameters[2]->getCode(), - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], + 'file' => $this->statement['file'], + 'line' => $this->statement['line'], + 'char' => $this->statement['char'], ], - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], + 'file' => $this->statement['file'], + 'line' => $this->statement['line'], + 'char' => $this->statement['char'], ], ], ]); @@ -275,248 +680,65 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) /** * Multi-line conditions would need to be regenerated here. */ - $condition = $expr->optimize($conditionExpr, $compilationContext); - $codePrinter->output('if (!('.$condition.')) {'); - $codePrinter->output("\t".'break;'); - $codePrinter->output('}'); - - $codePrinter->decreaseLevel(); - - $codePrinter->output('} else {'); - $codePrinter->output("\t".$flagVariable->getName().' = 1;'); - $codePrinter->output('}'); - - /* - * Initialize 'key' variable - */ - if (isset($this->statement['key'])) { - /* - * Check for anonymous variables - */ - if ('_' != $this->statement['key']) { - $keyVariableName = $this->statement['key']; - } else { - $keyVariableName = $keyVariable->getName(); - } - - /** - * Create an implicit 'let' operation, TODO: use a builder. - */ - $statement = new LetStatement([ - 'type' => 'let', - 'assignments' => [ - [ - 'assign-type' => 'variable', - 'variable' => $keyVariableName, - 'operator' => 'assign', - 'expr' => [ - 'type' => 'variable', - 'value' => $keyVariable->getName(), - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], - ], - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], - ], - ], - ]); - - $statement->compile($compilationContext); - } - - /* - * Initialize 'value' variable - */ - if (isset($this->statement['value'])) { - /* - * Check for anonymous variables - */ - if ('_' != $this->statement['value']) { - $valueVariable = $this->statement['value']; - } else { - $valueVariable = $tempVariable->getName(); - } - - /** - * Create an implicit 'let' operation, TODO: use a builder. - */ - $statement = new LetStatement([ - 'type' => 'let', - 'assignments' => [ - [ - 'assign-type' => 'variable', - 'variable' => $valueVariable, - 'operator' => 'assign', - 'expr' => [ - 'type' => 'variable', - 'value' => $tempVariable->getName(), - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], - ], - 'file' => $this->statement['file'], - 'line' => $this->statement['line'], - 'char' => $this->statement['char'], - ], - ], - ]); - - $statement->compile($compilationContext); - } - - $codePrinter->decreaseLevel(); - - /* - * Compile statements in the 'for' block - */ - if (isset($this->statement['statements'])) { - $st = new StatementsBlock($this->statement['statements']); - $st->isLoop(true); - if (isset($this->statement['key'])) { - $st->getMutateGatherer()->increaseMutations($this->statement['key']); - } - $st->getMutateGatherer()->increaseMutations($this->statement['value']); - $st->compile($compilationContext); - } - - /* - * Restore the cycle counter - */ - --$compilationContext->insideCycle; - - $codePrinter->output('}'); - - $codePrinter->decreaseLevel(); - - $codePrinter->output('}'); - } - - /** - * Compiles a 'for' statement that use an 'iterator' as expression. - * - * @param array $exprRaw - * @param CompilationContext $compilationContext - * - * @return bool - */ - public function compileIterator(array $exprRaw, CompilationContext $compilationContext) - { - $iteratorVariable = $compilationContext->symbolTable->getTempVariableForWrite('zend_object_iterator', $compilationContext); - - $compilationContext->headersManager->add('kernel/iterator'); - - $codePrinter = $compilationContext->codePrinter; - - /** - * Resolve first parameter of iterator(p). - */ - $expr = new Expression($exprRaw['parameters'][0]['parameter']); - $expr->setReadOnly(false); - $expression = $expr->compile($compilationContext); + $condition = $expr->optimize($conditionExpr, $compilationContext); + $codePrinter->output('if (!(' . $condition . ')) {'); + $codePrinter->output("\t" . 'break;'); + $codePrinter->output('}'); - if ('variable' != $expression->getType()) { - throw new CompilerException('Unknown type: '.$expression->getType(), $exprRaw); - } + $codePrinter->decreaseLevel(); - $exprVariable = $compilationContext->symbolTable->getVariableForRead($expression->getCode(), $compilationContext, $this->statement['expr']); - switch ($exprVariable->getType()) { - case 'variable': - break; - } + $codePrinter->output('} else {'); + $codePrinter->output("\t" . $flagVariable->getName() . ' = 1;'); + $codePrinter->output('}'); - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { + /** + * Check for anonymous variables + */ if ('_' != $this->statement['key']) { - $keyVariable = $compilationContext->symbolTable->getVariableForWrite($this->statement['key'], $compilationContext, $this->statement['expr']); - if ('variable' != $keyVariable->getType()) { - throw new CompilerException('Cannot use variable: '.$this->statement['key'].' type: '.$keyVariable->getType().' as key in hash traversal', $this->statement['expr']); - } + $keyVariableName = $this->statement['key']; } else { - /** - * Anonymous key variable. - */ - $keyVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $keyVariable->increaseUses(); + $keyVariableName = $keyVariable->getName(); } - $keyVariable->setMustInitNull(true); - $keyVariable->setIsInitialized(true, $compilationContext); - $keyVariable->setDynamicTypes('undefined'); + /** + * Create an implicit 'let' operation, TODO: use a builder. + */ + $this->getLetStatement($keyVariableName, $keyVariable, $compilationContext); } - /* + /** * Initialize 'value' variable */ if (isset($this->statement['value'])) { + /** + * Check for anonymous variables + */ if ('_' != $this->statement['value']) { - $variable = $compilationContext->symbolTable->getVariableForWrite($this->statement['value'], $compilationContext, $this->statement['expr']); - if ('variable' != $variable->getType()) { - throw new CompilerException('Cannot use variable: '.$this->statement['value'].' type: '.$variable->getType().' as value in hash traversal', $this->statement['expr']); - } + $valueVariable = $this->statement['value']; } else { - /** - * Anonymous value variable. - */ - $variable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $variable->increaseUses(); + $valueVariable = $tempVariable->getName(); } - $variable->setMustInitNull(true); - $variable->setIsInitialized(true, $compilationContext); - $variable->setDynamicTypes('undefined'); - } - - /* - * Variables are initialized in a different way inside cycle - */ - ++$compilationContext->insideCycle; - - $codePrinter->output($iteratorVariable->getName().' = zephir_get_iterator('.$compilationContext->backend->getVariableCode($exprVariable).');'); - - $codePrinter->output($iteratorVariable->getName().'->funcs->rewind('.$iteratorVariable->getName().');'); - $codePrinter->output('for (;'.$iteratorVariable->getName().'->funcs->valid('.$iteratorVariable->getName().') == SUCCESS && !EG(exception); '.$iteratorVariable->getName().'->funcs->move_forward('.$iteratorVariable->getName().')) {'); - - if (isset($this->statement['key'])) { - $compilationContext->symbolTable->mustGrownStack(true); - $codePrinter->output("\t".'ZEPHIR_GET_IMKEY('.$this->statement['key'].', '.$iteratorVariable->getName().');'); + /** + * Create an implicit 'let' operation, TODO: use a builder. + */ + $this->getLetStatement($valueVariable, $tempVariable, $compilationContext); } - if (isset($this->statement['value'])) { - $compilationContext->symbolTable->mustGrownStack(true); - $codePrinter->increaseLevel(); - $codePrinter->output('{'); - $codePrinter->increaseLevel(); - $compilationContext->backend->forStatementIterator($iteratorVariable, $variable, $compilationContext); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - $codePrinter->decreaseLevel(); - } + $codePrinter->decreaseLevel(); - /* + /** * Compile statements in the 'for' block */ - if (isset($this->statement['statements'])) { - $st = new StatementsBlock($this->statement['statements']); - $st->isLoop(true); - if (isset($this->statement['key'])) { - $st->getMutateGatherer()->increaseMutations($this->statement['key']); - } - $st->getMutateGatherer()->increaseMutations($this->statement['value']); - $st->compile($compilationContext); - } - - /* - * Restore the cycle counter - */ - --$compilationContext->insideCycle; - + $this->compileStatementsForBlock($compilationContext, $codePrinter); + $codePrinter->decreaseLevel(); $codePrinter->output('}'); - $compilationContext->backend->destroyIterator($iteratorVariable, $compilationContext); + return true; } /** @@ -525,20 +747,26 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC * - Every key must be an integer or compatible * - Every value must be a char/integer or compatible. * - * @param array $expression - * @param CompilationContext $compilationContext - * @param Variable $exprVariable + * @throws Exception + * @throws ReflectionException */ - public function compileStringTraverse($expression, CompilationContext $compilationContext, $exprVariable) - { + public function compileStringTraverse( + CompiledExpression $expression, + CompilationContext $compilationContext, + Variable $exprVariable = null, + ): void { $codePrinter = $compilationContext->codePrinter; - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { if ('_' != $this->statement['key']) { - $keyVariable = $compilationContext->symbolTable->getVariableForWrite($this->statement['key'], $compilationContext, $this->statement['expr']); + $keyVariable = $compilationContext->symbolTable->getVariableForWrite( + $this->statement['key'], + $compilationContext, + $this->statement['expr'] + ); switch ($keyVariable->getType()) { case 'int': case 'uint': @@ -548,7 +776,14 @@ public function compileStringTraverse($expression, CompilationContext $compilati case 'uchar': break; default: - throw new CompilerException('Cannot use variable: '.$this->statement['key'].' type: '.$keyVariable->getType().' as key in string traversal', $this->statement['expr']); + throw new CompilerException( + 'Cannot use variable: ' + . $this->statement['key'] + . ' type: ' + . $keyVariable->getType() + . ' as key in string traversal', + $this->statement['expr'] + ); } } else { $keyVariable = $compilationContext->symbolTable->getTempVariableForWrite('int', $compilationContext); @@ -559,12 +794,16 @@ public function compileStringTraverse($expression, CompilationContext $compilati $keyVariable->setIsInitialized(true, $compilationContext); } - /* + /** * Initialize 'value' variable */ if (isset($this->statement['value'])) { if ('_' != $this->statement['value']) { - $variable = $compilationContext->symbolTable->getVariableForWrite($this->statement['value'], $compilationContext, $this->statement['expr']); + $variable = $compilationContext->symbolTable->getVariableForWrite( + $this->statement['value'], + $compilationContext, + $this->statement['expr'] + ); switch ($variable->getType()) { case 'int': case 'uint': @@ -574,7 +813,14 @@ public function compileStringTraverse($expression, CompilationContext $compilati case 'uchar': break; default: - throw new CompilerException('Cannot use variable: '.$this->statement['value'].' type: '.$variable->getType().' as value in string traversal', $this->statement['expr']); + throw new CompilerException( + 'Cannot use variable: ' + . $this->statement['value'] + . ' type: ' + . $variable->getType() + . ' as value in string traversal', + $this->statement['expr'] + ); } } else { $variable = $compilationContext->symbolTable->getTempVariableForWrite('char', $compilationContext); @@ -587,17 +833,19 @@ public function compileStringTraverse($expression, CompilationContext $compilati $tempVariable = $compilationContext->symbolTable->addTemp('long', $compilationContext); - /* + /** * Create a temporary value to store the constant string */ if ('string' == $expression->getType()) { - $constantVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite('variable', $compilationContext); + $constantVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite( + 'variable', + $compilationContext + ); $compilationContext->backend->assignString( $constantVariable, - add_slashes($expression->getCode()), + Name::addSlashes($expression->getCode()), $compilationContext, - true ); $stringVariable = $constantVariable; @@ -607,204 +855,121 @@ public function compileStringTraverse($expression, CompilationContext $compilati $stringVariableCode = $compilationContext->backend->getVariableCode($stringVariable); if ($this->statement['reverse']) { - $codePrinter->output('for ('.$tempVariable->getName().' = Z_STRLEN_P('.$stringVariableCode.'); '.$tempVariable->getName().' >= 0; '.$tempVariable->getName().'--) {'); + $codePrinter->output( + 'for (' + . $tempVariable->getName() + . ' = Z_STRLEN_P(' + . $stringVariableCode + . '); ' + . $tempVariable->getName() + . ' >= 0; ' + . $tempVariable->getName() + . '--) {' + ); } else { - $codePrinter->output('for ('.$tempVariable->getName().' = 0; '.$tempVariable->getName().' < Z_STRLEN_P('.$stringVariableCode.'); '.$tempVariable->getName().'++) {'); + $codePrinter->output( + 'for (' + . $tempVariable->getName() + . ' = 0; ' + . $tempVariable->getName() + . ' < Z_STRLEN_P(' + . $stringVariableCode + . '); ' + . $tempVariable->getName() + . '++) {' + ); } if (isset($this->statement['key'])) { - $codePrinter->output("\t".$keyVariable->getName().' = '.$tempVariable->getName().'; '); + $codePrinter->output( + "\t" + . $keyVariable->getName() + . ' = ' + . $tempVariable->getName() + . '; ' + ); } $compilationContext->headersManager->add('kernel/operators'); - $codePrinter->output("\t".$variable->getName().' = ZEPHIR_STRING_OFFSET('.$stringVariableCode.', '.$tempVariable->getName().');'); + $codePrinter->output( + "\t" . $variable->getName( + ) . ' = ZEPHIR_STRING_OFFSET(' . $stringVariableCode . ', ' . $tempVariable->getName() . ');' + ); - /* + /** * Variables are initialized in a different way inside cycle */ ++$compilationContext->insideCycle; - /* + /** * Compile statements in the 'for' block */ - if (isset($this->statement['statements'])) { - $st = new StatementsBlock($this->statement['statements']); - $st->isLoop(true); - if (isset($this->statement['key'])) { - $st->getMutateGatherer()->increaseMutations($this->statement['key']); - } - $st->getMutateGatherer()->increaseMutations($this->statement['value']); - $st->compile($compilationContext); - } - - --$compilationContext->insideCycle; - - $codePrinter->output('}'); + $this->compileStatementsForBlock($compilationContext, $codePrinter); } /** - * Compiles traversing of hash values. - * - * - Evaluated expression must be a zval - * - A key must be a zval - * - A value must be a zval - * - * @param array $expression * @param CompilationContext $compilationContext - * @param Variable $exprVariable + * @param Printer|null $codePrinter + * + * @return void + * @throws Exception + * @throws ReflectionException */ - public function compileHashTraverse($expression, CompilationContext $compilationContext, Variable $exprVariable) - { - /* - * Initialize 'key' variable - */ - if (isset($this->statement['key'])) { - if ('_' != $this->statement['key']) { - $keyVariable = $compilationContext->symbolTable->getVariableForWrite($this->statement['key'], $compilationContext, $this->statement['expr']); - if ('variable' != $keyVariable->getType()) { - throw new CompilerException('Cannot use variable: '.$this->statement['key'].' type: '.$keyVariable->getType().' as key in hash traversal', $this->statement['expr']); - } - } else { - $keyVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - } - - $keyVariable->setMustInitNull(true); - $keyVariable->setIsInitialized(true, $compilationContext); - $keyVariable->setDynamicTypes('undefined'); - } - - /* - * Initialize 'value' variable - */ - if (isset($this->statement['value'])) { - if ('_' != $this->statement['value']) { - $variable = $compilationContext->symbolTable->getVariableForWrite($this->statement['value'], $compilationContext, $this->statement['expr']); - if ('variable' != $variable->getType()) { - throw new CompilerException('Cannot use variable: '.$this->statement['value'].' type: '.$variable->getType().' as value in hash traversal', $this->statement['expr']); - } - } else { - $variable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - } - - $variable->setMustInitNull(true); - $variable->setIsInitialized(true, $compilationContext); - $variable->increaseVariantIfNull(); - $variable->setDynamicTypes('undefined'); - } - - /* - * Variables are initialized in a different way inside cycle - */ - ++$compilationContext->insideCycle; - -// $compilationContext->headersManager->add('kernel/hash'); - - $duplicateHash = '0'; - $duplicateKey = true; - - /** - * We have to check if hashes are modified within the for's block. - */ - $st = null; + private function compileStatementsForBlock( + CompilationContext $compilationContext, + ?Printer $codePrinter + ): void { if (isset($this->statement['statements'])) { - /** - * Create the statements block here to obtain the last use line. - */ $st = new StatementsBlock($this->statement['statements']); - - $detector = new ForValueUseDetector(); - if ($detector->detect($exprVariable->getName(), $this->statement['statements'])) { - $duplicateHash = '1'; - } - - /* - * Detect if the key is modified or passed to an external scope - */ + $st->isLoop(true); if (isset($this->statement['key'])) { - if (!$keyVariable->isTemporal()) { - $detector->setDetectionFlags(ForValueUseDetector::DETECT_ALL); - if ($detector->detect($keyVariable->getName(), $this->statement['statements'])) { - $duplicateKey = true; - } - } + $st->getMutateGatherer()->increaseMutations($this->statement['key']); } + $st->getMutateGatherer()->increaseMutations($this->statement['value']); + $st->compile($compilationContext); } - $compilationContext->backend->forStatement( - $exprVariable, - isset($this->statement['key']) ? $keyVariable : null, - isset($this->statement['value']) ? $variable : null, - $duplicateKey, - $duplicateHash, - $this->statement, - $st, - $compilationContext - ); - - /* + /** * Restore the cycle counter */ --$compilationContext->insideCycle; + + $codePrinter->output('}'); } /** + * @param mixed $keyVariableName + * @param Variable $keyVariable * @param CompilationContext $compilationContext * - * @throws CompilerException + * @return void */ - public function compile(CompilationContext $compilationContext) - { - $exprRaw = $this->statement['expr']; - - /* - * TODO: implement optimizers here - */ - if ('fcall' == $exprRaw['type']) { - if ('range' == $exprRaw['name']) { - $status = $this->compileRange($exprRaw, $compilationContext); - if (false !== $status) { - return; - } - } - - if ('iterator' == $exprRaw['name']) { - $status = $this->compileIterator($exprRaw, $compilationContext); - if (false !== $status) { - return; - } - } - } - - $expr = new Expression($exprRaw); - $expr->setReadOnly(true); - $expression = $expr->compile($compilationContext); - - /* - * Check for traversing a constant string - */ - if ('string' == $expression->getType()) { - $this->compileStringTraverse($expression, $compilationContext, null); - - return; - } - - if ('variable' != $expression->getType() && 'array' != $expression->getType()) { - throw new CompilerException('Unknown type: '.$expression->getType(), $exprRaw); - } - - $exprVariable = $compilationContext->symbolTable->getVariableForRead($expression->getCode(), $compilationContext, $this->statement['expr']); - switch ($exprVariable->getType()) { - case 'variable': - case 'array': - $this->compileHashTraverse($expression, $compilationContext, $exprVariable); - break; - - case 'string': - $this->compileStringTraverse($expression, $compilationContext, $exprVariable); - break; + private function getLetStatement( + mixed $keyVariableName, + Variable $keyVariable, + CompilationContext $compilationContext + ): void { + $statement = new LetStatement([ + 'type' => 'let', + 'assignments' => [ + [ + 'assign-type' => 'variable', + 'variable' => $keyVariableName, + 'operator' => 'assign', + 'expr' => [ + 'type' => 'variable', + 'value' => $keyVariable->getName(), + 'file' => $this->statement['file'], + 'line' => $this->statement['line'], + 'char' => $this->statement['char'], + ], + 'file' => $this->statement['file'], + 'line' => $this->statement['line'], + 'char' => $this->statement['char'], + ], + ], + ]); - default: - throw new CompilerException('Cannot traverse value type: '.$exprVariable->getType(), $exprRaw); - } + $statement->compile($compilationContext); } } diff --git a/Library/Statements/IfStatement.php b/src/Statements/IfStatement.php similarity index 80% rename from Library/Statements/IfStatement.php rename to src/Statements/IfStatement.php index f079af883b..3e65748486 100644 --- a/Library/Statements/IfStatement.php +++ b/src/Statements/IfStatement.php @@ -9,38 +9,44 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; +use ReflectionException; use Zephir\Branch; use Zephir\CompilationContext; use Zephir\Detectors\ReadDetector; +use Zephir\Exception; use Zephir\Optimizers\EvalExpression; use Zephir\Passes\SkipVariantInit; use Zephir\StatementsBlock; +use function is_object; + /** - * IfStatement. - * * 'If' statement, the same as in PHP/C */ class IfStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext + * + * @throws ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $exprRaw = $this->statement['expr']; - $expr = new EvalExpression(); + $expr = new EvalExpression(); $condition = $expr->optimize($exprRaw, $compilationContext); - /* + /** * This pass tries to move dynamic variable initialization out of the if/else branch */ if (isset($this->statement['statements']) && (isset($this->statement['else_statements']) || isset($this->statement['elseif_statements']))) { - $readDetector = new ReadDetector(); - + $readDetector = new ReadDetector(); $skipVariantInit = new SkipVariantInit(); $skipVariantInit->setVariablesToSkip(0, $expr->getUsedVariables()); @@ -56,7 +62,10 @@ public function compile(CompilationContext $compilationContext) if (isset($this->statement['elseif_statements'])) { foreach ($this->statement['elseif_statements'] as $key => $statement) { - $this->statement['elseif_statements'][$key]['condition'] = $expr->optimize($statement['expr'], $compilationContext); + $this->statement['elseif_statements'][$key]['condition'] = $expr->optimize( + $statement['expr'], + $compilationContext + ); ++$lastBranchId; $skipVariantInit->setVariablesToSkip($lastBranchId, $expr->getUsedVariables()); @@ -71,9 +80,9 @@ public function compile(CompilationContext $compilationContext) $symbolTable = $compilationContext->symbolTable; foreach ($skipVariantInit->getVariables() as $variable) { - if ($symbolTable->hasVariable($variable)) { + if ($symbolTable->hasVariable((string)$variable)) { $symbolVariable = $symbolTable->getVariable($variable); - if ('variable' == $symbolVariable->getType()) { + if ('variable' === $symbolVariable->getType()) { if (!$readDetector->detect($variable, $exprRaw)) { $symbolVariable->initVariant($compilationContext); $symbolVariable->skipInitVariant(2); @@ -83,50 +92,48 @@ public function compile(CompilationContext $compilationContext) } } - $compilationContext->codePrinter->output('if ('.$condition.') {'); + $compilationContext->codePrinter->output('if (' . $condition . ') {'); $this->evalExpression = $expr; /** * Try to mark latest temporary variable used as idle. */ $evalVariable = $expr->getEvalVariable(); - if (\is_object($evalVariable)) { - if ($evalVariable->isTemporal()) { - $evalVariable->setIdle(true); - } + if (is_object($evalVariable)) { + $this->checkVariableTemporal($evalVariable); } - /* + /** * Compile statements in the 'if' block */ if (isset($this->statement['statements'])) { - $st = new StatementsBlock($this->statement['statements']); + $st = new StatementsBlock($this->statement['statements']); $branch = $st->compile($compilationContext, $expr->isUnreachable(), Branch::TYPE_CONDITIONAL_TRUE); $branch->setRelatedStatement($this); } - /* + /** * Compile statements in the 'elseif' block */ if (isset($this->statement['elseif_statements'])) { - foreach ($this->statement['elseif_statements'] as $key => $statement) { + foreach ($this->statement['elseif_statements'] as $statement) { if (!isset($statement['statements'])) { continue; } $st = new StatementsBlock($statement['statements']); - $compilationContext->codePrinter->output('} else if ('.$statement['condition'].') {'); + $compilationContext->codePrinter->output('} else if (' . $statement['condition'] . ') {'); $branch = $st->compile($compilationContext, $expr->isUnreachable(), Branch::TYPE_CONDITIONAL_TRUE); $branch->setRelatedStatement($this); } } - /* + /** * Compile statements in the 'else' block */ if (isset($this->statement['else_statements'])) { $compilationContext->codePrinter->output('} else {'); - $st = new StatementsBlock($this->statement['else_statements']); + $st = new StatementsBlock($this->statement['else_statements']); $branch = $st->compile($compilationContext, $expr->isUnreachableElse(), Branch::TYPE_CONDITIONAL_FALSE); $branch->setRelatedStatement($this); } diff --git a/Library/Statements/Let/ArrayIndex.php b/src/Statements/Let/ArrayIndex.php similarity index 56% rename from Library/Statements/Let/ArrayIndex.php rename to src/Statements/Let/ArrayIndex.php index c42e9d7e29..0aa4c4eb12 100644 --- a/Library/Statements/Let/ArrayIndex.php +++ b/src/Statements/Let/ArrayIndex.php @@ -9,14 +9,21 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\GlobalConstant; -use Zephir\Variable as ZephirVariable; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable as ZephirVariable; + +use function count; +use function sprintf; /** * ArrayIndex. @@ -25,6 +32,8 @@ */ class ArrayIndex { + use VariablesTrait; + /** * Compiles foo[y] = {expr}. * @@ -36,37 +45,33 @@ class ArrayIndex * * @throws CompilerException */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) - { + public function assign( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + $statement + ): void { /* * Arrays must be stored in the HEAP */ - if ($symbolVariable->isLocalOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is local only", $statement); - } - - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - if ($symbolVariable->isReadOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is read only", $statement); - } - - if ($symbolVariable->isLocalOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is local only", $statement); - } + $this->checkVariableInitialized($variable, $symbolVariable, $statement); + $this->checkVariableReadOnly($variable, $symbolVariable, $statement); + $this->checkVariableLocalOnly($variable, $symbolVariable, $statement); /* * Only dynamic variables can be used as arrays */ if ($symbolVariable->isNotVariableAndArray()) { - throw new CompilerException("Cannot use variable type: '".$symbolVariable->getType()."' as array", $statement); + throw CompilerException::cannotUseAsArray( + $symbolVariable->getType(), + $statement + ); } if ('variable' == $symbolVariable->getType()) { if ($symbolVariable->hasAnyDynamicType('unknown')) { - throw new CompilerException('Cannot use non-initialized variable as an object', $statement); + throw CompilerException::cannotUseNonInitializedVariableAsObject($statement); } /* @@ -83,112 +88,92 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres /* * Choose one-offset or multiple-offset functions */ - if (1 == \count($statement['index-expr'])) { - $this->_assignArrayIndexSingle($variable, $symbolVariable, $resolvedExpr, $compilationContext, $statement); + if (1 == count($statement['index-expr'])) { + $this->_assignArrayIndexSingle($symbolVariable, $resolvedExpr, $compilationContext, $statement); } else { - $this->_assignArrayIndexMultiple($variable, $symbolVariable, $resolvedExpr, $compilationContext, $statement); + $this->_assignArrayIndexMultiple( + $variable, + $symbolVariable, + $resolvedExpr, + $compilationContext, + $statement + ); } } /** - * Resolves an item that will be assigned to an array offset. + * Compiles foo[y][x] = {expr} (multiple offset). * + * @param string $variable + * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext + * @param array $statement * * @throws CompilerException - * - * @return GlobalConstant|ZephirVariable + * @throws Exception */ - protected function _getResolvedArrayItem(CompiledExpression $resolvedExpr, CompilationContext $compilationContext) - { - switch ($resolvedExpr->getType()) { - case 'null': - $symbolVariable = new GlobalConstant('ZEPHIR_GLOBAL(global_null)'); - break; - - case 'int': - case 'uint': - case 'long': - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $resolvedExpr->getOriginal()); - $compilationContext->backend->assignLong($symbolVariable, $resolvedExpr->getCode(), $compilationContext); - break; - - case 'char': - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $resolvedExpr->getOriginal()); - $compilationContext->backend->assignLong($symbolVariable, '\''.$resolvedExpr->getCode().'\'', $compilationContext); - break; - - case 'double': - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $resolvedExpr->getOriginal()); - $compilationContext->backend->assignDouble($symbolVariable, $resolvedExpr->getCode(), $compilationContext); - break; - - case 'bool': - if ('1' == $resolvedExpr->getBooleanCode()) { - $symbolVariable = new GlobalConstant('ZEPHIR_GLOBAL(global_true)'); - } else { - if ('0' == $resolvedExpr->getBooleanCode()) { - $symbolVariable = new GlobalConstant('ZEPHIR_GLOBAL(global_false)'); - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $resolvedExpr->getOriginal()); - $compilationContext->backend->assignBool($symbolVariable, $resolvedExpr->getBooleanCode(), $compilationContext); - } - } - break; - - case 'string': - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $resolvedExpr->getOriginal()); - $compilationContext->backend->assignString($symbolVariable, $resolvedExpr->getCode(), $compilationContext); - break; + protected function _assignArrayIndexMultiple( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + $statement + ): void { + $offsetExprs = []; - case 'array': - $symbolVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $resolvedExpr->getOriginal()); - break; + foreach ($statement['index-expr'] as $indexExpr) { + $expression = new Expression($indexExpr); + $expression->setReadOnly(true); + $exprIndex = $expression->compile($compilationContext); - case 'variable': - $variableExpr = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $resolvedExpr->getOriginal()); - switch ($variableExpr->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $resolvedExpr->getOriginal()); - $compilationContext->backend->assignLong($symbolVariable, $variableExpr, $compilationContext); - break; + switch ($exprIndex->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'string': + case 'variable': + break; + default: + throw new CompilerException( + sprintf( + 'Index: %s cannot be used as array index in assignment without cast', + $exprIndex->getType() + ), + $indexExpr + ); + } - case 'double': - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $resolvedExpr->getOriginal()); - $compilationContext->backend->assignDouble($symbolVariable, $variableExpr, $compilationContext); - break; + $offsetExprs[] = $exprIndex; + } - case 'bool': - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $resolvedExpr->getOriginal()); - $compilationContext->backend->assignBool($symbolVariable, $variableExpr, $compilationContext); - break; + $compilationContext->headersManager->add('kernel/array'); - case 'variable': - case 'string': - case 'array': - $symbolVariable = $variableExpr; - break; + /** + * Create a temporal zval (if needed). + */ + $symbolVariable = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); - default: - throw new CompilerException('Variable: '.$variableExpr->getType().' cannot be assigned to array offset', $resolvedExpr->getOriginal()); - } - break; + $targetVariable = $compilationContext->symbolTable->getVariableForWrite( + $variable, + $compilationContext, + $statement + ); - default: - throw new CompilerException('Expression: '.$resolvedExpr->getType().' cannot be assigned to array offset', $resolvedExpr->getOriginal()); - } + $compilationContext->backend->assignArrayMulti( + $targetVariable, + $symbolVariable, + $offsetExprs, + $compilationContext + ); - return $symbolVariable; + $this->checkVariableTemporal($symbolVariable); } /** * Compiles foo[y] = {expr} (one offset). * - * @param string $variable * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext @@ -196,10 +181,14 @@ protected function _getResolvedArrayItem(CompiledExpression $resolvedExpr, Compi * * @throws CompilerException */ - protected function _assignArrayIndexSingle($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) - { + protected function _assignArrayIndexSingle( + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + $statement + ): void { $expression = new Expression($statement['index-expr'][0]); - $exprIndex = $expression->compile($compilationContext); + $exprIndex = $expression->compile($compilationContext); switch ($exprIndex->getType()) { case 'int': @@ -210,14 +199,19 @@ protected function _assignArrayIndexSingle($variable, ZephirVariable $symbolVari case 'variable': break; default: - throw new CompilerException('Index: '.$exprIndex->getType().' cannot be used as array offset in assignment without cast', $statement['index-expr'][0]); + throw new CompilerException( + 'Index: ' + . $exprIndex->getType() + . ' cannot be used as array offset in assignment without cast', + $statement['index-expr'][0] + ); } /** * Create a temporal zval (if needed). */ $realSymbolVariable = $symbolVariable; - $symbolVariable = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); + $symbolVariable = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); $flags = 'PH_COPY | PH_SEPARATE'; @@ -229,11 +223,21 @@ protected function _assignArrayIndexSingle($variable, ZephirVariable $symbolVari case 'long': case 'ulong': case 'string': - $compilationContext->backend->updateArray($realSymbolVariable, $exprIndex, $symbolVariable, $compilationContext, $flags); + $compilationContext->backend->updateArray( + $realSymbolVariable, + $exprIndex, + $symbolVariable, + $compilationContext, + $flags + ); break; case 'variable': - $variableIndex = $compilationContext->symbolTable->getVariableForRead($exprIndex->getCode(), $compilationContext, $statement); + $variableIndex = $compilationContext->symbolTable->getVariableForRead( + $exprIndex->getCode(), + $compilationContext, + $statement + ); switch ($variableIndex->getType()) { case 'int': case 'uint': @@ -241,86 +245,189 @@ protected function _assignArrayIndexSingle($variable, ZephirVariable $symbolVari case 'ulong': case 'string': case 'variable': - $compilationContext->backend->updateArray($realSymbolVariable, $variableIndex, $symbolVariable, $compilationContext, $flags); + $compilationContext->backend->updateArray( + $realSymbolVariable, + $variableIndex, + $symbolVariable, + $compilationContext, + $flags + ); break; default: - throw new CompilerException('Variable: '.$variableIndex->getType().' cannot be used as array index', $statement); + throw new CompilerException( + 'Variable: ' + . $variableIndex->getType() + . ' cannot be used as array index', + $statement + ); } break; default: - throw new CompilerException('Value: '.$exprIndex->getType().' cannot be used as array index', $statement); + throw new CompilerException( + 'Value: ' . $exprIndex->getType() . ' cannot be used as array index', + $statement + ); } } /** - * Compiles foo[y][x] = {expr} (multiple offset). + * Resolves an item that will be assigned to an array offset. * - * @param string $variable - * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext - * @param array $statement + * + * @return GlobalConstant|ZephirVariable * * @throws CompilerException - * @throws \Zephir\Exception */ - protected function _assignArrayIndexMultiple( - $variable, - ZephirVariable $symbolVariable, - CompiledExpression $resolvedExpr, - CompilationContext $compilationContext, - $statement - ) { - $offsetExprs = []; + protected function _getResolvedArrayItem(CompiledExpression $resolvedExpr, CompilationContext $compilationContext) + { + switch ($resolvedExpr->getType()) { + case 'null': + $symbolVariable = new GlobalConstant('ZEPHIR_GLOBAL(global_null)'); + break; - foreach ($statement['index-expr'] as $indexExpr) { - $expression = new Expression($indexExpr); - $expression->setReadOnly(true); - $exprIndex = $expression->compile($compilationContext); + case 'int': + case 'uint': + case 'long': + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $resolvedExpr->getOriginal() + ); + $compilationContext->backend->assignLong( + $symbolVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + break; - switch ($exprIndex->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'string': - case 'variable': - break; - default: - throw new CompilerException( - sprintf( - 'Index: %s cannot be used as array index in assignment without cast', - $exprIndex->getType() - ), - $indexExpr - ); - } + case 'char': + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $resolvedExpr->getOriginal() + ); + $compilationContext->backend->assignLong( + $symbolVariable, + '\'' . $resolvedExpr->getCode() . '\'', + $compilationContext + ); + break; - $offsetExprs[] = $exprIndex; - } + case 'double': + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $resolvedExpr->getOriginal() + ); + $compilationContext->backend->assignDouble( + $symbolVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + break; - $compilationContext->headersManager->add('kernel/array'); + case 'bool': + if ('1' == $resolvedExpr->getBooleanCode()) { + $symbolVariable = new GlobalConstant('ZEPHIR_GLOBAL(global_true)'); + } else { + if ('0' == $resolvedExpr->getBooleanCode()) { + $symbolVariable = new GlobalConstant('ZEPHIR_GLOBAL(global_false)'); + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $resolvedExpr->getOriginal() + ); + $compilationContext->backend->assignBool( + $symbolVariable, + $resolvedExpr->getBooleanCode(), + $compilationContext + ); + } + } + break; - /** - * Create a temporal zval (if needed). - */ - $symbolVariable = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); + case 'string': + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $resolvedExpr->getOriginal() + ); + $compilationContext->backend->assignString( + $symbolVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + break; - $targetVariable = $compilationContext->symbolTable->getVariableForWrite( - $variable, - $compilationContext, - $statement - ); + case 'array': + $symbolVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $resolvedExpr->getOriginal() + ); + break; - $compilationContext->backend->assignArrayMulti( - $targetVariable, - $symbolVariable, - $offsetExprs, - $compilationContext - ); + case 'variable': + $variableExpr = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $resolvedExpr->getOriginal() + ); + switch ($variableExpr->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $resolvedExpr->getOriginal() + ); + $compilationContext->backend->assignLong($symbolVariable, $variableExpr, $compilationContext); + break; + + case 'double': + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $resolvedExpr->getOriginal() + ); + $compilationContext->backend->assignDouble($symbolVariable, $variableExpr, $compilationContext); + break; + + case 'bool': + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $resolvedExpr->getOriginal() + ); + $compilationContext->backend->assignBool($symbolVariable, $variableExpr, $compilationContext); + break; + + case 'variable': + case 'string': + case 'array': + $symbolVariable = $variableExpr; + break; - if ($symbolVariable->isTemporal()) { - $symbolVariable->setIdle(true); + default: + throw new CompilerException( + 'Variable: ' . $variableExpr->getType() . ' cannot be assigned to array offset', + $resolvedExpr->getOriginal() + ); + } + break; + + default: + throw new CompilerException( + 'Expression: ' . $resolvedExpr->getType() . ' cannot be assigned to array offset', + $resolvedExpr->getOriginal() + ); } + + return $symbolVariable; } } diff --git a/Library/Statements/Let/ArrayIndexAppend.php b/src/Statements/Let/ArrayIndexAppend.php similarity index 63% rename from Library/Statements/Let/ArrayIndexAppend.php rename to src/Statements/Let/ArrayIndexAppend.php index 270d8ff754..4aca7cbbc6 100644 --- a/Library/Statements/Let/ArrayIndexAppend.php +++ b/src/Statements/Let/ArrayIndexAppend.php @@ -9,13 +9,15 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * ArrayIndexAppend. @@ -35,36 +37,32 @@ class ArrayIndexAppend extends ArrayIndex * * @throws CompilerException */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) - { + public function assign( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + $statement + ): void { /* * Arrays must be stored in the HEAP */ - if ($symbolVariable->isLocalOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is local only", $statement); - } - - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } - - if ($symbolVariable->isReadOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is read only", $statement); - } - - if ($symbolVariable->isLocalOnly()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is local only", $statement); - } + $this->checkVariableInitialized($variable, $symbolVariable, $statement); + $this->checkVariableReadOnly($variable, $symbolVariable, $statement); + $this->checkVariableLocalOnly($variable, $symbolVariable, $statement); /* * Only dynamic variables and arrays can be used as arrays */ if ($symbolVariable->isNotVariableAndArray()) { - throw new CompilerException("Cannot use variable type: '".$symbolVariable->getType()."' as array", $statement); + throw CompilerException::cannotUseAsArray( + $symbolVariable->getType(), + $statement + ); } if ($symbolVariable->hasAnyDynamicType('unknown')) { - throw new CompilerException('Cannot use non-initialized variable as an object', $statement); + throw CompilerException::cannotUseNonInitializedVariableAsObject($statement); } /* @@ -89,8 +87,13 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres * @param CompilationContext $compilationContext * @param array $statement */ - protected function _assignArrayIndexMultiple($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) - { + protected function _assignArrayIndexMultiple( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + $statement + ): void { $offsetExprs = []; foreach ($statement['index-expr'] as $indexExpr) { $expression = new Expression($indexExpr); @@ -106,7 +109,12 @@ protected function _assignArrayIndexMultiple($variable, ZephirVariable $symbolVa case 'variable': break; default: - throw new CompilerException('Index: '.$exprIndex->getType().' cannot be used as array index in assignment without cast', $indexExpr); + throw new CompilerException( + 'Index: ' + . $exprIndex->getType() + . ' cannot be used as array index in assignment without cast', + $indexExpr + ); } $offsetExprs[] = $exprIndex; @@ -118,9 +126,18 @@ protected function _assignArrayIndexMultiple($variable, ZephirVariable $symbolVa * Create a temporal zval (if needed). */ $symbolVariable = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); - $targetVariable = $compilationContext->symbolTable->getVariableForWrite($variable, $compilationContext, $statement); + $targetVariable = $compilationContext->symbolTable->getVariableForWrite( + $variable, + $compilationContext, + $statement + ); $offsetExprs[] = 'a'; - $compilationContext->backend->assignArrayMulti($targetVariable, $symbolVariable, $offsetExprs, $compilationContext); + $compilationContext->backend->assignArrayMulti( + $targetVariable, + $symbolVariable, + $offsetExprs, + $compilationContext + ); } } diff --git a/src/Statements/Let/Decr.php b/src/Statements/Let/Decr.php new file mode 100644 index 0000000000..1eae8fc457 --- /dev/null +++ b/src/Statements/Let/Decr.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Zephir\CompilationContext; +use Zephir\Exception\CompilerException; +use Zephir\Traits\VariablesTrait; +use Zephir\Types\Types; +use Zephir\Variable\Variable as ZephirVariable; + +/** + * Decrements a variable + */ +class Decr +{ + use VariablesTrait; + + protected string $operator = '--'; + protected string $warningText = 'decrement'; + protected string $warningType = 'non-valid-decrement'; + protected string $zephirMethod = 'zephir_decrement'; + + /** + * Compiles x++/x--. + * + * @throws CompilerException + */ + public function assign( + string $variable, + ZephirVariable $symbolVariable, + CompilationContext $compilationContext, + array $statement + ): void { + if (!$symbolVariable->isInitialized()) { + throw new CompilerException( + "Cannot mutate variable '" + . $variable + . "' because it is not initialized", + $statement + ); + } + + /** + * TODO: implement increment of objects members + */ + $this->checkVariableReadOnly($variable, $symbolVariable, $statement); + + switch ($symbolVariable->getType()) { + case Types::T_INT: + case Types::T_UINT: + case Types::T_LONG: + case Types::T_ULONG: + case Types::T_DOUBLE: + case Types::T_CHAR: + case Types::T_UCHAR: + $compilationContext->codePrinter->output($variable . $this->operator . ';'); + break; + + case Types::T_VARIABLE: + /** + * Variable is probably not initialized here + */ + if ($symbolVariable->hasAnyDynamicType('unknown')) { + throw new CompilerException( + 'Attempt to ' + . $this->warningText + . ' uninitialized variable', + $statement + ); + } + + /** + * Decrement non-numeric variables could be expensive + */ + if (!$symbolVariable->hasAnyDynamicType(['undefined', 'int', 'long', 'double', 'uint'])) { + $compilationContext->logger->warning( + 'Possible attempt to ' + . $this->warningText + . ' non-numeric dynamic variable', + [$this->warningType, $statement] + ); + } + + $compilationContext->headersManager->add('kernel/operators'); + if (!$symbolVariable->isLocalOnly()) { + $symbolVariable->separate($compilationContext); + } + + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $compilationContext->codePrinter->output($this->zephirMethod . '(' . $symbol . ');'); + break; + + default: + throw new CompilerException( + 'Cannot ' + . $this->warningText + . ' variable: ' + . $symbolVariable->getType(), + $statement + ); + } + } +} diff --git a/src/Statements/Let/ExportSymbol.php b/src/Statements/Let/ExportSymbol.php new file mode 100644 index 0000000000..dc93f8cc18 --- /dev/null +++ b/src/Statements/Let/ExportSymbol.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Zephir\Code\Printer; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Statements\LetStatement; +use Zephir\Variable\Variable as ZephirVariable; + +/** + * Exports a symbol to the current PHP symbol table using a variable as parameter + */ +class ExportSymbol +{ + /** + * Compiles {var} = {expr}. + * + * @param string $variable + * @param ZephirVariable|null $symbolVariable + * @param CompiledExpression|null $resolvedExpr + * @param CompilationContext|null $compilationContext , + * @param array|null $statement + */ + public function assign( + $variable, + ZephirVariable $symbolVariable = null, + CompiledExpression $resolvedExpr = null, + CompilationContext $compilationContext = null, + $statement = null + ): void { + $codePrinter = $compilationContext->codePrinter; + + $variable = $compilationContext->symbolTable->getTempVariable( + 'variable', + $compilationContext + ); + $variable->setMustInitNull(true); + + $letStatement = new LetStatement([ + 'type' => 'let', + 'assignments' => [ + [ + 'assign-type' => 'variable', + 'variable' => $variable->getName(), + 'operator' => 'assign', + 'expr' => [ + 'type' => $resolvedExpr->getType(), + 'value' => $resolvedExpr->getCode(), + 'file' => $statement['file'], + 'line' => $statement['line'], + 'char' => $statement['char'], + ], + 'file' => $statement['file'], + 'line' => $statement['line'], + 'char' => $statement['char'], + ], + ], + ]); + $letStatement->compile($compilationContext); + + $this->getOutput( + $compilationContext, + $symbolVariable, + $variable, + $codePrinter, + $statement + ); + } + + /** + * @param CompilationContext|null $compilationContext + * @param ZephirVariable|null $symbolVariable + * @param ZephirVariable $variable + * @param Printer|null $codePrinter + * @param array|null $statement + * + * @return void + */ + protected function getOutput( + ?CompilationContext $compilationContext, + ?ZephirVariable $symbolVariable, + ZephirVariable $variable, + ?Printer $codePrinter, + ?array $statement + ): void { + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + $variable = $compilationContext->backend->getVariableCode($variable); + + $codePrinter->output('if (zephir_set_symbol(' . $symbol . ', ' . $variable . ') == FAILURE) {'); + $codePrinter->output("\t" . 'return;'); + $codePrinter->output('}'); + } +} diff --git a/src/Statements/Let/ExportSymbolString.php b/src/Statements/Let/ExportSymbolString.php new file mode 100644 index 0000000000..2d7cbb28c0 --- /dev/null +++ b/src/Statements/Let/ExportSymbolString.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Zephir\Code\Printer; +use Zephir\CompilationContext; +use Zephir\Variable\Variable as ZephirVariable; + +/** + * ExportSymbolString. + * + * Exports a symbol to the current PHP symbol table using a variable as parameter + */ +class ExportSymbolString extends ExportSymbol +{ + /** + * Compiles {"var"} = {expr}. + */ + + /** + * @param CompilationContext|null $compilationContext + * @param ZephirVariable|null $symbolVariable + * @param ZephirVariable $variable + * @param Printer|null $codePrinter + * @param array|null $statement + * + * @return void + */ + protected function getOutput( + ?CompilationContext $compilationContext, + ?ZephirVariable $symbolVariable, + ZephirVariable $variable, + ?Printer $codePrinter, + ?array $statement + ): void { + $symbol = $compilationContext->backend->getVariableCode($variable); + $codePrinter->output( + 'if (zephir_set_symbol_str(SS("' . $statement['variable'] . '"), ' . $symbol . ') == FAILURE) {' + ); + $codePrinter->output(' return;'); + $codePrinter->output('}'); + } +} diff --git a/src/Statements/Let/Incr.php b/src/Statements/Let/Incr.php new file mode 100644 index 0000000000..801c3fc307 --- /dev/null +++ b/src/Statements/Let/Incr.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +/** + * Incr. + * + * Increments a variable + */ +class Incr extends Decr +{ + protected string $operator = '++'; + protected string $warningText = 'increment'; + protected string $warningType = 'non-valid-increment'; + protected string $zephirMethod = 'zephir_increment'; +} diff --git a/src/Statements/Let/ObjectDynamicProperty.php b/src/Statements/Let/ObjectDynamicProperty.php new file mode 100644 index 0000000000..798727b70d --- /dev/null +++ b/src/Statements/Let/ObjectDynamicProperty.php @@ -0,0 +1,258 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Exception; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception\CompilerException; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable as ZephirVariable; + +/** + * Updates object properties dynamically + */ +class ObjectDynamicProperty +{ + use VariablesTrait; + + /** + * Compiles foo->{x} = {expr}. + * + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param array $statement + * + * @throws CompilerException + * @throws Exception + */ + public function assign( + string $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + array $statement + ): void { + $this->checkVariableInitialized($variable, $symbolVariable, $statement); + + if (!$symbolVariable->isVariable()) { + throw new CompilerException( + "Variable type '" . $symbolVariable->getType() . "' cannot be used as object", + $statement + ); + } + + $propertyName = $statement['property']; + + $propertyVariable = $compilationContext->symbolTable->getVariableForRead( + $propertyName, + $compilationContext, + $statement + ); + if ($propertyVariable->isNotVariableAndMixedAndString()) { + throw new CompilerException( + "Cannot use variable type '" . $propertyVariable->getType() . "' to update object property", + $statement + ); + } + + if (!$symbolVariable->isInitialized()) { + throw new CompilerException( + "Cannot mutate static property '" . $compilationContext->classDefinition->getCompleteName( + ) . '::' . $propertyName . "' because it is not initialized", + $statement + ); + } + + if (!$symbolVariable->isVariable()) { + throw CompilerException::cannotUseVariableTypeAs( + $symbolVariable, + 'as an object', + $statement + ); + } + + if ($symbolVariable->hasAnyDynamicType('unknown')) { + throw CompilerException::cannotUseNonInitializedVariableAsObject($statement); + } + + /** + * Trying to use a non-object dynamic variable as object + */ + if ($symbolVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { + $compilationContext->logger->warning( + 'Possible attempt to update property on non-object dynamic property', + ['non-valid-objectupdate', $statement] + ); + } + + $codePrinter = $compilationContext->codePrinter; + $compilationContext->headersManager->add('kernel/object'); + + $propertyVariableName = $compilationContext->symbolTable->getVariable($propertyName); + + switch ($resolvedExpr->getType()) { + case 'null': + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyVariableName, + 'null', + $compilationContext + ); + break; + + case 'int': + case 'long': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getCode(), $compilationContext); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyVariableName, + $tempVariable, + $compilationContext + ); + break; + + case 'string': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignString( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyVariableName, + $tempVariable, + $compilationContext + ); + break; + + case 'bool': + if ('1' == $resolvedExpr->getBooleanCode()) { + $value = 'true'; + } elseif ('0' == $resolvedExpr->getBooleanCode()) { + $value = 'false'; + } else { + throw new Exception('?'); + } + + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyVariableName, + $value, + $compilationContext + ); + break; + + case 'empty-array': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $codePrinter->output('array_init(' . $tempVariable->getName() . ');'); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyVariableName, + $tempVariable, + $compilationContext + ); + break; + + case 'array': + $variableVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyVariableName, + $variableVariable, + $compilationContext + ); + break; + + case 'variable': + $variableVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + switch ($variableVariable->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong($tempVariable, $variableVariable, $compilationContext); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyVariableName, + $tempVariable, + $compilationContext + ); + break; + + case 'bool': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignBool($tempVariable, $variableVariable, $compilationContext); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyVariableName, + $tempVariable, + $compilationContext + ); + break; + + case 'string': + case 'variable': + case 'array': + case 'mixed': + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyVariable, + $resolvedExpr, + $compilationContext + ); + + $this->checkVariableTemporal($symbolVariable); + break; + + default: + throw new CompilerException('Unknown type ' . $variableVariable->getType(), $statement); + } + break; + + default: + throw new CompilerException('Unknown type ' . $resolvedExpr->getType(), $statement); + } + } +} diff --git a/src/Statements/Let/ObjectDynamicStringProperty.php b/src/Statements/Let/ObjectDynamicStringProperty.php new file mode 100644 index 0000000000..4ec9aff495 --- /dev/null +++ b/src/Statements/Let/ObjectDynamicStringProperty.php @@ -0,0 +1,250 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Exception; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception\CompilerException; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable as ZephirVariable; + +use function gettype; +use function is_string; + +/** + * Updates object properties dynamically + */ +class ObjectDynamicStringProperty +{ + use VariablesTrait; + + /** + * Compiles foo->{"x"} = {expr}. + * + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param array $statement + * + * @throws CompilerException + * @throws Exception + */ + public function assign( + string $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + array $statement + ): void { + $this->checkVariableInitialized($variable, $symbolVariable, $statement); + + if ('variable' !== $symbolVariable->getType()) { + throw new CompilerException( + "Variable type '" . $symbolVariable->getType() . "' cannot be used as object", + $statement + ); + } + + $propertyName = $statement['property']; + + if (!is_string($propertyName)) { + throw new CompilerException( + 'Expected string to update object property, ' . gettype($propertyName) . ' received', + $statement + ); + } + + if (!$symbolVariable->isInitialized()) { + throw new CompilerException( + "Cannot mutate static property '" . $compilationContext->classDefinition->getCompleteName( + ) . '::' . $propertyName . "' because it is not initialized", + $statement + ); + } + + if ('variable' != $symbolVariable->getType()) { + throw CompilerException::cannotUseVariableTypeAs( + $symbolVariable, + 'as an object', + $statement + ); + } + + if ($symbolVariable->hasAnyDynamicType('unknown')) { + throw CompilerException::cannotUseNonInitializedVariableAsObject($statement); + } + + /** + * Trying to use a non-object dynamic variable as object + */ + if ($symbolVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { + $compilationContext->logger->warning( + 'Possible attempt to update property on non-object dynamic property', + ['non-valid-objectupdate', $statement] + ); + } + + $compilationContext->headersManager->add('kernel/object'); + + switch ($resolvedExpr->getType()) { + case 'null': + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyName, + 'null', + $compilationContext + ); + break; + + case 'int': + case 'long': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getCode(), $compilationContext); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyName, + $tempVariable, + $compilationContext + ); + break; + + case 'string': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignString( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyName, + $tempVariable, + $compilationContext + ); + break; + + case 'bool': + if ('1' == $resolvedExpr->getBooleanCode()) { + $value = 'true'; + } elseif ('0' == $resolvedExpr->getBooleanCode()) { + $value = 'false'; + } else { + throw new Exception('?'); + } + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyName, + $value, + $compilationContext + ); + break; + + case 'empty-array': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->initArray($tempVariable, $compilationContext); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyName, + $tempVariable, + $compilationContext + ); + break; + + case 'array': + $variableVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyName, + $variableVariable, + $compilationContext + ); + break; + + case 'variable': + $variableVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + switch ($variableVariable->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong($tempVariable, $variableVariable, $compilationContext); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyName, + $tempVariable, + $compilationContext + ); + break; + + case 'bool': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignBool($tempVariable, $variableVariable, $compilationContext); + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyName, + $tempVariable, + $compilationContext + ); + break; + + case 'string': + case 'variable': + case 'array': + $compilationContext->backend->updateProperty( + $symbolVariable, + $propertyName, + $resolvedExpr, + $compilationContext + ); + $this->checkVariableTemporal($symbolVariable); + break; + + default: + throw new CompilerException('Unknown type ' . $variableVariable->getType(), $statement); + } + break; + + default: + throw new CompilerException('Unknown type ' . $resolvedExpr->getType(), $statement); + } + } +} diff --git a/Library/Statements/Let/ObjectProperty.php b/src/Statements/Let/ObjectProperty.php similarity index 74% rename from Library/Statements/Let/ObjectProperty.php rename to src/Statements/Let/ObjectProperty.php index e7e8dc9e8c..482e21b131 100644 --- a/Library/Statements/Let/ObjectProperty.php +++ b/src/Statements/Let/ObjectProperty.php @@ -15,26 +15,30 @@ use Zephir\CompilationContext as Context; use Zephir\CompiledExpression as Expression; +use Zephir\Exception\CompilerException; use Zephir\Exception\CompilerException as Exception; -use Zephir\Variable as ZephirVariable; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable as ZephirVariable; + +use function sprintf; /** * Adds/Updates an array index */ class ObjectProperty { + use VariablesTrait; + /** * Compiles foo->x = {expr}. * - * @param string $variable + * @param string $variable * @param ZephirVariable $symbolVariable - * @param Expression $expression - * @param Context $context - * @param array $statement + * @param Expression $expression + * @param Context $context + * @param array $statement * * @return void - * - * @throws Exception */ public function assign( string $variable, @@ -42,7 +46,7 @@ public function assign( Expression $expression, Context $context, array $statement - ) { + ): void { if (!$symbolVariable->isInitialized()) { throw new Exception( "Cannot mutate variable '{$variable}' because it is not initialized", @@ -58,7 +62,7 @@ public function assign( } $propertyName = $statement['property']; - $className = $context->classDefinition->getCompleteName(); + $className = $context->classDefinition->getCompleteName(); if (!$symbolVariable->isInitialized()) { throw new Exception( @@ -79,7 +83,7 @@ public function assign( } if ($symbolVariable->hasAnyDynamicType('unknown')) { - throw new Exception('Cannot use non-initialized variable as an object', $statement); + throw CompilerException::cannotUseNonInitializedVariableAsObject($statement); } /* @@ -135,8 +139,18 @@ public function assign( $resolvedVariable = $context->symbolTable->getTempVariableForWrite('variable', $context); $context->backend->assignLong($resolvedVariable, $expression->getBooleanCode(), $context); - $context->backend->fetchProperty($tempVariable, $symbolVariable, $propertyName, false, $context); - $codePrinter->output($functionName.'('.$context->backend->getVariableCode($tempVariable).', '.$context->backend->getVariableCode($resolvedVariable).')'); + $context->backend->fetchProperty( + $tempVariable, + $symbolVariable, + $propertyName, + false, + $context + ); + $codePrinter->output( + $functionName . '(' . $context->backend->getVariableCode( + $tempVariable + ) . ', ' . $context->backend->getVariableCode($resolvedVariable) . ')' + ); break; case 'assign': @@ -145,7 +159,13 @@ public function assign( break; default: - throw new Exception("Operator '".$statement['operator']."' is not supported for object property: ".$tempVariable->getType(), $statement); + throw new Exception( + "Operator '" + . $statement['operator'] + . "' is not supported for object property: " + . $tempVariable->getType(), + $statement + ); } $context->backend->updateProperty($symbolVariable, $propertyName, $tempVariable, $context); @@ -157,11 +177,21 @@ public function assign( switch ($statement['operator']) { case 'assign': $tempVariable->initNonReferenced($context); - $context->backend->assignLong($tempVariable, '\''.$expression->getBooleanCode().'\'', $context); + $context->backend->assignLong( + $tempVariable, + '\'' . $expression->getBooleanCode() . '\'', + $context + ); break; default: - throw new Exception("Operator '".$statement['operator']."' is not supported for object property: ".$tempVariable->getType(), $statement); + throw new Exception( + "Operator '" + . $statement['operator'] + . "' is not supported for object property: " + . $tempVariable->getType(), + $statement + ); } $context->backend->updateProperty($symbolVariable, $propertyName, $tempVariable, $context); @@ -188,8 +218,18 @@ public function assign( $resolvedVariable = $context->symbolTable->getTempVariableForWrite('variable', $context); $context->backend->assignDouble($resolvedVariable, $expression->getBooleanCode(), $context); - $context->backend->fetchProperty($tempVariable, $symbolVariable, $propertyName, false, $context); - $codePrinter->output($functionName.'('.$context->backend->getVariableCode($tempVariable).', '.$context->backend->getVariableCode($resolvedVariable).')'); + $context->backend->fetchProperty( + $tempVariable, + $symbolVariable, + $propertyName, + false, + $context + ); + $codePrinter->output( + $functionName . '(' . $context->backend->getVariableCode( + $tempVariable + ) . ', ' . $context->backend->getVariableCode($resolvedVariable) . ')' + ); break; case 'assign': @@ -198,7 +238,13 @@ public function assign( break; default: - throw new Exception("Operator '".$statement['operator']."' is not supported for object property: ".$tempVariable->getType(), $statement); + throw new Exception( + "Operator '" + . $statement['operator'] + . "' is not supported for object property: " + . $tempVariable->getType(), + $statement + ); } $context->backend->updateProperty($symbolVariable, $propertyName, $tempVariable, $context); @@ -210,7 +256,15 @@ public function assign( switch ($statement['operator']) { case 'concat-assign': - $codePrinter->output('zephir_concat_self_str(&'.$tempVariable->getName().', "'.$expression->getCode().'", sizeof("'.$expression->getCode().'") - 1);'); + $codePrinter->output( + 'zephir_concat_self_str(&' + . $tempVariable->getName() + . ', "' + . $expression->getCode() + . '", sizeof("' + . $expression->getCode() + . '") - 1);' + ); break; case 'assign': /* We only can use nonReferenced variables for not refcounted stuff in ZE3 */ @@ -228,7 +282,7 @@ public function assign( break; case 'bool': - $codePrinter->output('if ('.$expression->getBooleanCode().') {'); + $codePrinter->output('if (' . $expression->getBooleanCode() . ') {'); $codePrinter->increaseLevel(); $context->backend->updateProperty($symbolVariable, $propertyName, 'true', $context); $codePrinter->decreaseLevel(); @@ -249,7 +303,11 @@ public function assign( break; case 'variable': - $variableVariable = $context->symbolTable->getVariableForRead($expression->getCode(), $context, $statement); + $variableVariable = $context->symbolTable->getVariableForRead( + $expression->getCode(), + $context, + $statement + ); switch ($variableVariable->getType()) { case 'int': case 'uint': @@ -271,7 +329,7 @@ public function assign( break; case 'bool': - $codePrinter->output('if ('.$variableVariable->getName().') {'); + $codePrinter->output('if (' . $variableVariable->getName() . ') {'); $codePrinter->increaseLevel(); $context->backend->updateProperty($symbolVariable, $propertyName, 'true', $context); $codePrinter->decreaseLevel(); @@ -287,13 +345,11 @@ public function assign( case 'variable': case 'mixed': $context->backend->updateProperty($symbolVariable, $propertyName, $variableVariable, $context); - if ($symbolVariable->isTemporal()) { - $symbolVariable->setIdle(true); - } + $this->checkVariableTemporal($symbolVariable); break; default: - throw new Exception('Unknown type '.$variableVariable->getType(), $statement); + throw new Exception('Unknown type ' . $variableVariable->getType(), $statement); } break; diff --git a/src/Statements/Let/ObjectPropertyAppend.php b/src/Statements/Let/ObjectPropertyAppend.php new file mode 100644 index 0000000000..b63edad376 --- /dev/null +++ b/src/Statements/Let/ObjectPropertyAppend.php @@ -0,0 +1,329 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception\CompilerException; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable as ZephirVariable; + +use function current; + +/** + * ObjectPropertyAppend. + * + * Appends a value to a property + */ +class ObjectPropertyAppend +{ + use VariablesTrait; + + /** + * Compiles x->y[] = foo. + * + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param array $statement + * + * @throws CompilerException + */ + public function assign( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + array $statement + ): void { + $this->checkVariableInitialized($variable, $symbolVariable, $statement); + + if (!$symbolVariable->isVariable()) { + throw new CompilerException( + 'Attempt to use variable type: ' . $symbolVariable->getType() . ' as object', + $statement + ); + } + + $codePrinter = $compilationContext->codePrinter; + + $property = $statement['property']; + + $compilationContext->headersManager->add('kernel/object'); + + /* + * Check if the variable to update is defined + */ + if ('this' == $symbolVariable->getRealName()) { + $classDefinition = $compilationContext->classDefinition; + $this->checkClassHasProperty( + $classDefinition, + $property, + $statement + ); + } else { + /* + * If we know the class related to a variable we could check if the property + * is defined on that class + */ + if ($symbolVariable->hasAnyDynamicType('object')) { + $classType = current($symbolVariable->getClassTypes()); + $compiler = $compilationContext->compiler; + + if ($compiler->isClass($classType)) { + $classDefinition = $compiler->getClassDefinition($classType); + if (!$classDefinition) { + throw new CompilerException( + 'Cannot locate class definition for class: ' . $classType, + $statement + ); + } + + $this->checkClassHasProperty( + $classDefinition, + $property, + $statement, + $classType + ); + } + } + } + + switch ($resolvedExpr->getType()) { + case 'null': + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + 'null', + $compilationContext + ); + break; + + case 'bool': + $codePrinter->output('if (' . $resolvedExpr->getBooleanCode() . ') {'); + $codePrinter->increaseLevel(); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + 'true', + $compilationContext + ); + $codePrinter->decreaseLevel(); + $codePrinter->output('} else {'); + $codePrinter->increaseLevel(); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + 'false', + $compilationContext + ); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + break; + + case 'char': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignLong( + $tempVariable, + '\'' . $resolvedExpr->getCode() . '\'', + $compilationContext + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'int': + case 'long': + case 'uint': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignLong($tempVariable, $resolvedExpr->getCode(), $compilationContext); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'double': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignDouble( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'string': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $tempVariable->initVariant($compilationContext); + $compilationContext->backend->assignString( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'array': + $variableExpr = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + $variableExpr, + $compilationContext + ); + break; + + case 'variable': + $variableExpr = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + switch ($variableExpr->getType()) { + case 'int': + case 'long': + case 'uint': + case 'char': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignLong($tempVariable, $variableExpr, $compilationContext); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'double': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignDouble($tempVariable, $variableExpr, $compilationContext); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'bool': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignBool($tempVariable, $variableExpr, $compilationContext); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'variable': + case 'mixed': + case 'string': + case 'array': + case 'resource': + case 'object': + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + null, + $variableExpr, + $compilationContext + ); + $this->checkVariableTemporal($variableExpr); + break; + + default: + throw new CompilerException( + 'Variable: ' . $variableExpr->getType() . ' cannot be appended to array property', + $statement + ); + } + break; + + default: + throw new CompilerException( + 'Expression: ' . $resolvedExpr->getType() . ' cannot be appended to array property', + $statement + ); + } + } +} diff --git a/src/Statements/Let/ObjectPropertyArrayIndex.php b/src/Statements/Let/ObjectPropertyArrayIndex.php new file mode 100644 index 0000000000..ffdce4f363 --- /dev/null +++ b/src/Statements/Let/ObjectPropertyArrayIndex.php @@ -0,0 +1,551 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\Variable\Variable as ZephirVariable; + +use function count; +use function current; + +/** + * ObjectPropertyArrayIndex. + * + * Updates object properties dynamically + */ +class ObjectPropertyArrayIndex extends ArrayIndex +{ + /** + * Compiles x->y[z] = foo. + * + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext , + * @param array $statement + * + * @throws CompilerException + */ + public function assign( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + $statement + ): void { + if (!$symbolVariable->isInitialized()) { + throw new CompilerException( + "Cannot mutate variable '" + . $variable + . "' because it is not initialized", + $statement + ); + } + + if (!$symbolVariable->isVariable()) { + throw new CompilerException( + 'Attempt to use variable type: ' + . $symbolVariable->getType() + . ' as object', + $statement + ); + } + + /** + * Update the property according to the number of array-offsets + */ + $symbolVariable->setUsed(true); + if (1 == count($statement['index-expr'])) { + $this->_assignPropertyArraySingleIndex( + $variable, + $symbolVariable, + $resolvedExpr, + $compilationContext, + $statement + ); + } else { + $this->_assignPropertyArrayMultipleIndex( + $variable, + $symbolVariable, + $resolvedExpr, + $compilationContext, + $statement + ); + } + } + + /** + * Compiles x->y[a][b] = {expr} (multiple offset assignment). + * + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param array $statement + * + * @throws CompilerException + */ + protected function _assignPropertyArrayMultipleIndex( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + array $statement + ): void { + $property = $statement['property']; + $compilationContext->headersManager->add('kernel/object'); + + /** + * Create a temporal zval (if needed). + */ + $variableExpr = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); + + /** + * Only string/variable/int. + */ + $offsetExprs = []; + foreach ($statement['index-expr'] as $indexExpr) { + $indexExpression = new Expression($indexExpr); + + $resolvedIndex = $indexExpression->compile($compilationContext); + switch ($resolvedIndex->getType()) { + case 'string': + case 'int': + case 'uint': + case 'ulong': + case 'long': + case 'variable': + break; + default: + throw new CompilerException( + 'Expression: ' + . $resolvedIndex->getType() + . ' cannot be used as index without cast', + $statement['index-expr'] + ); + } + + $offsetExprs[] = $resolvedIndex; + } + + $compilationContext->backend->assignPropertyArrayMulti( + $symbolVariable, + $variableExpr, + $property, + $offsetExprs, + $compilationContext + ); + + $this->checkVariableTemporal($variableExpr); + } + + /** + * Compiles x->y[z] = {expr} (single offset assignment). + * + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param array $statement + * + * @throws CompilerException + */ + protected function _assignPropertyArraySingleIndex( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + array $statement + ): void { + $property = $statement['property']; + $compilationContext->headersManager->add('kernel/object'); + + /** + * Only string/variable/int. + */ + $indexExpression = new Expression($statement['index-expr'][0]); + $resolvedIndex = $indexExpression->compile($compilationContext); + + switch ($resolvedIndex->getType()) { + case 'string': + case 'int': + case 'uint': + case 'ulong': + case 'long': + case 'variable': + break; + default: + throw new CompilerException( + 'Expression: ' + . $resolvedIndex->getType() + . ' cannot be used as index without cast', + $statement + ); + } + + if ('variable' == $resolvedIndex->getType()) { + $indexVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedIndex->getCode(), + $compilationContext, + $statement + ); + switch ($indexVariable->getType()) { + case 'string': + case 'int': + case 'uint': + case 'ulong': + case 'long': + case 'variable': + case 'mixed': + break; + default: + throw new CompilerException( + 'Variable: ' + . $indexVariable->getType() + . ' cannot be used as index without cast', + $statement + ); + } + + if ('variable' == $indexVariable->getType()) { + if ($indexVariable->hasDifferentDynamicType(['undefined', 'int', 'string'])) { + $compilationContext->logger->warning( + 'Possible attempt to use non string/long dynamic variable as array index', + ['invalid-array-offset', $statement] + ); + } + } + } + + switch ($resolvedIndex->getType()) { + case 'int': + case 'uint': + case 'long': + $indexVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignLong( + $indexVariable, + $resolvedIndex->getCode(), + $compilationContext + ); + break; + + case 'string': + $indexVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignString( + $indexVariable, + $resolvedIndex->getCode(), + $compilationContext + ); + break; + + case 'variable': + $variableIndex = $compilationContext->symbolTable->getVariableForRead( + $resolvedIndex->getCode(), + $compilationContext, + $statement['index-expr'] + ); + switch ($variableIndex->getType()) { + case 'int': + case 'uint': + case 'long': + $indexVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignLong($indexVariable, $variableIndex, $compilationContext); + break; + } + break; + } + + /* + * Check if the variable to update is defined + */ + if ('this' == $symbolVariable->getRealName()) { + $classDefinition = $compilationContext->classDefinition; + $this->checkClassHasProperty( + $classDefinition, + $property, + $statement + ); + } else { + /** + * If we know the class related to a variable we could check if the property + * is defined on that class + */ + if ($symbolVariable->hasAnyDynamicType('object')) { + $classType = current($symbolVariable->getClassTypes()); + $compiler = $compilationContext->compiler; + + if ($classType !== false && $compiler->isClass($classType)) { + $classDefinition = $compiler->getClassDefinition($classType); + if (!$classDefinition) { + throw new CompilerException( + 'Cannot locate class definition for class: ' . $classType, + $statement + ); + } + + $this->checkClassHasProperty( + $classDefinition, + $property, + $statement, + $classType + ); + } + } + } + + switch ($indexVariable->getType()) { + case 'variable': + case 'mixed': + case 'string': + switch ($resolvedExpr->getType()) { + case 'null': + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + 'null', + $compilationContext + ); + break; + + case 'bool': + $booleanCode = $resolvedExpr->getBooleanCode(); + if ('1' == $booleanCode) { + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + 'true', + $compilationContext + ); + } elseif ('0' == $booleanCode) { + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + 'false', + $compilationContext + ); + } else { + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignBool($tempVariable, $booleanCode, $compilationContext); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + $tempVariable, + $compilationContext + ); + } + break; + + case 'int': + case 'long': + case 'uint': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + $tempVariable, + $compilationContext + ); + break; + + case 'char': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong( + $tempVariable, + '\'' . $resolvedExpr->getCode() . '\'', + $compilationContext + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + $tempVariable, + $compilationContext + ); + break; + + case 'double': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignDouble( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + $tempVariable, + $compilationContext + ); + break; + + case 'string': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignString( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + $tempVariable, + $compilationContext + ); + break; + + case 'array': + $variableExpr = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement['index-expr'] + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + $variableExpr, + $compilationContext + ); + break; + + case 'variable': + $variableExpr = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement['index-expr'] + ); + switch ($variableExpr->getType()) { + case 'bool': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignBool( + $tempVariable, + $variableExpr, + $compilationContext + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + $tempVariable, + $compilationContext + ); + break; + + case 'int': + case 'long': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong( + $tempVariable, + $variableExpr, + $compilationContext + ); + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + $tempVariable, + $compilationContext + ); + break; + + case 'variable': + case 'mixed': + case 'string': + case 'array': + $compilationContext->backend->assignArrayProperty( + $symbolVariable, + $property, + $indexVariable, + $variableExpr, + $compilationContext + ); + $this->checkVariableTemporal($variableExpr); + break; + + default: + throw new CompilerException( + 'Cannot update variable type: ' . $variableExpr->getType(), + $statement + ); + } + break; + + default: + throw new CompilerException( + 'Variable index: ' + . $indexVariable->getType() + . ' cannot be updated into array property', + $statement + ); + } + break; + + default: + throw new CompilerException( + 'Index: ' + . $resolvedIndex->getType() + . ' cannot be updated into array property', + $statement + ); + } + } +} diff --git a/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php b/src/Statements/Let/ObjectPropertyArrayIndexAppend.php similarity index 55% rename from Library/Statements/Let/ObjectPropertyArrayIndexAppend.php rename to src/Statements/Let/ObjectPropertyArrayIndexAppend.php index cb0f51d753..e0b1fccbe3 100644 --- a/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php +++ b/src/Statements/Let/ObjectPropertyArrayIndexAppend.php @@ -9,17 +9,22 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; + +use function count; +use function current; /** - * ObjectPropertyArrayIndexAppend. - * * Updates object properties dynamically */ class ObjectPropertyArrayIndexAppend extends ArrayIndex @@ -30,35 +35,45 @@ class ObjectPropertyArrayIndexAppend extends ArrayIndex * @param string $variable * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr - * @param CompilationContext $compilationContext, + * @param CompilationContext $compilationContext , * @param array $statement */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) - { - if (!$symbolVariable->isInitialized()) { - throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); - } + public function assign( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + $statement + ): void { + $this->checkVariableInitialized($variable, $symbolVariable, $statement); if (!$symbolVariable->isVariable()) { - throw new CompilerException('Attempt to use variable type: '.$symbolVariable->getType().' as object', $statement); + throw new CompilerException( + 'Attempt to use variable type: ' . $symbolVariable->getType() . ' as object', + $statement + ); } - $this->_assignPropertyArrayMultipleIndex($variable, $symbolVariable, $resolvedExpr, $compilationContext, $statement); + $this->_assignPropertyArrayMultipleIndex($symbolVariable, $resolvedExpr, $compilationContext, $statement); } /** * Compiles x->y[a][b][] = {expr} (multiple offset assignment). * - * @param string $variable * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext * @param array $statement * - * @throws CompilerException + * @throws ReflectionException + * @throws Exception */ - protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) - { + protected function _assignPropertyArrayMultipleIndex( + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + array $statement + ): void { $property = $statement['property']; $compilationContext->headersManager->add('kernel/object'); @@ -67,7 +82,7 @@ protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $ */ $variableExpr = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); - if (\count($statement['index-expr']) > 16) { + if (count($statement['index-expr']) > 16) { throw new CompilerException('Too many array indexes', $statement); } @@ -88,43 +103,62 @@ protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $ case 'variable': break; default: - throw new CompilerException('Expression: '.$resolvedIndex->getType().' cannot be used as index without cast', $statement); + throw new CompilerException( + 'Expression: ' + . $resolvedIndex->getType() + . ' cannot be used as index without cast', + $statement + ); } $offsetExprs[] = $resolvedIndex; } - /* + /** * Check if the property to update is defined */ if ('this' == $symbolVariable->getRealName()) { $classDefinition = $compilationContext->classDefinition; - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); - } + $this->checkClassHasProperty( + $classDefinition, + $property, + $statement + ); } else { - /* + /** * If we know the class related to a variable we could check if the property * is defined on that class */ if ($symbolVariable->hasAnyDynamicType('object')) { $classType = current($symbolVariable->getClassTypes()); - $compiler = $compilationContext->compiler; + $compiler = $compilationContext->compiler; if ($compiler->isClass($classType)) { $classDefinition = $compiler->getClassDefinition($classType); if (!$classDefinition) { - throw new CompilerException('Cannot locate class definition for class: '.$classType, $statement); + throw new CompilerException( + 'Cannot locate class definition for class: ' . $classType, + $statement + ); } - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classType."' does not have a property called: '".$property."'", $statement); - } + $this->checkClassHasProperty( + $classDefinition, + $property, + $statement, + $classType + ); } } } $offsetExprs[] = 'a'; - $compilationContext->backend->assignPropertyArrayMulti($symbolVariable, $variableExpr, $property, $offsetExprs, $compilationContext); + $compilationContext->backend->assignPropertyArrayMulti( + $symbolVariable, + $variableExpr, + $property, + $offsetExprs, + $compilationContext + ); } } diff --git a/src/Statements/Let/ObjectPropertyDecr.php b/src/Statements/Let/ObjectPropertyDecr.php new file mode 100644 index 0000000000..0ac5201b72 --- /dev/null +++ b/src/Statements/Let/ObjectPropertyDecr.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Zephir\CompilationContext; +use Zephir\Exception\CompilerException; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable as ZephirVariable; + +use function current; + +/** + * Decrements an object property + */ +class ObjectPropertyDecr +{ + use VariablesTrait; + + protected string $zephirMethod = 'zephir_property_decr'; + + /** + * Compiles obj->x++/obj->x--. + */ + public function assign( + string $variable, + string $property, + ZephirVariable $symbolVariable, + CompilationContext $compilationContext, + array $statement, + ): void { + $this->checkVariableInitialized($variable, $symbolVariable, $statement); + + /** + * Arrays must be stored in the HEAP + */ + $this->checkVariableLocalOnly($variable, $symbolVariable, $statement); + + /** + * Only dynamic variables can be used as arrays + */ + if (!$symbolVariable->isVariable()) { + throw CompilerException::cannotUseAsArray( + $symbolVariable->getType(), + $statement + ); + } + + if ($symbolVariable->hasAnyDynamicType('unknown')) { + throw CompilerException::cannotUseNonInitializedVariableAsObject($statement); + } + + /** + * Trying to use a non-object dynamic variable as object + */ + if ($symbolVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { + $compilationContext->logger->warning( + 'Possible attempt to increment non-object dynamic variable', + ['non-object-update', $statement] + ); + } + + /** + * Check if the variable to update is defined + */ + if ('this' === $symbolVariable->getRealName()) { + $this->checkClassHasProperty($compilationContext->classDefinition, $property, $statement); + } else { + /** + * If we know the class related to a variable we could check if the property + * is defined on that class + */ + if ($symbolVariable->hasAnyDynamicType('object')) { + $classType = current($symbolVariable->getClassTypes()); + $compiler = $compilationContext->compiler; + + if ($compiler->isClass($classType)) { + $classDefinition = $compiler->getClassDefinition($classType); + if (!$classDefinition) { + throw new CompilerException( + 'Cannot locate class definition for class: ' . $classType, + $statement + ); + } + + $this->checkClassHasProperty( + $classDefinition, + $property, + $statement, + $classType + ); + } + } + } + + $symbolVariable->setUsed(true); + $compilationContext->headersManager->add('kernel/object'); + $compilationContext->codePrinter->output( + 'RETURN_ON_FAILURE(' . $this->zephirMethod . '(' . $symbolVariable->getName( + ) . ', SL("' . $property . '")));' + ); + } +} diff --git a/src/Statements/Let/ObjectPropertyIncr.php b/src/Statements/Let/ObjectPropertyIncr.php new file mode 100644 index 0000000000..94a2623a70 --- /dev/null +++ b/src/Statements/Let/ObjectPropertyIncr.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +/** + * ObjectPropertyIncr. + * + * Increments an object property + */ +class ObjectPropertyIncr extends ObjectPropertyDecr +{ + protected string $zephirMethod = 'zephir_property_incr'; +} diff --git a/src/Statements/Let/StaticProperty.php b/src/Statements/Let/StaticProperty.php new file mode 100644 index 0000000000..20f2300684 --- /dev/null +++ b/src/Statements/Let/StaticProperty.php @@ -0,0 +1,192 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Exception\CompilerException; +use Zephir\Expression; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable; + +/** + * Updates static properties + */ +class StaticProperty extends StaticPropertySub +{ + use VariablesTrait; + + protected string $methodName = 'updateStaticProperty'; + + /** + * @param CompilationContext $compilationContext + * @param array $statement + * @param string $classEntry + * @param string $property + * @param Variable $variableVariable + * + * @return void + * @throws ReflectionException + */ + protected function processDefaultType( + CompilationContext $compilationContext, + array $statement, + string $classEntry, + string $property, + Variable $variableVariable + ): void { + switch ($variableVariable->getType()) { + case 'string': + switch ($statement['operator']) { + /* @noinspection PhpMissingBreakStatementInspection */ + case 'concat-assign': + $tempVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( + 'variable', + $compilationContext + ); + $expression = new Expression([ + 'type' => 'static-property-access', + 'left' => [ + 'value' => $statement['variable'], + ], + 'right' => [ + 'value' => $statement['property'], + ], + ]); + $expression->setExpectReturn(true, $tempVariable); + + try { + $expression->compile($compilationContext); + } catch (Exception $e) { + throw new CompilerException($e->getMessage(), $statement, $e->getCode(), $e); + } + + $variableVariableCode = $compilationContext->backend->getVariableCode( + $variableVariable + ); + $tempVariableCode = $compilationContext->backend->getVariableCode($tempVariable); + $compilationContext->codePrinter->output( + 'SEPARATE_ZVAL(' . $variableVariableCode . ');' + ); + $compilationContext->codePrinter->output( + 'zephir_concat_function(' . $variableVariableCode . ', ' . $tempVariableCode . ', ' . $variableVariableCode . ');' + ); + // no break + case 'assign': + $compilationContext->backend->updateStaticProperty( + $classEntry, + $property, + $variableVariable, + $compilationContext + ); + $this->checkVariableTemporal($variableVariable); + break; + default: + throw CompilerException::illegalOperationTypeOnStaticVariable( + $statement['operator'], + $variableVariable->getType(), + $statement + ); + } + break; + case 'variable': + case 'array': + $compilationContext->backend->updateStaticProperty( + $classEntry, + $property, + $variableVariable, + $compilationContext + ); + $this->checkVariableTemporal($variableVariable); + break; + + default: + throw new CompilerException( + 'Unknown type ' . $variableVariable->getType(), + $statement + ); + } + } + + + /** + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param array $statement + * + * @return Variable + */ + protected function processStringType( + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + array $statement + ): Variable { + // TODO: add-assign + if ('assign' !== $statement['operator']) { + throw CompilerException::illegalOperationTypeOnStaticVariable( + $statement['operator'], + $resolvedExpr->getType(), + $statement + ); + } + + return $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + } + + /** + * @param array $statement + * @param Variable $variableVariable + * + * @return void + */ + protected function processVariableDoubleType( + array $statement, + Variable $variableVariable + ): void { + // TODO: mul-assign, div-assign, sub-assign, add-assign + if ('assign' !== $statement['operator']) { + throw CompilerException::illegalOperationTypeOnStaticVariable( + $statement['operator'], + $variableVariable->getType(), + $statement + ); + } + } + + /** + * @param array $statement + * @param Variable $variableVariable + * + * @return void + */ + protected function processVariableIntType( + array $statement, + Variable $variableVariable + ): void { + // TODO: mul-assign, div-assign, sub-assign, add-assign + if ('assign' !== $statement['operator']) { + throw CompilerException::illegalOperationTypeOnStaticVariable( + $statement['operator'], + $variableVariable->getType(), + $statement + ); + } + } +} diff --git a/Library/Exception/ContainerException.php b/src/Statements/Let/StaticPropertyAdd.php similarity index 52% rename from Library/Exception/ContainerException.php rename to src/Statements/Let/StaticPropertyAdd.php index 2f775a3141..a4ac55b291 100644 --- a/Library/Exception/ContainerException.php +++ b/src/Statements/Let/StaticPropertyAdd.php @@ -9,13 +9,16 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Exception; +declare(strict_types=1); -use Psr\Container\ContainerExceptionInterface; +namespace Zephir\Statements\Let; /** - * Zephir\Exception\ContainerException. + * StaticPropertyAdd. + * + * Updates static properties */ -class ContainerException extends RuntimeException implements ContainerExceptionInterface +class StaticPropertyAdd extends StaticPropertySub { + protected string $methodName = 'addStaticProperty'; } diff --git a/Library/Statements/Let/StaticPropertyAppend.php b/src/Statements/Let/StaticPropertyAppend.php similarity index 59% rename from Library/Statements/Let/StaticPropertyAppend.php rename to src/Statements/Let/StaticPropertyAppend.php index 8303d5057e..9db9e8eb29 100644 --- a/Library/Statements/Let/StaticPropertyAppend.php +++ b/src/Statements/Let/StaticPropertyAppend.php @@ -9,14 +9,19 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; -use Zephir\ClassProperty; +use ReflectionException; +use Zephir\Class\Property; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; +use function in_array; + /** * StaticPropertyAppend. * @@ -42,9 +47,9 @@ public function assignStatic( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement - ) { + ): void { $compiler = $compilationContext->compiler; - if (!\in_array($className, ['self', 'static', 'parent'])) { + if (!in_array($className, ['self', 'static', 'parent'])) { $className = $compilationContext->getFullName($className); if ($compiler->isClass($className)) { $classDefinition = $compiler->getClassDefinition($className); @@ -52,18 +57,25 @@ public function assignStatic( if ($compiler->isBundledClass($className)) { $classDefinition = $compiler->getInternalClassDefinition($className); } else { - throw new CompilerException("Cannot locate class '".$className."'", $statement); + throw new CompilerException("Cannot locate class '" . $className . "'", $statement); } } } else { - if (\in_array($className, ['self', 'static'])) { + if (in_array($className, ['self', 'static'])) { $classDefinition = $compilationContext->classDefinition; } else { if ('parent' == $className) { $classDefinition = $compilationContext->classDefinition; - $extendsClass = $classDefinition->getExtendsClass(); + $extendsClass = $classDefinition->getExtendsClass(); if (!$extendsClass) { - throw new CompilerException('Cannot assign static property "'.$property.'" on parent because class '.$classDefinition->getCompleteName().' does not extend any class', $statement); + throw new CompilerException( + 'Cannot assign static property "' + . $property + . '" on parent because class ' + . $classDefinition->getCompleteName() + . ' does not extend any class', + $statement + ); } else { $classDefinition = $classDefinition->getExtendsClassDefinition(); } @@ -71,25 +83,43 @@ public function assignStatic( } } - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); - } + $this->checkClassHasProperty( + $classDefinition, + $property, + $statement + ); - /** @var ClassProperty $propertyDefinition */ + /** @var Property $propertyDefinition */ $propertyDefinition = $classDefinition->getProperty($property); - if (!$propertyDefinition->isStatic()) { - throw new CompilerException("Cannot access non-static property '".$classDefinition->getCompleteName().'::'.$property."'", $statement); - } + $this->checkAccessNonStaticProperty( + $propertyDefinition, + $classDefinition, + $property, + $statement + ); if ($propertyDefinition->isPrivate()) { if ($classDefinition != $compilationContext->classDefinition) { - throw new CompilerException("Cannot access private static property '".$classDefinition->getCompleteName().'::'.$property."' out of its declaring context", $statement); + throw new CompilerException( + "Cannot access private static property '" + . $classDefinition->getCompleteName() + . '::' + . $property + . "' out of its declaring context", + $statement + ); } } $compilationContext->headersManager->add('kernel/object'); $classEntry = $classDefinition->getClassEntry($compilationContext); - $this->_assignStaticPropertyArrayMultipleIndex($classEntry, $property, $resolvedExpr, $compilationContext, $statement); + $this->_assignStaticPropertyArrayMultipleIndex( + $classEntry, + $property, + $resolvedExpr, + $compilationContext, + $statement + ); } /** @@ -103,20 +133,20 @@ public function assignStatic( */ protected function _assignStaticPropertyArrayMultipleIndex( $classEntry, - $property, + string $property, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement - ) { + ): void { $property = $statement['property']; $compilationContext->headersManager->add('kernel/object'); /** * Create a temporal zval (if needed). */ - $variableExpr = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); + $variableExpr = $this->_getResolvedArrayItem($resolvedExpr, $compilationContext); + $offsetExpressions = $this->getOffsetExpressions($statement, $compilationContext); - $offsetExpressions[] = 'a'; $compilationContext->backend->assignStaticPropertyArrayMulti( $classEntry, $variableExpr, @@ -125,8 +155,23 @@ protected function _assignStaticPropertyArrayMultipleIndex( $compilationContext ); - if ($variableExpr->isTemporal()) { - $variableExpr->setIdle(true); - } + $this->checkVariableTemporal($variableExpr); + } + + /** + * @param array $statement + * @param CompilationContext $compilationContext + * + * @return array + * @throws ReflectionException + * @throws Exception + */ + protected function getOffsetExpressions( + array $statement, + CompilationContext $compilationContext + ): array { + $offsetExpressions[] = 'a'; + + return $offsetExpressions; } } diff --git a/src/Statements/Let/StaticPropertyArrayIndex.php b/src/Statements/Let/StaticPropertyArrayIndex.php new file mode 100644 index 0000000000..7215dc0e28 --- /dev/null +++ b/src/Statements/Let/StaticPropertyArrayIndex.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\Exception; +use Zephir\Exception\CompilerException; +use Zephir\Expression; + +/** + * Zephir\Statements\Let\StaticPropertyArrayIndex. + * + * Updates object properties dynamically. + */ +class StaticPropertyArrayIndex extends StaticPropertyAppend +{ + /** + * @param array $statement + * @param CompilationContext $compilationContext + * + * @return array + * @throws ReflectionException + * @throws Exception + */ + protected function getOffsetExpressions( + array $statement, + CompilationContext $compilationContext + ): array { + /** + * Only string/variable/int. + */ + $offsetExpressions = []; + foreach ($statement['index-expr'] as $indexExpr) { + $indexExpression = new Expression($indexExpr); + + $resolvedIndex = $indexExpression->compile($compilationContext); + switch ($resolvedIndex->getType()) { + case 'string': + case 'int': + case 'uint': + case 'ulong': + case 'long': + case 'variable': + break; + default: + throw new CompilerException( + sprintf( + 'Expression: %s cannot be used as index without cast', + $resolvedIndex->getType() + ), + $statement['index-expr'] + ); + } + + $offsetExpressions[] = $resolvedIndex; + } + + return $offsetExpressions; + } +} diff --git a/src/Statements/Let/StaticPropertyArrayIndexAppend.php b/src/Statements/Let/StaticPropertyArrayIndexAppend.php new file mode 100644 index 0000000000..3553faf069 --- /dev/null +++ b/src/Statements/Let/StaticPropertyArrayIndexAppend.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use ReflectionException; +use Zephir\CompilationContext; +use Zephir\Exception; + +/** + * StaticPropertyArrayIndexAppend. + * + * Updates object properties dynamically + */ +class StaticPropertyArrayIndexAppend extends StaticPropertyArrayIndex +{ + /** + * @param array $statement + * @param CompilationContext $compilationContext + * + * @return array + * @throws Exception + * @throws ReflectionException + */ + protected function getOffsetExpressions( + array $statement, + CompilationContext $compilationContext + ): array { + /** + * Only string/variable/int. + */ + $offsetExpressions = parent::getOffsetExpressions( + $statement, + $compilationContext + ); + $offsetExpressions[] = 'a'; + + return $offsetExpressions; + } +} diff --git a/src/Statements/Let/StaticPropertySub.php b/src/Statements/Let/StaticPropertySub.php new file mode 100644 index 0000000000..d3aeda75cc --- /dev/null +++ b/src/Statements/Let/StaticPropertySub.php @@ -0,0 +1,422 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Exception\CompilerException; +use Zephir\Exception\IllegalOperationException; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable; + +use function sprintf; + +/** + * StaticPropertySub. + * + * Updates static properties + */ +class StaticPropertySub +{ + use VariablesTrait; + + protected string $methodName = 'subStaticProperty'; + + /** + * Compiles ClassName::foo = {expr}. + * + * @param string $className + * @param string $property + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param array $statement + * + * @throws CompilerException + * @throws IllegalOperationException + */ + public function assignStatic( + string $className, + string $property, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + array $statement + ): void { + $classDefinition = $compilationContext->classLookup($className); + $method = $this->methodName; + + if (!$propertyDefinition = $classDefinition->getProperty($property)) { + throw CompilerException::classDoesNotHaveProperty( + $classDefinition->getCompleteName(), + $property, + $statement + ); + } + + $this->checkAccessNonStaticProperty( + $propertyDefinition, + $classDefinition, + $property, + $statement + ); + + if ($propertyDefinition->isPrivate()) { + if ($classDefinition->getCompleteName() != $compilationContext->classDefinition->getCompleteName()) { + throw new CompilerException( + sprintf( + "Cannot access private static property '%s::%s out of its declaring context", + $classDefinition->getCompleteName(), + $property + ), + $statement + ); + } + } + + $codePrinter = $compilationContext->codePrinter; + $compilationContext->headersManager->add('kernel/object'); + + try { + $classEntry = $classDefinition->getClassEntry($compilationContext); + } catch (Exception $e) { + throw new CompilerException($e->getMessage(), $statement, $e->getCode(), $e); + } + + switch ($resolvedExpr->getType()) { + case 'null': + $compilationContext->backend->updateStaticProperty($classEntry, $property, 'null', $compilationContext); + break; + + case 'int': + case 'uint': + case 'long': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignLong( + $tempVariable, + $resolvedExpr->getBooleanCode(), + $compilationContext + ); + $compilationContext->backend->$method( + $classEntry, + $property, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'char': + case 'uchar': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignLong( + $tempVariable, + '\'' . $resolvedExpr->getCode() . '\'', + $compilationContext + ); + $compilationContext->backend->$method( + $classEntry, + $property, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'double': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignDouble( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->$method( + $classEntry, + $property, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'string': + $tempVariable = $this->processStringType( + $resolvedExpr, + $compilationContext, + $statement + ); + $tempVariable->initVariant($compilationContext); + + if ($resolvedExpr->getCode()) { + $compilationContext->backend->assignString( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + } else { + $codePrinter->output('ZVAL_EMPTY_STRING(' . $tempVariable->getName() . ');'); + } + + $this->checkVariableTemporal($tempVariable); + + $compilationContext->backend->$method( + $classEntry, + $property, + $tempVariable, + $compilationContext + ); + break; + + case 'bool': + if ('1' == $resolvedExpr->getBooleanCode()) { + $compilationContext->backend->$method( + $classEntry, + $property, + 'true', + $compilationContext + ); + } else { + if ('0' == $resolvedExpr->getBooleanCode()) { + $compilationContext->backend->$method( + $classEntry, + $property, + 'false', + $compilationContext + ); + } else { + $codePrinter->output('if (' . $resolvedExpr->getBooleanCode() . ') {'); + $codePrinter->increaseLevel(); + $compilationContext->backend->$method( + $classEntry, + $property, + 'true', + $compilationContext + ); + $codePrinter->decreaseLevel(); + $codePrinter->output('} else {'); + $codePrinter->increaseLevel(); + $compilationContext->backend->$method( + $classEntry, + $property, + 'false', + $compilationContext + ); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + } + } + break; + + case 'empty-array': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->initArray($tempVariable, $compilationContext); + $compilationContext->backend->$method( + $classEntry, + $property, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + + case 'array': + $compilationContext->backend->$method( + $classEntry, + $property, + $resolvedExpr, + $compilationContext + ); + break; + + case 'variable': + $variableVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + + switch ($variableVariable->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + $this->processVariableIntType( + $statement, + $variableVariable + ); + + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + + $compilationContext->backend->assignLong($tempVariable, $variableVariable, $compilationContext); + $compilationContext->backend->$method( + $classEntry, + $property, + $tempVariable, + $compilationContext + ); + + $this->checkVariableTemporal($tempVariable); + break; + + case 'double': + $this->processVariableDoubleType( + $statement, + $variableVariable + ); + + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + + $compilationContext->backend->assignDouble( + $tempVariable, + $variableVariable, + $compilationContext + ); + $compilationContext->backend->$method( + $classEntry, + $property, + $tempVariable, + $compilationContext + ); + + $this->checkVariableTemporal($tempVariable); + break; + + case 'bool': + $tempVariable = $compilationContext->symbolTable->getTempNonTrackedVariable( + 'variable', + $compilationContext, + true + ); + $compilationContext->backend->assignBool($tempVariable, $variableVariable, $compilationContext); + $compilationContext->backend->$method( + $classEntry, + $property, + $tempVariable, + $compilationContext + ); + $this->checkVariableTemporal($tempVariable); + break; + default: + $this->processDefaultType( + $compilationContext, + $statement, + $classEntry, + $property, + $variableVariable + ); + break; + } + + break; + + default: + throw new CompilerException('Unknown type ' . $resolvedExpr->getType(), $statement); + } + } + + /** + * @param CompilationContext $compilationContext + * @param array $statement + * @param string $classEntry + * @param string $property + * @param Variable $variableVariable + * + * @return void + */ + protected function processDefaultType( + CompilationContext $compilationContext, + array $statement, + string $classEntry, + string $property, + Variable $variableVariable + ): void { + $method = $this->methodName; + $compilationContext->backend->$method( + $classEntry, + $property, + $variableVariable, + $compilationContext + ); + $this->checkVariableTemporal($variableVariable); + } + + /** + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param array $statement + * + * @return Variable + */ + protected function processStringType( + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + array $statement + ): Variable { + return $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + } + + /** + * @param array $statement + * @param Variable $variableVariable + * + * @return void + */ + protected function processVariableDoubleType( + array $statement, + Variable $variableVariable + ): void { + // Nothing + } + + /** + * @param array $statement + * @param Variable $variableVariable + * + * @return void + */ + protected function processVariableIntType( + array $statement, + Variable $variableVariable + ): void { + // Nothing + } +} diff --git a/src/Statements/Let/Variable.php b/src/Statements/Let/Variable.php new file mode 100644 index 0000000000..3dbc8e49bd --- /dev/null +++ b/src/Statements/Let/Variable.php @@ -0,0 +1,1598 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Zephir\Code\Printer; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Detectors\ReadDetector; +use Zephir\Exception\CompilerException; +use Zephir\Exception\IllegalOperationException; +use Zephir\Name; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable as ZephirVariable; + +use function array_keys; + +/** + * Zephir\Statements\Let\Variable. + * + * Assign a value to a variable. + */ +class Variable +{ + use VariablesTrait; + + /** + * Compiles foo = {expr} + * Changes the value of a mutable variable. + * + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param CompiledExpression $resolvedExpr + * @param ReadDetector $readDetector + * @param CompilationContext $compilationContext + * @param array $statement + * + * @throws CompilerException + */ + public function assign( + string $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + ReadDetector $readDetector, + CompilationContext $compilationContext, + array $statement + ): void { + $this->checkVariableReadOnly($variable, $symbolVariable, $statement); + + $codePrinter = $compilationContext->codePrinter; + + /* + * Only initialize variables if it's direct assignment + */ + if ('assign' == $statement['operator']) { + $symbolVariable->setIsInitialized(true, $compilationContext); + } else { + $this->checkVariableInitialized($variable, $symbolVariable, $statement); + } + + /* + * Set the assigned value to the variable as a CompiledExpression + * We could use this expression for further analysis + */ + $symbolVariable->setPossibleValue($resolvedExpr, $compilationContext); + + $type = $symbolVariable->getType(); + switch ($type) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + $this->doNumericAssignment( + $codePrinter, + $resolvedExpr, + $variable, + $statement, + $compilationContext + ); + break; + + case 'double': + $this->doDoubleAssignment( + $codePrinter, + $resolvedExpr, + $variable, + $statement, + $compilationContext + ); + break; + + case 'array': + $this->doArrayAssignment( + $codePrinter, + $resolvedExpr, + $symbolVariable, + $variable, + $statement, + $compilationContext + ); + break; + + case 'string': + $this->doStringAssignment( + $codePrinter, + $resolvedExpr, + $symbolVariable, + $variable, + $statement, + $compilationContext + ); + break; + + case 'bool': + $this->doBoolAssignment( + $codePrinter, + $resolvedExpr, + $variable, + $statement, + $compilationContext + ); + break; + + case 'variable': + case 'mixed': + $this->doVariableAssignment( + $codePrinter, + $resolvedExpr, + $symbolVariable, + $variable, + $statement, + $compilationContext, + $readDetector + ); + break; + + default: + throw new CompilerException('Unknown type: ' . $type, $statement); + } + } + + /** + * Performs array assignment. + * + * @param Printer $codePrinter + * @param CompiledExpression $resolvedExpr + * @param ZephirVariable $symbolVariable + * @param string $variable + * @param array $statement + * @param CompilationContext $compilationContext + * + * @throws CompilerException + * @throws IllegalOperationException + */ + private function doArrayAssignment( + Printer $codePrinter, + CompiledExpression $resolvedExpr, + ZephirVariable $symbolVariable, + string $variable, + array $statement, + CompilationContext $compilationContext + ): void { + switch ($resolvedExpr->getType()) { + case 'variable': + case 'array': + $this->doArrayAssignmentProcess( + $statement, + $resolvedExpr, + $variable, + $symbolVariable, + $compilationContext, + $codePrinter + ); + break; + + default: + throw new CompilerException( + "Cannot '" . $statement['operator'] . "' " . $resolvedExpr->getType() . ' for array type', + $resolvedExpr->getOriginal() + ); + } + } + + /** + * @param array $statement + * @param CompiledExpression $resolvedExpr + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param CompilationContext $compilationContext + * @param Printer $codePrinter + * + * @return void + */ + private function doArrayAssignmentProcess( + array $statement, + CompiledExpression $resolvedExpr, + string $variable, + ZephirVariable $symbolVariable, + CompilationContext $compilationContext, + Printer $codePrinter + ): void { + switch ($statement['operator']) { + case 'assign': + if ($variable != $resolvedExpr->getCode()) { + $symbolVariable->setMustInitNull(true); + $compilationContext->symbolTable->mustGrownStack(true); + + /* Inherit the dynamic type data from the assigned value */ + $symbolVariable->setDynamicTypes('array'); + $symbolVariable->increaseVariantIfNull(); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + + $codePrinter->output( + 'ZEPHIR_CPY_WRT(' . $symbol . ', ' . $compilationContext->backend->resolveValue( + $resolvedExpr, + $compilationContext + ) . ');' + ); + } + break; + + default: + throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); + } + } + + /** + * Performs boolean assignment. + * + * @param Printer $codePrinter + * @param CompiledExpression $resolvedExpr + * @param string $variable + * @param array $statement + * @param CompilationContext $compilationContext + * + * @throws CompilerException + * @throws IllegalOperationException + */ + private function doBoolAssignment( + Printer $codePrinter, + CompiledExpression $resolvedExpr, + string $variable, + array $statement, + CompilationContext $compilationContext + ): void { + switch ($resolvedExpr->getType()) { + case 'null': + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = 0;'); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'int': + case 'uint': + case 'long': + case 'ulong': + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = ((' . $resolvedExpr->getCode() . ') ? 1 : 0);'); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'double': + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = ((' . $resolvedExpr->getCode() . ' != 0.0) ? 1 : 0);'); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'char': + case 'uchar': + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = ((\'' . $resolvedExpr->getCode() . '\') ? 1 : 0);'); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'bool': + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = ' . $resolvedExpr->getBooleanCode() . ';'); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'variable': + $itemVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + switch ($itemVariable->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = ((' . $itemVariable->getName() . ') ? 1 : 0);'); + break; + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'double': + switch ($statement['operator']) { + case 'assign': + $codePrinter->output( + $variable . ' = ((' . $itemVariable->getName() . ' != 0.0) ? 1 : 0);' + ); + break; + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'bool': + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = ' . $itemVariable->getName() . ';'); + break; + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'variable': + case 'mixed': + case 'string': + case 'array': + switch ($statement['operator']) { + case 'assign': + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + $variable . ' = zephir_is_true(' . $compilationContext->backend->getVariableCode( + $itemVariable + ) . ');' + ); + break; + + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + default: + throw new CompilerException('Cannot assign variable: ' . $itemVariable->getType(), $statement); + } + break; + + default: + throw new CompilerException('Unknown type: ' . $resolvedExpr->getType(), $statement); + } + } + + /** + * Performs double assignment. + * + * @throws CompilerException + * @throws IllegalOperationException + */ + private function doDoubleAssignment( + Printer $codePrinter, + CompiledExpression $resolvedExpr, + string $variable, + array $statement, + CompilationContext $compilationContext + ): void { + switch ($resolvedExpr->getType()) { + case 'null': + $this->doNumberAssignmentNull( + $statement, + $codePrinter, + $variable, + $resolvedExpr, + '0.0' + ); + break; + + case 'int': + case 'uint': + case 'long': + case 'ulong': + $this->doNumericAssignmentLong( + $statement, + $codePrinter, + $variable, + $resolvedExpr, + '(double)' + ); + break; + + case 'double': + $this->doNumericAssignmentLong( + $statement, + $codePrinter, + $variable, + $resolvedExpr + ); + break; + + case 'bool': + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = ' . $resolvedExpr->getBooleanCode() . ';'); + break; + + case 'add-assign': + $codePrinter->output($variable . ' += ' . $resolvedExpr->getBooleanCode() . ';'); + break; + + case 'sub-assign': + $codePrinter->output($variable . ' -= ' . $resolvedExpr->getBooleanCode() . ';'); + break; + + case 'mul-assign': + $codePrinter->output($variable . ' *= ' . $resolvedExpr->getBooleanCode() . ';'); + break; + + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'variable': + $itemVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + switch ($itemVariable->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'bool': + $this->doNumericAssignmentVar( + $statement, + $codePrinter, + $variable, + $itemVariable, + '(double)' + ); + break; + + case 'double': + $this->doNumericAssignmentVar( + $statement, + $codePrinter, + $variable, + $itemVariable + ); + break; + + case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + $this->processDoNumericAssignmentMixed( + $compilationContext, + $itemVariable, + $statement, + $codePrinter, + $variable, + $itemVariable + ); + break; + + default: + throw new CompilerException('Unknown type: ' . $itemVariable->getType(), $statement); + } + break; + default: + throw new CompilerException('Unknown type ' . $resolvedExpr->getType(), $statement); + } + } + + /** + * @param array $statement + * @param Printer $codePrinter + * @param string $variable + * @param CompiledExpression $resolvedExpr + * @param string $value + * + * @return void + */ + private function doNumberAssignmentNull( + array $statement, + Printer $codePrinter, + string $variable, + CompiledExpression $resolvedExpr, + string $value + ): void { + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = ' . $value . ';'); + break; + case 'add-assign': + $codePrinter->output($variable . ' += ' . $value . ';'); + break; + case 'sub-assign': + $codePrinter->output($variable . ' -= ' . $value . ';'); + break; + case 'mul-assign': + $codePrinter->output($variable . ' *= ' . $value . ';'); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + } + + /** + * Performs numeric assignment. + * + * @throws CompilerException + * @throws IllegalOperationException + */ + private function doNumericAssignment( + Printer $codePrinter, + CompiledExpression $resolvedExpr, + string $variable, + array $statement, + CompilationContext $compilationContext + ): void { + switch ($resolvedExpr->getType()) { + case 'null': + $this->doNumberAssignmentNull( + $statement, + $codePrinter, + $variable, + $resolvedExpr, + '0' + ); + break; + + case 'int': + case 'uint': + case 'long': + case 'ulong': + $operator = match ($statement['operator']) { + 'assign' => ' = ', + 'add-assign' => ' += ', + 'sub-assign' => ' -= ', + 'mul-assign' => ' *= ', + 'div-assign' => ' /= ', + 'mod-assign' => ' %= ', + default => throw new IllegalOperationException($statement, $resolvedExpr) + }; + + $codePrinter->output($variable . $operator . $resolvedExpr->getCode() . ';'); + break; + + case 'char': + case 'uchar': + $operator = match ($statement['operator']) { + 'assign' => ' = ', + 'add-assign' => ' += ', + 'sub-assign' => ' -= ', + 'mul-assign' => ' *= ', + default => throw new IllegalOperationException($statement, $resolvedExpr) + }; + + $codePrinter->output($variable . $operator . '\'' . $resolvedExpr->getCode() . '\';'); + break; + + case 'double': + $this->doNumericAssignmentLong( + $statement, + $codePrinter, + $variable, + $resolvedExpr, + '(long)' + ); + break; + + case 'bool': + $operator = match ($statement['operator']) { + 'assign' => ' = ', + 'add-assign' => ' += ', + 'sub-assign' => ' -= ', + default => throw new IllegalOperationException($statement, $resolvedExpr) + }; + + $codePrinter->output($variable . $operator . $resolvedExpr->getBooleanCode() . ';'); + break; + + case 'variable': + $itemVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + switch ($itemVariable->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'bool': + case 'char': + case 'uchar': + $operator = match ($statement['operator']) { + 'assign' => ' = ', + 'add-assign' => ' += ', + 'sub-assign' => ' -= ', + 'mul-assign' => ' *= ', + 'div-assign' => ' /= ', + 'mod-assign' => ' %= ', + default => throw new IllegalOperationException($statement, $itemVariable) + }; + + $codePrinter->output($variable . $operator . $itemVariable->getName() . ';'); + break; + + case 'double': + $this->doNumericAssignmentVar( + $statement, + $codePrinter, + $variable, + $itemVariable, + '(long)' + ); + break; + + case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + $exprVariable = $compilationContext->symbolTable->getVariableForWrite( + $resolvedExpr->resolve(null, $compilationContext), + $compilationContext + ); + $this->processDoNumericAssignmentMixed( + $compilationContext, + $exprVariable, + $statement, + $codePrinter, + $variable, + $itemVariable + ); + break; + + default: + throw new CompilerException('Unknown type: ' . $itemVariable->getType(), $statement); + } + break; + default: + throw new CompilerException( + "Value type '" . $resolvedExpr->getType() . "' cannot be assigned to variable: int", + $statement + ); + } + } + + /** + * @param array $statement + * @param Printer $codePrinter + * @param string $variable + * @param CompiledExpression $resolvedExpr + * @param string $cast + * + * @return void + */ + private function doNumericAssignmentLong( + array $statement, + Printer $codePrinter, + string $variable, + CompiledExpression $resolvedExpr, + string $cast = '' + ): void { + switch ($statement['operator']) { + case 'assign': + $codePrinter->output( + $variable . ' = ' . $cast + . ' (' . $resolvedExpr->getCode() . ');' + ); + break; + + case 'add-assign': + $codePrinter->output( + $variable . ' += ' . $cast + . ' (' . $resolvedExpr->getCode() . ');' + ); + break; + + case 'sub-assign': + $codePrinter->output( + $variable . ' -= ' . $cast + . ' (' . $resolvedExpr->getCode() . ');' + ); + break; + + case 'mul-assign': + $codePrinter->output( + $variable . ' *= ' . $cast + . ' (' . $resolvedExpr->getCode() . ');' + ); + break; + + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + } + + /** + * @param array $statement + * @param Printer $codePrinter + * @param string $variable + * @param ZephirVariable|bool $itemVariable + * @param string $cast + * + * @return void + */ + private function doNumericAssignmentVar( + array $statement, + Printer $codePrinter, + string $variable, + ZephirVariable | bool $itemVariable, + string $cast = '' + ): void { + switch ($statement['operator']) { + case 'assign': + $codePrinter->output( + $variable . ' = ' . $cast . ' ' . $itemVariable->getName() . ';' + ); + break; + case 'add-assign': + $codePrinter->output( + $variable . ' += ' . $cast . ' ' . $itemVariable->getName() . ';' + ); + break; + case 'sub-assign': + $codePrinter->output( + $variable . ' -= ' . $cast . ' ' . $itemVariable->getName() . ';' + ); + break; + case 'mul-assign': + $codePrinter->output( + $variable . ' *= ' . $cast . ' ' . $itemVariable->getName() . ';' + ); + break; + default: + throw new IllegalOperationException($statement, $itemVariable); + } + } + + /** + * Performs string assignment. + * + * @throws CompilerException + * @throws IllegalOperationException + */ + private function doStringAssignment( + Printer $codePrinter, + CompiledExpression $resolvedExpr, + ZephirVariable $symbolVariable, + string $variable, + array $statement, + CompilationContext $compilationContext + ): void { + switch ($resolvedExpr->getType()) { + case 'null': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignString($symbolVariable, null, $compilationContext); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'int': + case 'uint': + case 'long': + case 'ulong': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignString( + $symbolVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + break; + case 'concat-assign': + $codePrinter->output( + 'zephir_concat_self_str(&' . $variable . ', "' . $resolvedExpr->getCode( + ) . '", sizeof("' . $resolvedExpr->getCode() . '") - 1);' + ); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'string': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + if ($resolvedExpr->getCode()) { + $compilationContext->backend->assignString( + $symbolVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + } else { + $compilationContext->backend->assignString($symbolVariable, null, $compilationContext); + } + break; + case 'concat-assign': + $codePrinter->output( + 'zephir_concat_self_str(&' . $variable . ', "' . $resolvedExpr->getCode( + ) . '", sizeof("' . $resolvedExpr->getCode() . '") - 1);' + ); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'char': + case 'uchar': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + if ($resolvedExpr->getCode()) { + $compilationContext->backend->assignString( + $symbolVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + } else { + $compilationContext->backend->assignString($symbolVariable, null, $compilationContext); + } + break; + + case 'concat-assign': + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + 'zephir_concat_self_str(&' . $variable . ', "' . $resolvedExpr->getCode( + ) . '", sizeof("' . $resolvedExpr->getCode() . '") - 1);' + ); + break; + + default: + throw new IllegalOperationException($statement, $resolvedExpr); + } + break; + + case 'variable': + $itemVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + switch ($itemVariable->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + $compilationContext->headersManager->add('kernel/string'); + // FIXME: Most likely this code is outdated and no longer works. + $codePrinter->output( + 'Z_STRLEN_P(' . $variable . ') = zephir_spprintf(&Z_STRVAL_P(' . $variable . '), 0, "%ld", ' . $itemVariable->getName( + ) . ');' + ); + $codePrinter->output('Z_TYPE_P(' . $variable . ') = IS_STRING;'); + break; + + case 'concat-assign': + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + 'zephir_concat_self_long(&' . $variable . ', ' . $itemVariable->getName() . ');' + ); + break; + + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'char': + case 'uchar': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + $compilationContext->headersManager->add('kernel/string'); + // FIXME: Most likely this code is outdated and no longer works. + $codePrinter->output( + 'Z_STRLEN_P(' . $variable . ') = zephir_spprintf(&Z_STRVAL_P(' . $variable . '), 0, "%c", ' . $itemVariable->getName( + ) . ');' + ); + $codePrinter->output('Z_TYPE_P(' . $variable . ') = IS_STRING;'); + break; + + case 'concat-assign': + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + 'zephir_concat_self_char(&' . $variable . ', ' . $itemVariable->getName() . ');' + ); + break; + + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'string': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->setMustInitNull(true); + $symbolVariable->increaseVariantIfNull(); + $compilationContext->symbolTable->mustGrownStack(true); + if ($variable != $itemVariable->getName()) { + $compilationContext->backend->copyOnWrite( + $symbolVariable, + $itemVariable, + $compilationContext + ); + } + break; + + case 'concat-assign': + $compilationContext->headersManager->add('kernel/operators'); + $compilationContext->backend->concatSelf( + $symbolVariable, + $itemVariable, + $compilationContext + ); + break; + + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'variable': + case 'mixed': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->setMustInitNull(true); + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + 'zephir_get_strval(' . $compilationContext->backend->getVariableCode( + $symbolVariable + ) . ', ' . $compilationContext->backend->getVariableCode($itemVariable) . ');' + ); + break; + + case 'concat-assign': + $compilationContext->headersManager->add('kernel/operators'); + $compilationContext->backend->concatSelf( + $symbolVariable, + $itemVariable, + $compilationContext + ); + break; + + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + default: + throw new CompilerException('Unknown type: ' . $itemVariable->getType(), $statement); + } + break; + + default: + throw new CompilerException('Unknown type ' . $resolvedExpr->getType(), $statement); + } + } + + /** + * Performs variable assignment. + * + * @param Printer $codePrinter + * @param CompiledExpression $resolvedExpr + * @param ZephirVariable $symbolVariable + * @param string $variable + * @param array $statement + * @param CompilationContext $compilationContext + * @param ReadDetector $readDetector + * + * @throws CompilerException + * @throws IllegalOperationException + */ + private function doVariableAssignment( + Printer $codePrinter, + CompiledExpression $resolvedExpr, + ZephirVariable $symbolVariable, + string $variable, + array $statement, + CompilationContext $compilationContext, + ReadDetector $readDetector + ): void { + switch ($resolvedExpr->getType()) { + case 'null': + if ($statement['operator'] == 'assign') { + $symbolVariable->initVariant($compilationContext); + $symbolVariable->setDynamicTypes('null'); + + $compilationContext->backend->assignNull($symbolVariable, $compilationContext); + } + break; + + case 'int': + case 'uint': + case 'long': + case 'ulong': + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + + switch ($statement['operator']) { + case 'mul-assign': + case 'sub-assign': + case 'add-assign': + switch ($statement['operator']) { + case 'mul-assign': + $functionName = 'ZEPHIR_MUL_ASSIGN'; + break; + + case 'sub-assign': + $functionName = 'ZEPHIR_SUB_ASSIGN'; + break; + + case 'add-assign': + $functionName = 'ZEPHIR_ADD_ASSIGN'; + break; + } + + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $compilationContext->backend->assignLong( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + $functionName . '(' . $symbol . ', ' . $compilationContext->backend->getVariableCode( + $tempVariable + ) . ');' + ); + break; + + case 'assign': + $symbolVariable->setDynamicTypes('long'); + if ($readDetector->detect($variable, $resolvedExpr->getOriginal())) { + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'int', + $compilationContext + ); + $codePrinter->output($tempVariable->getName() . ' = ' . $resolvedExpr->getCode() . ';'); + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignLong( + $symbolVariable, + $tempVariable, + $compilationContext + ); + } else { + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignLong( + $symbolVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + } + break; + + case 'div-assign': + $this->processDoVariableAssignmentAssign( + $symbolVariable, + $readDetector, + $variable, + $resolvedExpr, + $compilationContext, + $codePrinter + ); + break; + + default: + throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); + } + break; + + case 'char': + case 'uchar': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->setDynamicTypes('long'); + if ($readDetector->detect($variable, $resolvedExpr->getOriginal())) { + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'char', + $compilationContext + ); + $codePrinter->output($tempVariable->getName() . ' = ' . $resolvedExpr->getCode() . ';'); + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignLong( + $symbolVariable, + $tempVariable, + $compilationContext + ); + } else { + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignLong( + $symbolVariable, + '\'' . $resolvedExpr->getCode() . '\'', + $compilationContext + ); + } + + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); + } + break; + + case 'double': + switch ($statement['operator']) { + case 'mul-assign': + case 'sub-assign': + case 'add-assign': + switch ($statement['operator']) { + case 'mul-assign': + $functionName = 'ZEPHIR_MUL_ASSIGN'; + break; + + case 'sub-assign': + $functionName = 'ZEPHIR_SUB_ASSIGN'; + break; + + case 'add-assign': + $functionName = 'ZEPHIR_ADD_ASSIGN'; + break; + } + + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext + ); + $tempVariable->setDynamicTypes('double'); + $compilationContext->backend->assignDouble( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + $functionName . '(' . $compilationContext->backend->getVariableCode( + $symbolVariable + ) . ', ' . $compilationContext->backend->getVariableCode($tempVariable) . ');' + ); + break; + + case 'assign': + $this->processDoVariableAssignmentAssign( + $symbolVariable, + $readDetector, + $variable, + $resolvedExpr, + $compilationContext, + $codePrinter + ); + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); + } + break; + + case 'bool': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->setDynamicTypes('bool'); + if ('true' == $resolvedExpr->getCode()) { + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignBool($symbolVariable, '1', $compilationContext); + } else { + if ('false' == $resolvedExpr->getCode()) { + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignBool($symbolVariable, '0', $compilationContext); + } else { + if ($readDetector->detect($variable, $resolvedExpr->getOriginal())) { + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'double', + $compilationContext + ); + $codePrinter->output( + $tempVariable->getName() . ' = ' . $resolvedExpr->getBooleanCode() . ';' + ); + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignBool( + $symbolVariable, + $tempVariable, + $compilationContext + ); + } else { + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignBool( + $symbolVariable, + $resolvedExpr->getBooleanCode(), + $compilationContext + ); + } + } + } + break; + default: + throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); + } + break; + + case 'string': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + $symbolVariable->setDynamicTypes('string'); + $compilationContext->backend->assignString( + $symbolVariable, + Name::addSlashes($resolvedExpr->getCode()), + $compilationContext + ); + break; + + case 'concat-assign': + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + 'zephir_concat_self_str(&' . $variable . ', SL("' . $resolvedExpr->getCode() . '"));' + ); + break; + + default: + throw new IllegalOperationException($statement, $resolvedExpr, $resolvedExpr->getOriginal()); + } + break; + + case 'array': + $this->doArrayAssignmentProcess( + $statement, + $resolvedExpr, + $variable, + $symbolVariable, + $compilationContext, + $codePrinter + ); + break; + + case 'variable': + $itemVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $resolvedExpr->getOriginal() + ); + switch ($itemVariable->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'char': + case 'uchar': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + $symbolVariable->setDynamicTypes('long'); + $compilationContext->backend->assignLong( + $symbolVariable, + $itemVariable, + $compilationContext + ); + break; + + case 'add-assign': + $compilationContext->headersManager->add('kernel/operators'); + $symbolVariable->initVariant($compilationContext); + $symbolVariable->setDynamicTypes('long'); + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + $itemVariable->getType(), + $compilationContext + ); + $codePrinter->output( + $tempVariable->getName( + ) . ' = zephir_get_numberval(' . $compilationContext->backend->getVariableCode( + $symbolVariable + ) . ') + ' . $itemVariable->getName() . ';' + ); + $compilationContext->backend->assignLong( + $symbolVariable, + $tempVariable, + $compilationContext + ); + break; + + case 'sub-assign': + $compilationContext->headersManager->add('kernel/operators'); + $symbolVariable->initVariant($compilationContext); + $symbolVariable->setDynamicTypes('long'); + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + $itemVariable->getType(), + $compilationContext + ); + $codePrinter->output( + $tempVariable->getName( + ) . ' = zephir_get_numberval(' . $compilationContext->backend->getVariableCode( + $symbolVariable + ) . ');' + ); + $compilationContext->backend->assignLong( + $symbolVariable, + $tempVariable->getName() . ' - ' . $itemVariable->getName(), + $compilationContext + ); + break; + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'double': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + $symbolVariable->setDynamicTypes('double'); + $compilationContext->backend->assignDouble( + $symbolVariable, + $itemVariable, + $compilationContext + ); + break; + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'bool': + switch ($statement['operator']) { + case 'assign': + $symbolVariable->initVariant($compilationContext); + $symbolVariable->setDynamicTypes('bool'); + $compilationContext->backend->assignBool( + $symbolVariable, + $itemVariable, + $compilationContext + ); + break; + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'array': + $this->doArrayAssignmentProcess( + $statement, + $resolvedExpr, + $variable, + $symbolVariable, + $compilationContext, + $codePrinter + ); + break; + + case 'variable': + switch ($statement['operator']) { + case 'assign': + $this->processDoVariableAssignmentVariableString( + $itemVariable, + $variable, + $symbolVariable, + $compilationContext + ); + break; + + case 'concat-assign': + $compilationContext->headersManager->add('kernel/operators'); + $compilationContext->backend->concatSelf( + $symbolVariable, + $itemVariable, + $compilationContext + ); + break; + + case 'add-assign': + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + 'ZEPHIR_ADD_ASSIGN(' . $compilationContext->backend->getVariableCode( + $symbolVariable + ) . ', ' . $compilationContext->backend->getVariableCode($itemVariable) . ');' + ); + break; + + case 'sub-assign': + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->headersManager->add('kernel/operators'); + $codePrinter->output( + 'ZEPHIR_SUB_ASSIGN(' . $compilationContext->backend->getVariableCode( + $symbolVariable + ) . ', ' . $compilationContext->backend->getVariableCode($itemVariable) . ');' + ); + break; + + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + case 'string': + switch ($statement['operator']) { + case 'assign': + $this->processDoVariableAssignmentVariableString( + $itemVariable, + $variable, + $symbolVariable, + $compilationContext + ); + break; + + case 'concat-assign': + $compilationContext->headersManager->add('kernel/operators'); + $compilationContext->backend->concatSelf( + $symbolVariable, + $itemVariable, + $compilationContext + ); + break; + + default: + throw new IllegalOperationException($statement, $itemVariable); + } + break; + + default: + throw new CompilerException( + 'Unknown type: ' . $itemVariable->getType(), + $resolvedExpr->getOriginal() + ); + } + break; + + default: + throw new CompilerException('Unknown type: ' . $resolvedExpr->getType(), $resolvedExpr->getOriginal()); + } + } + + /** + * @param CompilationContext $compilationContext + * @param ZephirVariable|bool $exprVariable + * @param array $statement + * @param Printer $codePrinter + * @param string $variable + * @param ZephirVariable|bool $itemVariable + * + * @return void + */ + private function processDoNumericAssignmentMixed( + CompilationContext $compilationContext, + ZephirVariable | bool $exprVariable, + array $statement, + Printer $codePrinter, + string $variable, + ZephirVariable | bool $itemVariable + ): void { + $exprVariableCode = $compilationContext->backend->getVariableCode($exprVariable); + switch ($statement['operator']) { + case 'assign': + $codePrinter->output($variable . ' = zephir_get_numberval(' . $exprVariableCode . ');'); + break; + + case 'add-assign': + $codePrinter->output( + $variable . ' += zephir_get_numberval(' . $exprVariableCode . ');' + ); + break; + + case 'sub-assign': + $codePrinter->output( + $variable . ' -= zephir_get_numberval(' . $exprVariableCode . ');' + ); + break; + + case 'mul-assign': + $codePrinter->output( + $variable . ' *= zephir_get_numberval(' . $exprVariableCode . ');' + ); + break; + + default: + throw new IllegalOperationException($statement, $itemVariable); + } + } + + /** + * @param ZephirVariable $symbolVariable + * @param ReadDetector $readDetector + * @param string $variable + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param Printer $codePrinter + * + * @return void + */ + private function processDoVariableAssignmentAssign( + ZephirVariable $symbolVariable, + ReadDetector $readDetector, + string $variable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + Printer $codePrinter + ): void { + $symbolVariable->setDynamicTypes('double'); + if ($readDetector->detect($variable, $resolvedExpr->getOriginal())) { + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'double', + $compilationContext + ); + $codePrinter->output($tempVariable->getName() . ' = ' . $resolvedExpr->getCode() . ';'); + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignDouble( + $symbolVariable, + $tempVariable, + $compilationContext + ); + } else { + $symbolVariable->initVariant($compilationContext); + $compilationContext->backend->assignDouble( + $symbolVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + } + } + + /** + * @param ZephirVariable|bool $itemVariable + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param CompilationContext $compilationContext + * + * @return void + */ + private function processDoVariableAssignmentVariableString( + ZephirVariable | bool $itemVariable, + string $variable, + ZephirVariable $symbolVariable, + CompilationContext $compilationContext + ): void { + if ($itemVariable->getName() != $variable) { + $symbolVariable->setMustInitNull(true); + $compilationContext->symbolTable->mustGrownStack(true); + + /* Inherit the dynamic type data from the assigned value */ + $symbolVariable->setDynamicTypes(array_keys($itemVariable->getDynamicTypes())); + $symbolVariable->setClassTypes($itemVariable->getClassTypes()); + $symbolVariable->increaseVariantIfNull(); + + $compilationContext->backend->copyOnWrite( + $symbolVariable, + $itemVariable, + $compilationContext + ); + $this->checkVariableTemporal($itemVariable); + } + } +} diff --git a/src/Statements/Let/VariableAppend.php b/src/Statements/Let/VariableAppend.php new file mode 100644 index 0000000000..8771fa0e06 --- /dev/null +++ b/src/Statements/Let/VariableAppend.php @@ -0,0 +1,292 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements\Let; + +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception\CompilerException; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable as ZephirVariable; + +/** + * VariableAppend. + * + * Append a value to a variable + */ +class VariableAppend +{ + use VariablesTrait; + + /** + * Compiles foo[] = {expr}. + * + * @param $variable + * @param ZephirVariable $symbolVariable + * @param CompiledExpression $resolvedExpr + * @param CompilationContext $compilationContext + * @param $statement + * + * @throws CompilerException + */ + public function assign( + $variable, + ZephirVariable $symbolVariable, + CompiledExpression $resolvedExpr, + CompilationContext $compilationContext, + $statement + ): void { + $this->checkVariableInitialized($variable, $symbolVariable, $statement); + $this->checkVariableReadOnly($variable, $symbolVariable, $statement); + $this->checkVariableLocalOnly($variable, $symbolVariable, $statement); + + /* + * Only dynamic variables and arrays can be used as arrays + */ + if ($symbolVariable->isNotVariableAndArray()) { + throw new CompilerException( + "Cannot use variable type: '" . $symbolVariable->getType() . "' as an array", + $statement + ); + } + + if ('variable' == $symbolVariable->getType()) { + if ($symbolVariable->hasDifferentDynamicType(['undefined', 'array'])) { + $compilationContext->logger->warning( + 'Possible attempt to append elements on a non-array dynamic variable', + ['non-array-append', $statement] + ); + } + } + + $compilationContext->headersManager->add('kernel/array'); + + $type = $symbolVariable->getType(); + switch ($type) { + case 'array': + case 'variable': + case 'mixed': + switch ($resolvedExpr->getType()) { + case 'null': + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + 'null', + $compilationContext, + $statement + ); + break; + + case 'int': + case 'uint': + case 'long': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignLong( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + $tempVariable, + $compilationContext, + $statement + ); + $tempVariable->setIdle(true); + break; + + case 'double': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignDouble( + $tempVariable, + $resolvedExpr->getCode(), + $compilationContext + ); + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + $tempVariable, + $compilationContext, + $statement + ); + $tempVariable->setIdle(true); + break; + + case 'bool': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignBool( + $tempVariable, + $resolvedExpr->getBooleanCode(), + $compilationContext + ); + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + $tempVariable, + $compilationContext, + $statement + ); + $tempVariable->setIdle(true); + break; + + case 'ulong': + case 'string': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignString( + $tempVariable, + $resolvedExpr->getBooleanCode(), + $compilationContext + ); + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + $tempVariable, + $compilationContext, + $statement + ); + $tempVariable->setIdle(true); + break; + + case 'array': + $exprVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + $exprVariable, + $compilationContext, + $statement + ); + break; + + case 'variable': + case 'mixed': + $exprVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $statement + ); + switch ($exprVariable->getType()) { + case 'int': + case 'uint': + case 'long': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignLong( + $tempVariable, + $exprVariable, + $compilationContext + ); + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + $tempVariable, + $compilationContext, + $statement + ); + $tempVariable->setIdle(true); + break; + + case 'double': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignDouble( + $tempVariable, + $exprVariable, + $compilationContext + ); + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + $tempVariable, + $compilationContext, + $statement + ); + $tempVariable->setIdle(true); + break; + + case 'bool': + $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $statement + ); + $compilationContext->backend->assignBool( + $tempVariable, + $exprVariable, + $compilationContext + ); + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + $tempVariable, + $compilationContext, + $statement + ); + $tempVariable->setIdle(true); + break; + + case 'variable': + case 'mixed': + case 'string': + case 'array': + $compilationContext->backend->addArrayEntry( + $symbolVariable, + null, + $exprVariable, + $compilationContext, + $statement + ); + break; + + default: + throw new CompilerException('Unknown type: ' . $exprVariable->getType(), $statement); + } + break; + + default: + throw new CompilerException('Unknown type: ' . $resolvedExpr->getType(), $statement); + } + break; + + default: + throw new CompilerException('Unknown type: ' . $type, $statement); + } + } +} diff --git a/Library/Statements/LetStatement.php b/src/Statements/LetStatement.php similarity index 76% rename from Library/Statements/LetStatement.php rename to src/Statements/LetStatement.php index 6663c36738..90aef5957b 100644 --- a/Library/Statements/LetStatement.php +++ b/src/Statements/LetStatement.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; use Zephir\CompilationContext; @@ -41,6 +43,8 @@ use Zephir\Statements\Let\Variable as LetVariable; use Zephir\Statements\Let\VariableAppend as LetVariableAppend; +use function is_object; + /** * LetStatement. * @@ -53,7 +57,7 @@ class LetStatement extends StatementAbstract * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $readDetector = new ReadDetector(); @@ -64,30 +68,30 @@ public function compile(CompilationContext $compilationContext) /* * Get the symbol from the symbol table if necessary */ - switch ($assignment['assign-type']) { - case 'static-property': - case 'static-property-append': - case 'static-property-array-index': - case 'static-property-array-index-append': - case 'dynamic-variable-string': - $symbolVariable = null; - break; - - case 'array-index': - case 'variable-append': - case 'object-property': - case 'array-index-append': - case 'string-dynamic-object-property': - case 'variable-dynamic-object-property': - $symbolVariable = $compilationContext->symbolTable->getVariableForUpdate($variable, $compilationContext, $assignment); - break; - - default: - $symbolVariable = $compilationContext->symbolTable->getVariableForWrite($variable, $compilationContext, $assignment); - break; - } - - /* + $symbolVariable = match ($assignment['assign-type']) { + 'static-property', + 'static-property-append', + 'static-property-array-index', + 'static-property-array-index-append', + 'dynamic-variable-string' => null, + 'array-index', + 'variable-append', + 'object-property', + 'array-index-append', + 'string-dynamic-object-property', + 'variable-dynamic-object-property' => $compilationContext->symbolTable->getVariableForUpdate( + $variable, + $compilationContext, + $assignment + ), + default => $compilationContext->symbolTable->getVariableForWrite( + $variable, + $compilationContext, + $assignment + ), + }; + + /** * Incr/Decr assignments don't require an expression */ if (isset($assignment['expr'])) { @@ -131,10 +135,10 @@ public function compile(CompilationContext $compilationContext) $resolvedExpr = $expr->compile($compilationContext); - /* - * Bad implemented operators could return values different than objects + /** + * Bad implemented operators could return values different from objects */ - if (!\is_object($resolvedExpr)) { + if (!is_object($resolvedExpr)) { throw new CompilerException('Resolved expression is not valid', $assignment['expr']); } } @@ -149,7 +153,14 @@ public function compile(CompilationContext $compilationContext) switch ($assignment['assign-type']) { case 'variable': $let = new LetVariable(); - $let->assign($variable, $symbolVariable, $resolvedExpr, $readDetector, $compilationContext, $assignment); + $let->assign( + $variable, + $symbolVariable, + $resolvedExpr, + $readDetector, + $compilationContext, + $assignment + ); break; case 'variable-append': @@ -175,34 +186,53 @@ public function compile(CompilationContext $compilationContext) case 'static-property': $let = new LetStaticProperty(); if (isset($assignment['operator'])) { - switch ($assignment['operator']) { - case 'add-assign': - $let = new LetStaticPropertyAdd(); - break; - case 'sub-assign': - $let = new LetStaticPropertySub(); - break; - default: - $let = new LetStaticProperty(); - } + $let = match ($assignment['operator']) { + 'add-assign' => new LetStaticPropertyAdd(), + 'sub-assign' => new LetStaticPropertySub(), + default => new LetStaticProperty(), + }; } - $let->assignStatic($variable, $assignment['property'], $resolvedExpr, $compilationContext, $assignment); + $let->assignStatic( + $variable, + $assignment['property'], + $resolvedExpr, + $compilationContext, + $assignment + ); break; case 'static-property-append': $let = new LetStaticPropertyAppend(); - $let->assignStatic($variable, $assignment['property'], $resolvedExpr, $compilationContext, $assignment); + $let->assignStatic( + $variable, + $assignment['property'], + $resolvedExpr, + $compilationContext, + $assignment + ); break; case 'static-property-array-index': $let = new LetStaticPropertyArrayIndex(); - $let->assignStatic($variable, $assignment['property'], $resolvedExpr, $compilationContext, $assignment); + $let->assignStatic( + $variable, + $assignment['property'], + $resolvedExpr, + $compilationContext, + $assignment + ); break; case 'static-property-array-index-append': $let = new LetStaticPropertyArrayIndexAppend(); - $let->assignStatic($variable, $assignment['property'], $resolvedExpr, $compilationContext, $assignment); + $let->assignStatic( + $variable, + $assignment['property'], + $resolvedExpr, + $compilationContext, + $assignment + ); break; case 'array-index': @@ -261,7 +291,7 @@ public function compile(CompilationContext $compilationContext) break; default: - throw new CompilerException('Unknown assignment: '.$assignment['assign-type'], $assignment); + throw new CompilerException('Unknown assignment: ' . $assignment['assign-type'], $assignment); } } } @@ -301,16 +331,17 @@ protected function replaceAssignBitwiseOnDirect(array $assignment): array } if ($assignment['assign-type'] !== 'variable') { - throw new CompilerException("Operator '".$assignment['operator']."' is not supported assign-type: ".$assignment['assign-type']); + throw new CompilerException( + "Operator '" . $assignment['operator'] . "' is not supported assign-type: " . $assignment['assign-type'] + ); } - $builderExpr = BuilderFactory::getInstance(); - - $leftExpression = $builderExpr->variable($assignment['variable']); - + $builderExpr = BuilderFactory::getInstance(); + $leftExpression = $builderExpr->variable($assignment['variable']); $assignment['expr'] = $builderExpr->operators() - ->binary($operator, $leftExpression, $builderExpr->raw($assignment['expr'])) - ->build(); + ->binary($operator, $leftExpression, $builderExpr->raw($assignment['expr'])) + ->build() + ; $assignment['operator'] = AssignVariableOperator::OPERATOR_ASSIGN; diff --git a/Library/Statements/LoopStatement.php b/src/Statements/LoopStatement.php similarity index 74% rename from Library/Statements/LoopStatement.php rename to src/Statements/LoopStatement.php index 525182745c..5d5f361b26 100644 --- a/Library/Statements/LoopStatement.php +++ b/src/Statements/LoopStatement.php @@ -9,17 +9,19 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; +use ReflectionException; use Zephir\Branch; use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Passes\LoopBreakPass; use Zephir\StatementsBlock; /** - * LoopStatement. - * * Loop statement, infinite loop */ class LoopStatement extends StatementAbstract @@ -27,22 +29,26 @@ class LoopStatement extends StatementAbstract /** * @param CompilationContext $compilationContext * - * @throws CompilerException + * @throws ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $compilationContext->codePrinter->output('while (1) {'); - /* + /** * Variables are initialized in a different way inside cycle */ ++$compilationContext->insideCycle; - /* + /** * Compile statements in the 'loop' block */ if (!isset($this->statement['statements'])) { - throw new CompilerException("Infinite loop without at least a 'break' statement is not allowed", $this->statement); + throw new CompilerException( + "Infinite loop without at least a 'break' statement is not allowed", + $this->statement + ); } $st = new StatementsBlock($this->statement['statements']); @@ -53,7 +59,10 @@ public function compile(CompilationContext $compilationContext) $loopBreakPass = new LoopBreakPass(); $loopBreakPass->pass($st); if (!$loopBreakPass->hasBreak()) { - throw new CompilerException("Infinite loop without at least a 'break' statement is not allowed", $this->statement); + throw new CompilerException( + "Infinite loop without at least a 'break' statement is not allowed", + $this->statement + ); } $st->isLoop(true); diff --git a/src/Statements/RequireOnceStatement.php b/src/Statements/RequireOnceStatement.php new file mode 100644 index 0000000000..35f03b4d58 --- /dev/null +++ b/src/Statements/RequireOnceStatement.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements; + +/** + * RequireOnceStatement. + * + * Require once statement is used to execute PHP scripts in a given path + */ +class RequireOnceStatement extends RequireStatement +{ + protected string $methodName = 'require_once'; +} diff --git a/Library/Statements/RequireStatement.php b/src/Statements/RequireStatement.php similarity index 86% rename from Library/Statements/RequireStatement.php rename to src/Statements/RequireStatement.php index 17cc9f8982..84c1036109 100644 --- a/Library/Statements/RequireStatement.php +++ b/src/Statements/RequireStatement.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; use Zephir\CompilationContext; @@ -22,15 +24,17 @@ */ class RequireStatement extends StatementAbstract { + protected string $methodName = 'require'; + /** * @param CompilationContext $compilationContext * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $expression = [ - 'type' => 'require', + 'type' => $this->methodName, 'left' => $this->statement['expr'], 'file' => $this->statement['file'], 'line' => $this->statement['line'], @@ -38,7 +42,7 @@ public function compile(CompilationContext $compilationContext) ]; $expr = new Expression($expression); - $expr->setExpectReturn(false, null); + $expr->setExpectReturn(false); $expr->compile($compilationContext); } } diff --git a/Library/Statements/ReturnStatement.php b/src/Statements/ReturnStatement.php similarity index 86% rename from Library/Statements/ReturnStatement.php rename to src/Statements/ReturnStatement.php index a411c5816d..90898c1249 100644 --- a/Library/Statements/ReturnStatement.php +++ b/src/Statements/ReturnStatement.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; use ReflectionException; @@ -17,17 +19,21 @@ use Zephir\Exception\CompilerException; use Zephir\Exception\InvalidTypeException; use Zephir\Expression; -use Zephir\Types; +use Zephir\Name; +use Zephir\Traits\VariablesTrait; +use Zephir\Types\Types; -use function Zephir\add_slashes; +use function sprintf; /** - * ReturnStatement. - * * Return statement is used to assign variables */ final class ReturnStatement extends StatementAbstract { + use VariablesTrait; + + private const RETURN_RETURN = 'RETURN_MM();'; + /** * @param CompilationContext $compilationContext * @@ -64,21 +70,16 @@ public function compile(CompilationContext $compilationContext): void /** * If the property is accessed on 'this', we check if the property does exist. */ - $property = $statement['expr']['right']['value']; + $property = $statement['expr']['right']['value']; $classDefinition = $compilationContext->classDefinition; - if (!$classDefinition->hasProperty($property)) { - throw new CompilerException( - sprintf( - "Class '%s' does not have a property called: '%s'", - $classDefinition->getCompleteName(), - $property - ), - $statement['expr']['right'] - ); - } + $this->checkClassHasProperty( + $classDefinition, + $property, + $statement['expr']['right'] + ); $compilationContext->headersManager->add('kernel/object'); - $codePrinter->output('RETURN_MM_MEMBER(getThis(), "'.$property.'");'); + $codePrinter->output('RETURN_MM_MEMBER(getThis(), "' . $property . '");'); return; } @@ -119,7 +120,11 @@ public function compile(CompilationContext $compilationContext): void break; case Types::T_BOOL: - if (!$currentMethod->areReturnTypesBoolCompatible() && !$currentMethod->isMixed() && !$currentMethod->areReturnTypesFalseCompatible()) { + if ( + !$currentMethod->areReturnTypesBoolCompatible() && + !$currentMethod->isMixed() && + !$currentMethod->areReturnTypesFalseCompatible() + ) { throw new InvalidTypeException($resolvedExpr->getType(), $statement['expr']); } break; @@ -201,30 +206,30 @@ public function compile(CompilationContext $compilationContext): void case Types::T_ULONG: case Types::T_CHAR: case Types::T_UCHAR: - $codePrinter->output('RETURN_MM_LONG('.$resolvedExpr->getCode().');'); + $codePrinter->output('RETURN_MM_LONG(' . $resolvedExpr->getCode() . ');'); break; case Types::T_BOOL: - $codePrinter->output('RETURN_MM_BOOL('.$resolvedExpr->getBooleanCode().');'); + $codePrinter->output('RETURN_MM_BOOL(' . $resolvedExpr->getBooleanCode() . ');'); break; case Types::T_DOUBLE: - $codePrinter->output('RETURN_MM_DOUBLE('.$resolvedExpr->getCode().');'); + $codePrinter->output('RETURN_MM_DOUBLE(' . $resolvedExpr->getCode() . ');'); break; case Types::T_STRING: case Types::T_ISTRING: $compilationContext->backend->returnString( - add_slashes($resolvedExpr->getCode()), + Name::addSlashes($resolvedExpr->getCode()), $compilationContext ); break; case Types::T_ARRAY: if ('return_value' != $resolvedExpr->getCode()) { - $codePrinter->output('RETURN_CTOR('.$resolvedExpr->getCode().');'); + $codePrinter->output('RETURN_CTOR(' . $resolvedExpr->getCode() . ');'); } else { - $codePrinter->output('RETURN_MM();'); + $codePrinter->output(self::RETURN_RETURN); } break; @@ -245,23 +250,23 @@ public function compile(CompilationContext $compilationContext): void case Types::T_ULONG: case Types::T_CHAR: case Types::T_UCHAR: - $codePrinter->output('RETURN_MM_LONG('.$symbolVariable->getName().');'); + $codePrinter->output('RETURN_MM_LONG(' . $symbolVariable->getName() . ');'); break; case Types::T_DOUBLE: - $codePrinter->output('RETURN_MM_DOUBLE('.$symbolVariable->getName().');'); + $codePrinter->output('RETURN_MM_DOUBLE(' . $symbolVariable->getName() . ');'); break; case Types::T_STRING: case Types::T_ISTRING: case Types::T_ARRAY: $codePrinter->output( - 'RETURN_CTOR('.$compilationContext->backend->getVariableCode($symbolVariable).');' + 'RETURN_CTOR(' . $compilationContext->backend->getVariableCode($symbolVariable) . ');' ); break; case Types::T_BOOL: - $codePrinter->output('RETURN_MM_BOOL('.$symbolVariable->getName().');'); + $codePrinter->output('RETURN_MM_BOOL(' . $symbolVariable->getName() . ');'); break; case Types::T_VARIABLE: @@ -302,15 +307,14 @@ public function compile(CompilationContext $compilationContext): void $compilationContext->backend->getVariableCode($symbolVariable) ) ); - $codePrinter->output('RETURN_MM();'); + $codePrinter->output(self::RETURN_RETURN); } } else { - $codePrinter->output('RETURN_MM();'); + $codePrinter->output(self::RETURN_RETURN); } } - if ($symbolVariable->isTemporal()) { - $symbolVariable->setIdle(true); - } + + $this->checkVariableTemporal($symbolVariable); break; default: @@ -322,7 +326,7 @@ public function compile(CompilationContext $compilationContext): void break; default: - throw new CompilerException("Cannot return '".$resolvedExpr->getType()."'", $statement['expr']); + throw new CompilerException("Cannot return '" . $resolvedExpr->getType() . "'", $statement['expr']); } return; diff --git a/src/Statements/StatementAbstract.php b/src/Statements/StatementAbstract.php new file mode 100644 index 0000000000..f2bcf57299 --- /dev/null +++ b/src/Statements/StatementAbstract.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Statements; + +use Zephir\CompilationContext; +use Zephir\Optimizers\EvalExpression; +use Zephir\Traits\VariablesTrait; + +abstract class StatementAbstract +{ + use VariablesTrait; + + protected ?EvalExpression $evalExpression; + + public function __construct(protected array $statement) + { + } + + /** + * Compiles the statement. + * + * @param CompilationContext $compilationContext + */ + abstract public function compile(CompilationContext $compilationContext); + + public function getEvalExpression(): ?EvalExpression + { + return $this->evalExpression; + } +} diff --git a/Library/Statements/SwitchStatement.php b/src/Statements/SwitchStatement.php similarity index 70% rename from Library/Statements/SwitchStatement.php rename to src/Statements/SwitchStatement.php index 29cc6fe92b..70430b0671 100644 --- a/Library/Statements/SwitchStatement.php +++ b/src/Statements/SwitchStatement.php @@ -9,25 +9,33 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; +use ReflectionException; use Zephir\Branch; use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Expression; use Zephir\Optimizers\EvalExpression; use Zephir\StatementsBlock; +use function count; +use function implode; + /** - * SwitchStatement. - * * Switch statement, the same as in PHP/C */ class SwitchStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext + * + * @throws ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $exprRaw = $this->statement['expr']; @@ -49,59 +57,64 @@ public function compile(CompilationContext $compilationContext) /** * Create a temporary variable. */ - $tempVariable = $compilationContext->symbolTable->getTempVariable($resolvedExpr->getType(), $compilationContext); + $tempVariable = $compilationContext->symbolTable->getTempVariable( + $resolvedExpr->getType(), + $compilationContext + ); /** * Simulate an assignment to the temporary variable. */ $statement = new LetStatement([ - 'type' => 'let', + 'type' => 'let', 'assignments' => [ [ 'assign-type' => 'variable', - 'operator' => 'assign', - 'variable' => $tempVariable->getName(), - 'expr' => [ - 'type' => $resolvedExpr->getType(), + 'operator' => 'assign', + 'variable' => $tempVariable->getName(), + 'expr' => [ + 'type' => $resolvedExpr->getType(), 'value' => $resolvedExpr->getCode(), - 'file' => $exprRaw['file'], - 'line' => $exprRaw['line'], - 'char' => $exprRaw['char'], + 'file' => $exprRaw['file'], + 'line' => $exprRaw['line'], + 'char' => $exprRaw['char'], ], - 'file' => $exprRaw['file'], - 'line' => $exprRaw['line'], - 'char' => $exprRaw['char'], + 'file' => $exprRaw['file'], + 'line' => $exprRaw['line'], + 'char' => $exprRaw['char'], ], ], ]); $statement->compile($compilationContext); } else { - $tempVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $exprRaw); + $tempVariable = $compilationContext->symbolTable->getVariableForRead( + $resolvedExpr->getCode(), + $compilationContext, + $exprRaw + ); } - $clauses = $this->normalizeClauses($this->statement['clauses']); + $clauses = $this->normalizeClauses($this->statement['clauses']); $tempLeft = ['type' => 'variable', 'value' => $tempVariable->getRealName()]; /** * In the first round we group case clauses that have block statements * with the ones that does not have one. */ - $blocks = []; - $exprStack = []; + $blocks = []; + $exprStack = []; $defaultBlock = null; foreach ($clauses as $clause) { if ('case' == $clause['type']) { - $expr = [ - 'type' => 'equals', - 'left' => $tempLeft, + $expr = [ + 'type' => 'equals', + 'left' => $tempLeft, 'right' => $clause['expr'], ]; - if (!isset($clause['statements'])) { - $exprStack[] = $expr; - } else { - $exprStack[] = $expr; - $blocks[] = [ - 'expr' => $exprStack, + $exprStack[] = $expr; + if (isset($clause['statements'])) { + $blocks[] = [ + 'expr' => $exprStack, 'block' => $clause['statements'], ]; $exprStack = []; @@ -113,26 +126,26 @@ public function compile(CompilationContext $compilationContext) } } - /* + /** * In the second round we generate the conditions with their blocks * grouping 'cases' without a statement block using an 'or' */ foreach ($blocks as $block) { $expressions = $block['expr']; - if (1 == \count($expressions)) { + if (1 == count($expressions)) { $condition = $evalExpr->optimize($expressions[0], $compilationContext); - $codePrinter->output('if ('.$condition.') {'); + $codePrinter->output('if (' . $condition . ') {'); } else { $orConditions = []; foreach ($expressions as $expression) { $orConditions[] = $evalExpr->optimize($expression, $compilationContext); } - $codePrinter->output('if ('.implode(' || ', $orConditions).') {'); + $codePrinter->output('if (' . implode(' || ', $orConditions) . ') {'); } if (isset($block['block'])) { - $st = new StatementsBlock($block['block']); + $st = new StatementsBlock($block['block']); $branch = $st->compile($compilationContext, false, Branch::TYPE_SWITCH); $branch->setRelatedStatement($this); } @@ -142,7 +155,7 @@ public function compile(CompilationContext $compilationContext) $compilationContext->codePrinter->decreaseLevel(); - /* + /** * The default block is resolved at the end of the 'switch' */ if ($defaultBlock) { @@ -165,7 +178,7 @@ public function normalizeClauses($clauses) } } - if ($defaultIndex === \count($clauses) - 1) { + if ($defaultIndex === count($clauses) - 1) { return $clauses; } diff --git a/Library/Statements/ThrowStatement.php b/src/Statements/ThrowStatement.php similarity index 72% rename from Library/Statements/ThrowStatement.php rename to src/Statements/ThrowStatement.php index 70a7e38322..7da50b81c1 100644 --- a/Library/Statements/ThrowStatement.php +++ b/src/Statements/ThrowStatement.php @@ -14,21 +14,20 @@ namespace Zephir\Statements; use ReflectionException; -use Zephir\Classes\Entry; -use Zephir\CodePrinter; +use Zephir\Class\Entry; +use Zephir\Code\Printer; use Zephir\CompilationContext; use Zephir\Compiler; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; +use Zephir\Name; +use function count; use function in_array; -use function Zephir\add_slashes; -use function Zephir\fqcn; +use function sprintf; /** - * ThrowStatement. - * * Throws exceptions */ class ThrowStatement extends StatementAbstract @@ -39,24 +38,25 @@ class ThrowStatement extends StatementAbstract * @throws Exception * @throws ReflectionException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $compilationContext->headersManager->add('kernel/exception'); $codePrinter = $compilationContext->codePrinter; - $statement = $this->statement; - $expr = $statement['expr']; + $statement = $this->statement; + $expr = $statement['expr']; - /* + /** * This optimizes throw new Exception("hello") */ if (!$compilationContext->insideTryCatch) { - if (isset($expr['class']) && + if ( + isset($expr['class']) && isset($expr['parameters']) && - 1 == \count($expr['parameters']) && + 1 == count($expr['parameters']) && 'string' == $expr['parameters'][0]['parameter']['type'] ) { - $className = fqcn( + $className = Name::fetchFQN( $expr['class'], $compilationContext->classDefinition->getNamespace(), $compilationContext->aliasManager @@ -64,7 +64,7 @@ public function compile(CompilationContext $compilationContext) if ($compilationContext->compiler->isClass($className)) { $classDefinition = $compilationContext->compiler->getClassDefinition($className); - $message = $expr['parameters'][0]['parameter']['value']; + $message = $expr['parameters'][0]['parameter']['value']; try { $class = $classDefinition->getClassEntry($compilationContext); $this->throwStringException($codePrinter, $class, $message, $expr); @@ -76,7 +76,7 @@ public function compile(CompilationContext $compilationContext) } else { if ($compilationContext->compiler->isBundledClass($className)) { $classEntry = (new Entry($expr['class'], $compilationContext))->get(); - $message = $expr['parameters'][0]['parameter']['value']; + $message = $expr['parameters'][0]['parameter']['value']; $this->throwStringException($codePrinter, $classEntry, $message, $expr); return; @@ -94,7 +94,7 @@ public function compile(CompilationContext $compilationContext) } try { - $throwExpr = new Expression($expr); + $throwExpr = new Expression($expr); $resolvedExpr = $throwExpr->compile($compilationContext); } catch (Exception $e) { throw new CompilerException($e->getMessage(), $expr, $e->getCode(), $e); @@ -102,7 +102,7 @@ public function compile(CompilationContext $compilationContext) if (!in_array($resolvedExpr->getType(), ['variable', 'string'])) { throw new CompilerException( - "Expression '".$resolvedExpr->getType().'" cannot be used as exception', + "Expression '" . $resolvedExpr->getType() . '" cannot be used as exception', $expr ); } @@ -115,44 +115,42 @@ public function compile(CompilationContext $compilationContext) if (!in_array($variableVariable->getType(), ['variable', 'string'])) { throw new CompilerException( - "Variable '".$variableVariable->getType()."' cannot be used as exception", + "Variable '" . $variableVariable->getType() . "' cannot be used as exception", $expr ); } $variableCode = $compilationContext->backend->getVariableCode($variableVariable); - $file = Compiler::getShortUserPath($statement['expr']['file']); - $line = $statement['expr']['line']; + $file = Compiler::getShortUserPath($statement['expr']['file']); + $line = $statement['expr']['line']; $codePrinter->output( - 'zephir_throw_exception_debug('.$variableCode.', "'.$file.'", '.$line.');' + 'zephir_throw_exception_debug(' . $variableCode . ', "' . $file . '", ' . $line . ');' ); if (!$compilationContext->insideTryCatch) { $codePrinter->output('ZEPHIR_MM_RESTORE();'); $codePrinter->output('return;'); } else { - $codePrinter->output('goto try_end_'.$compilationContext->currentTryCatch.';'); + $codePrinter->output('goto try_end_' . $compilationContext->currentTryCatch . ';'); $codePrinter->outputBlankLine(); } - if ($variableVariable->isTemporal()) { - $variableVariable->setIdle(true); - } + $this->checkVariableTemporal($variableVariable); } /** * Throws an exception escaping the data. * - * @param CodePrinter $printer - * @param string $class - * @param string $message - * @param array $expression + * @param Printer $printer + * @param string $class + * @param string $message + * @param array $expression */ - private function throwStringException(CodePrinter $printer, string $class, string $message, array $expression): void + private function throwStringException(Printer $printer, string $class, string $message, array $expression): void { - $message = add_slashes($message); - $path = Compiler::getShortUserPath($expression['file']); + $message = Name::addSlashes($message); + $path = Compiler::getShortUserPath($expression['file']); $printer->output( sprintf( 'ZEPHIR_THROW_EXCEPTION_DEBUG_STR(%s, "%s", "%s", %s);', diff --git a/Library/Statements/TryCatchStatement.php b/src/Statements/TryCatchStatement.php similarity index 54% rename from Library/Statements/TryCatchStatement.php rename to src/Statements/TryCatchStatement.php index 5625d05086..6534a15e3b 100644 --- a/Library/Statements/TryCatchStatement.php +++ b/src/Statements/TryCatchStatement.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; use Zephir\CompilationContext; @@ -17,17 +19,15 @@ use Zephir\Expression\Builder\Operators\BinaryOperator; use Zephir\StatementsBlock; +use function array_merge; +use function count; + /** - * TryCatchStatement. - * * Try/Catch statement the same as in PHP */ class TryCatchStatement extends StatementAbstract { - /** - * @param CompilationContext $compilationContext - */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $codePrinter = $compilationContext->codePrinter; @@ -35,7 +35,7 @@ public function compile(CompilationContext $compilationContext) $currentTryCatch = ++$compilationContext->currentTryCatch; $codePrinter->outputBlankLine(); - $codePrinter->output('/* try_start_'.$currentTryCatch.': */'); + $codePrinter->output('/* try_start_' . $currentTryCatch . ': */'); $codePrinter->outputBlankLine(); if (isset($this->statement['statements'])) { @@ -44,9 +44,9 @@ public function compile(CompilationContext $compilationContext) } $codePrinter->outputBlankLine(); - $codePrinter->output('try_end_'.$currentTryCatch.':'); + $codePrinter->output('try_end_' . $currentTryCatch . ':'); - /* + /** * If 'try' is the latest statement add a 'dummy' statement to avoid compilation errors */ $codePrinter->outputBlankLine(); @@ -54,69 +54,83 @@ public function compile(CompilationContext $compilationContext) --$compilationContext->insideTryCatch; if (isset($this->statement['catches'])) { - /* + /** * Check if there was an exception */ $codePrinter->output('if (EG(exception)) {'); $codePrinter->increaseLevel(); - $exc_var = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $compilationContext); + $exc_var = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $compilationContext + ); $compilationContext->backend->copyOnWrite($exc_var, 'EG(exception)', $compilationContext); $exprBuilder = BuilderFactory::getInstance(); - $ifs = []; + $ifs = []; foreach ($this->statement['catches'] as $catch) { if (isset($catch['variable'])) { - $variable = $compilationContext->symbolTable->getVariableForWrite($catch['variable']['value'], $compilationContext, $catch['variable']); + $variable = $compilationContext->symbolTable->getVariableForWrite( + $catch['variable']['value'], + $compilationContext, + $catch['variable'] + ); if ('variable' != $variable->getType()) { - throw new CompilerException('Only dynamic variables can be used to catch exceptions', $catch['exception']); + throw new CompilerException( + 'Only dynamic variables can be used to catch exceptions', + $catch['exception'] + ); } } else { - $variable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $compilationContext); + $variable = $compilationContext->symbolTable->getTempVariableForWrite( + 'variable', + $compilationContext, + $compilationContext + ); } - if ($compilationContext->backend->isZE3()) { - $assignExceptionVarStmt = $exprBuilder->statements()->rawC('ZEPHIR_CPY_WRT(&'.$variable->getName().', &'.$exc_var->getName().');'); - } else { - $assignExceptionVarStmt = $exprBuilder->statements()->rawC('ZEPHIR_CPY_WRT('.$variable->getName().', '.$exc_var->getName().');'); - } + $assignExceptionVarStmt = $exprBuilder->statements()->rawC( + 'ZEPHIR_CPY_WRT(&' . $variable->getName() . ', &' . $exc_var->getName() . ');' + ); - /* + /** * TODO:, use a builder here */ $variable->setIsInitialized(true, $compilationContext); $variable->setMustInitNull(true); - /* + /** * Check if any of the classes in the catch block match the thrown exception */ foreach ($catch['classes'] as $class) { - $assignExceptVar = $exprBuilder->statements()->let([ - $exprBuilder->operators()->assignVariable($variable->getName(), $exprBuilder->variable($variable->getName())), - ]); - $ifs[] = $exprBuilder->statements()->ifX() - ->setCondition( - $exprBuilder->operators()->binary( - BinaryOperator::OPERATOR_INSTANCEOF, - $exprBuilder->variable($exc_var->getName()), - $exprBuilder->variable($class['value']) - ) - ) - ->setStatements($exprBuilder->statements()->block(array_merge( - [ - $exprBuilder->statements()->rawC('zend_clear_exception();'), - $assignExceptionVarStmt, - ], - isset($catch['statements']) ? $catch['statements'] : [] - ))); + ->setCondition( + $exprBuilder->operators()->binary( + BinaryOperator::OPERATOR_INSTANCEOF, + $exprBuilder->variable($exc_var->getName()), + $exprBuilder->variable($class['value']) + ) + ) + ->setStatements( + $exprBuilder->statements()->block( + array_merge( + [ + $exprBuilder->statements()->rawC('zend_clear_exception();'), + $assignExceptionVarStmt, + ], + $catch['statements'] ?? [] + ) + ) + ) + ; } } $primaryIf = $ifs[0]; - $lastIf = $ifs[0]; - for ($i = 1; $i < \count($ifs); ++$i) { + $lastIf = $ifs[0]; + for ($i = 1; $i < count($ifs); ++$i) { $lastIf->setElseStatements($exprBuilder->statements()->block([$ifs[$i]])); $lastIf = $ifs[$i]; } diff --git a/Library/Statements/UnsetStatement.php b/src/Statements/UnsetStatement.php similarity index 65% rename from Library/Statements/UnsetStatement.php rename to src/Statements/UnsetStatement.php index e8eda65fcd..7acb07cfc5 100644 --- a/Library/Statements/UnsetStatement.php +++ b/src/Statements/UnsetStatement.php @@ -54,8 +54,12 @@ public function compile(CompilationContext $compilationContext): void $expr = new Expression($expression['left']); $expr->setReadOnly(true); - $exprVar = $expr->compile($compilationContext); - $variable = $compilationContext->symbolTable->getVariableForWrite($exprVar->getCode(), $compilationContext, $this->statement); + $exprVar = $expr->compile($compilationContext); + $variable = $compilationContext->symbolTable->getVariableForWrite( + $exprVar->getCode(), + $compilationContext, + $this->statement + ); $expr = new Expression($expression['right']); $expr->setReadOnly(true); @@ -66,21 +70,34 @@ public function compile(CompilationContext $compilationContext): void case 'property-dinamic-access': $expr = new Expression($expression['left']); $expr->setReadOnly(true); - $exprVar = $expr->compile($compilationContext); - $variable = $compilationContext->symbolTable->getVariableForWrite($exprVar->getCode(), $compilationContext, $this->statement); + $exprVar = $expr->compile($compilationContext); + $variable = $compilationContext->symbolTable->getVariableForWrite( + $exprVar->getCode(), + $compilationContext, + $this->statement + ); $variableCode = $compilationContext->backend->getVariableCode($variable); $compilationContext->headersManager->add('kernel/object'); - $compilationContext->codePrinter->output('zephir_unset_property('.$variableCode.', "'.$expression['right']['value'].'");'); + $compilationContext->codePrinter->output( + 'zephir_unset_property(' . $variableCode . ', "' . $expression['right']['value'] . '");' + ); return; default: - throw new CompilerException('Cannot use expression type: '.$expression['type'].' in "unset"', $expression); + throw new CompilerException( + 'Cannot use expression type: ' . $expression['type'] . ' in "unset"', + $expression + ); } if (!in_array($variable->getType(), ['variable', 'array'])) { - throw new CompilerException('Cannot use variable type: '.$variable->gettype().' in "unset"', $expression['left']); + throw CompilerException::cannotUseVariableTypeAs( + $variable, + 'in "unset"', + $expression['left'] + ); } if ($variable->hasDifferentDynamicType(['undefined', 'array', 'object', 'null'])) { @@ -102,34 +119,48 @@ public function compile(CompilationContext $compilationContext): void * @throws Exception * @throws ReflectionException */ - private function generateUnsetPropertyFromObject(array $expression, CompilationContext $compilationContext): CompilationContext - { + private function generateUnsetPropertyFromObject( + array $expression, + CompilationContext $compilationContext + ): CompilationContext { $expr = new Expression($expression['right']); $expr->setReadOnly(true); $exprVar = $expr->compile($compilationContext); switch ($exprVar->getType()) { case 'variable': - $variable = $compilationContext->symbolTable->getVariableForRead($exprVar->getCode(), $compilationContext, $this->statement); + $variable = $compilationContext->symbolTable->getVariableForRead( + $exprVar->getCode(), + $compilationContext, + $this->statement + ); $variableRef = $compilationContext->backend->getVariableCode($variable); break; default: $expr = new Expression($expression['left']); $expr->setReadOnly(true); - $exprVar = $expr->compile($compilationContext); - $variable = $compilationContext->symbolTable->getVariableForWrite($exprVar->getCode(), $compilationContext, $this->statement); + $exprVar = $expr->compile($compilationContext); + $variable = $compilationContext->symbolTable->getVariableForWrite( + $exprVar->getCode(), + $compilationContext, + $this->statement + ); $variableRef = $compilationContext->backend->getVariableCode($variable); // TODO: Add more types check when parser will support them, see ArrayAccessTest.zep switch ($expression['right']['type']) { case 'string': - $compilationContext->codePrinter->output('ZVAL_STR('.$variableRef.', "'.$expression['right']['value'].'");'); + $compilationContext->codePrinter->output( + 'ZVAL_STR(' . $variableRef . ', "' . $expression['right']['value'] . '");' + ); break; case 'int': - $compilationContext->codePrinter->output('ZVAL_LONG('.$variableRef.', '.$expression['right']['value'].');'); + $compilationContext->codePrinter->output( + 'ZVAL_LONG(' . $variableRef . ', ' . $expression['right']['value'] . ');' + ); break; } break; @@ -137,13 +168,17 @@ private function generateUnsetPropertyFromObject(array $expression, CompilationC $expr = new Expression($expression['left']['left']); $expr->setReadOnly(true); - $exprVar = $expr->compile($compilationContext); - $variable = $compilationContext->symbolTable->getVariableForWrite($exprVar->getCode(), $compilationContext, $this->statement); + $exprVar = $expr->compile($compilationContext); + $variable = $compilationContext->symbolTable->getVariableForWrite( + $exprVar->getCode(), + $compilationContext, + $this->statement + ); $variableCode = $compilationContext->backend->getVariableCode($variable); $compilationContext->headersManager->add('kernel/object'); $compilationContext->codePrinter->output( - 'zephir_unset_property_array('.$variableCode.', ZEND_STRL("'.$expression['left']['right']['value'].'"), '.$variableRef.');' + 'zephir_unset_property_array(' . $variableCode . ', ZEND_STRL("' . $expression['left']['right']['value'] . '"), ' . $variableRef . ');' ); return $compilationContext; diff --git a/Library/Statements/WhileStatement.php b/src/Statements/WhileStatement.php similarity index 82% rename from Library/Statements/WhileStatement.php rename to src/Statements/WhileStatement.php index c72309d941..7eebf11db2 100644 --- a/Library/Statements/WhileStatement.php +++ b/src/Statements/WhileStatement.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements; use Zephir\CompilationContext; @@ -25,9 +27,9 @@ class WhileStatement extends StatementAbstract /** * @param CompilationContext $compilationContext */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { - $exprRaw = $this->statement['expr']; + $exprRaw = $this->statement['expr']; $codePrinter = $compilationContext->codePrinter; /* @@ -42,12 +44,12 @@ public function compile(CompilationContext $compilationContext) */ ++$compilationContext->insideCycle; - $expr = new EvalExpression(); - $condition = $expr->optimize($exprRaw, $compilationContext); + $expr = new EvalExpression(); + $condition = $expr->optimize($exprRaw, $compilationContext); $this->evalExpression = $expr; - $codePrinter->output('if (!('.$condition.')) {'); - $codePrinter->output("\t".'break;'); + $codePrinter->output('if (!(' . $condition . ')) {'); + $codePrinter->output("\t" . 'break;'); $codePrinter->output('}'); $codePrinter->decreaseLevel(); diff --git a/Library/StatementsBlock.php b/src/StatementsBlock.php similarity index 90% rename from Library/StatementsBlock.php rename to src/StatementsBlock.php index 5067263589..0c46d5137e 100644 --- a/Library/StatementsBlock.php +++ b/src/StatementsBlock.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use ReflectionException; @@ -30,7 +32,14 @@ use Zephir\Statements\TryCatchStatement; use Zephir\Statements\UnsetStatement; use Zephir\Statements\WhileStatement; + +use function array_pop; use function count; +use function filter_var; +use function getenv; +use function sprintf; + +use const FILTER_VALIDATE_BOOLEAN; /** * This represents a single basic block in Zephir. @@ -38,30 +47,14 @@ */ class StatementsBlock { - protected $statements; - + protected bool $loop = false; + protected bool $debug = false; + protected ?array $lastStatement = null; + protected ?MutateGathererPass $mutateGatherer = null; protected ?bool $unreachable = null; - protected $debug = false; - - protected $loop = false; - - protected $mutateGatherer; - - /** - * @var array|null - */ - protected $lastStatement; - - /** - * StatementsBlock constructor. - * - * @param array $statements - */ - public function __construct(array $statements) + public function __construct(protected array $statements) { - $this->statements = $statements; - $debug = false; if (getenv('ZEPHIR_DEBUG')) { // Do not use this feature for typical use case. @@ -71,28 +64,9 @@ public function __construct(array $statements) $debug = getenv('ZEPHIR_DEBUG'); } - // TODO: Add container support - // elseif ($this->container->has('ZEPHIR_DEBUG')) { - // $debug = $this->container->get('ZEPHIR_DEBUG'); - // } - $this->debug = filter_var($debug, FILTER_VALIDATE_BOOLEAN); } - /** - * Sets whether the statements blocks belongs to a loop. - * - * @param bool $loop - * - * @return StatementsBlock - */ - public function isLoop($loop) - { - $this->loop = $loop; - - return $this; - } - /** * @param CompilationContext $compilationContext * @param bool $unreachable @@ -103,8 +77,11 @@ public function isLoop($loop) * @throws Exception * @throws ReflectionException */ - public function compile(CompilationContext $compilationContext, ?bool $unreachable = null, int $branchType = Branch::TYPE_UNKNOWN): Branch - { + public function compile( + CompilationContext $compilationContext, + bool $unreachable = null, + int $branchType = Branch::TYPE_UNKNOWN + ): Branch { $compilationContext->codePrinter->increaseLevel(); ++$compilationContext->currentBranch; @@ -144,14 +121,14 @@ public function compile(CompilationContext $compilationContext, ?bool $unreachab } foreach ($statements as $statement) { - /* + /** * TODO: Generate GDB hints */ if ($this->debug) { if (isset($statement['file'])) { if ('declare' != $statement['type'] && 'comment' != $statement['type']) { $compilationContext->codePrinter->outputNoIndent( - '#line '.$statement['line'].' "'.$statement['file'].'"' + '#line ' . $statement['line'] . ' "' . $statement['file'] . '"' ); } } @@ -303,19 +280,19 @@ public function compile(CompilationContext $compilationContext, ?bool $unreachab $expr = new Expression($statement['expr']); $expr->setExpectReturn(false); $compiledExpression = $expr->compile($compilationContext); - $compilationContext->codePrinter->output($compiledExpression->getCode().';'); + $compilationContext->codePrinter->output($compiledExpression->getCode() . ';'); break; case 'mcall': $methodCall = new MethodCall(); - $expr = new Expression($statement['expr']); + $expr = new Expression($statement['expr']); $expr->setExpectReturn(false); $methodCall->compile($expr, $compilationContext); break; case 'fcall': $functionCall = new FunctionCall(); - $expr = new Expression($statement['expr']); + $expr = new Expression($statement['expr']); $expr->setExpectReturn(false); $compiledExpression = $functionCall->compile($expr, $compilationContext); switch ($compiledExpression->getType()) { @@ -327,14 +304,14 @@ public function compile(CompilationContext $compilationContext, ?bool $unreachab case 'char': case 'uchar': case 'bool': - $compilationContext->codePrinter->output($compiledExpression->getCode().';'); + $compilationContext->codePrinter->output($compiledExpression->getCode() . ';'); break; } break; case 'scall': $methodCall = new StaticCall(); - $expr = new Expression($statement['expr']); + $expr = new Expression($statement['expr']); $expr->setExpectReturn(false); $methodCall->compile($expr, $compilationContext); break; @@ -348,7 +325,7 @@ public function compile(CompilationContext $compilationContext, ?bool $unreachab break; default: - throw new Exception('Unsupported statement: '.$statement['type']); + throw new Exception('Unsupported statement: ' . $statement['type']); } if ('comment' != $statement['type']) { @@ -378,49 +355,51 @@ public function compile(CompilationContext $compilationContext, ?bool $unreachab } /** - * Returns the statements in the block. + * Returns the last statement executed. * - * @return array + * @return array|null */ - public function getStatements(): array + public function getLastStatement() { - return $this->statements; + return $this->lastStatement; } /** - * Setter for statements. + * Returns the type of the last statement executed. * - * @param array $statements + * @return string */ - public function setStatements(array $statements): void + public function getLastStatementType() { - $this->statements = $statements; + return $this->lastStatement['type']; } /** - * Returns the type of the last statement executed. - * - * @return string + * Create/Returns a mutate gatherer pass for this block. */ - public function getLastStatementType() + public function getMutateGatherer(bool $pass = false): MutateGathererPass { - return $this->lastStatement['type']; + if (!$this->mutateGatherer) { + $this->mutateGatherer = new MutateGathererPass(); + } + + if ($pass) { + $this->mutateGatherer->pass($this); + } + + return $this->mutateGatherer; } /** - * Returns the last statement executed. - * - * @return array|null + * Returns the statements in the block. */ - public function getLastStatement() + public function getStatements(): array { - return $this->lastStatement; + return $this->statements; } /** * Checks whether the block is empty or not. - * - * @return bool */ public function isEmpty(): bool { @@ -428,22 +407,20 @@ public function isEmpty(): bool } /** - * Create/Returns a mutate gatherer pass for this block. - * - * @param bool $pass - * - * @return MutateGathererPass + * Sets whether the statements block belongs to a loop. */ - public function getMutateGatherer(bool $pass = false): MutateGathererPass + public function isLoop(bool $loop): static { - if (!$this->mutateGatherer) { - $this->mutateGatherer = new MutateGathererPass(); - } + $this->loop = $loop; - if ($pass) { - $this->mutateGatherer->pass($this); - } + return $this; + } - return $this->mutateGatherer; + /** + * Setter for statements. + */ + public function setStatements(array $statements): void + { + $this->statements = $statements; } } diff --git a/Library/StaticCall.php b/src/StaticCall.php similarity index 50% rename from Library/StaticCall.php rename to src/StaticCall.php index 86329d27e8..1fc4943439 100644 --- a/Library/StaticCall.php +++ b/src/StaticCall.php @@ -9,23 +9,35 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use ReflectionException; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; +use Zephir\Traits\VariablesTrait; +use Zephir\Variable\Variable; use function count; +use function implode; use function in_array; +use function is_object; use function is_string; +use function sprintf; +use function str_replace; +use function strtolower; +use function strtoupper; /** - * StaticCall. - * * Call methods in a static context */ class StaticCall extends Call { + use VariablesTrait; + /** * Compiles a static method call. * @@ -34,13 +46,14 @@ class StaticCall extends Call * * @return CompiledExpression * + * @throws Exception * @throws ReflectionException */ public function compile(Expression $expr, CompilationContext $compilationContext): CompiledExpression { $expression = $expr->getExpression(); - $methodName = strtolower($expression['name']); + $methodName = strtolower($expression['name']); $dynamicMethod = $expression['dynamic'] ?? false; $symbolVariable = null; @@ -48,34 +61,37 @@ public function compile(Expression $expr, CompilationContext $compilationContext /** * Create temporary variable if needed. */ - $mustInit = false; + $mustInit = false; $isExpecting = $expr->isExpectingReturn(); if ($isExpecting) { $symbolVariable = $expr->getExpectingVariable(); - if (\is_object($symbolVariable)) { - $readDetector = new ReadDetector($expression); + if (is_object($symbolVariable)) { + $readDetector = new ReadDetector(); if ($readDetector->detect($symbolVariable->getName(), $expression)) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( + 'variable', + $compilationContext + ); } else { $mustInit = true; } } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( + 'variable', + $compilationContext + ); } } /** - * Method calls only return zvals so we need to validate the target variable is also a zval + * Method calls only return zvals, so we need to validate the target variable is also a zval */ if ($isExpecting) { /** * At this point, we don't know the exact dynamic type returned by the static method call */ $symbolVariable->setDynamicTypes('undefined'); - - if (!$symbolVariable->isVariable()) { - throw new CompilerException('Returned values by functions can only be assigned to variant variables', $expression); - } + $this->checkNotVariable($symbolVariable, $expression); } /** @@ -87,7 +103,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext $dynamicClass = $expression['dynamic-class']; if (!$dynamicClass) { - $className = $expression['class']; + $className = $expression['class']; $classDefinition = false; if (!in_array($className, ['self', 'static', 'parent'])) { @@ -99,7 +115,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($compiler->isBundledClass($className)) { $classDefinition = $compiler->getInternalClassDefinition($className); } else { - throw new CompilerException('Class name: '.$className.' does not exist', $expression); + throw new CompilerException('Class name: ' . $className . ' does not exist', $expression); } } } else { @@ -108,7 +124,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($compiler->isClass($singleClass)) { $classDefinition = $compiler->getClassDefinition($singleClass); } else { - throw new CompilerException('Class name: '.$className.' does not exist', $expression); + throw new CompilerException('Class name: ' . $className . ' does not exist', $expression); } } } @@ -118,10 +134,17 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ('parent' === $className) { $extendsClass = $classDefinition->getExtendsClass(); if (!$extendsClass) { - throw new CompilerException('Cannot call method "'.$methodName.'" on parent because class '.$classDefinition->getCompleteName().' does not extend any class', $expression); + throw new CompilerException( + 'Cannot call method "' + . $methodName + . '" on parent because class ' + . $classDefinition->getCompleteName() + . ' does not extend any class', + $expression + ); } $currentClassDefinition = $classDefinition; - $classDefinition = $classDefinition->getExtendsClassDefinition(); + $classDefinition = $classDefinition->getExtendsClassDefinition(); } } } @@ -135,47 +158,94 @@ public function compile(Expression $expr, CompilationContext $compilationContext if (!$classDefinition->hasMethod($methodName)) { $possibleMethod = $classDefinition->getPossibleMethodName($methodName); if ($possibleMethod) { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not implement static method: '".$expression['name']."'. Did you mean '".$possibleMethod."'?", $expression); + throw new CompilerException( + "Class '" + . $classDefinition->getCompleteName() + . "' does not implement static method: '" + . $expression['name'] + . "'. Did you mean '" + . $possibleMethod + . "'?", + $expression + ); } else { - throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not implement static method: '".$expression['name']."'", $expression); + throw new CompilerException( + "Class '" + . $classDefinition->getCompleteName() + . "' does not implement static method: '" + . $expression['name'] + . "'", + $expression + ); } } else { $method = $classDefinition->getMethod($methodName); if ($method->isPrivate() && $method->getClassDefinition() !== $compilationContext->classDefinition) { - throw new CompilerException("Cannot call private method '".$methodName."' out of its scope", $expression); + throw new CompilerException( + "Cannot call private method '" . $methodName . "' out of its scope", + $expression + ); } if (!in_array($className, ['self', 'static', 'parent']) && !$method->isStatic()) { - throw new CompilerException("Cannot call non-static method '".$methodName."' in a static way", $expression); + throw new CompilerException( + "Cannot call non-static method '" . $methodName . "' in a static way", + $expression + ); } if (!$classDefinition->hasMethod('__callStatic')) { - if ($method instanceof ClassMethod && !$method->isBundled()) { + if ($method instanceof Method && !$method->isBundled()) { /** * Try to produce an exception if method is called with a wrong number of parameters */ - $callNumberParameters = isset($expression['parameters']) ? count($expression['parameters']) : 0; + $callNumberParameters = isset($expression['parameters']) ? count( + $expression['parameters'] + ) : 0; - $classMethod = $classDefinition->getMethod($methodName); + $classMethod = $classDefinition->getMethod($methodName); $expectedNumberParameters = $classMethod->getNumberOfRequiredParameters(); if (!$expectedNumberParameters && $callNumberParameters > 0) { $numberParameters = $classMethod->getNumberOfParameters(); if ($callNumberParameters > $numberParameters) { - throw new CompilerException("Method '".$classDefinition->getCompleteName().'::'.$expression['name']."' called with a wrong number of parameters, the method has: ".$expectedNumberParameters.', passed: '.$callNumberParameters, $expression); + throw new CompilerException( + "Method '" . $classDefinition->getCompleteName() . '::' . $expression['name'] + . "' called with a wrong number of parameters, the method has: " + . $expectedNumberParameters + . ', passed: ' + . $callNumberParameters, + $expression + ); } } if ($callNumberParameters < $expectedNumberParameters) { - throw new CompilerException("Method '".$classDefinition->getCompleteName().'::'.$expression['name']."' called with a wrong number of parameters, the method has: ".$expectedNumberParameters.', passed: '.$callNumberParameters, $expression); + throw new CompilerException( + "Method '" + . $classDefinition->getCompleteName() + . '::' + . $expression['name'] + . "' called with a wrong number of parameters, the method has: " + . $expectedNumberParameters + . ', passed: ' + . $callNumberParameters, + $expression + ); } } } else { if (!isset($method)) { $method = $classDefinition->getMethod('__callStatic'); - if ($method->isPrivate() && $method->getClassDefinition() !== $compilationContext->classDefinition) { - throw new CompilerException("Cannot call private magic method '__call' out of its scope", $expression); + if ( + $method->isPrivate() && + $method->getClassDefinition() !== $compilationContext->classDefinition + ) { + throw new CompilerException( + "Cannot call private magic method '__call' out of its scope", + $expression + ); } } } @@ -188,21 +258,64 @@ public function compile(Expression $expr, CompilationContext $compilationContext */ if (!$dynamicMethod) { if ($dynamicClass) { - $this->callFromDynamicClass($methodName, $expression, $symbolVariable, $mustInit, $isExpecting, $compilationContext); + $this->callFromDynamicClass( + $methodName, + $expression, + $symbolVariable, + $mustInit, + $isExpecting, + $compilationContext + ); } else { - if (in_array($className, ['self', 'static']) || $classDefinition == $compilationContext->classDefinition) { - $this->call(strtoupper($className), $methodName, $expression, $mustInit, $isExpecting, $compilationContext, $symbolVariable, $method ?? null); + if ( + in_array($className, ['self', 'static']) || + $classDefinition == $compilationContext->classDefinition + ) { + $this->call( + strtoupper($className), + $methodName, + $expression, + $mustInit, + $isExpecting, + $compilationContext, + $symbolVariable, + $method ?? null + ); } else { if ('parent' == $className) { - $this->callParent($methodName, $expression, $symbolVariable, $mustInit, $isExpecting, $currentClassDefinition, $compilationContext, $method ?? null); + $this->callParent( + $methodName, + $expression, + $symbolVariable, + $mustInit, + $isExpecting, + $currentClassDefinition, + $compilationContext, + $method ?? null + ); } else { - $this->callFromClass($methodName, $expression, $symbolVariable, $mustInit, $isExpecting, $classDefinition, $compilationContext, $method ?? null); + $this->callFromClass( + $methodName, + $expression, + $symbolVariable, + $mustInit, + $isExpecting, + $classDefinition, + $compilationContext, + $method ?? null + ); } } } } else { if ($dynamicClass) { - $this->callFromDynamicClassDynamicMethod($expression, $symbolVariable, $mustInit, $isExpecting, $compilationContext); + $this->callFromDynamicClassDynamicMethod( + $expression, + $symbolVariable, + $mustInit, + $isExpecting, + $compilationContext + ); } } @@ -214,7 +327,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext /** * Transfer the return type-hint to the returned variable */ - if ($isExpecting && isset($method) && $method instanceof ClassMethod) { + if ($isExpecting && isset($method) && $method instanceof Method) { $symbolVariable->setDynamicTypes('object'); foreach ($method->getReturnClassTypes() as $classType) { $symbolVariable->setClassTypes($compilationContext->getFullName($classType)); @@ -242,14 +355,16 @@ public function compile(Expression $expr, CompilationContext $compilationContext /** * Calls static methods on the 'self/static' context. * - * @param string $context SELF / STATIC + * @param string $context SELF / STATIC * @param string $methodName * @param array $expression - * @param Variable|null $symbolVariable * @param bool $mustInit * @param bool $isExpecting * @param CompilationContext $compilationContext - * @param ClassMethod|null $method + * @param Variable|null $symbolVariable + * @param Method|null $method + * + * @throws Exception */ protected function call( string $context, @@ -258,9 +373,9 @@ protected function call( bool $mustInit, bool $isExpecting, CompilationContext $compilationContext, - ?Variable $symbolVariable = null, - ?ClassMethod $method = null - ) { + Variable $symbolVariable = null, + Method $method = null + ): void { if (!in_array($context, ['SELF', 'STATIC'])) { $context = 'SELF'; } @@ -275,7 +390,7 @@ protected function call( $codePrinter = $compilationContext->codePrinter; /** - * Call static methods must grown the stack + * Call static methods must grow the stack */ $compilationContext->symbolTable->mustGrownStack(true); @@ -287,48 +402,53 @@ protected function call( /** * Check if the method call can have an inline cache. */ - $methodCache = $compilationContext->cacheManager->getStaticMethodCache(); - $cachePointer = $methodCache->get($compilationContext, $method ?? null, false); + $methodCache = $compilationContext->cacheManager->getStaticMethodCache(); + $cachePointer = $methodCache->get($compilationContext, $method ?? null); $params = []; if (isset($expression['parameters']) && count($expression['parameters'])) { $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); } - $isInternal = false; - if (isset($method)) { - $isInternal = $method->isInternal(); - } - if ($symbolVariable) { - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } $paramCount = count($params); - $paramsStr = $paramCount ? ', '.implode(', ', $params) : ''; + $paramsStr = $paramCount ? ', ' . implode(', ', $params) : ''; + + $isInternal = isset($method) && $method->isInternal(); if (!$isInternal) { if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_'.$context.'("'.$methodName.'", '.$cachePointer.$paramsStr.');'); + $codePrinter->output( + 'ZEPHIR_RETURN_CALL_' . $context . '("' . $methodName . '", ' . $cachePointer . $paramsStr . ');' + ); } else { - $codePrinter->output('ZEPHIR_CALL_'.$context.'('.$symbol.', "'.$methodName.'", '.$cachePointer.$paramsStr.');'); + $codePrinter->output( + 'ZEPHIR_CALL_' . $context . '(' . $symbol . ', "' . $methodName . '", ' . $cachePointer . $paramsStr . ');' + ); } } else { - $codePrinter->output('ZEPHIR_CALL_'.$context.'(NULL, "'.$methodName.'", '.$cachePointer.$paramsStr.');'); + $codePrinter->output( + 'ZEPHIR_CALL_' . $context . '(NULL, "' . $methodName . '", ' . $cachePointer . $paramsStr . ');' + ); } } else { $ce = $method->getClassDefinition()->getClassEntry($compilationContext); if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $macro = $compilationContext->backend->getFcallManager()->getMacro(true, true, $paramCount); - $codePrinter->output($macro.'('.$ce.', '.$method->getInternalName().$paramsStr.');'); + $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 1, $paramCount); + $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'); } else { $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount); - $codePrinter->output($macro.'('.$symbol.', '.$ce.', '.$method->getInternalName().$paramsStr.');'); + $codePrinter->output( + $macro . '(' . $symbol . ', ' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');' + ); } } else { - $macro = $compilationContext->backend->getFcallManager()->getMacro(true, false, $paramCount); - $codePrinter->output($macro.'('.$ce.', '.$method->getInternalName().$paramsStr.');'); + $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 0, $paramCount); + $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'); } } @@ -336,31 +456,53 @@ protected function call( * Temporary variables must be copied if they have more than one reference */ foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); + $codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); } $this->addCallStatusOrJump($compilationContext); } /** - * Calls static methods on the 'parent' context. + * Calls static methods on some class context. * * @param string $methodName * @param array $expression * @param Variable $symbolVariable * @param bool $mustInit * @param bool $isExpecting - * @param ClassDefinition $classDefinition + * @param Definition $classDefinition * @param CompilationContext $compilationContext - * @param ClassMethod $method + * @param Method $method + * + * @throws Exception */ - protected function callParent($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, ClassDefinition $classDefinition, CompilationContext $compilationContext, ClassMethod $method) - { + protected function callFromClass( + $methodName, + array $expression, + $symbolVariable, + $mustInit, + $isExpecting, + Definition $classDefinition, + CompilationContext $compilationContext, + Method $method + ): void { $codePrinter = $compilationContext->codePrinter; - $classCe = $classDefinition->getClassEntry($compilationContext); + + if ($classDefinition->isBundled()) { + $classEntryVariable = $compilationContext->symbolTable->addTemp('zend_class_entry', $compilationContext); + $compilationContext->backend->fetchClass( + $classEntryVariable, + 'SL("' . str_replace('\\', '\\\\', $classDefinition->getName()) . '")', + false, + $compilationContext + ); + $classEntry = $classEntryVariable->getName(); + } else { + $classEntry = $classDefinition->getClassEntry($compilationContext); + } /** - * Call static methods must grown the stack + * Call static methods must grow the stack */ $compilationContext->symbolTable->mustGrownStack(true); @@ -369,36 +511,57 @@ protected function callParent($methodName, array $expression, $symbolVariable, $ $symbolVariable->trackVariant($compilationContext); } + $method = $method->getOptimizedMethod(); + /** * Check if the method call can have an inline cache. */ - $methodCache = $compilationContext->cacheManager->getStaticMethodCache(); - $cachePointer = $methodCache->get($compilationContext, isset($method) ? $method : null); + $methodCache = $compilationContext->cacheManager->getStaticMethodCache(); + $cachePointer = $methodCache->get($compilationContext, $method); $params = []; if (isset($expression['parameters']) && count($expression['parameters'])) { $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); } - if (!count($params)) { + if ($symbolVariable) { + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + } + + $paramCount = count($params); + $paramsStr = $paramCount ? ', ' . implode(', ', $params) : ''; + + if ($method->isInternal()) { + $ce = $classDefinition->getClassEntry($compilationContext); if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_PARENT('.$classCe.', getThis(), "'.$methodName.'", '.$cachePointer.');'); + $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 1, $paramCount); + $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'); } else { - $codePrinter->output('ZEPHIR_CALL_PARENT(&'.$symbolVariable->getName().', '.$classCe.', getThis(), "'.$methodName.'", '.$cachePointer.');'); + $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount); + $codePrinter->output( + $macro . '(' . $symbol . ', ' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');' + ); } } else { - $codePrinter->output('ZEPHIR_CALL_PARENT(NULL, '.$classCe.', getThis(), "'.$methodName.'", '.$cachePointer.');'); + $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 0, $paramCount); + $codePrinter->output($macro . '(' . $ce . ', ' . $method->getInternalName() . $paramsStr . ');'); } } else { if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_PARENT('.$classCe.', getThis(), "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); + $codePrinter->output( + 'ZEPHIR_RETURN_CALL_CE_STATIC(' . $classEntry . ', "' . $methodName . '", ' . $cachePointer . $paramsStr . ');' + ); } else { - $codePrinter->output('ZEPHIR_CALL_PARENT(&'.$symbolVariable->getName().', '.$classCe.', getThis(), "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); + $codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC(' . $symbol . ', ' . $classEntry . ', "' . $methodName . '", ' . $cachePointer . $paramsStr . ');' + ); } } else { - $codePrinter->output('ZEPHIR_CALL_PARENT(NULL, '.$classCe.', getThis(), "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); + $codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC(NULL, ' . $classEntry . ', "' . $methodName . '", ' . $cachePointer . $paramsStr . ');' + ); } } @@ -406,91 +569,164 @@ protected function callParent($methodName, array $expression, $symbolVariable, $ * Temporary variables must be copied if they have more than one reference */ foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); + $codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); } $this->addCallStatusOrJump($compilationContext); } /** - * Calls static methods on the some class context. + * Calls static methods on using a dynamic variable as class. * * @param string $methodName * @param array $expression * @param Variable $symbolVariable * @param bool $mustInit * @param bool $isExpecting - * @param ClassDefinition $classDefinition * @param CompilationContext $compilationContext - * @param ClassMethod $method */ - protected function callFromClass($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, ClassDefinition $classDefinition, CompilationContext $compilationContext, ClassMethod $method) - { - $codePrinter = $compilationContext->codePrinter; + protected function callFromDynamicClass( + string $methodName, + array $expression, + $symbolVariable, + $mustInit, + $isExpecting, + CompilationContext $compilationContext + ): void { + [$params, $classEntry] = $this->fetchClassParams($expression, $compilationContext, $symbolVariable, $mustInit); - if ($classDefinition->isBundled()) { - $classEntryVariable = $compilationContext->symbolTable->addTemp('zend_class_entry', $compilationContext); - $compilationContext->backend->fetchClass($classEntryVariable, 'SL("'.str_replace('\\', '\\\\', $classDefinition->getName()).'")', false, $compilationContext); - $classEntry = $classEntryVariable->getName(); + if ($symbolVariable) { + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); + } + + $cachePointer = 'NULL, 0'; + + if (!count($params)) { + if ($isExpecting) { + if ('return_value' == $symbolVariable->getName()) { + $compilationContext->codePrinter->output( + 'ZEPHIR_RETURN_CALL_CE_STATIC(' . $classEntry . ', "' . $methodName . '", ' . $cachePointer . ');' + ); + } else { + $compilationContext->codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC(' . $symbol . ', ' . $classEntry . ', "' . $methodName . '", ' . $cachePointer . ');' + ); + } + } else { + $compilationContext->codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC(NULL, ' . $classEntry . ', "' . $methodName . '", ' . $cachePointer . ');' + ); + } } else { - $classEntry = $classDefinition->getClassEntry($compilationContext); + if ($isExpecting) { + if ('return_value' == $symbolVariable->getName()) { + $compilationContext->codePrinter->output( + 'ZEPHIR_RETURN_CALL_CE_STATIC(' . $classEntry . ', "' . $methodName . '", ' . $cachePointer . ', ' . implode( + ', ', + $params + ) . ');' + ); + } else { + $compilationContext->codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC(' . $symbol . ', ' . $classEntry . ', "' . $methodName . '", ' . $cachePointer . ', ' . implode( + ', ', + $params + ) . ');' + ); + } + } else { + $compilationContext->codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC(NULL, ' . $classEntry . ', "' . $methodName . '", ' . $cachePointer . ', ' . implode( + ', ', + $params + ) . ');' + ); + } } /** - * Call static methods must grown the stack + * Temporary variables must be copied if they have more than one reference */ - $compilationContext->symbolTable->mustGrownStack(true); - - if ($mustInit) { - $symbolVariable->setMustInitNull(true); - $symbolVariable->trackVariant($compilationContext); + foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { + $compilationContext->codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); } - if ($method) { - $method = $method->getOptimizedMethod(); - } + $this->addCallStatusOrJump($compilationContext); + } + + /** + * Calls static methods on using a dynamic variable as class and a dynamic method. + * + * @param array $expression + * @param Variable $symbolVariable + * @param bool $mustInit + * @param bool $isExpecting + * @param CompilationContext $compilationContext + */ + protected function callFromDynamicClassDynamicMethod( + array $expression, + $symbolVariable, + bool $mustInit, + bool $isExpecting, + CompilationContext $compilationContext + ): void { + [$params, $classEntry] = $this->fetchClassParams($expression, $compilationContext, $symbolVariable, $mustInit); /** - * Check if the method call can have an inline cache. + * Obtain the method name from the variable. */ - $methodCache = $compilationContext->cacheManager->getStaticMethodCache(); - $cachePointer = $methodCache->get($compilationContext, isset($method) ? $method : null); - - $params = []; - if (isset($expression['parameters']) && count($expression['parameters'])) { - $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); + $methodNameVariable = $compilationContext->symbolTable->getVariableForRead( + $expression['name'], + $compilationContext, + $expression + ); + if ($methodNameVariable->isNotVariableAndString()) { + throw new CompilerException('Only dynamic/string variables can be used in dynamic methods', $expression); } if ($symbolVariable) { - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } - $paramCount = count($params); - $paramsStr = $paramCount ? ', '.implode(', ', $params) : ''; + $cachePointer = 'NULL, 0'; - if ($method->isInternal()) { - $ce = $classDefinition->getClassEntry($compilationContext); + if (!count($params)) { if ($isExpecting) { - if ('return_value' == $symbolVariable->getName()) { - $macro = $compilationContext->backend->getFcallManager()->getMacro(true, true, $paramCount); - $codePrinter->output($macro.'('.$ce.', '.$method->getInternalName().$paramsStr.');'); + if ('return_value' === $symbolVariable->getName()) { + $compilationContext->codePrinter->output( + 'ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL(' . $classEntry . ', ' . $methodNameVariable->getName( + ) . ', ' . $cachePointer . ');' + ); } else { - $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount); - $codePrinter->output($macro.'('.$symbol.', '.$ce.', '.$method->getInternalName().$paramsStr.');'); + $compilationContext->codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC_ZVAL(' . $symbol . ', ' . $classEntry . ', ' . $methodNameVariable->getName( + ) . ', ' . $cachePointer . ');' + ); } } else { - $macro = $compilationContext->backend->getFcallManager()->getMacro(true, false, $paramCount); - $codePrinter->output($macro.'('.$ce.', '.$method->getInternalName().$paramsStr.');'); + $compilationContext->codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC_ZVAL(NULL, ' . $classEntry . ', ' . $methodNameVariable->getName( + ) . ', ' . $cachePointer . ');' + ); } } else { if ($isExpecting) { - if ('return_value' == $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC('.$classEntry.', "'.$methodName.'", '.$cachePointer.$paramsStr.');'); + if ('return_value' === $symbolVariable->getName()) { + $compilationContext->codePrinter->output( + 'ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL(' . $classEntry . ', ' . $methodNameVariable->getName( + ) . ', ' . $cachePointer . ', ' . implode(', ', $params) . ');' + ); } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC('.$symbol.', '.$classEntry.', "'.$methodName.'", '.$cachePointer.$paramsStr.');'); + $compilationContext->codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC_ZVAL(' . $symbol . ', ' . $classEntry . ', ' . $methodNameVariable->getName( + ) . ', ' . $cachePointer . ', ' . implode(', ', $params) . ');' + ); } } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC(NULL, '.$classEntry.', "'.$methodName.'", '.$cachePointer.$paramsStr.');'); + $compilationContext->codePrinter->output( + 'ZEPHIR_CALL_CE_STATIC_ZVAL(NULL, ' . $classEntry . ', ' . $methodNameVariable->getName( + ) . ', ' . $cachePointer . ', ' . implode(', ', $params) . ');' + ); } } @@ -498,28 +734,41 @@ protected function callFromClass($methodName, array $expression, $symbolVariable * Temporary variables must be copied if they have more than one reference */ foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); + $compilationContext->codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); } $this->addCallStatusOrJump($compilationContext); } /** - * Calls static methods on using a dynamic variable as class. + * Calls static methods on the 'parent' context. * * @param string $methodName * @param array $expression * @param Variable $symbolVariable * @param bool $mustInit * @param bool $isExpecting + * @param Definition $classDefinition * @param CompilationContext $compilationContext + * @param Method $method + * + * @throws Exception */ - protected function callFromDynamicClass($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, CompilationContext $compilationContext) - { + protected function callParent( + string $methodName, + array $expression, + $symbolVariable, + $mustInit, + $isExpecting, + Definition $classDefinition, + CompilationContext $compilationContext, + Method $method + ): void { $codePrinter = $compilationContext->codePrinter; + $classCe = $classDefinition->getClassEntry($compilationContext); /** - * Call static methods must grown the stack + * Call static methods must grow the stack */ $compilationContext->symbolTable->mustGrownStack(true); @@ -528,56 +777,59 @@ protected function callFromDynamicClass($methodName, array $expression, $symbolV $symbolVariable->trackVariant($compilationContext); } - $cachePointer = 'NULL, 0'; + /** + * Check if the method call can have an inline cache. + */ + $methodCache = $compilationContext->cacheManager->getStaticMethodCache(); + $cachePointer = $methodCache->get($compilationContext, $method ?? null); $params = []; if (isset($expression['parameters']) && count($expression['parameters'])) { $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); } - /** - * Obtain the class entry from the variable. - */ - $classNameVariable = $compilationContext->symbolTable->getVariableForRead($expression['class'], $compilationContext, $expression); - if ($classNameVariable->isNotVariableAndString()) { - throw new CompilerException('Only dynamic/string variables can be used in dynamic classes', $expression); - } - - $compilationContext->headersManager->add('kernel/object'); - - $classEntryVariable = $compilationContext->symbolTable->addTemp('zend_class_entry', $compilationContext); - $codePrinter->output( - sprintf( - '%s = zephir_fetch_class(%s);', - $classEntryVariable->getName(), - $compilationContext->backend->getVariableCode($classNameVariable) - ) - ); - $classEntry = $classEntryVariable->getName(); - - if ($symbolVariable) { - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); - } - if (!count($params)) { if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC('.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); + $codePrinter->output( + 'ZEPHIR_RETURN_CALL_PARENT(' . $classCe . ', getThis(), "' . $methodName . '", ' . $cachePointer . ');' + ); } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC('.$symbol.', '.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); + $codePrinter->output( + 'ZEPHIR_CALL_PARENT(&' . $symbolVariable->getName( + ) . ', ' . $classCe . ', getThis(), "' . $methodName . '", ' . $cachePointer . ');' + ); } } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC(NULL, '.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); + $codePrinter->output( + 'ZEPHIR_CALL_PARENT(NULL, ' . $classCe . ', getThis(), "' . $methodName . '", ' . $cachePointer . ');' + ); } } else { if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC('.$classEntry.', "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); + $codePrinter->output( + 'ZEPHIR_RETURN_CALL_PARENT(' . $classCe . ', getThis(), "' . $methodName . '", ' . $cachePointer . ', ' . implode( + ', ', + $params + ) . ');' + ); } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC('.$symbol.', '.$classEntry.', "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); + $codePrinter->output( + 'ZEPHIR_CALL_PARENT(&' . $symbolVariable->getName( + ) . ', ' . $classCe . ', getThis(), "' . $methodName . '", ' . $cachePointer . ', ' . implode( + ', ', + $params + ) . ');' + ); } } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC(NULL, '.$classEntry.', "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); + $codePrinter->output( + 'ZEPHIR_CALL_PARENT(NULL, ' . $classCe . ', getThis(), "' . $methodName . '", ' . $cachePointer . ', ' . implode( + ', ', + $params + ) . ');' + ); } } @@ -585,27 +837,20 @@ protected function callFromDynamicClass($methodName, array $expression, $symbolV * Temporary variables must be copied if they have more than one reference */ foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); + $codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); } $this->addCallStatusOrJump($compilationContext); } - /** - * Calls static methods on using a dynamic variable as class and a dynamic method. - * - * @param array $expression - * @param Variable $symbolVariable - * @param bool $mustInit - * @param bool $isExpecting - * @param CompilationContext $compilationContext - */ - protected function callFromDynamicClassDynamicMethod(array $expression, $symbolVariable, $mustInit, $isExpecting, CompilationContext $compilationContext) - { - $codePrinter = $compilationContext->codePrinter; - + private function fetchClassParams( + array $expression, + CompilationContext $compilationContext, + Variable $symbolVariable, + bool $mustInit + ): array { /** - * Call static methods must grown the stack + * Call static methods must grow the stack */ $compilationContext->symbolTable->mustGrownStack(true); @@ -614,26 +859,27 @@ protected function callFromDynamicClassDynamicMethod(array $expression, $symbolV $symbolVariable->trackVariant($compilationContext); } - $cachePointer = 'NULL, 0'; - $params = []; - if (isset($expression['parameters']) && count($expression['parameters'])) { + if (!empty($expression['parameters'])) { $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); } /** * Obtain the class entry from the variable. */ - $classNameVariable = $compilationContext->symbolTable->getVariableForRead($expression['class'], $compilationContext, $expression); + $classNameVariable = $compilationContext->symbolTable->getVariableForRead( + $expression['class'], + $compilationContext, + $expression + ); if ($classNameVariable->isNotVariableAndString()) { throw new CompilerException('Only dynamic/string variables can be used in dynamic classes', $expression); } $compilationContext->headersManager->add('kernel/object'); - $classEntryVariable = $compilationContext->symbolTable->addTemp('zend_class_entry', $compilationContext); - $codePrinter->output( + $compilationContext->codePrinter->output( sprintf( '%s = zephir_fetch_class(%s);', $classEntryVariable->getName(), @@ -641,49 +887,6 @@ protected function callFromDynamicClassDynamicMethod(array $expression, $symbolV ) ); - $classEntry = $classEntryVariable->getName(); - - /** - * Obtain the method name from the variable. - */ - $methodNameVariable = $compilationContext->symbolTable->getVariableForRead($expression['name'], $compilationContext, $expression); - if ($methodNameVariable->isNotVariableAndString()) { - throw new CompilerException('Only dynamic/string variables can be used in dynamic methods', $expression); - } - - if ($symbolVariable) { - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); - } - - if (!count($params)) { - if ($isExpecting) { - if ('return_value' === $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL('.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); - } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL('.$symbol.', '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); - } - } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL(NULL, '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); - } - } else { - if ($isExpecting) { - if ('return_value' === $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL('.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.', '.implode(', ', $params).');'); - } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL('.$symbol.', '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.', '.implode(', ', $params).');'); - } - } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL(NULL, '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.', '.implode(', ', $params).');'); - } - } - - /** - * Temporary variables must be copied if they have more than one reference - */ - foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); - } - - $this->addCallStatusOrJump($compilationContext); + return [$params, $classEntryVariable->getName()]; } } diff --git a/Library/StringsManager.php b/src/StringsManager.php similarity index 79% rename from Library/StringsManager.php rename to src/StringsManager.php index f94a7bbd2f..2e007e3965 100644 --- a/Library/StringsManager.php +++ b/src/StringsManager.php @@ -34,7 +34,7 @@ abstract class StringsManager * * @param string $key */ - public function addConcatKey(string $key) + public function addConcatKey(string $key): void { $this->concatKeys[$key] = true; } @@ -45,14 +45,4 @@ public function addConcatKey(string $key) * @return void */ abstract public function genConcatCode(): void; - - /** - * Obtains the existing concatenation keys. - * - * @return array - */ - public function getConcatKeys(): array - { - return $this->concatKeys; - } } diff --git a/Library/Stubs/DocBlock.php b/src/Stubs/DocBlock.php similarity index 77% rename from Library/Stubs/DocBlock.php rename to src/Stubs/DocBlock.php index d31b576a47..90bf686f39 100644 --- a/Library/Stubs/DocBlock.php +++ b/src/Stubs/DocBlock.php @@ -13,7 +13,18 @@ namespace Zephir\Stubs; +use function array_map; +use function array_pop; +use function array_reverse; +use function array_shift; use function count; +use function explode; +use function implode; +use function preg_match; +use function preg_replace; +use function rtrim; +use function str_replace; +use function trim; /** * @author Gusakov Nikita @@ -23,13 +34,11 @@ class DocBlock /** * @var string */ - protected string $indent; - + protected string $description = ''; /** * @var string */ - protected string $description = ''; - + protected string $indent; /** * @var array */ @@ -42,8 +51,8 @@ class DocBlock public function __construct(?string $source, string $indent = ' ') { $this->indent = $indent; - $lines = explode("\n", trim($source ?: '')); - $count = count($lines); + $lines = explode("\n", trim($source ?: '')); + $count = count($lines); foreach ($lines as $i => $line) { $line = preg_replace('#^([\s\t]+)?/?([*]+)([\s\t]+)?$#im', '', rtrim($line)); @@ -56,24 +65,24 @@ public function __construct(?string $source, string $indent = ' ') $cleaned = trim($line, "\t*\0 "); $cleaned = str_replace('$$', '$', $cleaned); - if (0 === strpos($cleaned, '@')) { + if (str_starts_with($cleaned, '@')) { $this->lines[] = $cleaned; } else { $line = preg_replace('#([\s\t]+)?[*]#', '', $line); - $line = preg_replace('#([\s\t]+)?[*]([\s\t]){1,2}#', '$1* ', ' * '.$line); + $line = preg_replace('#([\s\t]+)?[*]([\s\t]){1,2}#', '$1* ', ' * ' . $line); $line = preg_replace('#[*]([\s\t])+$#', '*', $line); $line = preg_replace('#\t#', $indent, $line); - $this->lines[] = array_pop($this->lines)."\n{$this->indent}".$line; + $this->lines[] = array_pop($this->lines) . "\n{$this->indent}" . $line; } } - if (!empty($this->lines) && 0 !== strpos(trim($this->lines[0], "\t*\0 "), '@')) { + if (!empty($this->lines) && !str_starts_with(trim($this->lines[0], "\t*\0 "), '@')) { $description = array_shift($this->lines); $description = explode("\n", $description); $cleaned = []; - $empty = 0; + $empty = 0; foreach ($description as $i => $line) { if (preg_match('#^([\s\t]+)?[*]([\s\t]+)?$#', $line)) { ++$empty; @@ -102,7 +111,7 @@ public function __construct(?string $source, string $indent = ' ') */ public function __toString(): string { - $doc = ''; + $doc = ''; $indent = $this->indent; if (!empty($this->description)) { @@ -110,15 +119,13 @@ public function __toString(): string } if (!empty($this->lines)) { - $lines = array_map(function ($line) use ($indent) { - return "$indent * $line"; - }, $this->lines); + $lines = array_map(fn($line) => "$indent * $line", $this->lines); if (!empty($doc)) { $doc .= "\n$indent *"; } - $doc .= "\n".implode("\n", $lines); + $doc .= "\n" . implode("\n", $lines); } return '' === $doc ? '' : "$indent/**$doc\n$indent */"; diff --git a/Library/Stubs/Generator.php b/src/Stubs/Generator.php similarity index 55% rename from Library/Stubs/Generator.php rename to src/Stubs/Generator.php index 22b8e41548..7ac972c232 100644 --- a/Library/Stubs/Generator.php +++ b/src/Stubs/Generator.php @@ -14,20 +14,33 @@ namespace Zephir\Stubs; use Zephir\AliasManager; -use Zephir\ClassConstant; -use Zephir\ClassDefinition; -use Zephir\ClassMethod; -use Zephir\ClassMethodParameters; -use Zephir\ClassProperty; +use Zephir\Class\Constant; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Property; use Zephir\CompilerFile; use Zephir\Exception; +use function addslashes; +use function array_diff; use function array_key_exists; +use function file_put_contents; +use function implode; use function in_array; +use function is_dir; +use function key; +use function mkdir; +use function realpath; +use function sprintf; +use function str_ireplace; +use function str_replace; +use function trim; +use function ucfirst; + +use const DIRECTORY_SEPARATOR; +use const PHP_EOL; -/** - * Stubs Generator. - */ class Generator { /** @@ -42,17 +55,11 @@ class Generator 'deprecated', ]; - /** - * @var CompilerFile[] - */ - protected array $files; - /** * @param CompilerFile[] $files */ - public function __construct(array $files) + public function __construct(protected array $files) { - $this->files = $files; } /** @@ -76,55 +83,60 @@ public function generate(string $namespace, string $path, string $indent, string $indent = 'tabs' === $indent ? "\t" : ' '; foreach ($this->files as $file) { - $class = $file->getClassDefinition(); + $class = $file->getClassDefinition(); $source = $this->buildClass($class, $indent, $banner); - $filename = ucfirst($class->getName()).'.php'; - $filePath = $path.str_ireplace( - $namespace, - '', - str_replace($namespace.'\\\\', \DIRECTORY_SEPARATOR, $class->getNamespace()) - ); - $filePath = str_replace('\\', \DIRECTORY_SEPARATOR, $filePath); - $filePath = str_replace(\DIRECTORY_SEPARATOR.\DIRECTORY_SEPARATOR, \DIRECTORY_SEPARATOR, $filePath); + $filename = ucfirst($class->getName()) . '.php'; + $filePath = $path + . str_ireplace( + $namespace, + '', + str_replace( + $namespace . '\\\\', + DIRECTORY_SEPARATOR, + $class->getNamespace() + ) + ); + $filePath = str_replace('\\', DIRECTORY_SEPARATOR, $filePath); + $filePath = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $filePath); if (!is_dir($filePath)) { mkdir($filePath, 0777, true); } - $filePath = realpath($filePath).'/'; - file_put_contents($filePath.$filename, $source); + $filePath = realpath($filePath) . '/'; + file_put_contents($filePath . $filename, $source); } } /** * Build class. * - * @param ClassDefinition $class - * @param string $indent - * @param string $banner - * - * @throws Exception\RuntimeException + * @param Definition $class + * @param string $indent + * @param string $banner * * @return string + * + * @throws Exception\RuntimeException */ - protected function buildClass(ClassDefinition $class, string $indent, string $banner): string + protected function buildClass(Definition $class, string $indent, string $banner): string { - $source = 'getNamespace()};".PHP_EOL; + $source = 'getNamespace()};" . PHP_EOL; /** @var AliasManager $aliasManager */ $aliasManager = $class->getAliasManager(); - $aliases = $aliasManager->getAliases(); + $aliases = $aliasManager->getAliases(); if (!empty($aliases)) { $source .= PHP_EOL; foreach ($aliases as $alias => $fqn) { $isAliased = $aliasManager->isUseStatementAliased($alias); - $asAlias = $isAliased ? ' as '.$alias : ''; - $source .= 'use '.$fqn.$asAlias.';'.PHP_EOL; + $asAlias = $isAliased ? ' as ' . $alias : ''; + $source .= 'use ' . $fqn . $asAlias . ';' . PHP_EOL; } } @@ -132,8 +144,8 @@ protected function buildClass(ClassDefinition $class, string $indent, string $ba $docBlock = (new DocBlock($class->getDocBlock(), '')); - if ('' !== (string) $docBlock) { - $source .= $docBlock.PHP_EOL; + if ('' !== (string)$docBlock) { + $source .= $docBlock . PHP_EOL; } if ($class->isFinal()) { @@ -142,7 +154,7 @@ protected function buildClass(ClassDefinition $class, string $indent, string $ba $source .= 'abstract '; } - $source .= $class->getType().' '.$class->getName(); + $source .= $class->getType() . ' ' . $class->getName(); if ($class->getExtendsClass()) { $extendsClassDefinition = $class->getExtendsClassDefinition(); @@ -157,34 +169,35 @@ protected function buildClass(ClassDefinition $class, string $indent, string $ba $hasAliasForExtends = $aliasManager->isAlias($extendsClassDefinition->getShortName()); - $source .= ' extends '.($hasAliasForExtends || $extendsClassDefinition->isBundled() ? '' : '\\'); - $source .= $hasAliasForExtends ? $extendsClassDefinition->getShortName() : $extendsClassDefinition->getCompleteName(); + $source .= ' extends ' . ($hasAliasForExtends || $extendsClassDefinition->isBundled() ? '' : '\\'); + $source .= $hasAliasForExtends ? $extendsClassDefinition->getShortName( + ) : $extendsClassDefinition->getCompleteName(); } if ($interfaces = $class->getImplementedInterfaces()) { foreach ($interfaces as $key => $interface) { - $interfaces[$key] = '\\'.trim($interface, '\\'); + $interfaces[$key] = '\\' . trim($interface, '\\'); if ($aliasManager->isAliasPresentFor($interface)) { $interfaces[$key] = $aliasManager->getAliasForClassName($interface); } } - $keyword = 'interface' == $class->getType() ? ' extends ' : ' implements '; - $source .= $keyword.implode(', ', $interfaces); + $keyword = Definition::TYPE_INTERFACE === $class->getType() ? ' extends ' : ' implements '; + $source .= $keyword . implode(', ', $interfaces); } - $source .= PHP_EOL.'{'.PHP_EOL; + $source .= PHP_EOL . '{' . PHP_EOL; /** * Build Class constants */ $constants = []; foreach ($class->getConstants() as $constant) { - $constants[] = $this->buildConstant($constant, $indent).PHP_EOL; + $constants[] = $this->buildConstant($constant, $indent) . PHP_EOL; } - $source .= implode(PHP_EOL, $constants).PHP_EOL; + $source .= implode(PHP_EOL, $constants) . PHP_EOL; unset($constants); /** @@ -192,10 +205,10 @@ protected function buildClass(ClassDefinition $class, string $indent, string $ba */ $properties = []; foreach ($class->getProperties() as $property) { - $properties[] = $this->buildProperty($property, $indent).PHP_EOL; + $properties[] = $this->buildProperty($property, $indent) . PHP_EOL; } - $source .= implode(PHP_EOL, $properties).PHP_EOL; + $source .= implode(PHP_EOL, $properties) . PHP_EOL; unset($properties); /** @@ -207,92 +220,60 @@ protected function buildClass(ClassDefinition $class, string $indent, string $ba continue; } - $methods[] = $this->buildMethod($method, 'interface' === $class->getType(), $indent).PHP_EOL; + $methods[] = $this->buildMethod($method, Definition::TYPE_INTERFACE === $class->getType(), $indent) . PHP_EOL; } $source .= implode(PHP_EOL, $methods); unset($methods); - return $source.'}'.PHP_EOL; - } - - /** - * Build property. - * - * @param ClassProperty $property - * @param string $indent - * - * @return string - */ - protected function buildProperty(ClassProperty $property, string $indent): string - { - $visibility = 'public'; - - if (false === $property->isPublic()) { - $visibility = $property->isProtected() ? 'protected' : 'private'; - } - - if ($property->isStatic()) { - $visibility = 'static '.$visibility; - } - - $source = $indent.$visibility.' $'.$property->getName(); - $original = $property->getOriginal(); - - if (isset($original['default'])) { - $source .= ' = '.$this->wrapPHPValue([ - 'default' => $original['default'], - ]); - } - - return $this->fetchDocBlock($property->getDocBlock(), $indent).$source.';'; + return $source . '}' . PHP_EOL; } /** - * @param ClassConstant $constant - * @param string $indent + * @param Constant $constant + * @param string $indent * * @return string */ - protected function buildConstant(ClassConstant $constant, string $indent): string + protected function buildConstant(Constant $constant, string $indent): string { - $source = 'const '.$constant->getName(); + $source = 'const ' . $constant->getName(); $value = $this->wrapPHPValue([ 'default' => $constant->getValue(), ]); - return $this->fetchDocBlock($constant->getDocBlock(), $indent).$indent.$source.' = '.$value.';'; + return $this->fetchDocBlock($constant->getDocBlock(), $indent) . $indent . $source . ' = ' . $value . ';'; } /** - * @param ClassMethod $method - * @param bool $isInterface - * @param string $indent + * @param Method $method + * @param bool $isInterface + * @param string $indent * * @return string */ - protected function buildMethod(ClassMethod $method, bool $isInterface, string $indent): string + protected function buildMethod(Method $method, bool $isInterface, string $indent): string { $modifier = implode(' ', array_diff($method->getVisibility(), $this->ignoreModifiers)); $methodParameters = $method->getParameters(); - $aliasManager = $method->getClassDefinition()->getAliasManager(); - $docBlock = new MethodDocBlock($method, $aliasManager, $indent); + $aliasManager = $method->getClassDefinition()->getAliasManager(); + $docBlock = new MethodDocBlock($method, $aliasManager, $indent); $parameters = []; - if ($methodParameters instanceof ClassMethodParameters) { + if ($methodParameters instanceof Parameters) { foreach ($methodParameters->getParameters() as $parameter) { $paramStr = ''; if (isset($parameter['cast'])) { if ($aliasManager->isAlias($parameter['cast']['value'])) { - $cast = '\\'.$aliasManager->getAlias($parameter['cast']['value']); + $cast = '\\' . $aliasManager->getAlias($parameter['cast']['value']); } else { $cast = $parameter['cast']['value']; } - $paramStr .= $cast.' '; + $paramStr .= $cast . ' '; } elseif (isset($parameter['data-type']) && 'array' === $parameter['data-type']) { $paramStr .= 'array '; } elseif (isset($parameter['data-type'])) { @@ -307,10 +288,10 @@ protected function buildMethod(ClassMethod $method, bool $isInterface, string $i } } - $paramStr .= '$'.$parameter['name']; + $paramStr .= '$' . $parameter['name']; if (isset($parameter['default'])) { - $paramStr .= ' = '.$this->wrapPHPValue($parameter); + $paramStr .= ' = ' . $this->wrapPHPValue($parameter); } $parameters[] = $paramStr; @@ -318,68 +299,98 @@ protected function buildMethod(ClassMethod $method, bool $isInterface, string $i } $return = ''; + $returnTypes = []; + $methodReturnTypes = $method->getReturnTypes(); if ($method->hasReturnTypes()) { - $supported = 0; - - if (array_key_exists('object', $method->getReturnTypes())) { - $return = key($method->getReturnClassTypes()); - ++$supported; - } + if (array_key_exists('variable', $methodReturnTypes) || array_key_exists('mixed', $methodReturnTypes)) { + $returnTypes[] = 'mixed'; + } else { + if (array_key_exists('object', $methodReturnTypes)) { + $returnTypes[] = key($method->getReturnClassTypes()) ?: 'object'; + } - if ($method->areReturnTypesIntCompatible()) { - $return = 'int'; - ++$supported; - } + if ($method->areReturnTypesIntCompatible()) { + $returnTypes[] = 'int'; + } - if ($method->areReturnTypesDoubleCompatible()) { - $return = 'float'; - ++$supported; - } + if ($method->areReturnTypesDoubleCompatible()) { + $returnTypes[] = 'float'; + } - if ($method->areReturnTypesBoolCompatible()) { - $return = 'bool'; - ++$supported; - } + if ($method->areReturnTypesFalseCompatible()) { + $returnTypes[] = 'false'; + } elseif ($method->areReturnTypesBoolCompatible()) { + $returnTypes[] = 'bool'; + } - if ($method->areReturnTypesStringCompatible()) { - $return = 'string'; - ++$supported; - } + if ($method->areReturnTypesStringCompatible()) { + $returnTypes[] = 'string'; + } - if (array_key_exists('array', $method->getReturnTypes())) { - $return = 'array'; - ++$supported; - } + if (array_key_exists('array', $methodReturnTypes)) { + $returnTypes[] = 'array'; + } - if (!empty($return) && $method->areReturnTypesNullCompatible()) { - $return = '?'.$return; + if ($method->areReturnTypesNullCompatible()) { + $returnTypes[] = 'null'; + } } - // PHP doesn't support multiple return types (yet?) - if ($supported > 1 || array_key_exists('variable', $method->getReturnTypes())) { - $return = ''; - } + $returnTypes = array_filter($returnTypes); + $return = join('|', $returnTypes); } elseif ($method->isVoid()) { $return = 'void'; } if (!empty($return)) { - $return = ': '.$return; + $return = ': ' . $return; } - $function = trim($modifier.' function', ' ').' '; - $methodBody = $indent.$function.$method->getName().'('.implode(', ', $parameters).')'.$return; + $function = trim($modifier . ' function', ' ') . ' '; + $methodBody = $indent . $function . $method->getName() . '(' . implode(', ', $parameters) . ')' . $return; if ($isInterface || $method->isAbstract()) { $methodBody .= ';'; } else { - $methodBody .= PHP_EOL.$indent.'{'.PHP_EOL.$indent.'}'; + $methodBody .= PHP_EOL . $indent . '{' . PHP_EOL . $indent . '}'; } $docs = $docBlock->processMethodDocBlock(); - $docs = $docs ? $docs.PHP_EOL : ''; + $docs = $docs ? $docs . PHP_EOL : ''; - return $docs.$methodBody; + return $docs . $methodBody; + } + + /** + * Build property. + * + * @param Property $property + * @param string $indent + * + * @return string + */ + protected function buildProperty(Property $property, string $indent): string + { + $visibility = 'public'; + + if (false === $property->isPublic()) { + $visibility = $property->isProtected() ? 'protected' : 'private'; + } + + if ($property->isStatic()) { + $visibility = 'static ' . $visibility; + } + + $source = $indent . $visibility . ' $' . $property->getName(); + $original = $property->getOriginal(); + + if (isset($original['default'])) { + $source .= ' = ' . $this->wrapPHPValue([ + 'default' => $original['default'], + ]); + } + + return $this->fetchDocBlock($property->getDocBlock(), $indent) . $source . ';'; } /** @@ -387,9 +398,9 @@ protected function buildMethod(ClassMethod $method, bool $isInterface, string $i * * @param array $parameter * - * @throws Exception\NotImplementedException - * * @return string + * + * @throws Exception\NotImplementedException */ protected function wrapPHPValue(array $parameter): string { @@ -400,7 +411,7 @@ protected function wrapPHPValue(array $parameter): string case 'string': case 'char': - $returnValue = '\''.addslashes($parameter['default']['value']).'\''; + $returnValue = '\'' . addslashes($parameter['default']['value']) . '\''; break; case 'empty-array': @@ -415,22 +426,22 @@ protected function wrapPHPValue(array $parameter): string if (isset($value['key'])) { $source .= $this->wrapPHPValue([ - 'default' => $value['key'], - 'type' => $value['key']['type'], - ]).' => '; + 'default' => $value['key'], + 'type' => $value['key']['type'], + ]) . ' => '; } - $parameters[] = $source.$this->wrapPHPValue([ - 'default' => $value['value'], - 'type' => $value['value']['type'], - ]); + $parameters[] = $source . $this->wrapPHPValue([ + 'default' => $value['value'], + 'type' => $value['value']['type'], + ]); } - $returnValue = '['.implode(', ', $parameters).']'; + $returnValue = '[' . implode(', ', $parameters) . ']'; break; case 'static-constant-access': - $returnValue = $parameter['default']['left']['value'].'::'.$parameter['default']['right']['value']; + $returnValue = $parameter['default']['left']['value'] . '::' . $parameter['default']['right']['value']; break; case 'int': @@ -448,16 +459,13 @@ protected function wrapPHPValue(array $parameter): string ); } - return (string) $returnValue; + return (string)$returnValue; } private function fetchDocBlock(?string $docBlock, string $indent): string { $docBlock = (new DocBlock($docBlock, $indent))->__toString(); - if ($docBlock) { - return $docBlock.PHP_EOL; - } - return ''; + return $docBlock ? $docBlock . PHP_EOL : ''; } } diff --git a/Library/Stubs/MethodDocBlock.php b/src/Stubs/MethodDocBlock.php similarity index 73% rename from Library/Stubs/MethodDocBlock.php rename to src/Stubs/MethodDocBlock.php index 86a5e48cbb..e6fe1792ef 100644 --- a/Library/Stubs/MethodDocBlock.php +++ b/src/Stubs/MethodDocBlock.php @@ -14,8 +14,15 @@ namespace Zephir\Stubs; use Zephir\AliasManager; -use Zephir\ClassMethod; -use Zephir\Types; +use Zephir\Class\Method\Method; +use Zephir\Types\Types; + +use function array_keys; +use function array_merge; +use function array_unique; +use function preg_match; +use function str_replace; +use function trim; /** * Stubs Generator. @@ -24,58 +31,51 @@ */ class MethodDocBlock extends DocBlock { + /** + * @var AliasManager + */ + private AliasManager $aliasManager; + /** + * @var Method + */ + private Method $classMethod; + /** + * @var bool + */ + private bool $deprecated; private array $parameters = []; - /** * Parameters which are described by User into docblock * * @var array */ private array $predefinedParams = []; - /** * @var array */ private array $return = []; - /** * @var string|mixed */ private string $shortcutName; - - /** - * @var bool - */ - private bool $deprecated; - - /** - * @var AliasManager - */ - private AliasManager $aliasManager; - - /** - * @var ClassMethod - */ - private ClassMethod $classMethod; - /** * @var Types */ private Types $types; public function __construct( - ClassMethod $method, + Method $method, AliasManager $aliasManager, string $indent = ' ', - ?Types $types = null + Types $types = null ) { parent::__construct($method->getDocBlock(), $indent); - $this->deprecated = $method->isDeprecated(); + $this->deprecated = $method->isDeprecated(); $this->aliasManager = $aliasManager; $this->shortcutName = $method->isShortcut() ? $method->getShortcutName() : ''; - $this->classMethod = $method; - $this->types = $types ?? new Types(); + $this->classMethod = $method; + $this->types = $types ?? new Types(); } /** @@ -97,66 +97,6 @@ public function processMethodDocBlock(): string return $this->__toString(); } - protected function parseMethodReturnType(ClassMethod $method): void - { - $return = []; - foreach ($method->getReturnTypes() as $type) { - if (isset($type['data-type'])) { - $dataType = 'variable' === $type['data-type'] ? 'mixed' : $type['data-type']; - $return[$dataType] = $dataType; - } - } - - $returnClassTypes = $method->getReturnClassTypes(); - if ($returnClassTypes) { - foreach ($returnClassTypes as $key => $returnClassType) { - if ($this->aliasManager->isAlias($returnClassType)) { - $returnClassTypes[$key] = '\\'.$this->aliasManager->getAlias($returnClassType); - } - } - - $return = array_merge($return, $returnClassTypes); - } - - /** - * Prepare return types for Collections compatible types. - * Only for complex types. - */ - $collections = []; - if ($method->hasReturnTypesRaw()) { - $returnClassTypes = $method->getReturnTypesRaw(); - - if (!empty($returnClassTypes['list'])) { - foreach ($returnClassTypes['list'] as $returnType) { - if (empty($returnType['cast']) || !$returnType['collection']) { - continue; - } - - $key = $returnType['cast']['value']; - $type = $key; - - if ($this->aliasManager->isAlias($type)) { - $type = '\\'.$this->aliasManager->getAlias($type); - } - - $return[$key] = $type.'[]'; - $collections[$type.'[]'] = $returnType; - } - } - } - - $processedTypes = !empty($method->getReturnClassTypes()) ? $return : null; - $returnType = $this->types->getReturnTypeAnnotation( - $this->classMethod, - $processedTypes ?: array_merge($method->getReturnTypes(), $collections) - ); - - if (!empty($returnType)) { - // Empty line in array - it's an empty description. Don't remove it! - $this->return = [$returnType, '']; - } - } - /** * Parse DocBlock and returns extracted groups. */ @@ -181,12 +121,12 @@ protected function parseLines(): void foreach ($this->lines as $line) { $parsedLine = $this->parseDocBlockParam($line); - $docType = $parsedLine['doctype'] ?? null; + $docType = $parsedLine['doctype'] ?? null; - $dollar = $parsedLine['dollar'] ?? ''; - $identifier = $parsedLine['name'] ?? false; + $dollar = $parsedLine['dollar'] ?? ''; + $identifier = $parsedLine['name'] ?? false; $description = $parsedLine['description'] ?? ''; - $type = $parsedLine['type'] ?? ''; + $type = $parsedLine['type'] ?? ''; // Remember docblock @param to avoid param duplication when parse input args. if ($identifier) { @@ -201,11 +141,11 @@ protected function parseLines(): void $this->predefinedParams['return'] = true; $mixed = str_replace('var', 'mixed', $type); - $line = str_replace($type, $mixed, $line); + $line = str_replace($type, $mixed, $line); } if ('$' !== $dollar && $identifier && 'return' !== $docType) { - $line = '@'.$docType.' '.trim($type).' $'.trim($identifier.' '.$description); + $line = '@' . $docType . ' ' . trim($type) . ' $' . trim($identifier . ' ' . $description); } if ('var' === $docType) { @@ -214,12 +154,12 @@ protected function parseLines(): void if ('var' === $docType && 'set' === $this->shortcutName) { $docType = 'param'; - $name = array_keys($this->parameters); - $name = $name[0]; + $name = array_keys($this->parameters); + $name = $name[0]; } elseif ('var' == $docType && 'get' == $this->shortcutName) { $docType = 'return'; } else { - $name = $identifier ? '$'.trim($identifier, '$') : ''; + $name = $identifier ? '$' . trim($identifier, '$') : ''; } switch ($docType) { @@ -237,39 +177,63 @@ protected function parseLines(): void $this->lines = $lines; } - private function appendReturnLine(): void + protected function parseMethodReturnType(Method $method): void { - if (!isset($this->predefinedParams['return'])) { - list($type, $description) = $this->return; - - $return = $this->aliasManager->getAliasForClassName($type).' '.$description; - $this->lines[] = '@return '.trim($return, ' '); + $return = []; + foreach ($method->getReturnTypes() as $type) { + if (isset($type['data-type'])) { + $dataType = 'variable' === $type['data-type'] ? 'mixed' : $type['data-type']; + $return[$dataType] = $dataType; + } } - } - private function parseMethodParameters(ClassMethod $method): void - { - $parameters = $method->getParameters(); - $aliasManager = $method->getClassDefinition()->getAliasManager(); + $returnClassTypes = $method->getReturnClassTypes(); + if ($returnClassTypes) { + foreach ($returnClassTypes as $key => $returnClassType) { + if ($this->aliasManager->isAlias($returnClassType)) { + $returnClassTypes[$key] = '\\' . $this->aliasManager->getAlias($returnClassType); + } + } - if ($parameters === null) { - return; + $return = array_merge($return, $returnClassTypes); } - foreach ($parameters as $parameter) { - if (isset($parameter['cast'])) { - if ($aliasManager->isAlias($parameter['cast']['value'])) { - $type = '\\'.$aliasManager->getAlias($parameter['cast']['value']); - } else { - $type = $parameter['cast']['value']; + /** + * Prepare return types for Collections compatible types. + * Only for complex types. + */ + $collections = []; + if ($method->hasReturnTypesRaw()) { + $returnClassTypes = $method->getReturnTypesRaw(); + + if (!empty($returnClassTypes['list'])) { + foreach ($returnClassTypes['list'] as $returnType) { + if (empty($returnType['cast']) || !$returnType['collection']) { + continue; + } + + $key = $returnType['cast']['value']; + $type = $key; + + if ($this->aliasManager->isAlias($type)) { + $type = '\\' . $this->aliasManager->getAlias($type); + } + + $return[$key] = $type . '[]'; + $collections[$type . '[]'] = $returnType; } - } elseif (isset($parameter['data-type'])) { - $type = 'variable' === $parameter['data-type'] ? 'mixed' : $parameter['data-type']; - } else { - $type = 'mixed'; } + } - $this->parameters['$'.trim($parameter['name'], '$')] = [$type, '']; + $processedTypes = !empty($method->getReturnClassTypes()) ? $return : null; + $returnType = $this->types->getReturnTypeAnnotation( + $this->classMethod, + $processedTypes ?: array_merge($method->getReturnTypes(), $collections) + ); + + if (!empty($returnType)) { + // Empty line in array - it's an empty description. Don't remove it! + $this->return = [$returnType, '']; } } @@ -281,10 +245,10 @@ private function appendParametersLines(): void } if (!isset($this->predefinedParams[trim($name, '$')])) { - list($type, $description) = $parameter; + [$type, $description] = $parameter; - $param = $type.' '.$name.' '.$description; - $this->lines[] = '@param '.trim($param, ' '); + $param = $type . ' ' . $name . ' ' . $description; + $this->lines[] = '@param ' . trim($param, ' '); } } @@ -294,4 +258,40 @@ private function appendParametersLines(): void $this->lines = array_unique($this->lines); } + + private function appendReturnLine(): void + { + if (!isset($this->predefinedParams['return'])) { + [$type, $description] = $this->return; + + $return = $this->aliasManager->getAliasForClassName($type) . ' ' . $description; + $this->lines[] = '@return ' . trim($return, ' '); + } + } + + private function parseMethodParameters(Method $method): void + { + $parameters = $method->getParameters(); + $aliasManager = $method->getClassDefinition()->getAliasManager(); + + if ($parameters === null) { + return; + } + + foreach ($parameters as $parameter) { + if (isset($parameter['cast'])) { + if ($aliasManager->isAlias($parameter['cast']['value'])) { + $type = '\\' . $aliasManager->getAlias($parameter['cast']['value']); + } else { + $type = $parameter['cast']['value']; + } + } elseif (isset($parameter['data-type'])) { + $type = 'variable' === $parameter['data-type'] ? 'mixed' : $parameter['data-type']; + } else { + $type = 'mixed'; + } + + $this->parameters['$' . trim($parameter['name'], '$')] = [$type, '']; + } + } } diff --git a/Library/SymbolTable.php b/src/SymbolTable.php similarity index 72% rename from Library/SymbolTable.php rename to src/SymbolTable.php index 7fe44386e9..ac0495fa69 100644 --- a/Library/SymbolTable.php +++ b/src/SymbolTable.php @@ -9,55 +9,44 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use Zephir\Exception\CompilerException; use Zephir\Passes\LocalContextPass; use Zephir\Variable\Globals; +use Zephir\Variable\Variable; + +use function array_reverse; +use function count; +use function is_object; +use function strlen; +use function strpos; +use function substr; /** - * Zephir\SymbolTable. - * * A symbol table stores all the variables defined in a method, their data types and default values. */ class SymbolTable { - protected $mustGrownStack = false; - - /** @var Variable[][] */ - protected $branchVariables = []; + protected array $branchTempVariables = []; - protected $tempVarCount = 0; + protected array $branchVariables = []; - /** @var Variable[][][][] */ - protected $branchTempVariables = []; + protected Globals $globalsManager; - /** - * @var LocalContextPass - */ - protected $localContext; + protected ?LocalContextPass $localContext = null; - /** - * @var CompilationContext - */ - protected $compilationContext; + protected bool $mustGrownStack = false; - /** - * @var Globals - */ - protected $globalsManager; + protected int $tempVarCount = 0; - /** - * SymbolTable. - * - * @param CompilationContext $compilationContext - */ - public function __construct(CompilationContext $compilationContext) + public function __construct(protected CompilationContext $compilationContext) { $this->globalsManager = new Globals(); /* The variables are registered in branch 1, which is the external branch */ - $this->compilationContext = $compilationContext; $this->branchVariables[1] = []; /* this_ptr */ $thisVar = new Variable('variable', 'this', $compilationContext->branchManager->getCurrentBranch()); @@ -73,65 +62,51 @@ public function __construct(CompilationContext $compilationContext) $returnValue->increaseUses(); $this->branchVariables[1]['return_value'] = $returnValue; - $returnValue = new Variable('variable', 'return_value_ptr', $compilationContext->branchManager->getCurrentBranch()); + $returnValue = new Variable( + 'variable', + 'return_value_ptr', + $compilationContext->branchManager->getCurrentBranch() + ); $returnValue->setIsInitialized(true, $compilationContext); $returnValue->increaseUses(); $this->branchVariables[1]['return_value_ptr'] = $returnValue; } - public function resolveVariableToBranch($name, CompilationContext $compilationContext) - { - $currentBranch = $compilationContext->branchManager->getCurrentBranch(); - - do { - $currentId = $currentBranch->getUniqueId(); - if (isset($this->branchVariables[$currentId]) && isset($this->branchVariables[$currentId][$name])) { - return $currentBranch; - } - $currentBranch = $currentBranch->getParentBranch(); - } while (null != $currentBranch); - - return null; - } - /** - * Sets the local context information. + * Adds a raw variable to the symbol table (root branch). * - * @param LocalContextPass $localContext + * @param Variable $variable + * + * @return Variable */ - public function setLocalContext(LocalContextPass $localContext) + public function addRawVariable(Variable $variable): Variable { - $this->localContext = $localContext; + if (!isset($this->branchVariables[1])) { + $this->branchVariables[1] = []; + } + $this->branchVariables[1][$variable->getName()] = $variable; + + return $variable; } /** - * Check if a variable is declared in the current symbol table. - * - * @param string $name - * @param CompilationContext $compilationContext - * - * @return bool + * Creates a temporary variable. */ - public function hasVariable($name, CompilationContext $compilationContext = null) - { - return false !== $this->getVariable($name, $compilationContext ?: $this->compilationContext); - } - - public function hasVariableInBranch($name, Branch $compareBranch, CompilationContext $compilationContext = null) + public function addTemp(string $type, CompilationContext $context): Variable { - $branch = $this->resolveVariableToBranch($name, $compilationContext ?: $this->compilationContext); + $tempVar = $this->getNextTempVar(); + $variable = $this->addVariable($type, '_' . $tempVar, $context); + $variable->setIsInitialized(true, $context); + $variable->setTemporal(true); + $variable->setUsed(true); + $variable->increaseUses(); + $variable->increaseMutates(); - return $branch instanceof Branch && $branch === $compareBranch; + return $variable; } /** * Adds a variable to the symbol table. - * - * @param string $type - * @param string $name - * @param CompilationContext $compilationContext - * - * @return Variable */ public function addVariable( string $type, @@ -139,19 +114,20 @@ public function addVariable( CompilationContext $compilationContext ): Variable { $currentBranch = $compilationContext->branchManager->getCurrentBranch(); - $branchId = $currentBranch->getUniqueId(); + $branchId = $currentBranch->getUniqueId(); if ($this->globalsManager->isSuperGlobal($name) || 'zephir_fcall_cache_entry' == $type) { $branchId = 1; } $varName = $name; if ($branchId > 1 && Branch::TYPE_ROOT != $currentBranch->getType()) { - $varName = $name.Variable::BRANCH_MAGIC.$branchId; + $varName = $name . Variable::BRANCH_MAGIC . $branchId; } $variable = new Variable($type, $varName, $currentBranch); + $variable->setUsed(true); - /* + /** * Checks whether a variable can be optimized to be static or not */ if ('variable' == $type && $this->localContext && $this->localContext->shouldBeLocal($name)) { @@ -168,416 +144,299 @@ public function addVariable( } /** - * Adds a raw variable to the symbol table (root branch). + * Returns the number of expected mutations for a variable. * - * @param Variable $variable + * @param string $variable * - * @return Variable + * @return int */ - public function addRawVariable(Variable $variable) + public function getExpectedMutations(string $variable): int { - if (!isset($this->branchVariables[1])) { - $this->branchVariables[1] = []; + if ($this->localContext) { + return $this->localContext->getNumberOfMutations($variable); } - $this->branchVariables[1][$variable->getName()] = $variable; - return $variable; + return 0; } /** - * Returns a variable in the symbol table. - * - * @param $name - * @param CompilationContext $compilationContext + * Returns the last line where any kind of call was performed within the method + * This is not necessary related to the symbol table but this information is gathered + * by the LocalContextPass. * - * @return bool|Variable + * @return int */ - public function getVariable($name, CompilationContext $compilationContext = null) + public function getLastCallLine(): int { - /* Check if the variable already is referencing a branch */ - $pos = strpos($name, Variable::BRANCH_MAGIC); - if ($pos > -1) { - $branchId = (int) (substr($name, $pos + \strlen(Variable::BRANCH_MAGIC))); - $name = substr($name, 0, $pos); - } else { - $compilationContext = $compilationContext ?: $this->compilationContext; - $branch = $this->resolveVariableToBranch($name, $compilationContext); - if (!$branch) { - return false; - } - $branchId = $branch->getUniqueId(); - } - if (!isset($this->branchVariables[$branchId]) || !isset($this->branchVariables[$branchId][$name])) { - return false; + if ($this->localContext) { + return $this->localContext->getLastCallLine(); } - return $this->branchVariables[$branchId][$name]; + return 0; } /** - * Returns all the variables defined in the symbol table. + * Returns the last line where an 'unset' operation was made within the current method + * This is not necessary related to the symbol table but this information is gathered + * by the LocalContextPass. * - * @return Variable[] + * @return int */ - public function getVariables() + public function getLastUnsetLine(): int { - $ret = []; - foreach ($this->branchVariables as $branchId => $vars) { - foreach ($vars as $var) { - $ret[$var->getName()] = $var; - } + if ($this->localContext) { + return $this->localContext->getLastUnsetLine(); } - return $ret; + return 0; } - public function getVariablesByBranch($branchId) + /** + * Returns if the current symbol label must add a memory frame. + * + * @return bool + */ + public function getMustGrownStack(): bool { - if (isset($this->branchVariables[$branchId])) { - return $this->branchVariables[$branchId]; - } + return $this->mustGrownStack; + } - return null; + /** + * @return int + */ + public function getNextTempVar(): int + { + return $this->tempVarCount++; } /** - * Return a variable in the symbol table, it will be used for a read operation. - * - * @param string $name - * @param CompilationContext $compilationContext - * @param array $statement + * Creates a temporary variable to be used in a write operation + * the body of the variable is freed between iterations instead of + * request a new full zval variable. * - * @throws CompilerException + * @param string $type + * @param CompilationContext $context * * @return Variable */ - public function getVariableForRead($name, CompilationContext $compilationContext = null, array $statement = null) + public function getTempComplexLiteralVariableForWrite($type, CompilationContext $context) { - /** - * Validate that 'this' cannot be used in a static function - */ - if ('this' == $name || 'this_ptr' == $name) { - if ($compilationContext->staticContext) { - throw new CompilerException("Cannot use variable 'this' in static context", $statement); + $variable = $this->reuseTempVariable($type, 'heap-literal'); + if (is_object($variable)) { + $variable->increaseUses(); + $variable->increaseMutates(); + if ('variable' == $type || 'string' == $type || 'array' == $type) { + $variable->initComplexLiteralVariant($context); } + + return $variable; } - /** - * Create superglobals just in time - */ - if ($this->globalsManager->isSuperGlobal($name)) { - if (!$this->hasVariable($name)) { - /** - * TODO: injecting globals, initialize to null and check first? - */ - $variable = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch()); - $variable->setIsInitialized(true, $compilationContext); - $variable->setDynamicTypes('array'); - $variable->setIsExternal(true); - $this->addRawVariable($variable); - } else { - $variable = $this->getVariable($name); - } + $tempVar = $this->getNextTempVar(); + $variable = $this->addVariable($type, '_' . $tempVar, $context); + $variable->setIsInitialized(true, $context); + $variable->increaseUses(); + $variable->increaseMutates(); + $variable->setTemporal(true); + if ('variable' == $type || 'string' == $type || 'array' == $type) { + $variable->initComplexLiteralVariant($context); + } + + $this->registerTempVariable($type, 'heap-literal', $variable); + + return $variable; + } + + /** + * Creates a temporary variable to be used in a write operation. + * + * @param string $type + * @param CompilationContext $context + * + * @return Variable + */ + public function getTempLocalVariableForWrite($type, CompilationContext $context) + { + $variable = $this->reuseTempVariable($type, 'stack'); + if (is_object($variable)) { $variable->increaseUses(); + $variable->increaseMutates(); + $variable->setLocalOnly(true); + if ('variable' == $type || 'string' == $type || 'array' == $type) { + $variable->initVariant($context); + } return $variable; } - if (!$this->hasVariable($name)) { - throw new CompilerException("Cannot read variable '".$name."' because it wasn't declared", $statement); + $tempVar = $this->getNextTempVar(); + $variable = $this->addVariable($type, '_' . $tempVar, $context); + $variable->setIsInitialized(true, $context); + $variable->increaseUses(); + $variable->increaseMutates(); + $variable->setLocalOnly(true); + $variable->setTemporal(true); + if ('variable' == $type || 'string' == $type || 'array' == $type) { + $variable->initVariant($context); } - $variable = $this->getVariable($name); - if (!$variable->isInitialized()) { - /* DON'T REMOVE THIS!! */ - throw new CompilerException("Variable '".$name."' cannot be read because it's not initialized", $statement); - } + $this->registerTempVariable($type, 'stack', $variable); - $variable->increaseUses(); + return $variable; + } - /** - * Analise branches to detect possible initialization of variables in conditional branches - */ - if (!$variable->isTemporal() && !$variable->getSkipVariant()) { - if ('return_value' != $name && 'this' != $name) { - if (\is_object($compilationContext) && \is_object($compilationContext->branchManager)) { - if ($compilationContext->config->get('check-invalid-reads', 'optimizations')) { - switch ($variable->getType()) { - case 'variable': - case 'string': - case 'array': - case 'mixed': - if (!$variable->isLocalOnly()) { - $variable->setMustInitNull(true); - } - break; - } - } + /** + * Creates a temporary variable to be used in a read-only operation within native-array-access and property-access + * These kind of variables MUST not be tracked by the Zephir memory manager. + * + * @param string $type + * @param CompilationContext $context + * + * @return Variable + */ + public function getTempNonTrackedUninitializedVariable($type, CompilationContext $context) + { + $variable = $this->reuseTempVariable($type, 'non-tracked-uninitialized'); + if (is_object($variable)) { + $variable->increaseUses(); + $variable->increaseMutates(); - $initBranches = $variable->getInitBranches(); + return $variable; + } - $currentBranch = $compilationContext->branchManager->getCurrentBranch(); - /** @var Branch[] $branches */ - $branches = array_reverse($initBranches); + $tempVar = $this->getNextTempVar(); + $variable = $this->addVariable($type, '_' . $tempVar, $context); + $variable->setIsInitialized(true, $context); + $variable->setTemporal(true); + $variable->setMemoryTracked(false); + $variable->increaseUses(); + $variable->increaseMutates(); - if (1 == \count($branches)) { - if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) { - if (true === $branches[0]->isUnreachable()) { - throw new CompilerException('Initialization of variable "'.$name.'" depends on unreachable branch, consider initialize it at its declaration', $statement); - } - } else { - if (Branch::TYPE_CONDITIONAL_FALSE == $branches[0]->getType()) { - if (false === $branches[0]->isUnreachable()) { - throw new CompilerException('Initialization of variable "'.$name.'" depends on unreachable branch, consider initialize at its declaration', $statement); - } - } - } - - $tempBranch = $branches[0]->getParentBranch(); - while ($tempBranch) { - if (Branch::TYPE_CONDITIONAL_TRUE == $tempBranch->getType()) { - if (true === $tempBranch->isUnreachable()) { - throw new CompilerException('Initialization of variable "'.$name.'" depends on unreachable branch, consider initialize it at its declaration', $statement); - } - } - - $tempBranch = $tempBranch->getParentBranch(); - } - } - - $found = false; - foreach ($branches as $branch) { - /* - * Variable was initialized in the same current branch - */ - if ($branch === $currentBranch) { - $found = true; - break; - } - - /* - * 'root' and 'external' branches are safe branches - */ - if (Branch::TYPE_ROOT == $branch->getType() || Branch::TYPE_EXTERNAL == $branch->getType()) { - $found = true; - break; - } - } - - if (!$found) { - /** - * Check if last assignment - * Variable was initialized in a sub-branch and it's being used in a parent branch. - */ - $possibleBadAssignment = false; - - if ($currentBranch->getLevel() < $branches[0]->getLevel()) { - $possibleBadAssignment = true; - } - - if ($possibleBadAssignment) { - if (\count($branches) > 1) { - $graph = new BranchGraph(); - foreach ($branches as $branch) { - $graph->addLeaf($branch); - } - } else { - /* - * Variable is assigned just once and it's assigned in a conditional branch - */ - if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) { - $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression(); - - if (true === $evalExpression->isUnreachable()) { - throw new CompilerException("Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", $statement); - } else { - $variable->enableDefaultAutoInitValue(); - $compilationContext->logger->warning( - "Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", - ['conditional-initialization', $statement] - ); - } - } else { - if (Branch::TYPE_CONDITIONAL_FALSE == $branches[0]->getType()) { - $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression(); - - if (true === $evalExpression->isUnreachableElse()) { - throw new CompilerException("Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", $statement); - } else { - $variable->enableDefaultAutoInitValue(); - $compilationContext->logger->warning( - "Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", - ['conditional-initialization', $statement] - ); - } - } - } - } - } - } - } - } - } - - /* - * Saves the latest place where the variable was used - */ - $variable->setUsed(true, $statement); + $this->registerTempVariable($type, 'non-tracked-uninitialized', $variable); return $variable; } /** - * Return a variable in the symbol table, it will be used for a write operation - * Some variables aren't writable themselves but their members do. - * - * @param string $name - * @param CompilationContext $compilationContext - * @param array $statement + * Creates a temporary variable to be used to point to a heap variable + * These kind of variables MUST not be tracked by the Zephir memory manager. * - * @throws CompilerException + * @param $type + * @param CompilationContext $context + * @param bool $initNonReferenced * - * @return bool|\Zephir\Variable + * @return Variable */ - public function getVariableForWrite($name, CompilationContext $compilationContext, array $statement = null) + public function getTempNonTrackedVariable($type, CompilationContext $context, $initNonReferenced = false) { - /* - * Create superglobals just in time - */ - if ($this->globalsManager->isSuperGlobal($name)) { - if (!$this->hasVariable($name)) { - /** - * TODO:, injecting globals, initialize to null and check first? - */ - $superVar = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch()); - $superVar->setIsInitialized(true, $compilationContext); - $superVar->setDynamicTypes('array'); - $superVar->increaseMutates(); - $superVar->increaseUses(); - $superVar->setIsExternal(true); - $superVar->setUsed(true, $statement); - $this->addRawVariable($superVar); + $variable = $this->reuseTempVariable($type, 'non-tracked'); - return $superVar; + if (is_object($variable)) { + $variable->increaseUses(); + $variable->increaseMutates(); + if ($initNonReferenced) { + $variable->initNonReferenced($context); } - } - if (!$this->hasVariable($name)) { - throw new CompilerException("Cannot mutate variable '".$name."' because it wasn't defined", $statement); + return $variable; } - $variable = $this->getVariable($name); + $tempVar = $this->getNextTempVar(); + $variable = $this->addVariable($type, '_' . $tempVar, $context); + $variable->setIsInitialized(true, $context); + $variable->setTemporal(true); + $variable->setMemoryTracked(false); $variable->increaseUses(); $variable->increaseMutates(); - /* - * Saves the last place where the variable was mutated - * We discard mutations inside loops because iterations could use the value - * and Zephir only provides top-down compilation - */ - if (!$compilationContext->insideCycle) { - $variable->setUsed(false, $statement); - } else { - $variable->setUsed(true, $statement); + $this->registerTempVariable($type, 'non-tracked', $variable); + + if ($initNonReferenced) { + $variable->initNonReferenced($context); } return $variable; } /** - * Return a variable in the symbol table, it will be used for a mutating operation - * This method implies mutation of one of the members of the variable but no the variables it self. + * Returns a temporal variable. * - * @param string $name + * @param string $type * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException * * @return Variable */ - public function getVariableForUpdate($name, CompilationContext $compilationContext, array $statement = null) + public function getTempVariable(string $type, CompilationContext $compilationContext): Variable { - /* - * Create superglobals just in time - */ - if ($this->globalsManager->isSuperGlobal($name)) { - if (!$this->hasVariable($name)) { - /** - * TODO:, injecting globals, initialize to null and check first? - */ - $superVar = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch()); - $superVar->setIsInitialized(true, $compilationContext); - $superVar->setDynamicTypes('array'); - $superVar->increaseMutates(); - $superVar->increaseUses(); - $superVar->setIsExternal(true); - $superVar->setUsed(true, $statement); - $this->addRawVariable($superVar); - - return $superVar; - } - } - - if (!$this->hasVariable($name)) { - throw new CompilerException("Cannot mutate variable '".$name."' because it wasn't defined", $statement); - } - - $variable = $this->getVariable($name); - $variable->increaseUses(); - $variable->increaseMutates(); - - /* - * Saves the last place where the variable was mutated - * We discard mutations inside loops because iterations could use the value - * and Zephir only provides top-down compilation - */ - $variable->setUsed(true, $statement); + $tempVar = $this->getNextTempVar(); + $variable = $this->addVariable($type, '_' . $tempVar, $compilationContext); + $variable->setTemporal(true); return $variable; } /** - * Return a variable in the symbol table, it will be used for a write operation. + * Creates a temporary variable to be used as intermediate variable of a read operation + * Variables are automatically tracked by the memory manager. * - * @param bool $mustGrownStack - */ - public function mustGrownStack($mustGrownStack) - { - $this->mustGrownStack = $mustGrownStack; - } - - /** - * Returns if the current symbol label must add a memory frame. + * @param string $type + * @param CompilationContext $context * - * @return bool + * @return Variable */ - public function getMustGrownStack() + public function getTempVariableForObserve($type, CompilationContext $context) { - return $this->mustGrownStack; - } + $variable = $this->reuseTempVariable($type, 'observe'); + if (is_object($variable)) { + $variable->increaseUses(); + $variable->increaseMutates(); + $variable->observeVariant($context); - /** - * @return int - */ - public function getNextTempVar() - { - return $this->tempVarCount++; + return $variable; + } + + $tempVar = $this->getNextTempVar(); + $variable = $this->addVariable($type, '_' . $tempVar, $context); + $variable->setIsInitialized(true, $context); + $variable->setTemporal(true); + $variable->increaseUses(); + $variable->increaseMutates(); + $variable->observeVariant($context); + + $this->registerTempVariable($type, 'observe', $variable); + + return $variable; } /** - * Returns a temporal variable. + * Creates a temporary variable to be used as intermediate variable in a call operation + * Variables are automatically tracked by the memory manager. * * @param string $type - * @param CompilationContext $compilationContext + * @param CompilationContext $context * * @return Variable */ - public function getTempVariable(string $type, CompilationContext $compilationContext): Variable + public function getTempVariableForObserveOrNullify($type, CompilationContext $context) { - $tempVar = $this->getNextTempVar(); - $variable = $this->addVariable($type, '_'.$tempVar, $compilationContext); + $variable = $this->reuseTempVariable($type, 'observe-nullify'); + if (is_object($variable)) { + $variable->increaseUses(); + $variable->increaseMutates(); + $variable->observeOrNullifyVariant($context); + + return $variable; + } + + $tempVar = $this->getNextTempVar(); + $variable = $this->addVariable($type, '_' . $tempVar, $context); + $variable->setIsInitialized(true, $context); $variable->setTemporal(true); + $variable->increaseUses(); + $variable->increaseMutates(); + $variable->observeOrNullifyVariant($context); + + $this->registerTempVariable($type, 'observe-nullify', $variable); return $variable; } @@ -591,10 +450,10 @@ public function getTempVariable(string $type, CompilationContext $compilationCon * * @return Variable */ - public function getTempVariableForWrite($type, CompilationContext $context, $init = true) + public function getTempVariableForWrite(string $type, CompilationContext $context, $init = true): Variable { $variable = $this->reuseTempVariable($type, 'heap'); - if (\is_object($variable)) { + if (is_object($variable)) { $variable->increaseUses(); $variable->increaseMutates(); if ($init && ('variable' == $type || 'string' == $type || 'array' == $type)) { @@ -604,8 +463,8 @@ public function getTempVariableForWrite($type, CompilationContext $context, $ini return $variable; } - $tempVar = $this->getNextTempVar(); - $variable = $this->addVariable($type, '_'.$tempVar, $context); + $tempVar = $this->getNextTempVar(); + $variable = $this->addVariable($type, '_' . $tempVar, $context); $variable->setIsInitialized(true, $context); $variable->setTemporal(true); $variable->increaseUses(); @@ -620,262 +479,387 @@ public function getTempVariableForWrite($type, CompilationContext $context, $ini } /** - * Creates a temporary variable to be used to point to a heap variable - * These kind of variables MUST not be tracked by the Zephir memory manager. - * - * @param $type - * @param CompilationContext $context - * @param bool $initNonReferenced - * - * @return Variable + * Returns a variable in the symbol table. */ - public function getTempNonTrackedVariable($type, CompilationContext $context, $initNonReferenced = false) + public function getVariable(string $name, ?CompilationContext $compilationContext = null) { - $variable = $this->reuseTempVariable($type, 'non-tracked'); - - if (\is_object($variable)) { - $variable->increaseUses(); - $variable->increaseMutates(); - if ($initNonReferenced) { - $variable->initNonReferenced($context); + /* Check if the variable already is referencing a branch */ + $pos = strpos($name, Variable::BRANCH_MAGIC); + if ($pos > -1) { + $branchId = (int)substr($name, $pos + strlen(Variable::BRANCH_MAGIC)); + $name = substr($name, 0, $pos); + } else { + $compilationContext = $compilationContext ?: $this->compilationContext; + $branch = $this->resolveVariableToBranch($name, $compilationContext); + if (!$branch) { + return false; } - return $variable; + $branchId = $branch->getUniqueId(); } - $tempVar = $this->getNextTempVar(); - $variable = $this->addVariable($type, '_'.$tempVar, $context); - $variable->setIsInitialized(true, $context); - $variable->setTemporal(true); - $variable->setMemoryTracked(false); - $variable->increaseUses(); - $variable->increaseMutates(); - - $this->registerTempVariable($type, 'non-tracked', $variable); - - if ($initNonReferenced) { - $variable->initNonReferenced($context); + if (!isset($this->branchVariables[$branchId]) || !isset($this->branchVariables[$branchId][$name])) { + return false; } + $variable = $this->branchVariables[$branchId][$name]; + $variable->setUsed(true); + return $variable; } /** - * Creates a temporary variable to be used in a read-only operation within native-array-access and property-access - * These kind of variables MUST not be tracked by the Zephir memory manager. + * Return a variable in the symbol table, it will be used for a read operation. * - * @param string $type - * @param CompilationContext $context + * @param string $name + * @param CompilationContext|null $compilationContext + * @param array|null $statement * * @return Variable + * + * @throws CompilerException */ - public function getTempNonTrackedUninitializedVariable($type, CompilationContext $context) + public function getVariableForRead($name, CompilationContext $compilationContext = null, array $statement = null) { - $variable = $this->reuseTempVariable($type, 'non-tracked-uninitialized'); - if (\is_object($variable)) { + /** + * Validate that 'this' cannot be used in a static function + */ + if ('this' == $name || 'this_ptr' == $name) { + if ($compilationContext->staticContext) { + throw new CompilerException("Cannot use variable 'this' in static context", $statement); + } + } + + /** + * Create superglobals just in time + */ + if ($this->globalsManager->isSuperGlobal($name)) { + if (!$this->hasVariable($name)) { + /** + * TODO: injecting globals, initialize to null and check first? + */ + $variable = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch()); + $variable->setIsInitialized(true, $compilationContext); + $variable->setDynamicTypes('array'); + $variable->setIsExternal(true); + $this->addRawVariable($variable); + } else { + $variable = $this->getVariable($name); + } $variable->increaseUses(); - $variable->increaseMutates(); return $variable; } - $tempVar = $this->getNextTempVar(); - $variable = $this->addVariable($type, '_'.$tempVar, $context); - $variable->setIsInitialized(true, $context); - $variable->setTemporal(true); - $variable->setMemoryTracked(false); - $variable->increaseUses(); - $variable->increaseMutates(); - - $this->registerTempVariable($type, 'non-tracked-uninitialized', $variable); + if (!$this->hasVariable($name)) { + throw new CompilerException("Cannot read variable '" . $name . "' because it wasn't declared", $statement); + } + + $variable = $this->getVariable($name); + if (!$variable->isInitialized()) { + /* DON'T REMOVE THIS!! */ + throw new CompilerException( + "Variable '" . $name . "' cannot be read because it's not initialized", + $statement + ); + } + + $variable->increaseUses(); + + /** + * Analise branches to detect possible initialization of variables in conditional branches + */ + if (!$variable->isTemporal() && !$variable->getSkipVariant()) { + if ('return_value' != $name && 'this' != $name) { + if (is_object($compilationContext) && is_object($compilationContext->branchManager)) { + if ($compilationContext->config->get('check-invalid-reads', 'optimizations')) { + switch ($variable->getType()) { + case 'variable': + case 'string': + case 'array': + case 'mixed': + if (!$variable->isLocalOnly()) { + $variable->setMustInitNull(true); + } + break; + } + } + + $initBranches = $variable->getInitBranches(); + + $currentBranch = $compilationContext->branchManager->getCurrentBranch(); + $branches = array_reverse($initBranches); + + if (1 == count($branches)) { + if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) { + if (true === $branches[0]->isUnreachable()) { + throw new CompilerException( + 'Initialization of variable "' . $name . '" depends on unreachable branch, consider initialize it at its declaration', + $statement + ); + } + } else { + if (Branch::TYPE_CONDITIONAL_FALSE == $branches[0]->getType()) { + if (false === $branches[0]->isUnreachable()) { + throw new CompilerException( + 'Initialization of variable "' . $name . '" depends on unreachable branch, consider initialize at its declaration', + $statement + ); + } + } + } + + $tempBranch = $branches[0]->getParentBranch(); + while ($tempBranch) { + if (Branch::TYPE_CONDITIONAL_TRUE == $tempBranch->getType()) { + if (true === $tempBranch->isUnreachable()) { + throw new CompilerException( + 'Initialization of variable "' . $name . '" depends on unreachable branch, consider initialize it at its declaration', + $statement + ); + } + } + + $tempBranch = $tempBranch->getParentBranch(); + } + } + + $found = false; + foreach ($branches as $branch) { + /* + * Variable was initialized in the same current branch + */ + if ($branch === $currentBranch) { + $found = true; + break; + } + + /* + * 'root' and 'external' branches are safe branches + */ + if (Branch::TYPE_ROOT == $branch->getType() || Branch::TYPE_EXTERNAL == $branch->getType()) { + $found = true; + break; + } + } + + if (!$found) { + /** + * Check if last assignment + * Variable was initialized in a sub-branch, and it's being used in a parent branch. + */ + $possibleBadAssignment = $currentBranch->getLevel() < $branches[0]->getLevel(); + if ($possibleBadAssignment && count($branches) === 1) { + /** + * Variable is assigned just once, and it's assigned in a conditional branch + */ + if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) { + $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression(); + + if (true === $evalExpression->isUnreachable()) { + throw new CompilerException( + "Variable '" . $name . "' was assigned for the first time in conditional branch, consider initialize it at its declaration", + $statement + ); + } else { + $variable->enableDefaultAutoInitValue(); + $compilationContext->logger->warning( + "Variable '" . $name . "' was assigned for the first time in conditional branch, consider initialize it at its declaration", + ['conditional-initialization', $statement] + ); + } + } else { + if (Branch::TYPE_CONDITIONAL_FALSE == $branches[0]->getType()) { + $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression(); + + if (true === $evalExpression->isUnreachableElse()) { + throw new CompilerException( + "Variable '" . $name . "' was assigned for the first time in conditional branch, consider initialize it at its declaration", + $statement + ); + } else { + $variable->enableDefaultAutoInitValue(); + $compilationContext->logger->warning( + "Variable '" . $name . "' was assigned for the first time in conditional branch, consider initialize it at its declaration", + ['conditional-initialization', $statement] + ); + } + } + } + } + } + } + } + } + + /* + * Saves the latest place where the variable was used + */ + $variable->setUsed(true, $statement); return $variable; } /** - * Creates a temporary variable to be used in a write operation - * the body of the variable is freed between iterations instead of - * request a new full zval variable. - * - * @param string $type - * @param CompilationContext $context - * - * @return Variable + * Return a variable in the symbol table, it will be used for a mutating operation + * This method implies mutation of one of the members of the variable but no the variables itself. */ - public function getTempComplexLiteralVariableForWrite($type, CompilationContext $context) + public function getVariableForUpdate(string $name, CompilationContext $compilationContext, array $statement = null) { - $variable = $this->reuseTempVariable($type, 'heap-literal'); - if (\is_object($variable)) { - $variable->increaseUses(); - $variable->increaseMutates(); - if ('variable' == $type || 'string' == $type || 'array' == $type) { - $variable->initComplexLiteralVariant($context); + /** + * Create superglobals just in time + */ + if ($this->globalsManager->isSuperGlobal($name)) { + if (!$this->hasVariable($name)) { + /** + * TODO:, injecting globals, initialize to null and check first? + */ + $superVar = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch()); + $superVar->setIsInitialized(true, $compilationContext); + $superVar->setDynamicTypes('array'); + $superVar->increaseMutates(); + $superVar->increaseUses(); + $superVar->setIsExternal(true); + $superVar->setUsed(true, $statement); + $this->addRawVariable($superVar); + + return $superVar; } + } - return $variable; + if (!$this->hasVariable($name)) { + throw new CompilerException("Cannot mutate variable '" . $name . "' because it wasn't defined", $statement); } - $tempVar = $this->getNextTempVar(); - $variable = $this->addVariable($type, '_'.$tempVar, $context); - $variable->setIsInitialized(true, $context); + $variable = $this->getVariable($name); $variable->increaseUses(); $variable->increaseMutates(); - $variable->setTemporal(true); - if ('variable' == $type || 'string' == $type || 'array' == $type) { - $variable->initComplexLiteralVariant($context); - } - $this->registerTempVariable($type, 'heap-literal', $variable); + /** + * Saves the last place where the variable was mutated + * We discard mutations inside loops because iterations could use the value + * and Zephir only provides top-down compilation + */ + $variable->setUsed(true, $statement); return $variable; } /** - * Creates a temporary variable to be used in a write operation. + * Return a variable in the symbol table, it will be used for a write operation + * Some variables aren't writable themselves but their members do. * - * @param string $type - * @param CompilationContext $context + * @param string $name + * @param CompilationContext $compilationContext + * @param array|null $statement * - * @return Variable + * @return bool|Variable + * + * @throws CompilerException */ - public function getTempLocalVariableForWrite($type, CompilationContext $context) + public function getVariableForWrite($name, CompilationContext $compilationContext, array $statement = null) { - $variable = $this->reuseTempVariable($type, 'stack'); - if (\is_object($variable)) { - $variable->increaseUses(); - $variable->increaseMutates(); - $variable->setLocalOnly(true); - if ('variable' == $type || 'string' == $type || 'array' == $type) { - $variable->initVariant($context); - } + /** + * Create superglobals just in time + */ + if ($this->globalsManager->isSuperGlobal($name)) { + if (!$this->hasVariable($name)) { + /** + * TODO:, injecting globals, initialize to null and check first? + */ + $superVar = new Variable('variable', $name, $compilationContext->branchManager->getCurrentBranch()); + $superVar->setIsInitialized(true, $compilationContext); + $superVar->setDynamicTypes('array'); + $superVar->increaseMutates(); + $superVar->increaseUses(); + $superVar->setIsExternal(true); + $superVar->setUsed(true, $statement); + $this->addRawVariable($superVar); - return $variable; + return $superVar; + } } - $tempVar = $this->getNextTempVar(); - $variable = $this->addVariable($type, '_'.$tempVar, $context); - $variable->setIsInitialized(true, $context); - $variable->increaseUses(); - $variable->increaseMutates(); - $variable->setLocalOnly(true); - $variable->setTemporal(true); - if ('variable' == $type || 'string' == $type || 'array' == $type) { - $variable->initVariant($context); + if (!$this->hasVariable($name)) { + throw new CompilerException("Cannot mutate variable '" . $name . "' because it wasn't defined", $statement); } - $this->registerTempVariable($type, 'stack', $variable); - - return $variable; - } - - /** - * Creates a temporary variable. - * - * @param string $type - * @param CompilationContext $context - * - * @return Variable - */ - public function addTemp($type, CompilationContext $context) - { - $tempVar = $this->getNextTempVar(); - $variable = $this->addVariable($type, '_'.$tempVar, $context); - $variable->setIsInitialized(true, $context); - $variable->setTemporal(true); + $variable = $this->getVariable($name); $variable->increaseUses(); $variable->increaseMutates(); + /** + * Saves the last place where the variable was mutated + * We discard mutations inside loops because iterations could use the value + * and Zephir only provides top-down compilation + */ + if (!$compilationContext->insideCycle) { + $variable->setUsed(false, $statement); + } else { + $variable->setUsed(true, $statement); + } + return $variable; } /** - * Creates a temporary variable to be used as intermediate variable of a read operation - * Variables are automatically tracked by the memory manager. - * - * @param string $type - * @param CompilationContext $context + * Returns all the variables defined in the symbol table. * - * @return Variable + * @return Variable[] */ - public function getTempVariableForObserve($type, CompilationContext $context) + public function getVariables(): array { - $variable = $this->reuseTempVariable($type, 'observe'); - if (\is_object($variable)) { - $variable->increaseUses(); - $variable->increaseMutates(); - $variable->observeVariant($context); - - return $variable; + $ret = []; + foreach ($this->branchVariables as $vars) { + foreach ($vars as $var) { + $ret[$var->getName()] = $var; + } } - $tempVar = $this->getNextTempVar(); - $variable = $this->addVariable($type, '_'.$tempVar, $context); - $variable->setIsInitialized(true, $context); - $variable->setTemporal(true); - $variable->increaseUses(); - $variable->increaseMutates(); - $variable->observeVariant($context); - - $this->registerTempVariable($type, 'observe', $variable); - - return $variable; + return $ret; } /** - * Creates a temporary variable to be used as intermediate variable in a call operation - * Variables are automatically tracked by the memory manager. + * Check if a variable is declared in the current symbol table. * - * @param string $type - * @param CompilationContext $context + * @param string $name + * @param CompilationContext|null $compilationContext * - * @return Variable + * @return bool */ - public function getTempVariableForObserveOrNullify($type, CompilationContext $context) + public function hasVariable(string $name, CompilationContext $compilationContext = null): bool { - $variable = $this->reuseTempVariable($type, 'observe-nullify'); - if (\is_object($variable)) { - $variable->increaseUses(); - $variable->increaseMutates(); - $variable->observeOrNullifyVariant($context); - - return $variable; - } - - $tempVar = $this->getNextTempVar(); - $variable = $this->addVariable($type, '_'.$tempVar, $context); - $variable->setIsInitialized(true, $context); - $variable->setTemporal(true); - $variable->increaseUses(); - $variable->increaseMutates(); - $variable->observeOrNullifyVariant($context); + return false !== $this->getVariable($name, $compilationContext ?: $this->compilationContext); + } - $this->registerTempVariable($type, 'observe-nullify', $variable); + public function hasVariableInBranch( + $name, + Branch $compareBranch, + CompilationContext $compilationContext = null + ): bool { + $branch = $this->resolveVariableToBranch($name, $compilationContext ?: $this->compilationContext); - return $variable; + return $branch instanceof Branch && $branch === $compareBranch; } /** * Traverses temporal variables created in a specific branch * marking them as idle. - * - * @param CompilationContext $compilationContext */ - public function markTemporalVariablesIdle(CompilationContext $compilationContext) + public function markTemporalVariablesIdle(CompilationContext $compilationContext): void { - $compilationContext = $compilationContext ?: $this->compilationContext; $branchId = $compilationContext->branchManager->getCurrentBranchId(); - if (!isset($this->branchTempVariables[$branchId])) { return; } - foreach ($this->branchTempVariables[$branchId] as $location => $typeVariables) { - foreach ($typeVariables as $type => $variables) { + foreach ($this->branchTempVariables[$branchId] as $typeVariables) { + foreach ($typeVariables as $variables) { foreach ($variables as $variable) { - $pos = strpos($variable->getName(), Variable::BRANCH_MAGIC); + $pos = strpos($variable->getName(), Variable::BRANCH_MAGIC); $otherBranchId = 1; if ($pos > -1) { - $otherBranchId = (int) (substr($variable->getName(), $pos + \strlen(Variable::BRANCH_MAGIC))); + $otherBranchId = (int)substr($variable->getName(), $pos + strlen(Variable::BRANCH_MAGIC)); } if ($branchId == $otherBranchId) { $variable->setIdle(true); @@ -886,65 +870,51 @@ public function markTemporalVariablesIdle(CompilationContext $compilationContext } /** - * Returns the number of expected mutations for a variable. - * - * @param string $variable + * Return a variable in the symbol table, it will be used for a write operation. * - * @return int + * @param bool $mustGrownStack */ - public function getExpectedMutations($variable) + public function mustGrownStack(bool $mustGrownStack): void { - if ($this->localContext) { - return $this->localContext->getNumberOfMutations($variable); - } - - return 0; + $this->mustGrownStack = $mustGrownStack; } - /** - * Returns the last line where any kind of call was performed within the method - * This is not necessary related to the symbol table but this information is gathered - * by the LocalContextPass. - * - * @return int - */ - public function getLastCallLine() + public function resolveVariableToBranch($name, CompilationContext $compilationContext): ?Branch { - if ($this->localContext) { - return $this->localContext->getLastCallLine(); - } + $currentBranch = $compilationContext->branchManager->getCurrentBranch(); - return 0; + do { + $currentId = $currentBranch->getUniqueId(); + if (isset($this->branchVariables[$currentId][$name])) { + return $currentBranch; + } + $currentBranch = $currentBranch->getParentBranch(); + } while (null != $currentBranch); + + return null; } /** - * Returns the last line where an 'unset' operation was made within the current method - * This is not necessary related to the symbol table but this information is gathered - * by the LocalContextPass. + * Sets the local context information. * - * @return int + * @param LocalContextPass $localContext */ - public function getLastUnsetLine() + public function setLocalContext(LocalContextPass $localContext): void { - if ($this->localContext) { - return $this->localContext->getLastUnsetLine(); - } - - return 0; + $this->localContext = $localContext; } /** * Register a variable as temporal. - * - * @param string $type - * @param string $location - * @param Variable $variable - * @param CompilationContext $compilationContext */ - protected function registerTempVariable($type, $location, Variable $variable, CompilationContext $compilationContext = null) - { + protected function registerTempVariable( + string $type, + string $location, + Variable $variable, + ?CompilationContext $compilationContext = null + ): void { $compilationContext = $compilationContext ?: $this->compilationContext; - $branchId = $compilationContext->branchManager->getCurrentBranchId(); + $branchId = $compilationContext->branchManager->getCurrentBranchId(); if (!isset($this->branchTempVariables[$branchId][$location][$type])) { $this->branchTempVariables[$branchId][$location][$type] = []; @@ -954,26 +924,21 @@ protected function registerTempVariable($type, $location, Variable $variable, Co /** * Reuse variables marked as idle after leave a branch. - * - * @param string $type - * @param string $location - * @param CompilationContext $compilationContext - * - * @return Variable */ - protected function reuseTempVariable(string $type, $location, CompilationContext $compilationContext = null) - { + protected function reuseTempVariable( + string $type, + string $location, + ?CompilationContext $compilationContext = null, + ): ?Variable { $compilationContext = $compilationContext ?: $this->compilationContext; - $branchId = $compilationContext->branchManager->getCurrentBranchId(); + $branchId = $compilationContext->branchManager->getCurrentBranchId(); if (isset($this->branchTempVariables[$branchId][$location][$type])) { foreach ($this->branchTempVariables[$branchId][$location][$type] as $variable) { - if (!$variable->isDoublePointer()) { - if ($variable->isIdle()) { - $variable->setIdle(false); + if (!$variable->isDoublePointer() && $variable->isIdle()) { + $variable->setIdle(false); - return $variable; - } + return $variable; } } } diff --git a/src/Traits/CompilerTrait.php b/src/Traits/CompilerTrait.php new file mode 100644 index 0000000000..b85a2fdb77 --- /dev/null +++ b/src/Traits/CompilerTrait.php @@ -0,0 +1,110 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Traits; + +use Zephir\Class\Definition\Definition; +use Zephir\CompilationContext; + +use function dirname; +use function explode; +use function implode; +use function is_dir; +use function mkdir; +use function str_repeat; +use function str_replace; +use function strpos; +use function strtolower; + +use const DIRECTORY_SEPARATOR; +use const PHP_EOL; + +trait CompilerTrait +{ + /** + * @param string $completeName + * + * @return array + */ + protected function calculatePaths(string $completeName): array + { + $path = str_replace('\\', DIRECTORY_SEPARATOR, strtolower($completeName)); + + $filePath = 'ext/' . $path . '.zep.c'; + $filePathHeader = 'ext/' . $path . '.zep.h'; + + if (strpos($path, DIRECTORY_SEPARATOR)) { + $dirname = dirname($filePath); + if (!is_dir($dirname)) { + mkdir($dirname, 0755, true); + } + } + + return [$path, $filePath, $filePathHeader]; + } + + /** + * @param string $code + * @param Definition|null $classDefinition + * @param CompilationContext $compilationContext + * + * @return void + */ + protected function generateClassHeadersPost( + string $code, + ?Definition $classDefinition, + CompilationContext $compilationContext + ): void { + $code .= PHP_EOL; + + $code .= '#include "kernel/main.h"' . PHP_EOL; + + if ('class' == $classDefinition->getType()) { + foreach ($compilationContext->headersManager->get() as $header => $one) { + $code .= '#include "' . $header . '.h"' . PHP_EOL; + } + } + + if (count($this->headerCBlocks) > 0) { + $code .= implode(PHP_EOL, $this->headerCBlocks) . PHP_EOL; + } + + /** + * Prepend the required files to the header + */ + $compilationContext->codePrinter->preOutput($code); + } + + /** + * @param Definition|null $classDefinition + * + * @return string + */ + protected function generateCodeHeadersPre(?Definition $classDefinition): string + { + $separators = str_repeat('../', count(explode('\\', $classDefinition->getCompleteName())) - 1); + + $code = PHP_EOL; + $code .= '#ifdef HAVE_CONFIG_H' . PHP_EOL; + $code .= '#include "' . $separators . 'ext_config.h"' . PHP_EOL; + $code .= '#endif' . PHP_EOL; + $code .= PHP_EOL; + + $code .= '#include ' . PHP_EOL; + $code .= '#include "' . $separators . 'php_ext.h"' . PHP_EOL; + $code .= '#include "' . $separators . 'ext.h"' . PHP_EOL; + $code .= PHP_EOL; + + return $code; + } +} diff --git a/src/Traits/VariablesTrait.php b/src/Traits/VariablesTrait.php new file mode 100644 index 0000000000..dab4c5b314 --- /dev/null +++ b/src/Traits/VariablesTrait.php @@ -0,0 +1,213 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Traits; + +use Exception; +use Zephir\Class\Definition\AbstractDefinition; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Property; +use Zephir\Exception\CompilerException; +use Zephir\GlobalConstant; +use Zephir\Variable\Variable; +use Zephir\Variable\Variable as ZephirVariable; + +trait VariablesTrait +{ + /** + * Check whether a class has a property + * + * @param Definition $classDefinition + * @param string $property + * @param array $statement + * + * @return void + */ + protected function checkAccessNonStaticProperty( + Property $propertyDefinition, + AbstractDefinition $classDefinition, + string $property, + array $statement + ): void { + if (!$propertyDefinition->isStatic()) { + throw new CompilerException( + "Cannot access non-static property '" + . $classDefinition->getCompleteName() + . '::' + . $property + . "'", + $statement + ); + } + } + + /** + * Check whether a class has a property + * + * @param Definition $classDefinition + * @param string $property + * @param array $statement + * + * @return void + */ + protected function checkClassHasProperty( + Definition $classDefinition, + string $property, + array $statement, + string $className = '' + ): void { + if (!$classDefinition->hasProperty($property)) { + throw CompilerException::classDoesNotHaveProperty( + (empty($className) ? $classDefinition->getCompleteName() : $className), + $property, + $statement + ); + } + } + + /** + * @param array $expression + * @param string $exception + * @param array|null $extra + * + * @return void + */ + protected function checkLeft( + array $expression, + string $exception = Exception::class, + ?array $extra = null + ): void { + if (!isset($expression['left'])) { + throw new $exception('Missing left part of the expression', $extra); + } + } + + /** + * @param Variable|null $variable + * @param array $expression + * + * @return void + */ + protected function checkNotVariable( + ?Variable $variable, + array $expression + ): void { + if (null !== $variable && $variable->isNotVariable()) { + throw CompilerException::returnValuesVariantVars($expression); + } + } + + /** + * @param Variable|null $variable + * @param array $expression + * + * @return void + */ + protected function checkNotVariableString( + ?Variable $variable, + array $expression + ): void { + if (null !== $variable && $variable->isNotVariableAndString()) { + throw CompilerException::returnValuesVariantVars($expression); + } + } + + /** + * @param array $expression + * @param string $exception + * @param array|null $extra + * + * @return void + */ + protected function checkRight( + array $expression, + string $exception = Exception::class, + ?array $extra = null + ): void { + if (!isset($expression['right'])) { + throw new $exception('Missing right part of the expression', $extra); + } + } + + /** + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param array $statement + * + * @return void + */ + protected function checkVariableInitialized( + string $variable, + ZephirVariable $symbolVariable, + array $statement + ): void { + if (true !== $symbolVariable->isInitialized()) { + throw new CompilerException( + "Cannot mutate variable '" . $variable . "' because it is not initialized", + $statement + ); + } + } + + /** + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param array $statement + * + * @return void + */ + protected function checkVariableLocalOnly( + string $variable, + ZephirVariable $symbolVariable, + array $statement + ): void { + if ($symbolVariable->isLocalOnly()) { + throw new CompilerException( + "Cannot mutate variable '" . $variable . "' because it is local only", + $statement + ); + } + } + + /** + * @param string $variable + * @param ZephirVariable $symbolVariable + * @param array $statement + * + * @return void + */ + protected function checkVariableReadOnly( + string $variable, + ZephirVariable $symbolVariable, + array $statement + ): void { + if ($symbolVariable->isReadOnly()) { + throw new CompilerException( + "Cannot mutate variable '" . $variable . "' because it is read only", + $statement + ); + } + } + + /** + * @param GlobalConstant|ZephirVariable $variable + * + * @return void + */ + protected function checkVariableTemporal(GlobalConstant|Variable $variable): void + { + if ($variable->isTemporal()) { + $variable->setIdle(true); + } + } +} diff --git a/Library/TypeAwareInterface.php b/src/TypeAwareInterface.php similarity index 94% rename from Library/TypeAwareInterface.php rename to src/TypeAwareInterface.php index 1c8abd0292..1bf666ed9f 100644 --- a/Library/TypeAwareInterface.php +++ b/src/TypeAwareInterface.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; interface TypeAwareInterface diff --git a/Library/Types/AbstractType.php b/src/Types/AbstractType.php similarity index 78% rename from Library/Types/AbstractType.php rename to src/Types/AbstractType.php index e8c9c81db0..d50328f75d 100644 --- a/Library/Types/AbstractType.php +++ b/src/Types/AbstractType.php @@ -9,8 +9,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Types; +use ReflectionException; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; @@ -19,14 +22,28 @@ use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; +use function array_unshift; +use function method_exists; +use function sprintf; + abstract class AbstractType { /** * The array of methods in zephir mapped to PHP internal methods. + */ + protected array $methodMap = []; + + public function getMethodMap(): array + { + return $this->methodMap; + } + + /** + * Get the name of the type. * - * @var array + * @return string */ - protected $methodMap = []; + abstract public function getTypeName(): string; /** * Intercepts calls to built-in methods. @@ -39,7 +56,8 @@ abstract class AbstractType * * @return bool|CompiledExpression * - * @throws CompilerException|Exception + * @throws Exception + * @throws ReflectionException */ public function invokeMethod( $methodName, @@ -48,19 +66,19 @@ public function invokeMethod( Call $call, array $expression ) { - /* + /** * Checks first whether the method exist in the array type definition */ if (method_exists($this, $methodName)) { return $this->{$methodName}($caller, $compilationContext, $call, $expression); } - /* + /** * Check the method map */ if (isset($this->methodMap[$methodName])) { $paramNumber = $this->getNumberParam($methodName); - if (0 == $paramNumber) { + if (0 === $paramNumber) { if (isset($expression['parameters'])) { $parameters = $expression['parameters']; array_unshift($parameters, ['parameter' => $caller]); @@ -71,7 +89,7 @@ public function invokeMethod( if (isset($expression['parameters'])) { $parameters = []; foreach ($expression['parameters'] as $number => $parameter) { - if ($number == $paramNumber) { + if ($number === $paramNumber) { $parameters[] = null; } $parameters[] = $parameter; @@ -83,10 +101,11 @@ public function invokeMethod( } $functionCall = BuilderFactory::getInstance()->statements() - ->functionCall($this->methodMap[$methodName], $parameters) - ->setFile($expression['file']) - ->setLine($expression['line']) - ->setChar($expression['char']); + ->functionCall($this->methodMap[$methodName], $parameters) + ->setFile($expression['file']) + ->setLine($expression['line']) + ->setChar($expression['char']) + ; $expression = new Expression($functionCall->build()); @@ -99,29 +118,10 @@ public function invokeMethod( ); } - /** - * Get the name of the type. - * - * @return string - */ - abstract public function getTypeName(); - - /** - * @return array - */ - public function getMethodMap() - { - return $this->methodMap; - } - /** * Returns the number of the parameter where the object must be bound. - * - * @param $methodName - * - * @return int */ - protected function getNumberParam($methodName) + protected function getNumberParam(string $methodName): int { return 0; } diff --git a/src/Types/ArrayType.php b/src/Types/ArrayType.php new file mode 100644 index 0000000000..fa20863e6c --- /dev/null +++ b/src/Types/ArrayType.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Types; + +use ReflectionException; +use Zephir\Call; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; +use Zephir\Expression; +use Zephir\Expression\Builder\BuilderFactory; + +/** + * Defines methods of the built-in array type + */ +class ArrayType extends AbstractType +{ + public array $methodMap = [ + 'join' => 'join', + 'reversed' => 'array_reverse', + 'rev' => 'array_reverse', + 'diff' => 'array_diff', + 'flip' => 'array_flip', + 'fill' => 'array_fill', + 'walk' => 'array_walk', + 'haskey' => 'array_key_exists', + 'keys' => 'array_keys', + 'values' => 'array_values', + 'split' => 'array_chunk', + 'combine' => 'array_combine', + 'intersect' => 'array_intersect', + 'merge' => 'array_merge', + 'mergerecursive' => 'array_merge_recursive', + 'pad' => 'array_pad', + 'pop' => 'array_pop', + 'push' => 'array_push', + 'rand' => 'array_rand', + 'replace' => 'array_replace', + 'map' => 'array_map', + 'replacerecursive' => 'array_replace_recursive', + 'shift' => 'array_shift', + 'slice' => 'array_slice', + 'splice' => 'array_splice', + 'sum' => 'array_sum', + 'unique' => 'array_unique', + 'prepend' => 'array_unshift', + 'count' => 'count', + 'current' => 'current', + 'each' => 'each', + 'end' => 'end', + 'key' => 'key', + 'next' => 'next', + 'prev' => 'prev', + 'reset' => 'reset', + 'sort' => 'sort', + 'sortbykey' => 'ksort', + 'reversesort' => 'rsort', + 'reversesortbykey' => 'krsort', + 'shuffle' => 'shuffle', + 'tojson' => 'json_encode', + 'reduce' => 'array_reduce', + ]; + + public function getTypeName(): string + { + return Types::T_ARRAY; + } + + /** + * Transforms calls to method "join" to function calls to "join". + * + * @param object $caller + * @param CompilationContext $compilationContext + * @param Call $call + * @param array $expression + * + * @return bool|CompiledExpression + * + * @throws ReflectionException + * @throws Exception + */ + public function join($caller, CompilationContext $compilationContext, Call $call, array $expression) + { + $functionCall = BuilderFactory::getInstance()->statements() + ->functionCall('join', $expression['parameters']) + ->addArgument($caller) + ->setFile($expression['file']) + ->setLine($expression['line']) + ->setChar($expression['char']) + ; + + $expression = new Expression($functionCall->build()); + + return $expression->compile($compilationContext); + } + + protected function getNumberParam(string $methodName): int + { + return 'map' === $methodName ? 1 : 0; + } +} diff --git a/Library/Types/CharType.php b/src/Types/CharType.php similarity index 62% rename from Library/Types/CharType.php rename to src/Types/CharType.php index 385fcd6330..b748c20ab3 100644 --- a/Library/Types/CharType.php +++ b/src/Types/CharType.php @@ -9,20 +9,21 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Types; +use ReflectionException; use Zephir\Call; use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; -use Zephir\Types; class CharType extends AbstractType { - /** - * {@inheritdoc} - */ - public function getTypeName() + public function getTypeName(): string { return Types::T_CHAR; } @@ -35,16 +36,20 @@ public function getTypeName() * @param Call $call * @param array $expression * - * @return bool|mixed|\Zephir\CompiledExpression + * @return bool|mixed|CompiledExpression + * + * @throws ReflectionException + * @throws Exception */ public function toHex($caller, CompilationContext $compilationContext, Call $call, array $expression) { - $exprBuilder = BuilderFactory::getInstance(); + $exprBuilder = BuilderFactory::getInstance(); $functionCall = $exprBuilder->statements() - ->functionCall('zephir_string_to_hex', [$caller]) - ->setFile($expression['file']) - ->setLine($expression['line']) - ->setChar($expression['char']); + ->functionCall('zephir_string_to_hex', [$caller]) + ->setFile($expression['file']) + ->setLine($expression['line']) + ->setChar($expression['char']) + ; $expression = new Expression($functionCall->build()); diff --git a/src/Types/DoubleType.php b/src/Types/DoubleType.php new file mode 100644 index 0000000000..f0097a0f0b --- /dev/null +++ b/src/Types/DoubleType.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Types; + +/** + * Defines methods of the built-in double type + */ +class DoubleType extends AbstractType +{ + public array $methodMap = [ + 'abs' => 'abs', + 'tobinary' => 'decbin', + 'tohex' => 'dechex', + 'tooctal' => 'decoct', + 'pow' => 'pow', + 'sqrt' => 'sqrt', + 'exp' => 'exp', + 'sin' => 'sin', + 'cos' => 'cos', + 'tan' => 'tan', + 'asin' => 'asin', + 'acos' => 'acos', + 'atan' => 'atan', + 'log' => 'log', + ]; + + public function getTypeName(): string + { + return Types::T_DOUBLE; + } +} diff --git a/src/Types/IntType.php b/src/Types/IntType.php new file mode 100644 index 0000000000..0172c68cae --- /dev/null +++ b/src/Types/IntType.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Types; + +/** + * Defines methods of the built-in int type + */ +class IntType extends AbstractType +{ + public array $methodMap = [ + 'abs' => 'abs', + 'tobinary' => 'decbin', + 'tohex' => 'dechex', + 'tooctal' => 'decoct', + 'pow' => 'pow', + 'sqrt' => 'sqrt', + 'exp' => 'exp', + 'sin' => 'sin', + 'cos' => 'cos', + 'tan' => 'tan', + 'asin' => 'asin', + 'acos' => 'acos', + 'atan' => 'atan', + 'log' => 'log', + ]; + + public function getTypeName(): string + { + return Types::T_INT; + } +} diff --git a/Library/Types/IstringType.php b/src/Types/IstringType.php similarity index 81% rename from Library/Types/IstringType.php rename to src/Types/IstringType.php index ad4ad03c32..ddf1e6b954 100644 --- a/Library/Types/IstringType.php +++ b/src/Types/IstringType.php @@ -9,19 +9,16 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Types; +declare(strict_types=1); -use Zephir\Types; +namespace Zephir\Types; /** * Encapsulates built-in methods for the "istring" type */ class IstringType extends StringType { - /** - * {@inheritdoc} - */ - public function getTypeName() + public function getTypeName(): string { return Types::T_ISTRING; } diff --git a/src/Types/StringType.php b/src/Types/StringType.php new file mode 100644 index 0000000000..263cc53e55 --- /dev/null +++ b/src/Types/StringType.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Types; + +/** + * Encapsulates built-in methods for the "string" type + * + * TODO: explode, join, replace + */ +class StringType extends AbstractType +{ + public array $methodMap = [ + 'index' => 'strpos', + 'trim' => 'trim', + 'trimleft' => 'ltrim', + 'trimright' => 'rtrim', + 'length' => 'strlen', + 'lower' => 'strtolower', + 'upper' => 'strtoupper', + 'lowerfirst' => 'lcfirst', + 'upperfirst' => 'ucfirst', + 'format' => 'sprintf', + 'md5' => 'md5', + 'sha1' => 'sha1', + 'nl2br' => 'nl2br', + 'parsecsv' => 'str_getcsv', + 'parsejson' => 'json_decode', + 'tojson' => 'json_encode', + 'repeat' => 'str_repeat', + 'shuffle' => 'str_shuffle', + 'split' => 'str_split', + 'compare' => 'strcmp', + 'comparelocale' => 'strcoll', + 'rev' => 'strrev', + 'htmlspecialchars' => 'htmlspecialchars', + 'camelize' => 'camelize', + 'uncamelize' => 'uncamelize', + ]; + + public function getTypeName(): string + { + return Types::T_STRING; + } +} diff --git a/Library/Types.php b/src/Types/Types.php similarity index 64% rename from Library/Types.php rename to src/Types/Types.php index ffb1eff3f7..73c30bdb34 100644 --- a/Library/Types.php +++ b/src/Types/Types.php @@ -9,66 +9,71 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir; +declare(strict_types=1); + +namespace Zephir\Types; + +use Zephir\Class\Method\Method; + +use function array_key_exists; +use function count; +use function in_array; final class Types { - const T_INT = 'int'; - const T_UINT = 'uint'; - const T_CHAR = 'char'; - const T_UCHAR = 'uchar'; - const T_LONG = 'long'; - const T_ULONG = 'ulong'; - const T_DOUBLE = 'double'; - const T_FLOAT = 'float'; - const T_NUMBER = 'number'; - const T_NULL = 'null'; - const T_BOOL = 'bool'; - const T_FALSE = 'false'; - const T_STRING = 'string'; - const T_ISTRING = 'istring'; - const T_VARIABLE = 'variable'; - const T_MIXED = 'mixed'; - const T_ARRAY = 'array'; - const T_VOID = 'void'; - const T_OBJECT = 'object'; - const T_CALLABLE = 'callable'; - const T_RESOURCE = 'resource'; - const T_ITERABLE = 'iterable'; - const T_UNDEFINED = 'undefined'; + public const T_ARRAY = 'array'; + public const T_BOOL = 'bool'; + public const T_BOOLEAN = 'boolean'; + public const T_CALLABLE = 'callable'; + public const T_CHAR = 'char'; + public const T_DOUBLE = 'double'; + public const T_FALSE = 'false'; + public const T_FLOAT = 'float'; + public const T_HASH = 'hash'; + public const T_INT = 'int'; + public const T_INTEGER = 'integer'; + public const T_ISTRING = 'istring'; + public const T_ITERABLE = 'iterable'; + public const T_LONG = 'long'; + public const T_MIXED = 'mixed'; + public const T_NULL = 'null'; + public const T_NUMBER = 'number'; + public const T_OBJECT = 'object'; + public const T_RESOURCE = 'resource'; + public const T_STRING = 'string'; + public const T_UCHAR = 'uchar'; + public const T_UINT = 'uint'; + public const T_ULONG = 'ulong'; + public const T_VARIABLE = 'variable'; + public const T_VOID = 'void'; /** * Gets PHP compatible return type from class method. - * - * @param ClassMethod $method - * @param array|null $returnTypes - * - * @return string */ - public function getReturnTypeAnnotation(ClassMethod $method, array $returnTypes = null): string + public function getReturnTypeAnnotation(Method $method, array $returnTypes = null): string { if (!$method->hasReturnTypes() && !$method->isVoid()) { return ''; } $isProcessedReturnType = null !== $returnTypes; - $returnTypes = $returnTypes ?? $method->getReturnTypes(); - $typesCount = \count($returnTypes); + $returnTypes ??= $method->getReturnTypes(); + $typesCount = count($returnTypes); - $isDynamic = \in_array('var', array_keys($returnTypes)); + $isDynamic = in_array('var', array_keys($returnTypes)); $isNullable = $this->isNullable($returnTypes); - $isBool = $this->areReturnTypesBoolCompatible($returnTypes); - $isNull = $this->areReturnTypesNullCompatible($returnTypes); - $isVoid = $this->areReturnTypesVoidCompatible($returnTypes); - $isArray = $this->areReturnTypesArrayCompatible($returnTypes); - $isDouble = $this->areReturnTypesFloatCompatible($returnTypes); - $isString = $this->areReturnTypesStringCompatible($returnTypes); - $isObject = $this->areReturnTypesObjectCompatible($returnTypes); - $isInteger = $this->areReturnTypesIntegerCompatible($returnTypes); - $isNumeric = $this->isNumeric($returnTypes); - $isIterable = $this->areReturnTypesIterableCompatible($returnTypes); - $isResource = $this->areReturnTypesResourceCompatible($returnTypes); + $isBool = $this->areReturnTypesBoolCompatible($returnTypes); + $isNull = $this->areReturnTypesNullCompatible($returnTypes); + $isVoid = $this->areReturnTypesVoidCompatible($returnTypes); + $isArray = $this->areReturnTypesArrayCompatible($returnTypes); + $isDouble = $this->areReturnTypesFloatCompatible($returnTypes); + $isString = $this->areReturnTypesStringCompatible($returnTypes); + $isObject = $this->areReturnTypesObjectCompatible($returnTypes); + $isInteger = $this->areReturnTypesIntegerCompatible($returnTypes); + $isNumeric = $this->isNumeric($returnTypes); + $isIterable = $this->areReturnTypesIterableCompatible($returnTypes); + $isResource = $this->areReturnTypesResourceCompatible($returnTypes); $isCollection = $this->areReturnTypesCollectionCompatible($returnTypes); $isTypeHinted = $method->isReturnTypesHintDetermined(); @@ -81,19 +86,19 @@ public function getReturnTypeAnnotation(ClassMethod $method, array $returnTypes } if ($isInteger) { - return self::T_INT.$nullableType; + return self::T_INT . $nullableType; } if ($isDouble) { - return self::T_FLOAT.$nullableType; + return self::T_FLOAT . $nullableType; } if ($isBool) { - return self::T_BOOL.$nullableType; + return self::T_BOOL . $nullableType; } if ($isString) { - return self::T_STRING.$nullableType; + return self::T_STRING . $nullableType; } if ($isNull && 1 === $typesCount) { @@ -117,7 +122,7 @@ public function getReturnTypeAnnotation(ClassMethod $method, array $returnTypes } if ($method->areReturnTypesCompatible() && !$isTypeHinted) { - return self::T_MIXED.$nullableType; + return self::T_MIXED . $nullableType; } if ($isTypeHinted && !$isBasicTypes && !$isDynamic && !$isNullable) { @@ -131,44 +136,85 @@ public function getReturnTypeAnnotation(ClassMethod $method, array $returnTypes } }); - return implode('|', array_values($withoutNullable)).$nullableType; + return implode('|', array_values($withoutNullable)) . $nullableType; } if ($isCollection) { return implode('|', array_values($returnTypes)); } - return self::T_MIXED.$nullableType; + return self::T_MIXED . $nullableType; } /** - * Match Zephir types with Integer type. - * - * @param array $types + * Match Zephir types with Array type. + */ + private function areReturnTypesArrayCompatible(array $types): bool + { + return $this->areReturnTypesCompatible($types, [self::T_ARRAY]); + } + + /** + * Match Zephir types with Boolean type. + */ + private function areReturnTypesBoolCompatible(array $types): bool + { + return $this->areReturnTypesCompatible($types, [self::T_BOOL, self::T_BOOLEAN]); + } + + /** + * Match Zephir types with Collections. + */ + private function areReturnTypesCollectionCompatible(array $types): bool + { + $result = false; + + foreach ($types as $type => $data) { + if (str_contains($type, '[]')) { + $result = true; + } + } + + return $result; + } + + /** + * Match if return types from Zephir are compatible + * with allowed return types from PHP. * - * @return bool + * Examples: + * $types = [ + * 'variable' => [ + * 'type' => 'return-type-parameter', + * 'data-type' => 'variable', + * 'mandatory' => 0, + * 'file' => '../path-to-file/stubs.zep', + * 'line' => 21, + * 'char' => 48, + * ] + * ] */ - private function areReturnTypesIntegerCompatible(array $types): bool + private function areReturnTypesCompatible(array $types, array $allowedTypes, bool $isNullable = false): bool { - return $this->areReturnTypesCompatible( - $types, - [ - self::T_INT, - self::T_UINT, - self::T_CHAR, - self::T_UCHAR, - self::T_LONG, - self::T_ULONG, - ] - ); + $result = null; + + if ($isNullable) { + $allowedTypes[] = self::T_NULL; + } + + foreach ($types as $type => $data) { + $areEquals = in_array($type, $allowedTypes); + + $result = isset($result) + ? ($areEquals && $result) + : $areEquals; + } + + return $result ?? false; } /** * Match Zephir types with Float type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesFloatCompatible(array $types): bool { @@ -182,90 +228,50 @@ private function areReturnTypesFloatCompatible(array $types): bool } /** - * Match Zephir types with Boolean type. - * - * @param array $types - * - * @return bool - */ - private function areReturnTypesBoolCompatible(array $types): bool - { - return $this->areReturnTypesCompatible($types, [self::T_BOOL]); - } - - /** - * Match Zephir types with String type. - * - * @param array $types - * - * @return bool + * Match Zephir types with Integer type. */ - private function areReturnTypesStringCompatible(array $types): bool + private function areReturnTypesIntegerCompatible(array $types): bool { return $this->areReturnTypesCompatible( $types, [ - self::T_STRING, - self::T_ISTRING, - ], - $this->isNullable($types) + self::T_INT, + self::T_INTEGER, + self::T_UINT, + self::T_CHAR, + self::T_UCHAR, + self::T_LONG, + self::T_ULONG, + ] ); } /** - * Match Zephir types with Null type. - * - * @param array $types - * - * @return bool + * Match Zephir types with Iterable type. */ - private function areReturnTypesNullCompatible(array $types): bool + private function areReturnTypesIterableCompatible(array $types): bool { - return $this->areReturnTypesCompatible($types, [self::T_NULL]); + return $this->areReturnTypesCompatible($types, [self::T_ITERABLE]); } /** - * Match Zephir types with Array type. - * - * @param array $types - * - * @return bool + * Match Zephir types with Null type. */ - private function areReturnTypesArrayCompatible(array $types): bool + private function areReturnTypesNullCompatible(array $types): bool { - return $this->areReturnTypesCompatible($types, [self::T_ARRAY]); + return $this->areReturnTypesCompatible($types, [self::T_NULL]); } /** * Match Zephir types with Object type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesObjectCompatible(array $types): bool { return $this->areReturnTypesCompatible($types, [self::T_OBJECT]); } - /** - * Match Zephir types with Iterable type. - * - * @param array $types - * - * @return bool - */ - private function areReturnTypesIterableCompatible(array $types): bool - { - return $this->areReturnTypesCompatible($types, [self::T_ITERABLE]); - } - /** * Match Zephir types with Resource type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesResourceCompatible(array $types): bool { @@ -273,101 +279,43 @@ private function areReturnTypesResourceCompatible(array $types): bool } /** - * Match Zephir types with Collections. - * - * @param array $types - * - * @return bool + * Match Zephir types with String type. */ - private function areReturnTypesCollectionCompatible(array $types): bool + private function areReturnTypesStringCompatible(array $types): bool { - $result = false; - - foreach ($types as $type => $data) { - if (false !== strpos($type, '[]')) { - $result = true; - } - } - - return $result; + return $this->areReturnTypesCompatible( + $types, + [ + self::T_STRING, + self::T_ISTRING, + ], + $this->isNullable($types) + ); } /** * Match Zephir types with Void type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesVoidCompatible(array $types): bool { return $this->areReturnTypesCompatible($types, [self::T_VOID]); } - /** - * Check if Zephir types is a Numeric type compatible. - * - * @param array $types - * - * @return bool - */ - private function isNumeric(array $types): bool - { - return $this->areReturnTypesCompatible($types, [self::T_NUMBER]); - } - /** * Check if Zephir types can be Nullable. - * - * @param array $types - * - * @return bool */ private function isNullable(array $types): bool { - return (\array_key_exists(self::T_NULL, $types) - || \in_array(self::T_NULL, $types)) - && 1 !== \count($types); + return (array_key_exists(self::T_NULL, $types) + || in_array(self::T_NULL, $types)) + && 1 !== count($types); } /** - * Match if return types from Zephir are compatible - * with allowed return types from PHP. - * - * Examples: - * $types = [ - * 'variable' => [ - * 'type' => 'return-type-parameter', - * 'data-type' => 'variable', - * 'mandatory' => 0, - * 'file' => '../path-to-file/stubs.zep', - * 'line' => 21, - * 'char' => 48, - * ] - * ] - * - * @param array $types - Return types from parser - * @param array $allowedTypes - Allowed return types - * @param bool $isNullable - * - * @return bool + * Check if Zephir types is a Numeric type compatible. */ - private function areReturnTypesCompatible(array $types, array $allowedTypes, bool $isNullable = false): bool + private function isNumeric(array $types): bool { - $result = null; - - if ($isNullable) { - $allowedTypes[] = self::T_NULL; - } - - foreach ($types as $type => $data) { - $areEquals = \in_array($type, $allowedTypes); - - $result = isset($result) - ? ($areEquals && $result) - : $areEquals; - } - - return $result ?? false; + return $this->areReturnTypesCompatible($types, [self::T_NUMBER]); } } diff --git a/src/Variable/Globals.php b/src/Variable/Globals.php new file mode 100644 index 0000000000..bc6f226ce3 --- /dev/null +++ b/src/Variable/Globals.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Variable; + +use function in_array; + +/** + * Represents a central knowledge base on global variables. + */ +final class Globals +{ + /** + * Names of super global variables. + */ + protected array $superGlobals = [ + '_GET', + // The variables passed to the current script via the URL parameters. + '_POST', + // The variables passed to the current script via the HTTP POST method. + '_ENV', + // An array in which the environment variable names are element keys, and the environment variable value strings are element values. + '_COOKIE', + // The variables passed to the current script via HTTP Cookies. + '_SERVER', + // Server and execution environment information, such as headers, paths, and script locations. + '_SESSION', + // The session variables available to the current script. + '_REQUEST', + // By default, contains the contents of $_COOKIE, $_GET, and $_POST. + '_FILES', + // The items uploaded to the current script via the HTTP POST method. + ]; + + /** + * Checks if a variable is a super global. + */ + public function isSuperGlobal(string $name): bool + { + return in_array($name, $this->superGlobals, true); + } +} diff --git a/Library/Variable.php b/src/Variable/Variable.php similarity index 67% rename from Library/Variable.php rename to src/Variable/Variable.php index f0abe51c91..06eb122263 100644 --- a/Library/Variable.php +++ b/src/Variable/Variable.php @@ -9,923 +9,744 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir; +declare(strict_types=1); + +namespace Zephir\Variable; use ReflectionClass; +use Zephir\Branch; +use Zephir\BranchManager; +use Zephir\Class\Definition\Definition; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; -use Zephir\Variable\Globals; +use Zephir\TypeAwareInterface; + +use function in_array; +use function is_string; /** - * Variable. - * * This represents a variable in a symbol table */ class Variable implements TypeAwareInterface { - const BRANCH_MAGIC = '$$'; - /** - * Variable's type. - */ - protected $type; - + public const BRANCH_MAGIC = '$$'; + public const VAR_RETURN_VALUE = 'return_value'; + public const VAR_THIS_POINTER = 'this_ptr'; + protected Definition | ReflectionClass | null $associatedClass = null; + protected array $classTypes = []; + protected mixed $defaultInitValue = null; + protected bool $doublePointer = false; /** * Current dynamic type of the variable. * * @var array */ - protected $dynamicTypes = ['unknown' => true]; - + protected array $dynamicTypes = ['unknown' => true]; /** - * Variable's name. + * @var Globals */ - protected $name; - + protected Globals $globalsManager; /** - * Branch where the variable was declared. - * - * @var Branch|null + * Temporal variables are marked as idle. */ - protected $branch; - + protected bool $idle = false; /** * Branch where the variable was initialized for the first time. */ - protected $initBranch = false; - - /** - * Compiled variable's name. - */ - protected $lowName; - - /** - * Number of times the variable has been read. - */ - protected $numberUses = 0; - + protected bool $initBranch = false; + protected array $initBranches = []; /** - * Whether the variable is temporal or not. + * Whether the variable has received any assignment. */ - protected $temporal = false; - + protected bool $initialized = false; + protected bool $isExternal = false; + protected bool $localOnly = false; /** - * Temporal variables are marked as idle. + * Compiled variable's name. */ - protected $idle = false; - + protected string $lowName = ''; + protected bool $memoryTracked = true; + protected bool $mustInitNull = false; /** - * Reusable temporary variables? + * AST node where the variable was originally declared or created. */ - protected $reusable = true; - + protected ?array $node = null; /** * Number of mutations to the variable. */ - protected $numberMutates = 0; - - /** - * Whether the variable has received any assignment. - */ - protected $initialized = false; - - protected $initBranches = []; - - protected $isExternal = false; - - protected $variantInits = 0; - - protected $mustInitNull = false; - - protected $readOnly = false; - - protected $localOnly = false; - - protected $memoryTracked = true; - - protected $doublePointer = false; - - protected $defaultInitValue; - - /** - * Class types. - */ - protected $classTypes = []; - - /** - * Associated class. - */ - protected $associatedClass; - + protected int $numberMutates = 0; /** * Initialization skips. */ - protected $numberSkips = 0; - + protected int $numberSkips = 0; /** - * AST node where the variable was originally declared or created. + * Number of times the variable has been read. */ - protected $node; - + protected int $numberUses = 0; /** * Possible constant value assigned to the variable. */ - protected $possibleValue; - + protected mixed $possibleValue = null; /** * Branch where the variable got its last possible value. */ - protected $possibleValueBranch; - + protected mixed $possibleValueBranch = null; + protected bool $readOnly = false; /** - * Whether the variable was used or not. + * Reusable temporary variables? */ - protected $used = true; - + protected bool $reusable = true; /** - * Last AST node where the variable was used. + * Whether the variable is temporal or not. */ - protected $usedNode; - + protected bool $temporal = false; /** - * @var Globals + * Whether the variable was used or not. */ - protected $globalsManager; + protected bool $used = false; /** - * Complex variable type, they may need special treatment. - * - * @var array + * Last AST node where the variable was used. */ - protected $complexTypes = [ - 'variable' => 1, - 'string' => 1, - 'array' => 1, - 'resource' => 1, - 'callable' => 1, - 'object' => 1, - ]; + protected ?array $usedNode = null; + protected int $variantInits = 0; + + public function __construct(protected string $type, protected string $name, protected ?Branch $branch = null) + { + $this->globalsManager = new Globals(); + $this->type = in_array($type, ['callable', 'object', 'resource'], true) ? 'variable' : $type; + } /** - * Variable constructor. - * - * @param string $type - * @param string $name - * @param Branch $branch + * Sets an automatic safe default init value according to its type. */ - public function __construct(string $type, string $name, Branch $branch = null) + public function enableDefaultAutoInitValue(): void { - $this->globalsManager = new Globals(); + switch ($this->type) { + case 'char': + case 'boolean': + case 'bool': + case 'int': + case 'uint': + case 'long': + case 'ulong': + case 'double': + case 'zephir_ce_guard': + $this->defaultInitValue = 0; + break; - if (\in_array($type, ['callable', 'object', 'resource'], true)) { - $type = 'variable'; - } + case 'variable': + case 'string': + case 'array': + $this->defaultInitValue = null; + $this->setDynamicTypes('null'); + $this->setMustInitNull(true); + $this->setLocalOnly(false); + break; - $this->type = $type; - $this->name = $name; - $this->branch = $branch; + default: + throw new CompilerException( + 'Cannot create an automatic safe default value for variable type: ' . $this->type + ); + } } /** - * Get init branch. - * - * @return bool|int + * Returns the class related to the variable. */ - public function getInitBranch() + public function getAssociatedClass(): Definition | ReflectionClass | null { - return $this->initBranch; + return $this->associatedClass; } /** - * Get init marked branch. + * Get the branch where the variable was declared. * - * @return Branch[] + * @return Branch|null */ - public function getInitBranches() + public function getBranch(): ?Branch { - return $this->initBranches; + return $this->branch; } /** - * Sets the type of variable. + * Returns the PHP classes associated to the variable. * - * @param string $type + * @return array */ - public function setType(string $type) + public function getClassTypes(): array { - $this->type = $type; + return $this->classTypes; } /** - * Returns the type of variable. + * Returns the default init value. * - * @return string + * @return mixed */ - public function getType(): string + public function getDefaultInitValue(): mixed { - return $this->type; + return $this->defaultInitValue; } /** - * Sets if the variable is local-only scoped. + * Returns the current dynamic type in a polymorphic variable. * - * @param bool $localOnly + * @return array */ - public function setLocalOnly(bool $localOnly) + public function getDynamicTypes(): array { - $this->localOnly = $localOnly; + return $this->dynamicTypes; } /** - * Checks if the variable is local-only scoped. + * Get init branch. * * @return bool */ - public function isLocalOnly() + public function getInitBranch(): bool { - return $this->localOnly; + return $this->initBranch; } /** - * Marks the variable to be defined as a double pointer. + * Get init marked branch. * - * @param bool $doublePointer + * @return Branch[] */ - public function setIsDoublePointer(bool $doublePointer) + public function getInitBranches(): array { - $this->doublePointer = $doublePointer; + return $this->initBranches; } /** - * Returns the variable. + * Returns the last node where the variable was assigned or used. */ - public function isDoublePointer() + public function getLastUsedNode(): ?array { - return $this->doublePointer; + return $this->usedNode; } /** - * Returns variable's real name. + * Returns variable's name. * * @return string */ - public function getRealName() + public function getName(): string { - return $this->name; + return $this->lowName ?: $this->name; } /** - * Returns variable's name. + * Returns the number of mutations performed over the variable. * - * @return string + * @return int */ - public function getName() + public function getNumberMutations(): int { - if ($this->lowName) { - return $this->lowName; - } - - return $this->name; + return $this->numberMutates; } /** - * Sets the compiled variable's name. + * Return the number of uses. * - * @param string $lowName + * @return int */ - public function setLowName(string $lowName) + public function getNumberUses(): int { - $this->lowName = $lowName; + return $this->numberUses; } /** - * Sets if the variable is read only. + * Returns the original AST node where the variable was declared. * - * @param bool $readOnly + * @return array */ - public function setReadOnly(bool $readOnly) + public function getOriginal(): array { - $this->readOnly = $readOnly; + if ($this->node) { + return $this->node; + } + + return ['file' => 'unknown', 'line' => 0, 'char' => 0]; } /** - * Returns if the variable is read only. + * Returns the latest CompiledExpression assigned to a variable. * - * @return bool + * @return mixed */ - public function isReadOnly() + public function getPossibleValue(): mixed { - return $this->readOnly; + return $this->possibleValue; } /** - * Sets whether the variable is temporal or not. - * - * @param bool $temporal + * Returns the branch where the variable was assigned for the last time. */ - public function setTemporal(bool $temporal) + public function getPossibleValueBranch(): ?Branch { - $this->temporal = $temporal; + return $this->possibleValueBranch; } /** - * Returns whether the variable is temporal or not. + * Returns variable's real name. * - * @return bool + * @return string */ - public function isTemporal() + public function getRealName(): string { - return $this->temporal; + return $this->name; } /** - * Once a temporal variable is unused in a specific branch it is marked as idle. + * Get the number of initializations remaining to skip. * - * @param bool $idle + * @return int */ - public function setIdle(bool $idle) + public function getSkipVariant(): int { - $this->idle = false; - - if ($this->reusable) { - $this->classTypes = []; - $this->dynamicTypes = ['unknown' => true]; - $this->idle = $idle; - } + return $this->numberSkips; } /** - * Checks if the variable is idle. + * Returns the type of variable. * - * @return bool + * @return string */ - public function isIdle() + public function getType(): string { - return $this->idle; + return $this->type; } /** - * Some temporary variables can't be reused. + * Get the number of times the variable has been initialized. * - * @param bool $reusable + * @return int */ - public function setReusable(bool $reusable) + public function getVariantInits(): int { - $this->reusable = $reusable; + return $this->variantInits; } /** - * Checks if the temporary variable is reusable. + * Checks if the variable has any of the passed dynamic. + * + * @param array|string $types * * @return bool */ - public function isReusable() + public function hasAnyDynamicType(array | string $types): bool { - return $this->reusable; + if (is_string($types)) { + $types = [$types]; + } + + foreach ($types as $type) { + if (isset($this->dynamicTypes[$type])) { + return true; + } + } + + return false; } /** - * Sets the latest node where a variable was used. + * Check if the variable has at least one dynamic type to the ones passed in the list. * - * @param bool $used - * @param array|null $node + * @param array $types + * + * @return bool */ - public function setUsed(bool $used, array $node = null) + public function hasDifferentDynamicType(array $types): bool { - $this->used = $used; - $this->usedNode = $node; + $number = 0; + foreach ($types as $type) { + if (isset($this->dynamicTypes[$type])) { + ++$number; + } + } + + return 0 === $number; } /** - * Checks whether the last value assigned was used. - * - * @return bool + * Increase the number of mutations a variable may have. */ - public function isUsed() + public function increaseMutates(): void { - return $this->used; + ++$this->numberMutates; } /** - * Returns the last node where the variable was assigned or used. - * - * @return array + * Increase the number of uses a variable may have. */ - public function getLastUsedNode() + public function increaseUses(): void { - return $this->usedNode; + ++$this->numberUses; } /** - * Sets if the variable is not tracked by the memory manager. - * - * @param bool $memoryTracked + * Increase the number of times the variable has been initialized. */ - public function setMemoryTracked(bool $memoryTracked) + public function increaseVariantIfNull(): void { - $this->memoryTracked = $memoryTracked; + ++$this->variantInits; } /** - * Checks if the variable is tracked by the memory manager. - * - * @return bool - */ - public function isMemoryTracked() - { - return $this->memoryTracked; - } - - /** - * Get the branch where the variable was declared. - * - * @return Branch|null - */ - public function getBranch() - { - return $this->branch; - } - - /** - * Set the original AST node where the variable was declared. - * - * @param array $node - */ - public function setOriginal(array $node) - { - $this->node = $node; - } - - /** - * Returns the original AST node where the variable was declared. + * Initializes a variant variable that is intended to have the special + * behavior of only freed its body value instead of the full variable. * - * @return array + * @param CompilationContext $compilationContext */ - public function getOriginal() + public function initComplexLiteralVariant(CompilationContext $compilationContext): void { - $node = $this->node; + if ($this->numberSkips) { + --$this->numberSkips; - if (!$node) { - $node = ['file' => 'unknown', 'line' => 0, 'char' => 0]; + return; } - return $node; - } + if (self::VAR_THIS_POINTER != $this->getName() && self::VAR_RETURN_VALUE != $this->getName()) { + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; + } - /** - * Sets the PHP class related to variable. - * - * @param array|string $classTypes - */ - public function setClassTypes($classTypes) - { - if ($classTypes) { - if (\is_string($classTypes)) { - if (!\in_array($classTypes, $this->classTypes)) { - $this->classTypes[] = $classTypes; + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->symbolTable->mustGrownStack(true); + if (!$this->isLocalOnly()) { + if ($this->variantInits > 0 || $compilationContext->insideCycle) { + $this->mustInitNull = true; + $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&' . $this->getName() . ');'); + } else { + $compilationContext->backend->initVar($this, $compilationContext); } } else { - foreach ($classTypes as $classType) { - if (!\in_array($classType, $this->classTypes)) { - $this->classTypes[] = $classType; - } + if ($this->variantInits > 0 || $compilationContext->insideCycle) { + $this->mustInitNull = true; + $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&' . $this->getName() . ');'); + } else { + $compilationContext->codePrinter->output('ZEPHIR_INIT_VAR(&' . $this->getName() . ');'); } } + + ++$this->variantInits; } } /** - * Returns the PHP classes associated to the variable. + * Allocate memory for variable and init it null val * - * @return array + * @param CompilationContext $compilationContext */ - public function getClassTypes() + public function initNonReferenced(CompilationContext $compilationContext): void { - return $this->classTypes; + $compilationContext->codePrinter->output('ZVAL_UNDEF(&' . $this->getName() . ');'); } /** - * Sets the PHP class related to variable. + * Initializes a variant variable. * - * @param ClassDefinition|ReflectionClass $associatedClass + * @param CompilationContext $compilationContext */ - public function setAssociatedClass($associatedClass) + public function initVariant(CompilationContext $compilationContext): void { - $this->associatedClass = $associatedClass; - } + if ($this->numberSkips) { + --$this->numberSkips; - /** - * Returns the class related to the variable. - * - * @return ClassDefinition - */ - public function getAssociatedClass() - { - return $this->associatedClass; - } + return; + } - /** - * Sets the current dynamic type in a polymorphic variable. - * - * @param array|string $types - */ - public function setDynamicTypes($types) - { - if ($types) { - unset($this->dynamicTypes['unknown']); + /** + * Variables are allocated for the first time using ZEPHIR_INIT_VAR + * the second, third, etc. times are allocated using ZEPHIR_INIT_NVAR + * Variables initialized for the first time in a cycle are always initialized using ZEPHIR_INIT_NVAR + */ + if (self::VAR_THIS_POINTER !== $this->getName() && self::VAR_RETURN_VALUE !== $this->getName()) { + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; + } - if (\is_string($types)) { - if (!isset($this->dynamicTypes[$types])) { - $this->dynamicTypes[$types] = true; + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->symbolTable->mustGrownStack(true); + + if (!$this->isLocalOnly()) { + if ($compilationContext->insideCycle) { + $this->mustInitNull = true; + $compilationContext->backend->initVar($this, $compilationContext, true, true); + } else { + if ($this->variantInits > 0) { + if ($this->initBranch) { + $compilationContext->codePrinter->output('ZEPHIR_INIT_BNVAR(' . $this->getName() . ');'); + } else { + $this->mustInitNull = true; + $compilationContext->backend->initVar($this, $compilationContext, true, true); + } + } else { + $compilationContext->backend->initVar($this, $compilationContext); + } } } else { - foreach ($types as $type => $one) { - if (!isset($this->dynamicTypes[$one])) { - $this->dynamicTypes[$one] = true; - } + if ($this->variantInits > 0 || $compilationContext->insideCycle) { + $this->mustInitNull = true; + $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&' . $this->getName() . ');'); + } else { + $compilationContext->codePrinter->output('ZEPHIR_INIT_VAR(&' . $this->getName() . ');'); } } + + ++$this->variantInits; + $this->associatedClass = null; } } /** - * Returns the current dynamic type in a polymorphic variable. + * Shortcut is type double? * - * @return array + * @return bool */ - public function getDynamicTypes() + public function isArray(): bool { - return $this->dynamicTypes; + return 'array' === $this->type; } /** - * Checks if the variable has any of the passed dynamic. - * - * @param array|string $types + * Shortcut is type bool? * * @return bool */ - public function hasAnyDynamicType($types) + public function isBoolean(): bool { - if (\is_string($types)) { - $types = [$types]; - } - - foreach ($types as $type) { - if (isset($this->dynamicTypes[$type])) { - return true; - } - } - - return false; + return 'bool' === $this->type; } /** - * Check if the variable has at least one dynamic type to the ones passed in the list. - * - * @param array $types + * Shortcut is type double? * * @return bool */ - public function hasDifferentDynamicType(array $types) - { - $number = 0; - foreach ($types as $type) { - if (isset($this->dynamicTypes[$type])) { - ++$number; - } - } - - return 0 == $number; - } - - /** - * Increase the number of uses a variable may have. - */ - public function increaseUses() + public function isDouble(): bool { - ++$this->numberUses; + return 'double' === $this->type; } /** - * Increase the number of mutations a variable may have. + * Returns the variable. */ - public function increaseMutates() + public function isDoublePointer(): bool { - ++$this->numberMutates; + return $this->doublePointer; } /** - * Return the number of uses. + * Check if the variable is a parameter. * - * @return int + * @return bool */ - public function getNumberUses() + public function isExternal(): bool { - return $this->numberUses; + return $this->isExternal; } /** - * Returns the number of mutations performed over the variable. + * Checks if the variable is idle. * - * @return int + * @return bool */ - public function getNumberMutations() + public function isIdle(): bool { - return $this->numberMutates; + return $this->idle; } /** - * Sets if the variable is initialized - * This allow to throw an exception if the variable is being read without prior initialization. + * Check if the variable is initialized or not. * - * @param bool $initialized - * @param CompilationContext $compilationContext + * @return bool */ - public function setIsInitialized(bool $initialized, CompilationContext $compilationContext) + public function isInitialized(): bool { - $this->initialized = $initialized; - - if (!$initialized || !$compilationContext->branchManager instanceof BranchManager) { - return; - } - - $currentBranch = $compilationContext->branchManager->getCurrentBranch(); - - if ($currentBranch instanceof Branch) { - $this->initBranches[] = $currentBranch; - } + return $this->initialized; } /** - * Check if the variable is initialized or not. + * Shortcut is type int? * * @return bool */ - public function isInitialized() + public function isInt(): bool { - return $this->initialized; + return 'int' === $this->type; } /** - * Set if the symbol is a parameter of the method or not. + * Checks if the variable is local-only scoped. * - * @param bool $isExternal + * @return bool */ - public function setIsExternal(bool $isExternal) + public function isLocalOnly(): bool { - $this->isExternal = $isExternal; - $this->variantInits = 1; + return $this->localOnly; } /** - * Check if the variable is a parameter. + * Checks if a variable is a local static. * * @return bool */ - public function isExternal() + public function isLocalStatic(): bool { - return $this->isExternal; + return $this->isExternal && $this->localOnly; } /** - * Get if the variable must be initialized to null. + * Checks if the variable is tracked by the memory manager. * * @return bool */ - public function mustInitNull() + public function isMemoryTracked(): bool { - return $this->mustInitNull; + return $this->memoryTracked; } /** - * Set if the variable must be initialized to null. + * Shortcut is type mixed? * - * @param mixed $mustInitNull + * @return bool */ - public function setMustInitNull($mustInitNull) + public function isMixed(): bool { - $this->mustInitNull = (bool) $mustInitNull; + return 'mixed' === $this->type; } /** - * Sets the default init value. + * Shortcut is type variable or string? * - * @param mixed $value + * @return bool */ - public function setDefaultInitValue($value) + public function isNotVariable(): bool { - $this->defaultInitValue = $value; + return !$this->isVariable(); } /** - * Sets an automatic safe default init value according to its type. + * Shortcut is type variable or array? + * + * @return bool */ - public function enableDefaultAutoInitValue() + public function isNotVariableAndArray(): bool { - switch ($this->type) { - case 'char': - case 'boolean': - case 'bool': - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - case 'zephir_ce_guard': - $this->defaultInitValue = 0; - break; - - case 'variable': - case 'string': - case 'array': - $this->defaultInitValue = null; - $this->setDynamicTypes('null'); - $this->setMustInitNull(true); - $this->setLocalOnly(false); - break; - - default: - throw new CompilerException('Cannot create an automatic safe default value for variable type: '.$this->type); - } + return !$this->isVariable() && !$this->isArray(); } /** - * Returns the default init value. + * Shortcut is type variable or mixed or string? * - * @return mixed + * @return bool */ - public function getDefaultInitValue() + public function isNotVariableAndMixedAndString(): bool { - return $this->defaultInitValue; + return !$this->isVariable() && !$this->isMixed() && !$this->isString(); } /** - * Separates variables before being updated. + * Shortcut is type variable or string? * - * @param CompilationContext $compilationContext + * @return bool */ - public function separate(CompilationContext $compilationContext) + public function isNotVariableAndString(): bool { - if ('this_ptr' != $this->getName() && 'return_value' != $this->getName()) { - $compilationContext->codePrinter->output('ZEPHIR_SEPARATE('.$compilationContext->backend->getVariableCode($this).');'); - } + return !$this->isVariable() && !$this->isString(); } /** - * Skips variable initialization. + * Returns if the variable is read only. * - * @param int $numberSkips + * @return bool */ - public function skipInitVariant($numberSkips) + public function isReadOnly(): bool { - $this->numberSkips += $numberSkips; + return $this->readOnly; } /** - * Get the number of initializations remaining to skip. + * Checks if the temporary variable is reusable. * - * @return int + * @return bool */ - public function getSkipVariant() + public function isReusable(): bool { - return $this->numberSkips; + return $this->reusable; } - /* - * Allocate memory for variable and init it null val + /** + * Shortcut is type string? * - * @param CompilationContext $compilationContext + * @return bool */ - public function initNonReferenced(CompilationContext $compilationContext) + public function isString(): bool { - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->codePrinter->output('ZEPHIR_INIT_ZVAL_NREF('.$this->getName().');'); + return 'string' === $this->type; } /** - * Get the number of times the variable has been initialized. + * Checks if a variable is a super global. * - * @return int + * @return bool */ - public function getVariantInits() + public function isSuperGlobal(): bool { - return $this->variantInits; + return $this->isExternal && $this->globalsManager->isSuperGlobal($this->name); } /** - * Increase the number of times the variable has been initialized. + * Returns whether the variable is temporal or not. + * + * @return bool */ - public function increaseVariantIfNull() + public function isTemporal(): bool { - ++$this->variantInits; + return $this->temporal; } /** - * Initializes a variant variable. + * Checks whether the last value assigned was used. * - * @param CompilationContext $compilationContext + * @return bool */ - public function initVariant(CompilationContext $compilationContext) + public function isUsed(): bool { - if ($this->numberSkips) { - --$this->numberSkips; - - return; - } - - /* - * Variables are allocated for the first time using ZEPHIR_INIT_VAR - * the second, third, etc times are allocated using ZEPHIR_INIT_NVAR - * Variables initialized for the first time in a cycle are always initialized using ZEPHIR_INIT_NVAR - */ - if ('this_ptr' != $this->getName() && 'return_value' != $this->getName()) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; - } - - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->symbolTable->mustGrownStack(true); - - if (!$this->isLocalOnly()) { - if ($compilationContext->insideCycle) { - $this->mustInitNull = true; - $compilationContext->backend->initVar($this, $compilationContext, true, true); - } else { - if ($this->variantInits > 0) { - if (0 === $this->initBranch) { - $compilationContext->codePrinter->output('ZEPHIR_INIT_BNVAR('.$this->getName().');'); - } else { - $this->mustInitNull = true; - $compilationContext->backend->initVar($this, $compilationContext, true, true); - } - } else { - $compilationContext->backend->initVar($this, $compilationContext); - } - } - } else { - if ($this->variantInits > 0 || $compilationContext->insideCycle) { - $this->mustInitNull = true; - $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&'.$this->getName().');'); - } else { - $compilationContext->codePrinter->output('ZEPHIR_INIT_VAR(&'.$this->getName().');'); - } - } - - ++$this->variantInits; - $this->associatedClass = null; - } + return $this->used; } /** - * Tells the compiler a generated code will track the variable. + * Shortcut is type variable? * - * @param CompilationContext $compilationContext + * @return bool */ - public function trackVariant(CompilationContext $compilationContext) + public function isVariable(): bool { - if ($this->numberSkips) { - --$this->numberSkips; - - return; - } - - /* - * Variables are allocated for the first time using ZEPHIR_INIT_VAR - * the second, third, etc times are allocated using ZEPHIR_INIT_NVAR - * Variables initialized for the first time in a cycle are always initialized using ZEPHIR_INIT_NVAR - */ - if ('this_ptr' != $this->getName() && 'return_value' != $this->getName()) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; - } - - if (!$this->isLocalOnly()) { - $compilationContext->symbolTable->mustGrownStack(true); - if ($compilationContext->insideCycle) { - $this->mustInitNull = true; - } else { - if ($this->variantInits > 0) { - if (1 !== $this->initBranch) { - $this->mustInitNull = true; - } - } - } - } else { - if ($this->variantInits > 0 || $compilationContext->insideCycle) { - $this->mustInitNull = true; - } - } + return 'variable' === $this->type; + } - ++$this->variantInits; - } + /** + * Get if the variable must be initialized to null. + * + * @return bool + */ + public function mustInitNull(): bool + { + return $this->mustInitNull; } /** - * Initializes a variant variable that is intended to have the special - * behavior of only freed its body value instead of the full variable. + * Observes a variable in the memory frame without initialization or nullify + * an existing allocated variable. * * @param CompilationContext $compilationContext */ - public function initComplexLiteralVariant(CompilationContext $compilationContext) + public function observeOrNullifyVariant(CompilationContext $compilationContext): void { if ($this->numberSkips) { --$this->numberSkips; @@ -933,30 +754,22 @@ public function initComplexLiteralVariant(CompilationContext $compilationContext return; } - if ('this_ptr' != $this->getName() && 'return_value' != $this->getName()) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; - } + if (in_array($this->getName(), [self::VAR_THIS_POINTER, self::VAR_RETURN_VALUE], true)) { + return; + } - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->symbolTable->mustGrownStack(true); - if (!$this->isLocalOnly()) { - if ($this->variantInits > 0 || $compilationContext->insideCycle) { - $this->mustInitNull = true; - $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&'.$this->getName().');'); - } else { - $compilationContext->backend->initVar($this, $compilationContext); - } - } else { - if ($this->variantInits > 0 || $compilationContext->insideCycle) { - $this->mustInitNull = true; - $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&'.$this->getName().');'); - } else { - $compilationContext->codePrinter->output('ZEPHIR_INIT_VAR(&'.$this->getName().');'); - } - } - ++$this->variantInits; + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; + } + + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->symbolTable->mustGrownStack(true); + if ($this->variantInits > 0 || $compilationContext->insideCycle) { + $this->mustInitNull = true; } + + ++$this->variantInits; + $this->setMustInitNull(true); } /** @@ -964,7 +777,7 @@ public function initComplexLiteralVariant(CompilationContext $compilationContext * * @param CompilationContext $compilationContext */ - public function observeVariant(CompilationContext $compilationContext) + public function observeVariant(CompilationContext $compilationContext): void { if ($this->numberSkips) { --$this->numberSkips; @@ -973,9 +786,9 @@ public function observeVariant(CompilationContext $compilationContext) } $name = $this->getName(); - if ('this_ptr' != $name && 'return_value' != $name) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; + if (self::VAR_THIS_POINTER != $name && self::VAR_RETURN_VALUE != $name) { + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; } $compilationContext->headersManager->add('kernel/memory'); @@ -984,9 +797,9 @@ public function observeVariant(CompilationContext $compilationContext) if ($this->variantInits > 0 || $compilationContext->insideCycle) { $this->mustInitNull = true; - $compilationContext->codePrinter->output('ZEPHIR_OBS_NVAR('.$symbol.');'); + $compilationContext->codePrinter->output('ZEPHIR_OBS_NVAR(' . $symbol . ');'); } else { - $compilationContext->codePrinter->output('ZEPHIR_OBS_VAR('.$symbol.');'); + $compilationContext->codePrinter->output('zephir_memory_observe(' . $symbol . ');'); } ++$this->variantInits; @@ -994,213 +807,305 @@ public function observeVariant(CompilationContext $compilationContext) } /** - * Observes a variable in the memory frame without initialization or nullify - * an existing allocated variable. + * Separates variables before being updated. * * @param CompilationContext $compilationContext */ - public function observeOrNullifyVariant(CompilationContext $compilationContext) + public function separate(CompilationContext $compilationContext): void { - if ($this->numberSkips) { - --$this->numberSkips; + if (!in_array($this->getName(), [self::VAR_THIS_POINTER, self::VAR_RETURN_VALUE], true)) { + $compilationContext->codePrinter->output( + 'SEPARATE_ZVAL(' . $compilationContext->backend->getVariableCode($this) . ');' + ); + } + } + + /** + * Sets the PHP class related to variable. + * + * @param ReflectionClass|Definition $associatedClass + */ + public function setAssociatedClass(ReflectionClass | Definition $associatedClass): void + { + $this->associatedClass = $associatedClass; + } + + /** + * Sets the PHP class related to variable. + * + * @param array|string $classTypes + */ + public function setClassTypes(array | string $classTypes): void + { + if (is_string($classTypes)) { + if (!in_array($classTypes, $this->classTypes)) { + $this->classTypes[] = $classTypes; + } return; } - $name = $this->getName(); - if ('this_ptr' != $name && 'return_value' != $name) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; + foreach ($classTypes as $classType) { + if (!in_array($classType, $this->classTypes)) { + $this->classTypes[] = $classType; } + } + } - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->symbolTable->mustGrownStack(true); - /** - * TODO: Do we need this? - * $compilationContext->codePrinter->output('ZEPHIR_OBS_NVAR(' . $this->getName() . ');');. - * - * TODO: What about else? - * $compilationContext->codePrinter->output('ZEPHIR_OBS_VAR(' . $this->getName() . ');'); - */ - if ($this->variantInits > 0 || $compilationContext->insideCycle) { - $this->mustInitNull = true; - } + /** + * Sets the default init value. + * + * @param mixed $value + */ + public function setDefaultInitValue(mixed $value): void + { + $this->defaultInitValue = $value; + } - ++$this->variantInits; + /** + * Sets the current dynamic type in a polymorphic variable. + * + * @param array|string $types + */ + public function setDynamicTypes(array | string $types): void + { + unset($this->dynamicTypes['unknown']); + + if (is_string($types)) { + $types = [$types]; + } - $this->setMustInitNull(true); + foreach ($types as $type) { + if (!isset($this->dynamicTypes[$type])) { + $this->dynamicTypes[$type] = true; + } } } /** - * Whether the variable is of a complex type. + * Once a temporal variable is unused in a specific branch it is marked as idle. * - * @return bool + * @param bool $idle */ - public function isComplex() + public function setIdle(bool $idle): void { - return isset($this->complexTypes[$this->type]); + $this->idle = false; + + if ($this->reusable) { + $this->classTypes = []; + $this->dynamicTypes = ['unknown' => true]; + $this->idle = $idle; + } } /** - * Checks if a variable is a superglobal. + * Marks the variable to be defined as a double pointer. * - * @return bool + * @param bool $doublePointer */ - public function isSuperGlobal() + public function setIsDoublePointer(bool $doublePointer): void { - return $this->isExternal && $this->globalsManager->isSuperGlobal($this->name); + $this->doublePointer = $doublePointer; } /** - * Checks if a variable is a local static. + * Set if the symbol is a parameter of the method or not. * - * @return bool + * @param bool $isExternal */ - public function isLocalStatic() + public function setIsExternal(bool $isExternal): void { - return $this->isExternal && $this->localOnly; + $this->isExternal = $isExternal; + $this->variantInits = 1; } /** - * Shortcut is type variable? + * Sets if the variable is initialized + * This allow to throw an exception if the variable is being read without prior initialization. * - * @return bool + * @param bool $initialized + * @param CompilationContext $compilationContext */ - public function isVariable() + public function setIsInitialized(bool $initialized, CompilationContext $compilationContext): void { - return 'variable' == $this->type; + $this->initialized = $initialized; + + if (!$initialized || !$compilationContext->branchManager instanceof BranchManager) { + return; + } + + $currentBranch = $compilationContext->branchManager->getCurrentBranch(); + + if ($currentBranch instanceof Branch) { + $this->initBranches[] = $currentBranch; + } } /** - * Shortcut is type mixed? + * Sets if the variable is local-only scoped. * - * @return bool + * @param bool $localOnly */ - public function isMixed(): bool + public function setLocalOnly(bool $localOnly): void { - return 'mixed' === $this->type; + $this->localOnly = $localOnly; } /** - * Shortcut is type bool? + * Sets the compiled variable's name. * - * @return bool + * @param string $lowName */ - public function isBoolean() + public function setLowName(string $lowName): void { - return 'bool' == $this->type; + $this->lowName = $lowName; } /** - * Shortcut is type string? + * Sets if the variable is not tracked by the memory manager. * - * @return bool + * @param bool $memoryTracked */ - public function isString() + public function setMemoryTracked(bool $memoryTracked): void { - return 'string' == $this->type; + $this->memoryTracked = $memoryTracked; } /** - * Shortcut is type int? + * Set if the variable must be initialized to null. * - * @return bool + * @param bool $mustInitNull */ - public function isInt() + public function setMustInitNull(bool $mustInitNull): void { - return 'int' == $this->type; + $this->mustInitNull = $mustInitNull; } /** - * Shortcut is type double? + * Set the original AST node where the variable was declared. * - * @return bool + * @param array $node */ - public function isDouble() + public function setOriginal(array $node): void { - return 'double' == $this->type; + $this->node = $node; } /** - * Shortcut is type double? + * Sets the latest CompiledExpression assigned to a variable. * - * @return bool + * @param CompiledExpression $possibleValue + * @param CompilationContext $compilationContext */ - public function isArray() + public function setPossibleValue(CompiledExpression $possibleValue, CompilationContext $compilationContext): void { - return 'array' == $this->type; + $this->possibleValue = $possibleValue; + $this->possibleValueBranch = $compilationContext->branchManager->getCurrentBranch(); } /** - * Shortcut is type variable or string? + * Sets if the variable is read only. * - * @return bool + * @param bool $readOnly */ - public function isNotVariable() + public function setReadOnly(bool $readOnly): void { - return !$this->isVariable(); + $this->readOnly = $readOnly; } /** - * Shortcut is type variable or string? + * Some temporary variables can't be reused. * - * @return bool + * @param bool $reusable */ - public function isNotVariableAndString() + public function setReusable(bool $reusable): void { - return !$this->isVariable() && !$this->isString(); + $this->reusable = $reusable; } /** - * Shortcut is type variable or mixed or string? + * Sets whether the variable is temporal or not. * - * @return bool + * @param bool $temporal */ - public function isNotVariableAndMixedAndString() + public function setTemporal(bool $temporal): void { - return !$this->isVariable() && !$this->isMixed() && !$this->isString(); + $this->temporal = $temporal; } /** - * Shortcut is type variable or array? + * Sets the type of variable. * - * @return bool + * @param string $type */ - public function isNotVariableAndArray() + public function setType(string $type): void { - return !$this->isVariable() && !$this->isArray(); + $this->type = $type; } /** - * Sets the latest CompiledExpression assigned to a variable. + * Sets the latest node where a variable was used. * - * @param CompiledExpression $possibleValue - * @param CompilationContext $compilationContext + * @param bool $used + * @param array|null $node */ - public function setPossibleValue(CompiledExpression $possibleValue, CompilationContext $compilationContext) + public function setUsed(bool $used, array $node = null): void { - $this->possibleValue = $possibleValue; - $this->possibleValueBranch = $compilationContext->branchManager->getCurrentBranch(); + $this->used = $used; + $this->usedNode = $node; } /** - * Returns the latest CompiledExpression assigned to a variable. + * Skips variable initialization. * - * @return mixed + * @param int $numberSkips */ - public function getPossibleValue() + public function skipInitVariant(int $numberSkips): void { - return $this->possibleValue; + $this->numberSkips += $numberSkips; } /** - * Returns the branch where the variable was assigned for the last time. + * Tells the compiler a generated code will track the variable. * - * @return Branch + * @param CompilationContext $compilationContext */ - public function getPossibleValueBranch() + public function trackVariant(CompilationContext $compilationContext): void { - return $this->possibleValueBranch; + if ($this->numberSkips) { + --$this->numberSkips; + + return; + } + + /** + * Variables are allocated for the first time using ZEPHIR_INIT_VAR + * the second, third, etc. times are allocated using ZEPHIR_INIT_NVAR + * Variables initialized for the first time in a cycle are always initialized using ZEPHIR_INIT_NVAR + */ + if (self::VAR_THIS_POINTER !== $this->getName() && self::VAR_RETURN_VALUE !== $this->getName()) { + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; + } + + if (!$this->isLocalOnly()) { + $compilationContext->symbolTable->mustGrownStack(true); + if ($compilationContext->insideCycle) { + $this->mustInitNull = true; + } else { + if ($this->variantInits > 0) { + if (!$this->initBranch) { + $this->mustInitNull = true; + } + } + } + } else { + if ($this->variantInits > 0 || $compilationContext->insideCycle) { + $this->mustInitNull = true; + } + } + + ++$this->variantInits; + } } } diff --git a/Library/Zephir.php b/src/Zephir.php similarity index 85% rename from Library/Zephir.php rename to src/Zephir.php index f900f84a3c..0399ebe4a1 100644 --- a/Library/Zephir.php +++ b/src/Zephir.php @@ -15,9 +15,7 @@ final class Zephir { - public const VERSION = '0.17.0-$Id$'; - - public const LOGO = <<<'ASCII' + public const LOGO = <<<'ASCII' _____ __ _ /__ / ___ ____ / /_ (_)____ / / / _ \/ __ \/ __ \/ / ___/ @@ -27,4 +25,5 @@ final class Zephir ASCII; + public const VERSION = '0.18.0-$Id$'; } diff --git a/stub/cast.zep b/stub/cast.zep index 3ca8f02aa1..f59497baca 100644 --- a/stub/cast.zep +++ b/stub/cast.zep @@ -164,7 +164,7 @@ class Cast */ public function testIntCastFromStdClass() -> int { - return (int) (new \StdClass); + return (int) (new \stdClass); } /** @@ -174,7 +174,7 @@ class Cast public function testIntCastFromVariableStdClass() -> int { var a; - let a = new \StdClass; + let a = new \stdClass; return (int) a; } @@ -271,7 +271,7 @@ class Cast */ public function testFloatCastFromStdClass() -> float { - return (float) (new \StdClass); + return (float) (new \stdClass); } /** @@ -281,7 +281,7 @@ class Cast public function testFloatCastFromVariableStdClass() -> float { var a; - let a = new \StdClass; + let a = new \stdClass; return (float) a; } @@ -324,7 +324,7 @@ class Cast public function testBooleanCastFromObject() -> boolean { var simpleObject; - let simpleObject = new \StdClass(); + let simpleObject = new \stdClass(); return (boolean) simpleObject; } @@ -486,7 +486,7 @@ class Cast public function testArrayCastFromVariableStdClass() -> array { var uids; - let uids = new \StdClass; + let uids = new \stdClass; let uids->p1 = "v1"; let uids->p2 = "v2"; let uids = (array) uids; diff --git a/stub/fetchtest.zep b/stub/fetchtest.zep index 8c7c08f948..04cc16da81 100644 --- a/stub/fetchtest.zep +++ b/stub/fetchtest.zep @@ -64,7 +64,7 @@ class FetchTest return c; } - public function hasValue(string name) -> boolean + public function hasValue(name) -> boolean { // Check if there is a post value for the item if isset _POST[name] { @@ -79,7 +79,7 @@ class FetchTest return false; } - public function getValue(string name) + public function getValue(name) { var value; diff --git a/stub/mcall.zep b/stub/mcall.zep index ad6d55ff5d..218b4edcd3 100644 --- a/stub/mcall.zep +++ b/stub/mcall.zep @@ -223,7 +223,7 @@ class Mcall return driverOptions; } - public function testObjectParamCastStdClass(<\StdClass> param) + public function testObjectParamCastStdClass(<\stdClass> param) { return param; } diff --git a/stub/oo/ooparams.zep b/stub/oo/ooparams.zep index 256f0d32a7..de253ca6ad 100644 --- a/stub/oo/ooparams.zep +++ b/stub/oo/ooparams.zep @@ -126,4 +126,19 @@ class OoParams { return parameter; } + + public function getDefaultParamValue(int i = 0) + { + return i; + } + + public function getDefaultParamValue1(int i = 1) + { + return i; + } + + public function getDefaultParamValueStr(string str = "default") + { + return str; + } } diff --git a/stub/openssl.zep b/stub/openssl.zep new file mode 100644 index 0000000000..01aceb4d2d --- /dev/null +++ b/stub/openssl.zep @@ -0,0 +1,26 @@ + +namespace Stub; + +class Openssl +{ + public function randomPseudoBytes(int length) -> string + { + return openssl_random_pseudo_bytes(length); + } + + public function randomPseudoBytesLoop() -> string + { + var arr, i = 0; + let arr = []; + for i in range(1, 10) { + let arr[] = openssl_random_pseudo_bytes(10); + } + + return arr; + } + + public function opensslEncrypt(string data) + { + return openssl_encrypt(data, "AES-256-CBC", "passphrase", OPENSSL_RAW_DATA, "1234567890123456"); + } +} diff --git a/stub/unsettest.zep b/stub/unsettest.zep index 441add51f8..367d1d8706 100644 --- a/stub/unsettest.zep +++ b/stub/unsettest.zep @@ -45,7 +45,7 @@ class Unsettest public function testStdClassUnset() { var simpleObject; - let simpleObject = new \StdClass(); + let simpleObject = new \stdClass(); let simpleObject->property1 = 12345; let simpleObject->property2 = "test"; diff --git a/templates/Api/themes/zephir/partials/class/content.phtml b/templates/Api/themes/zephir/partials/class/content.phtml index 2dde01a6fd..7b5bc67cb1 100644 --- a/templates/Api/themes/zephir/partials/class/content.phtml +++ b/templates/Api/themes/zephir/partials/class/content.phtml @@ -4,7 +4,7 @@ * @var string $className * @var array $methods * @var string[] $namespacePieces - * @var Zephir\ClassDefinition $classDefinition + * @var \Zephir\Class\Definition\Definition $classDefinition * @var Zephir\CompilerFile $compilerFile */ @@ -27,10 +27,10 @@ $items = [
- +
Class - + $nspath) { ?> diff --git a/templates/Api/themes/zephir/partials/class/method-details.phtml b/templates/Api/themes/zephir/partials/class/method-details.phtml index 578291f48e..098cfdef82 100644 --- a/templates/Api/themes/zephir/partials/class/method-details.phtml +++ b/templates/Api/themes/zephir/partials/class/method-details.phtml @@ -1,6 +1,6 @@ diff --git a/templates/Api/themes/zephir/partials/class/method-summary-params.phtml b/templates/Api/themes/zephir/partials/class/method-summary-params.phtml index f4f36fbf68..3e607d0e05 100644 --- a/templates/Api/themes/zephir/partials/class/method-summary-params.phtml +++ b/templates/Api/themes/zephir/partials/class/method-summary-params.phtml @@ -1,6 +1,6 @@ getParameters()) { diff --git a/templates/Api/themes/zephir/partials/class/method-summary.phtml b/templates/Api/themes/zephir/partials/class/method-summary.phtml index d41a9a47f3..fa68581e65 100644 --- a/templates/Api/themes/zephir/partials/class/method-summary.phtml +++ b/templates/Api/themes/zephir/partials/class/method-summary.phtml @@ -1,7 +1,7 @@ @@ -16,7 +16,7 @@ isFinal() ? 'final' : '' ?> getVisibility()) ?> function getName() ?>(partial('partials/class/method-summary-params.phtml' ) ?>) - +
getDocBlock() ?>
diff --git a/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml b/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml index 78be6b6c80..60cbea36f9 100644 --- a/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml +++ b/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml @@ -1,6 +1,6 @@ getParameters()){ $i=0; diff --git a/templates/Api/themes/zephir/partials/namespace/method-summary.phtml b/templates/Api/themes/zephir/partials/namespace/method-summary.phtml index 4196e7ae29..1a3e26028e 100644 --- a/templates/Api/themes/zephir/partials/namespace/method-summary.phtml +++ b/templates/Api/themes/zephir/partials/namespace/method-summary.phtml @@ -1,6 +1,6 @@ diff --git a/templates/Api/themes/zephir/partials/source.phtml b/templates/Api/themes/zephir/partials/source.phtml index 8010ac6686..2cc090d244 100644 --- a/templates/Api/themes/zephir/partials/source.phtml +++ b/templates/Api/themes/zephir/partials/source.phtml @@ -3,7 +3,7 @@ * @var string $fullName * @var string $className * @var array $namespacePieces - * @var Zephir\ClassDefinition $classDefinition + * @var \Zephir\Class\Definition\Definition $classDefinition * @var Zephir\CompilerFile $compilerFile */ @@ -17,7 +17,7 @@ $items = [ partial('partials/breadcrumb.phtml', ['items'=> $items]) ?>
- +
Class @@ -28,10 +28,10 @@ $items = [
- +
Class - + $nspath): ?> @@ -40,7 +40,7 @@ $items = [

- +
diff --git a/templates/ZendEngine3/clean b/templates/engine/clean
similarity index 100%
rename from templates/ZendEngine3/clean
rename to templates/engine/clean
diff --git a/templates/ZendEngine3/config.m4 b/templates/engine/config.m4
similarity index 100%
rename from templates/ZendEngine3/config.m4
rename to templates/engine/config.m4
diff --git a/templates/ZendEngine3/config.w32 b/templates/engine/config.w32
similarity index 100%
rename from templates/ZendEngine3/config.w32
rename to templates/engine/config.w32
diff --git a/templates/ZendEngine3/ext.h b/templates/engine/ext.h
similarity index 100%
rename from templates/ZendEngine3/ext.h
rename to templates/engine/ext.h
diff --git a/templates/ZendEngine3/ext_config.h b/templates/engine/ext_config.h
similarity index 100%
rename from templates/ZendEngine3/ext_config.h
rename to templates/engine/ext_config.h
diff --git a/templates/ZendEngine3/install b/templates/engine/install
similarity index 100%
rename from templates/ZendEngine3/install
rename to templates/engine/install
diff --git a/templates/ZendEngine3/php_ext.h b/templates/engine/php_ext.h
similarity index 100%
rename from templates/ZendEngine3/php_ext.h
rename to templates/engine/php_ext.h
diff --git a/templates/ZendEngine3/php_project.h b/templates/engine/php_project.h
similarity index 100%
rename from templates/ZendEngine3/php_project.h
rename to templates/engine/php_project.h
diff --git a/templates/ZendEngine3/pkg-config-check.m4 b/templates/engine/pkg-config-check.m4
similarity index 100%
rename from templates/ZendEngine3/pkg-config-check.m4
rename to templates/engine/pkg-config-check.m4
diff --git a/templates/ZendEngine3/pkg-config.m4 b/templates/engine/pkg-config.m4
similarity index 100%
rename from templates/ZendEngine3/pkg-config.m4
rename to templates/engine/pkg-config.m4
diff --git a/templates/ZendEngine3/project.c b/templates/engine/project.c
similarity index 100%
rename from templates/ZendEngine3/project.c
rename to templates/engine/project.c
diff --git a/templates/ZendEngine3/project.h b/templates/engine/project.h
similarity index 100%
rename from templates/ZendEngine3/project.h
rename to templates/engine/project.h
diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php
index 97ea15ba81..737bc8d083 100644
--- a/tests/Extension/ArrayAccessTest.php
+++ b/tests/Extension/ArrayAccessTest.php
@@ -21,9 +21,9 @@ final class ArrayAccessTest extends TestCase
         'key_a' => 'marcin',
         'key_b' => 'paula',
         3 => 'long value',
-        //3.14 => 'double value', // Not supported yet
-        //false => 'bool value', // Not supported yet
-        //null => 'null value', // Not supported yet
+        // 3.14 => 'double value', // Not supported yet
+        // false => 'bool value', // Not supported yet
+        // null => 'null value', // Not supported yet
     ];
 
     public function testTest(): void
diff --git a/tests/Extension/AssignTest.php b/tests/Extension/AssignTest.php
index de5a00ee89..948ec3ac34 100644
--- a/tests/Extension/AssignTest.php
+++ b/tests/Extension/AssignTest.php
@@ -1,7 +1,5 @@
 assertCount($getCount + 2, $_GET);
     }
 
-    public function testIssue597()
+    public function testIssue597(): void
     {
         $_GET = [];
         $this->test->issue597();
diff --git a/tests/Extension/BitwiseTest.php b/tests/Extension/BitwiseTest.php
index 8281d3d5b3..7c4ccd7e29 100644
--- a/tests/Extension/BitwiseTest.php
+++ b/tests/Extension/BitwiseTest.php
@@ -1,7 +1,5 @@
  '-',
             ],
             [new \stdClass()],
         ];
diff --git a/tests/Extension/ClosureTest.php b/tests/Extension/ClosureTest.php
index e84ce190da..c5c2e5acd0 100644
--- a/tests/Extension/ClosureTest.php
+++ b/tests/Extension/ClosureTest.php
@@ -34,9 +34,7 @@ public function testIssue1036(): void
         $test = new Closures();
 
         $test->issue1036SetArgument(true);
-        $test->issue1036SetFunction(function ($argument) {
-            return $argument;
-        });
+        $test->issue1036SetFunction(fn ($argument) => $argument);
 
         $this->assertTrue($test->issue1036Call());
     }
diff --git a/tests/Extension/ConstantsTest.php b/tests/Extension/ConstantsTest.php
index d8bbf9a965..12734d534b 100644
--- a/tests/Extension/ConstantsTest.php
+++ b/tests/Extension/ConstantsTest.php
@@ -1,7 +1,5 @@
 expectException(\Exception::class);
-        $this->expectExceptionMessage(123);
+        $this->expectExceptionMessage('123');
 
         $this->test->testExceptionLiteral('int');
     }
@@ -91,7 +93,7 @@ public function testExceptionInt(): void
     public function testExceptionDouble(): void
     {
         $this->expectException(\Exception::class);
-        $this->expectExceptionMessage(123.123);
+        $this->expectExceptionMessage('123.123');
 
         $this->test->testExceptionLiteral('double');
     }
@@ -130,9 +132,7 @@ public function testMultiException(): void
             $this->assertSame($e->getMessage(), 'Some Exception');
         }
 
-        $this->test->internalExceptionCallable = function () {
-            return false;
-        };
+        $this->test->internalExceptionCallable = fn () => false;
 
         try {
             $value = $this->test->testMultiException('test', new Exception('Some Exception'));
@@ -147,9 +147,7 @@ public function testMultiException(): void
             $this->assertSame($e->getMessage(), 'Some Exception');
         }
 
-        $this->test->exceptionCallable = function () {
-            return false;
-        };
+        $this->test->exceptionCallable = fn () => false;
 
         try {
             $this->test->testMultiException('test', new \Exception('Some Exception'));
diff --git a/tests/Extension/ExitDieTest.php b/tests/Extension/ExitDieTest.php
index c704df77fc..91fe030cce 100644
--- a/tests/Extension/ExitDieTest.php
+++ b/tests/Extension/ExitDieTest.php
@@ -15,9 +15,6 @@
 
 use PHPUnit\Framework\TestCase;
 
-use function constant;
-use function defined;
-
 final class ExitDieTest extends TestCase
 {
     private string $phpBinary;
@@ -27,9 +24,9 @@ final class ExitDieTest extends TestCase
      */
     protected function setUp(): void
     {
-        $this->phpBinary = constant('PHP_BINARY');
+        $this->phpBinary = \constant('PHP_BINARY');
         /* If we use phpdbg, you need to add options -qrr */
-        if (defined('PHP_SAPI') && 'phpdbg' == constant('PHP_SAPI')) {
+        if (\defined('PHP_SAPI') && 'phpdbg' == \constant('PHP_SAPI')) {
             $this->phpBinary .= ' -qrr';
         }
 
@@ -107,7 +104,7 @@ private function prepareOutput(array $output): string
             return '(empty output)';
         }
 
-        if (isset($output[0]) && !empty($output[0])) {
+        if (!empty($output[0])) {
             return $output[0];
         }
 
diff --git a/tests/Extension/FunctionExistsTest.php b/tests/Extension/FunctionExistsTest.php
index 48c45b6df1..26e6ff3993 100644
--- a/tests/Extension/FunctionExistsTest.php
+++ b/tests/Extension/FunctionExistsTest.php
@@ -27,6 +27,7 @@ protected function setUp(): void
 
     /**
      * @dataProvider providerInternalFunctions
+     *
      * @issue https://github.com/zephir-lang/zephir/issues/1547
      *
      * @param string $func The internal (built-in) function name
@@ -69,9 +70,7 @@ public function providerInternalFunctions(): array
         shuffle($allFunctions['internal']);
 
         $functions = array_map(
-            function ($value) {
-                return [$value];
-            },
+            fn ($value) => [$value],
             $allFunctions['internal']
         );
 
diff --git a/tests/Extension/Globals/EnvTest.php b/tests/Extension/Globals/EnvTest.php
index e2f5b2582d..806341e3e2 100644
--- a/tests/Extension/Globals/EnvTest.php
+++ b/tests/Extension/Globals/EnvTest.php
@@ -22,7 +22,7 @@ protected function setUp(): void
     {
         parent::setUp();
 
-        if (false === strpos(ini_get('variables_order'), 'E')) {
+        if (!str_contains(ini_get('variables_order'), 'E')) {
             $this->markTestSkipped(
                 "variables_order ini directive does not contain 'E'. ".
                 "Make sure you have set variables_order to 'EGPCS' in php.ini."
diff --git a/tests/Extension/Integral/RegexDNATest.php b/tests/Extension/Integral/RegexDNATest.php
index d95548fb3b..9b0d505f46 100644
--- a/tests/Extension/Integral/RegexDNATest.php
+++ b/tests/Extension/Integral/RegexDNATest.php
@@ -15,27 +15,25 @@
 
 use PHPUnit\Framework\TestCase;
 use Stub\RegexDNA;
-
-use function dirname;
-use function Zephir\is_windows;
+use Zephir\Os;
 
 final class RegexDNATest extends TestCase
 {
     public function testProcess(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Different strlen() in Windows.');
         }
 
         $test = new RegexDNA();
 
         ob_start();
-        $test->process(dirname(__DIR__).'/../fixtures/regexdna/input.txt');
+        $test->process(\dirname(__DIR__).'/../fixtures/regexdna/input.txt');
         $content = ob_get_clean();
 
         $this->assertSame(
             $content,
-            file_get_contents(dirname(__DIR__).'/../fixtures/regexdna/output.txt')
+            file_get_contents(\dirname(__DIR__).'/../fixtures/regexdna/output.txt')
         );
     }
 }
diff --git a/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php b/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php
index ff77315a95..62661e30de 100644
--- a/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php
+++ b/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php
@@ -32,7 +32,7 @@ public function testImplementInterfaceInMethodSignature(): void
     public function testImplementInterfaceInMethodSignatureInt(): void
     {
         $this->expectException(\TypeError::class);
-        $this->expectExceptionMessageMatches('/must be of (the\s)?type int, bool given/');
+        $this->expectExceptionMessageMatches('/must be of type int, (true|bool) given/');
 
         (new ImplementInt())->set(true);
     }
@@ -41,7 +41,7 @@ public function testImplementInterfaceInMethodSignatureInterface(): void
     {
         $this->expectException(\TypeError::class);
         $this->expectExceptionMessageMatches(
-            '/(must be of type|implement interface) Stub\\\\Interfaces\\\\InterfaceInt, bool given/'
+            '/(must be of type) Stub\\\\Interfaces\\\\InterfaceInt, (true|bool) given/'
         );
 
         (new ImplementInterface())->getVoid(true);
diff --git a/tests/Extension/Issue1134Test.php b/tests/Extension/Issue1134Test.php
index bad9995745..48e9be1c0f 100644
--- a/tests/Extension/Issue1134Test.php
+++ b/tests/Extension/Issue1134Test.php
@@ -14,8 +14,6 @@
 namespace Extension;
 
 use PHPUnit\Framework\TestCase;
-use ReflectionClass;
-use ReflectionException;
 use Stub\Issue1134;
 
 /**
@@ -24,11 +22,11 @@
 final class Issue1134Test extends TestCase
 {
     /**
-     * @throws ReflectionException
+     * @throws \ReflectionException
      */
     public function testIssue914ReflectionParamDefaultValueShouldReturnTrue(): void
     {
-        $ref = new ReflectionClass(Issue1134::class);
+        $ref = new \ReflectionClass(Issue1134::class);
         $constructor = $ref->getConstructor();
         $params = $constructor->getParameters();
 
diff --git a/tests/Extension/MCallTest.php b/tests/Extension/MCallTest.php
index f6e48fa431..d209487b01 100644
--- a/tests/Extension/MCallTest.php
+++ b/tests/Extension/MCallTest.php
@@ -14,8 +14,6 @@
 namespace Extension;
 
 use PHPUnit\Framework\TestCase;
-use ReflectionClass;
-use ReflectionParameter;
 use Stub\Mcall;
 use Stub\Oo\Param;
 
@@ -132,7 +130,7 @@ public function testObjectParamCastStdClass(): void
         $this->assertNumberOfParameters(1);
         $this->assertNumberOfRequiredParameters(1);
 
-        $this->assertSame(\StdClass::class, $this->getMethodFirstParameter()->getType()->getName());
+        $this->assertSame(\stdClass::class, $this->getMethodFirstParameter()->getType()->getName());
         $this->assertInstanceOf(\stdClass::class, $this->test->testObjectParamCastStdClass(new \stdClass()));
     }
 
@@ -145,7 +143,7 @@ public function testObjectParamCastOoParam(): void
         $this->assertInstanceOf(Param::class, $this->test->testObjectParamCastOoParam(new Param()));
     }
 
-    protected function getMethodFirstParameter(): ReflectionParameter
+    protected function getMethodFirstParameter(): \ReflectionParameter
     {
         $methodInfo = $this->reflection->getMethod($this->getName());
         $parameters = $methodInfo->getParameters();
@@ -154,12 +152,12 @@ protected function getMethodFirstParameter(): ReflectionParameter
     }
 
     /**
-     * @return mixed|ReflectionClass
+     * @return mixed|\ReflectionClass
      */
     private function getReflection()
     {
         if (null === $this->reflection) {
-            return $this->reflection = new ReflectionClass(Mcall::class);
+            return $this->reflection = new \ReflectionClass(Mcall::class);
         }
 
         return $this->reflection;
diff --git a/tests/Extension/MethodArgsTest.php b/tests/Extension/MethodArgsTest.php
index 7291cf6a8b..a7e8be014d 100644
--- a/tests/Extension/MethodArgsTest.php
+++ b/tests/Extension/MethodArgsTest.php
@@ -27,7 +27,7 @@ protected function setUp(): void
 
     public function testCallable(): void
     {
-        $callback = function () {
+        $callback = function (): void {
         };
 
         $this->test->setCallable($callback);
diff --git a/tests/Extension/Oo/ExtendClassTest.php b/tests/Extension/Oo/ExtendClassTest.php
index 1586003099..a868477908 100644
--- a/tests/Extension/Oo/ExtendClassTest.php
+++ b/tests/Extension/Oo/ExtendClassTest.php
@@ -13,7 +13,6 @@
 
 namespace Extension\Oo;
 
-use PDO;
 use PHPUnit\Framework\TestCase;
 use Stub\Integration\Psr\Http\Message\MessageInterfaceEx;
 use Stub\Oo\ConcreteStatic;
@@ -27,13 +26,13 @@ public function testPDOExtending(): void
             $this->markTestSkipped('The PDO extension is not loaded');
         }
 
-        $this->assertSame(PDO::getAvailableDrivers(), ExtendPdoClass::getAvailableDrivers());
-        $this->assertSame(PDO::PARAM_STR, ExtendPdoClass::PARAM_STR);
+        $this->assertSame(\PDO::getAvailableDrivers(), ExtendPdoClass::getAvailableDrivers());
+        $this->assertSame(\PDO::PARAM_STR, ExtendPdoClass::PARAM_STR);
     }
 
     public function testPDOStatementExtending(): void
     {
-        $pdo = new ExtendPdoClass('sqlite::memory:', '', '', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
+        $pdo = new ExtendPdoClass('sqlite::memory:', '', '', [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);
         $stmt = $pdo->prepare('SELECT CURRENT_TIME');
 
         $this->assertInstanceof('Stub\\PdoStatement', $stmt);
diff --git a/tests/Extension/Oo/OoParamsTest.php b/tests/Extension/Oo/OoParamsTest.php
index 690f0ca013..757e3c54bc 100644
--- a/tests/Extension/Oo/OoParamsTest.php
+++ b/tests/Extension/Oo/OoParamsTest.php
@@ -9,6 +9,8 @@
  * the LICENSE file that was distributed with this source code.
  */
 
+declare(strict_types=1);
+
 namespace Extension\Oo;
 
 use PHPUnit\Framework\TestCase;
@@ -29,26 +31,22 @@ public function testOoParams(): void
         $this->assertinstanceOf('Stub\Oo\OoDynamicA', $this->test->createOtherClassWithoutWriteCurrentNamespace());
 
         $this->assertSame($this->test->setAge(17), 17);
-        $this->assertSame($this->test->setAge('17'), 17);
-        $this->assertSame($this->test->setAge(17.0), 17);
 
         $this->assertSame($this->test->setAverage(17.1), 17.1);
         $this->assertSame($this->test->setAverage(17), 17.0);
         $this->assertSame($this->test->setAverage('17.5'), 17.5);
 
         $this->assertSame($this->test->setName('peter'), 'peter');
-        $this->assertSame($this->test->setName(12.5), '12.5');
-        $this->assertSame($this->test->setName(17), '17');
 
         $this->assertSame($this->test->setEnabled(true), true);
         $this->assertSame($this->test->setEnabled(false), false);
-        $this->assertSame($this->test->setEnabled(1), true);
-        $this->assertSame($this->test->setEnabled(0), false);
-        $this->assertSame($this->test->setEnabled('1'), true);
-        $this->assertSame($this->test->setEnabled('0'), false);
 
         $this->assertSame($this->test->setList([1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]);
         $this->assertSame($this->test->setList([]), []);
+
+        $this->assertSame(0, $this->test->getDefaultParamValue());
+        $this->assertSame(1, $this->test->getDefaultParamValue1());
+        $this->assertSame('default', $this->test->getDefaultParamValueStr());
     }
 
     public function setObjectClassCast(): void
@@ -58,6 +56,33 @@ public function setObjectClassCast(): void
         $this->assertInstanceOf('Stub\Oo\Param', $result);
     }
 
+    public function testTypError(): void
+    {
+        $this->expectException(\TypeError::class);
+        $this->assertSame($this->test->setAge('17'), 17);
+
+        $this->expectException(\TypeError::class);
+        $this->assertSame($this->test->setAge(17.0), 17);
+
+        $this->expectException(\TypeError::class);
+        $this->assertSame($this->test->setName(12.5), '12.5');
+
+        $this->expectException(\TypeError::class);
+        $this->assertSame($this->test->setName(17), '17');
+
+        $this->expectException(\TypeError::class);
+        $this->assertSame($this->test->setEnabled(1), true);
+
+        $this->expectException(\TypeError::class);
+        $this->assertSame($this->test->setEnabled(0), false);
+
+        $this->expectException(\TypeError::class);
+        $this->assertSame($this->test->setEnabled('1'), true);
+
+        $this->expectException(\TypeError::class);
+        $this->assertSame($this->test->setEnabled('0'), false);
+    }
+
     /**
      * @issue https://github.com/zephir-lang/zephir/issues/938
      */
diff --git a/tests/Extension/Oo/Scopes/PrivateScopeTest.php b/tests/Extension/Oo/Scopes/PrivateScopeTest.php
index 4c593fb5ad..b240cbb9f5 100644
--- a/tests/Extension/Oo/Scopes/PrivateScopeTest.php
+++ b/tests/Extension/Oo/Scopes/PrivateScopeTest.php
@@ -13,16 +13,9 @@
 
 namespace Extension\Oo\Scopes;
 
-use Error;
 use PHPUnit\Framework\Error\Notice;
 use PHPUnit\Framework\TestCase;
 use Stub\Oo\Scopes\PrivateScopeTester;
-use TestScopeExtending;
-use TestScopeExtendingMagic;
-use TestScopePhp;
-use TestScopePhpMagic;
-use TestScopePhpMagicExtending;
-use UserExample;
 
 final class PrivateScopeTest extends TestCase
 {
@@ -36,13 +29,13 @@ public function testShouldCallPrivateMethod(): void
      */
     public function testShouldNotSetPrivatePropertyObjPhp(): void
     {
-        $this->expectException(Error::class);
+        $this->expectException(\Error::class);
         $this->expectExceptionMessage(
             'Cannot access private property TestScopePhp::$privateProperty'
         );
 
         $tester = new PrivateScopeTester();
-        $tester->setPropertyObj(new TestScopePhp(), 'privateProperty', 'test');
+        $tester->setPropertyObj(new \TestScopePhp(), 'privateProperty', 'test');
     }
 
     /**
@@ -50,13 +43,13 @@ public function testShouldNotSetPrivatePropertyObjPhp(): void
      */
     public function testShouldNotSetPrivatePropertyNewPhp(): void
     {
-        $this->expectException(Error::class);
+        $this->expectException(\Error::class);
         $this->expectExceptionMessage(
             'Cannot access private property TestScopePhp::$privateProperty'
         );
 
         $tester = new PrivateScopeTester();
-        $tester->setPropertyNew(TestScopePhp::class, 'privateProperty', 'test');
+        $tester->setPropertyNew(\TestScopePhp::class, 'privateProperty', 'test');
     }
 
     /**
@@ -64,13 +57,13 @@ public function testShouldNotSetPrivatePropertyNewPhp(): void
      */
     public function testShouldNotSetPrivatePropertyObjInternal(): void
     {
-        $this->expectException(Error::class);
+        $this->expectException(\Error::class);
         $this->expectExceptionMessage(
             'Cannot access private property TestScopeExtending::$privateProperty'
         );
 
         $tester = new PrivateScopeTester();
-        $tester->setPropertyObj(new TestScopeExtending(), 'privateProperty', 'test');
+        $tester->setPropertyObj(new \TestScopeExtending(), 'privateProperty', 'test');
     }
 
     /**
@@ -78,13 +71,13 @@ public function testShouldNotSetPrivatePropertyObjInternal(): void
      */
     public function testShouldNotSetPrivatePropertyNewInternal(): void
     {
-        $this->expectException(Error::class);
+        $this->expectException(\Error::class);
         $this->expectExceptionMessage(
             'Cannot access private property TestScopeExtending::$privateProperty'
         );
 
         $tester = new PrivateScopeTester();
-        $tester->setPropertyNew(TestScopeExtending::class, 'privateProperty', 'test');
+        $tester->setPropertyNew(\TestScopeExtending::class, 'privateProperty', 'test');
     }
 
     /**
@@ -92,7 +85,7 @@ public function testShouldNotSetPrivatePropertyNewInternal(): void
      */
     public function testShouldSetPrivatePropertyObjPhp(): void
     {
-        $object = new TestScopePhpMagic();
+        $object = new \TestScopePhpMagic();
         $tester = new PrivateScopeTester();
 
         $actual = $tester->setPropertyObj($object, 'privateProperty', 'test');
@@ -106,7 +99,7 @@ public function testShouldSetPrivatePropertyObjPhp(): void
     public function testShouldSetPrivatePropertyNewPhp(): void
     {
         $tester = new PrivateScopeTester();
-        $obj = $tester->setPropertyNew(TestScopePhpMagic::class, 'privateProperty', 'test');
+        $obj = $tester->setPropertyNew(\TestScopePhpMagic::class, 'privateProperty', 'test');
 
         $this->assertEquals('test', $obj->privateProperty);
         $this->assertEquals(1, $obj->setCount);
@@ -118,7 +111,7 @@ public function testShouldSetPrivatePropertyNewPhp(): void
     public function testShouldSetPrivatePropertyObjInternal(): void
     {
         $tester = new PrivateScopeTester();
-        $object = new TestScopeExtendingMagic();
+        $object = new \TestScopeExtendingMagic();
 
         $actual = $tester->setPropertyObj($object, 'privateProperty', 'test');
         $this->assertEquals('test', $actual);
@@ -131,7 +124,7 @@ public function testShouldSetPrivatePropertyObjInternal(): void
     public function testShouldSetPrivatePropertyNewInternal(): void
     {
         $tester = new PrivateScopeTester();
-        $obj = $tester->setPropertyNew(TestScopeExtendingMagic::class, 'privateProperty', 'test');
+        $obj = $tester->setPropertyNew(\TestScopeExtendingMagic::class, 'privateProperty', 'test');
 
         $this->assertEquals('test', $obj->privateProperty);
         $this->assertEquals(1, $obj->setCount);
@@ -142,12 +135,12 @@ public function testShouldSetPrivatePropertyNewInternal(): void
      */
     public function testShouldNotSetPrivatePropertyViaThis(): void
     {
-        $this->expectException(Error::class);
+        $this->expectException(\Error::class);
         $this->expectExceptionMessage(
             'Cannot access private property TestScopeExtending::$privateProperty'
         );
 
-        $obj = new TestScopeExtending();
+        $obj = new \TestScopeExtending();
         $obj->setProperty('privateProperty', 'test');
     }
 
@@ -156,7 +149,7 @@ public function testShouldNotSetPrivatePropertyViaThis(): void
      */
     public function testShouldSetPrivatePropertyViaThis(): void
     {
-        $obj = new TestScopeExtending();
+        $obj = new \TestScopeExtending();
         $obj->setProperty('privateProperty2', 'test');
 
         $this->assertEquals('test', $obj->getPrivateProperty2());
@@ -167,12 +160,12 @@ public function testShouldSetPrivatePropertyViaThis(): void
      */
     public function testShouldNotSetPrivatePropertyExtendedMagicObjInternal(): void
     {
-        $this->expectException(Error::class);
+        $this->expectException(\Error::class);
         $this->expectExceptionMessage(
             'Cannot access private property TestScopeExtendingMagic::$privateProperty2'
         );
 
-        $object = new TestScopeExtendingMagic();
+        $object = new \TestScopeExtendingMagic();
         $tester = new PrivateScopeTester();
 
         $this->assertEquals('private', $object->getPrivateProperty2());
@@ -184,14 +177,14 @@ public function testShouldNotSetPrivatePropertyExtendedMagicObjInternal(): void
      */
     public function testShouldNotSetPrivatePropertyExtendedMagicNewInternal(): void
     {
-        $this->expectException(Error::class);
+        $this->expectException(\Error::class);
         $this->expectExceptionMessage(
             'Cannot access private property TestScopeExtendingMagic::$privateProperty2'
         );
 
         $tester = new PrivateScopeTester();
         $tester->setPropertyNew(
-            TestScopeExtendingMagic::class,
+            \TestScopeExtendingMagic::class,
             'privateProperty2',
             'CHANGED'
         );
@@ -208,13 +201,13 @@ public function testShouldNotSetPrivatePropertyExtendedMagicObjPhp(): void
                 'Undefined property: TestScopePhpMagicExtending::$privateProperty2'
             );
         } else {
-            $this->expectException(Error::class);
+            $this->expectException(\Error::class);
             $this->expectExceptionMessage(
                 'Cannot access private property TestScopePhpMagicExtending::$privateProperty2'
             );
         }
 
-        $obj = new TestScopePhpMagicExtending();
+        $obj = new \TestScopePhpMagicExtending();
 
         $tester = new PrivateScopeTester();
         $tester->setPropertyObj($obj, 'privateProperty2', 'test');
@@ -225,14 +218,14 @@ public function testShouldNotSetPrivatePropertyExtendedMagicObjPhp(): void
      */
     public function testShouldNotSetPrivatePropertyExtendedMagicNewPhp(): void
     {
-        $this->expectException(Error::class);
+        $this->expectException(\Error::class);
         $this->expectExceptionMessage(
             'Cannot access private property TestScopePhpMagicExtending::$privateProperty2'
         );
 
         $tester = new PrivateScopeTester();
         $tester->setPropertyNew(
-            TestScopePhpMagicExtending::class,
+            \TestScopePhpMagicExtending::class,
             'privateProperty2',
             'CHANGED'
         );
@@ -244,7 +237,7 @@ public function testShouldNotSetPrivatePropertyExtendedMagicNewPhp(): void
     public function testShouldNotGetObjectVarsPrivatePropertyObjPhp(): void
     {
         $tester = new PrivateScopeTester();
-        $object = new TestScopePhp();
+        $object = new \TestScopePhp();
 
         $objectVars = $tester->getObjVars($object);
         $this->assertArrayNotHasKey('privateProperty', $objectVars);
@@ -256,7 +249,7 @@ public function testShouldNotGetObjectVarsPrivatePropertyObjPhp(): void
     public function testShouldNotGetObjectVarsPrivatePropertyNewPhp(): void
     {
         $tester = new PrivateScopeTester();
-        $objectVars = $tester->getNewVars(TestScopePhp::class);
+        $objectVars = $tester->getNewVars(\TestScopePhp::class);
 
         $this->assertArrayNotHasKey('privateProperty', $objectVars);
     }
@@ -267,7 +260,7 @@ public function testShouldNotGetObjectVarsPrivatePropertyNewPhp(): void
     public function testShouldNotGetObjectVarsPrivatePropertyObjInternal(): void
     {
         $tester = new PrivateScopeTester();
-        $object = new TestScopeExtending();
+        $object = new \TestScopeExtending();
         $objectVars = $tester->getObjVars($object);
 
         $this->assertArrayNotHasKey('privateProperty', $objectVars);
@@ -279,7 +272,7 @@ public function testShouldNotGetObjectVarsPrivatePropertyObjInternal(): void
     public function testShouldNotGetObjectVarsPrivatePropertyNewInternal(): void
     {
         $tester = new PrivateScopeTester();
-        $objectVars = $tester->getNewVars(TestScopeExtending::class);
+        $objectVars = $tester->getNewVars(\TestScopeExtending::class);
 
         $this->assertArrayNotHasKey('privateProperty', $objectVars);
     }
@@ -289,7 +282,7 @@ public function testShouldNotGetObjectVarsPrivatePropertyNewInternal(): void
      */
     public function testShouldGetAndSetPrivatePropertyUsingParentGetterAndSetter(): void
     {
-        $tester = new UserExample();
+        $tester = new \UserExample();
         $tester->setPrivateVariable('test');
 
         $this->assertEquals('test', $tester->getPrivateVariable());
diff --git a/tests/Extension/OpensslTest.php b/tests/Extension/OpensslTest.php
new file mode 100644
index 0000000000..a064c24cc9
--- /dev/null
+++ b/tests/Extension/OpensslTest.php
@@ -0,0 +1,62 @@
+
+ *
+ * For the full copyright and license information, please view
+ * the LICENSE file that was distributed with this source code.
+ */
+
+declare(strict_types=1);
+
+namespace Extension;
+
+use PHPUnit\Framework\TestCase;
+use Stub\Openssl;
+
+final class OpensslTest extends TestCase
+{
+    private Openssl $test;
+
+    protected function setUp(): void
+    {
+        $this->test = new Openssl();
+    }
+
+    /**
+     * @dataProvider providerLength
+     */
+    public function testRandomPseudoBytes(int $length): void
+    {
+        for ($i = 0; $i < 20; $i++) {
+            $this->assertSame($length, strlen($this->test->randomPseudoBytes($length)));
+        }
+    }
+
+    public function testRandomPseudoBytesLoop(): void
+    {
+        $this->assertSame(10, count($this->test->randomPseudoBytesLoop()));
+    }
+
+    public function testOpensslEncrypt(): void
+    {
+        for ($i = 0; $i < 20; $i++) {
+            $this->assertNotFalse($this->test->opensslEncrypt((string)$i));
+        }
+    }
+
+    public function providerLength(): array
+    {
+        return [
+            [1],
+            [2],
+            [5],
+            [10],
+            [30],
+            [50],
+            [100],
+        ];
+    }
+}
diff --git a/tests/Extension/Optimizers/IsPhpVersionTest.php b/tests/Extension/Optimizers/IsPhpVersionTest.php
index 2cb88d0090..d83731e2cf 100644
--- a/tests/Extension/Optimizers/IsPhpVersionTest.php
+++ b/tests/Extension/Optimizers/IsPhpVersionTest.php
@@ -9,12 +9,12 @@
  * the LICENSE file that was distributed with this source code.
  */
 
+declare(strict_types=1);
+
 namespace Extension\Optimizers;
 
-use Exception;
 use PHPUnit\Framework\TestCase;
 use Stub\Issue1404;
-use Throwable;
 
 /**
  * Extension\Optimizers\IsPhpVersionTest.
@@ -23,8 +23,8 @@
  */
 final class IsPhpVersionTest extends TestCase
 {
-    const PHP_RELEASES_LIMIT = 17;
-    const PHP_MINOR_LIMIT = 3;
+    public const PHP_RELEASES_LIMIT = 17;
+    public const PHP_MINOR_LIMIT = 3;
 
     protected $test;
 
@@ -61,18 +61,18 @@ public function phpVersionProvider(): array
      * @param mixed $version
      * @param mixed $expected
      *
-     * @throws Exception
+     * @throws \Exception
      */
     public function testOptimizer($version, $expected): void
     {
-        $isPhpVersion = (bool) $this->isPhpVersion($version);
+        $isPhpVersion = $this->isPhpVersion($version);
 
         $this->assertEquals($expected, $isPhpVersion);
     }
 
     public function testOptimizerExceptionLLU(): void
     {
-        $this->expectException(Exception::class);
+        $this->expectException(\Exception::class);
         $this->expectExceptionMessage('Could not parse PHP version');
 
         $this->isPhpVersion(92233720368547758079);
@@ -80,7 +80,7 @@ public function testOptimizerExceptionLLU(): void
 
     public function testOptimizerExceptionNegativeNumber(): void
     {
-        $this->expectException(Exception::class);
+        $this->expectException(\Exception::class);
         $this->expectExceptionMessage('Could not parse PHP version');
 
         $this->isPhpVersion(-7);
@@ -88,7 +88,7 @@ public function testOptimizerExceptionNegativeNumber(): void
 
     public function testOptimizerExceptionEmpty(): void
     {
-        $this->expectException(Exception::class);
+        $this->expectException(\Exception::class);
         $this->expectExceptionMessage('Could not parse PHP version');
 
         /**
@@ -151,7 +151,7 @@ public function releaseVersionProvider(): array
      * @param mixed $testName
      * @param mixed $version
      *
-     * @throws Exception
+     * @throws \Exception
      */
     public function testIsPhpVersionVersionUsing701XX($testName, $version): void
     {
@@ -178,7 +178,7 @@ public function minorVersionProvider(): array
      * @param mixed $testName
      * @param mixed $version
      *
-     * @throws Exception
+     * @throws \Exception
      */
     public function testIsPhpVersionVersionUsing70X00($testName, $version): void
     {
@@ -213,11 +213,11 @@ public function testZephirUsingString50600(): void
     }
 
     /**
-     * @param Throwable $error
+     * @param \Throwable $error
      *
-     * @throws Throwable
+     * @throws \Throwable
      */
-    protected function onNotSuccessfulTest(Throwable $error): void
+    protected function onNotSuccessfulTest(\Throwable $error): void
     {
         $phpVer = sprintf(
             'PHP_VERSION_ID:%d(%d.%d.%d)',
@@ -241,13 +241,13 @@ protected function onNotSuccessfulTest(Throwable $error): void
      *
      * @return bool
      *
-     * @throws Exception
+     * @throws \Exception
      */
-    private function isPhpVersion($version): bool
+    private function isPhpVersion(float | int | string $version): bool
     {
-        preg_match('/^(?\d+)(?:\.(?!?\d+))?(?:\.(?!?\d+))?(?:[^Ee0-9.]+.*)?$/', $version, $matches);
+        preg_match('/^(?\d+)(?:\.(?!?\d+))?(?:\.(?!?\d+))?(?:[^Ee0-9.]+.*)?$/', (string) $version, $matches);
         if (!\count($matches)) {
-            throw new Exception('Could not parse PHP version');
+            throw new \Exception('Could not parse PHP version');
         }
 
         $minorVersion = 0;
diff --git a/tests/Extension/Optimizers/IsScalarTest.php b/tests/Extension/Optimizers/IsScalarTest.php
index d2b7ce0fb8..0f2bf5cede 100644
--- a/tests/Extension/Optimizers/IsScalarTest.php
+++ b/tests/Extension/Optimizers/IsScalarTest.php
@@ -50,7 +50,7 @@ public function testVariableParameter(): void
         $this->assertFalse($this->test->testVarParameter($this));
         $this->assertFalse(
             $this->test->testVarParameter(
-                function () {
+                function (): void {
                 }
             )
         );
diff --git a/tests/Extension/Properties/PropertyUpdateTest.php b/tests/Extension/Properties/PropertyUpdateTest.php
index 1cb5ac4448..743d8a2a8a 100644
--- a/tests/Extension/Properties/PropertyUpdateTest.php
+++ b/tests/Extension/Properties/PropertyUpdateTest.php
@@ -1,7 +1,5 @@
 gc.refcount == 1) || ((ht)->u.flags & (1<<6))), function _zend_hash_index_add_or_update_i
         $test = new PropertyUpdate();
diff --git a/tests/Extension/Properties/StaticPublicPropertiesTest.php b/tests/Extension/Properties/StaticPublicPropertiesTest.php
index 352890bae8..95ecc6cb60 100644
--- a/tests/Extension/Properties/StaticPublicPropertiesTest.php
+++ b/tests/Extension/Properties/StaticPublicPropertiesTest.php
@@ -49,9 +49,9 @@ public function testIssues2020(): void
         $this->assertEquals(-1, StaticPublicProperties::$someSub);
 
         // PHP Notice:  A non well formed numeric value encountered
-        //\Stub\Properties\StaticPublicProperties::testAddAndSub2();
-        //$this->assertEquals(2, \Stub\Properties\StaticPublicProperties::$someAdd);
-        //$this->assertEquals(-2, \Stub\Properties\StaticPublicProperties::$someSub);
+        // \Stub\Properties\StaticPublicProperties::testAddAndSub2();
+        // $this->assertEquals(2, \Stub\Properties\StaticPublicProperties::$someAdd);
+        // $this->assertEquals(-2, \Stub\Properties\StaticPublicProperties::$someSub);
 
         StaticPublicProperties::testAddAndSub3();
         $this->assertEquals(2, StaticPublicProperties::$someAdd);
diff --git a/tests/Extension/ReflectionTest.php b/tests/Extension/ReflectionTest.php
index 15da5ed41e..556dd132bd 100644
--- a/tests/Extension/ReflectionTest.php
+++ b/tests/Extension/ReflectionTest.php
@@ -14,9 +14,6 @@
 namespace Extension;
 
 use PHPUnit\Framework\TestCase;
-use ReflectionClass;
-use ReflectionFunction;
-use ReflectionParameter;
 use Stub\Reflection as StubReflection;
 
 final class ReflectionTest extends TestCase
@@ -25,14 +22,12 @@ public function testMethods(): void
     {
         $class = new StubReflection();
 
-        $this->assertInstanceOf(ReflectionClass::class, $class->getReflectionClass());
-        $this->assertInstanceOf(ReflectionFunction::class, $class->getReflectionFunction());
+        $this->assertInstanceOf(\ReflectionClass::class, $class->getReflectionClass());
+        $this->assertInstanceOf(\ReflectionFunction::class, $class->getReflectionFunction());
         $this->assertNull($class->getReflectionParameter());
 
-        $class->setReflectionParameter(new ReflectionParameter(function ($test) {
-            return 1;
-        }, 0));
+        $class->setReflectionParameter(new \ReflectionParameter(fn ($test) => 1, 0));
 
-        $this->assertInstanceOf(ReflectionParameter::class, $class->getReflectionParameter());
+        $this->assertInstanceOf(\ReflectionParameter::class, $class->getReflectionParameter());
     }
 }
diff --git a/tests/Extension/RequiresTest.php b/tests/Extension/RequiresTest.php
index 99bd7ad134..099e0b32a3 100644
--- a/tests/Extension/RequiresTest.php
+++ b/tests/Extension/RequiresTest.php
@@ -16,8 +16,6 @@
 use PHPUnit\Framework\TestCase;
 use Stub\Requires;
 
-use function defined;
-
 final class RequiresTest extends TestCase
 {
     private Requires $test;
@@ -34,9 +32,9 @@ public function testRequireExternal1(): void
             $this->test->requireExternal1(__DIR__.'/../fixtures/require-me-1.php')
         );
 
-        $this->assertFalse(defined('REQUIRE_ME'));
+        $this->assertFalse(\defined('REQUIRE_ME'));
         $this->test->requireExternal1(__DIR__.'/../fixtures/require-me-2.php');
-        $this->assertTrue(defined('REQUIRE_ME'));
+        $this->assertTrue(\defined('REQUIRE_ME'));
     }
 
     /**
@@ -88,10 +86,10 @@ public function testRequireOnce(): void
             $this->test->requireOnce(__DIR__.'/../fixtures/require-me-before-once.php')
         );
 
-        $this->assertFalse(defined('REQUIRE_ONCE_ME'));
+        $this->assertFalse(\defined('REQUIRE_ONCE_ME'));
         $this->test->requireOnce(__DIR__.'/../fixtures/require-me-once.php');
-        $this->assertTrue(defined('REQUIRE_ONCE_ME'));
+        $this->assertTrue(\defined('REQUIRE_ONCE_ME'));
         $this->test->requireOnce(__DIR__.'/../fixtures/require-me-once.php');
-        $this->assertTrue(defined('REQUIRE_ONCE_ME'));
+        $this->assertTrue(\defined('REQUIRE_ONCE_ME'));
     }
 }
diff --git a/tests/Extension/StringTest.php b/tests/Extension/StringTest.php
index c5ae82f92a..eaa9906842 100644
--- a/tests/Extension/StringTest.php
+++ b/tests/Extension/StringTest.php
@@ -15,8 +15,7 @@
 
 use PHPUnit\Framework\TestCase;
 use Stub\Strings;
-
-use function Zephir\is_windows;
+use Zephir\Os;
 
 final class StringTest extends TestCase
 {
@@ -259,7 +258,7 @@ public function testStripcslashes(): void
 
     public function testMultilineStrings(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('String will contain different line endings.');
         }
 
@@ -414,9 +413,7 @@ public function providerCamelizeWrongSecondParam(): array
             [0],
             [[]],
             [
-                function () {
-                    return '-';
-                },
+                fn () => '-',
             ],
             [new \stdClass()],
         ];
diff --git a/tests/Extension/TypeHinting/AbstractTest.php b/tests/Extension/TypeHinting/AbstractTest.php
index aa782f1f10..8db2cbc3c1 100644
--- a/tests/Extension/TypeHinting/AbstractTest.php
+++ b/tests/Extension/TypeHinting/AbstractTest.php
@@ -14,7 +14,6 @@
 namespace Extension\TypeHinting;
 
 use PHPUnit\Framework\TestCase;
-use TestConcreteClass;
 
 final class AbstractTest extends TestCase
 {
@@ -23,7 +22,7 @@ final class AbstractTest extends TestCase
      */
     public function testShouldCreateCompatibleChildClassUsingTypeHintedParams(): void
     {
-        $childClass = new TestConcreteClass();
+        $childClass = new \TestConcreteClass();
 
         $this->assertEquals(
             [[1667], '/', true, null],
@@ -41,7 +40,7 @@ public function testShouldCreateCompatibleChildClassUsingTypeHintedParams(): voi
      */
     public function testShouldCreateCompatibleChildClassWithMultipleReturnTypesHint(): void
     {
-        $childClass = new TestConcreteClass();
+        $childClass = new \TestConcreteClass();
         $this->assertEquals('TestConcreteClass::returnOneOfScalar', $childClass->returnOneOfScalar());
     }
 
@@ -50,7 +49,7 @@ public function testShouldCreateCompatibleChildClassWithMultipleReturnTypesHint(
      */
     public function testShouldCreateCompatibleChildClassWithScalarType(): void
     {
-        $childClass = new TestConcreteClass();
+        $childClass = new \TestConcreteClass();
 
         $this->assertEquals(1, $childClass->returnInt());
         $this->assertEquals(1, $childClass->returnUint());
diff --git a/tests/Extension/TypeoffTest.php b/tests/Extension/TypeoffTest.php
index bb56b3c8fd..1762c23e53 100644
--- a/tests/Extension/TypeoffTest.php
+++ b/tests/Extension/TypeoffTest.php
@@ -1,7 +1,5 @@
 assertTrue($this->test->testCallableTypeOf($callback));
         $this->assertFalse($this->test->testCallableTypeOf(true));
diff --git a/tests/Extension/Types/MixedTypeTest.php b/tests/Extension/Types/MixedTypeTest.php
index 162edba89c..f544f56d84 100644
--- a/tests/Extension/Types/MixedTypeTest.php
+++ b/tests/Extension/Types/MixedTypeTest.php
@@ -22,7 +22,7 @@ public function testReturnsOfMixedType(): void
     {
         $returns = new MixedType();
 
-        $this->assertEquals((new \stdClass()), $returns->returnMixedObject());
+        $this->assertEquals(new \stdClass(), $returns->returnMixedObject());
         $this->assertSame([], $returns->returnMixedArray());
         $this->assertSame('mixed string', $returns->returnMixedString());
         $this->assertSame(1, $returns->returnMixedInt());
@@ -38,16 +38,16 @@ public function testReturnsOfMixedType(): void
         $this->assertNotNull($returns->returnMixedBool());
         $this->assertNull($returns->returnMixedNull());
 
-        $this->assertEquals((new \stdClass()), $returns->returnMixed74());
+        $this->assertEquals(new \stdClass(), $returns->returnMixed74());
         $this->assertSame('string', $returns->returnMixed74(true));
-        $this->assertEquals((new \stdClass()), $returns->returnMixed74(false));
+        $this->assertEquals(new \stdClass(), $returns->returnMixed74(false));
     }
 
     public function testParamsOfMixedType(): void
     {
         $returns = new MixedType();
 
-        $this->assertEquals((new \stdClass()), $returns->paramMixed((new \stdClass())));
+        $this->assertEquals(new \stdClass(), $returns->paramMixed(new \stdClass()));
         $this->assertSame([], $returns->paramMixed([]));
         $this->assertSame('mixed string', $returns->paramMixed('mixed string'));
         $this->assertSame(1, $returns->paramMixed(1));
@@ -55,14 +55,14 @@ public function testParamsOfMixedType(): void
         $this->assertTrue($returns->paramMixed(true));
         $this->assertNull($returns->paramMixed(null));
 
-        $this->assertEquals([(new \stdClass()), []], $returns->paramMixedTwo((new \stdClass()), []));
+        $this->assertEquals([new \stdClass(), []], $returns->paramMixedTwo(new \stdClass(), []));
         $this->assertSame([[], 'mixed string'], $returns->paramMixedTwo([], 'mixed string'));
         $this->assertSame([1, 3.14], $returns->paramMixedTwo(1, 3.14));
         $this->assertSame([3.14, true], $returns->paramMixedTwo(3.14, true));
         $this->assertSame([true, null], $returns->paramMixedTwo(true, null));
         $this->assertSame([null, null], $returns->paramMixedTwo(null, null));
 
-        $this->assertEquals([1337, 'object', (new \stdClass())], $returns->paramMixedWithMulti(1337, 'object', (new \stdClass())));
+        $this->assertEquals([1337, 'object', new \stdClass()], $returns->paramMixedWithMulti(1337, 'object', new \stdClass()));
         $this->assertSame([1337, 'array', []], $returns->paramMixedWithMulti(1337, 'array', []));
         $this->assertSame([1337, 'string', 'mixed string'], $returns->paramMixedWithMulti(1337, 'string', 'mixed string'));
         $this->assertSame([1337, 'int', 123], $returns->paramMixedWithMulti(1337, 'int', 123));
@@ -75,7 +75,7 @@ public function testParamsAndReturnsOfMixedType(): void
     {
         $returns = new MixedType();
 
-        $this->assertEquals((new \stdClass()), $returns->paramAndReturnMixed((new \stdClass())));
+        $this->assertEquals(new \stdClass(), $returns->paramAndReturnMixed(new \stdClass()));
         $this->assertSame([], $returns->paramAndReturnMixed([]));
         $this->assertSame('mixed string', $returns->paramAndReturnMixed('mixed string'));
         $this->assertSame(1, $returns->paramAndReturnMixed(1));
diff --git a/tests/Extension/Types/ObjTypeTest.php b/tests/Extension/Types/ObjTypeTest.php
index cf3539fdf3..e77883d5ad 100644
--- a/tests/Extension/Types/ObjTypeTest.php
+++ b/tests/Extension/Types/ObjTypeTest.php
@@ -14,7 +14,6 @@
 namespace Extension\Types;
 
 use PHPUnit\Framework\TestCase;
-use stdClass;
 use Stub\Types\Obj;
 
 final class ObjTypeTest extends TestCase
@@ -24,7 +23,7 @@ public function testIntFalse(): void
         $class = new Obj();
 
         $this->assertNull($class->nullableObjectReturnNull());
-        $this->assertInstanceOf(stdClass::class, $class->nullableObjectReturnObj());
-        $this->assertInstanceOf(stdClass::class, $class->objectReturn());
+        $this->assertInstanceOf(\stdClass::class, $class->nullableObjectReturnObj());
+        $this->assertInstanceOf(\stdClass::class, $class->objectReturn());
     }
 }
diff --git a/tests/Extension/UnsetTest.php b/tests/Extension/UnsetTest.php
index f448537875..6f8ed957b5 100644
--- a/tests/Extension/UnsetTest.php
+++ b/tests/Extension/UnsetTest.php
@@ -49,7 +49,7 @@ public function xtestUnsetValueFromProperty(): void
 
     public function xtestStdClassUnset(): void
     {
-        $equalsStdClass = new \StdClass();
+        $equalsStdClass = new \stdClass();
         $equalsStdClass->property1 = 12345;
         $equalsStdClass->property3 = 12345;
 
diff --git a/tests/Extension/VarsTest.php b/tests/Extension/VarsTest.php
index 61df81ff96..9791119b8f 100644
--- a/tests/Extension/VarsTest.php
+++ b/tests/Extension/VarsTest.php
@@ -62,9 +62,7 @@ public function testVarDumpWithTwoParams(): void
     public function testVarDumpWithThreeParams(): void
     {
         $this->setOutputCallback(
-            function ($output) {
-                return str_replace(["\n", ' '], '', $output);
-            }
+            fn ($output) => str_replace(["\n", ' '], '', $output)
         );
 
         $this->expectOutputString(
@@ -80,9 +78,7 @@ function ($output) {
     public function testVarExport(): void
     {
         $this->setOutputCallback(
-            function ($output) {
-                return str_replace(["\n", ' '], '', $output);
-            }
+            fn ($output) => str_replace(["\n", ' '], '', $output)
         );
 
         $this->expectOutputString(
@@ -123,9 +119,7 @@ public function testVarDumpAndCountOptimizer(): void
     public function testArrayTypeVarDumpAndExport(): void
     {
         $this->setOutputCallback(
-            function ($output) {
-                return str_replace(["\n", ' '], '', $output);
-            }
+            fn ($output) => str_replace(["\n", ' '], '', $output)
         );
 
         $this->expectOutputString(
diff --git a/tests/Zephir/AliasManagerTest.php b/tests/Zephir/AliasManagerTest.php
index 70e4c66fcb..65f76767e6 100644
--- a/tests/Zephir/AliasManagerTest.php
+++ b/tests/Zephir/AliasManagerTest.php
@@ -1,7 +1,5 @@
 
+ *
+ * For the full copyright and license information, please view
+ * the LICENSE file that was distributed with this source code.
+ */
+
+declare(strict_types=1);
+
+namespace Zephir\Test\Class;
+
+use PHPUnit\Framework\TestCase;
+use Zephir\Class\Entry;
+
+final class EntryTest extends TestCase
+{
+    public function testShouldEscapeClassName(): void
+    {
+        $classname = '\Bar\Foo';
+        $this->assertSame(
+            Entry::escape($classname),
+            '\\\\Bar\\\\Foo'
+        );
+    }
+}
diff --git a/tests/Zephir/CompilerFile/CheckDependenciesTest.php b/tests/Zephir/CompilerFile/CheckDependenciesTest.php
index 1201582e70..acf9e52d43 100644
--- a/tests/Zephir/CompilerFile/CheckDependenciesTest.php
+++ b/tests/Zephir/CompilerFile/CheckDependenciesTest.php
@@ -15,10 +15,10 @@
 
 use PHPUnit\Framework\TestCase;
 use Psr\Log\Test\TestLogger;
-use ReflectionException;
 use Zephir\AliasManager;
-use Zephir\Backends\ZendEngine3\Backend;
+use Zephir\Backend\Backend;
 use Zephir\Compiler;
+use Zephir\Compiler\CompilerFileFactory;
 use Zephir\CompilerFile;
 use Zephir\Config;
 use Zephir\FileSystem\HardDisk;
@@ -28,15 +28,15 @@
 final class CheckDependenciesTest extends TestCase
 {
     /**
-     * @throws ReflectionException
+     * @throws \ReflectionException
      */
     public function testExtendsClassThatDoesNotExist(): void
     {
         $logger = new TestLogger();
         $config = new Config();
-        $backend = new Backend($config, 'kernels', 'templates');
+        $backend = new Backend($config, 'kernel', 'templates');
         $disk = new HardDisk(realpath('..').'/tests/output');
-        $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger);
+        $compilerFactory = new CompilerFileFactory($config, $disk, $logger);
 
         $compiler = new Compiler($config, $backend, new Manager(new Parser()), $disk, $compilerFactory);
 
diff --git a/tests/Zephir/CompilerFile/CheckPathSeparatorTest.php b/tests/Zephir/CompilerFile/CheckPathSeparatorTest.php
index c5dd8fc521..d3c113e3a8 100644
--- a/tests/Zephir/CompilerFile/CheckPathSeparatorTest.php
+++ b/tests/Zephir/CompilerFile/CheckPathSeparatorTest.php
@@ -22,6 +22,6 @@ public function testExtendsClassThatDoesNotExist(): void
         $configM4Path = realpath(__DIR__.'/../../../ext/config.m4');
         $configM4Contents = file_get_contents($configM4Path);
 
-        $this->assertTrue(strpos($configM4Contents, 'stub/oo/abstractstatic.zep.c') !== false);
+        $this->assertTrue(str_contains($configM4Contents, 'stub/oo/abstractstatic.zep.c'));
     }
 }
diff --git a/tests/Zephir/ConfigTest.php b/tests/Zephir/ConfigTest.php
index e7debd114c..8f4458d058 100644
--- a/tests/Zephir/ConfigTest.php
+++ b/tests/Zephir/ConfigTest.php
@@ -15,7 +15,7 @@
 
 use PHPUnit\Framework\TestCase;
 use Zephir\Config;
-use function Zephir\is_windows;
+use Zephir\Os;
 
 final class ConfigTest extends TestCase
 {
@@ -65,15 +65,15 @@ private function cleanTmpConfigFile(): void
     private function stubsBanner(): string
     {
         return <<
- *
- * For the full copyright and license information, please view
- * the LICENSE file that was distributed with this source code.
- */
-DOC;
+            /**
+             * This file is part of the Zephir.
+             *
+             * (c) Phalcon Team 
+             *
+             * For the full copyright and license information, please view
+             * the LICENSE file that was distributed with this source code.
+             */
+            DOC;
     }
 
     /**
@@ -132,7 +132,7 @@ public function setConfigProvider(): array
      */
     public function testShouldSetConfigParams(array $test, $expected): void
     {
-        list($key, $value, $namespace) = $test;
+        [$key, $value, $namespace] = $test;
         $this->config->set($key, $value, $namespace);
 
         $actual = $this->config->get($key, $namespace);
@@ -167,9 +167,9 @@ public function defaultConfigProvider(): array
      * @param string $key
      * @param mixed  $expected
      */
-    public function testShouldGetDefaultConfigParams($namespace, string $key, $expected)
+    public function testShouldGetDefaultConfigParams($namespace, string $key, $expected): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
@@ -229,7 +229,7 @@ public function testShouldUnsetConfigParams(): void
 
     public function testShouldGetBannerFromConfig(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
diff --git a/tests/Zephir/Documentation/DocblockParserTest.php b/tests/Zephir/Documentation/DocblockParserTest.php
index c827b6619e..895cfbc40f 100644
--- a/tests/Zephir/Documentation/DocblockParserTest.php
+++ b/tests/Zephir/Documentation/DocblockParserTest.php
@@ -20,31 +20,30 @@
 use Zephir\Documentation\Annotation\See;
 use Zephir\Documentation\Docblock;
 use Zephir\Documentation\DocblockParser;
-
-use function Zephir\is_windows;
+use Zephir\Os;
 
 final class DocblockParserTest extends TestCase
 {
     public function testShouldParseDocblockFromString(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
         $test = <<getLinkText();
diff --git a/tests/Zephir/Documentation/DocblockTest.php b/tests/Zephir/Documentation/DocblockTest.php
index d29aa2f8fe..04f5d9f7de 100644
--- a/tests/Zephir/Documentation/DocblockTest.php
+++ b/tests/Zephir/Documentation/DocblockTest.php
@@ -75,16 +75,16 @@ public function testShouldAddAnnotations(): void
     public function testShouldGenerateDocblock(): void
     {
         $expected = <<docblock->setDescription('Example description block.');
         $this->docblock->setSummary('Example summary block.');
         $this->docblock->setAnnotations([
diff --git a/tests/Zephir/FunctionLike/ReturnType/CastHintTest.php b/tests/Zephir/FunctionLike/ReturnType/CastHintTest.php
deleted file mode 100644
index 4df7cd526d..0000000000
--- a/tests/Zephir/FunctionLike/ReturnType/CastHintTest.php
+++ /dev/null
@@ -1,82 +0,0 @@
-
- *
- * For the full copyright and license information, please view
- * the LICENSE file that was distributed with this source code.
- */
-
-namespace Zephir\Test\FunctionLike\ReturnType;
-
-use PHPUnit\Framework\TestCase;
-use Zephir\FunctionLike\ReturnType\CastHint;
-use Zephir\FunctionLike\ReturnType\TypeInterface;
-use Zephir\Types;
-
-final class CastHintTest extends TestCase
-{
-    public function testShouldReturnType(): void
-    {
-        $type = new CastHint(Types::T_OBJECT, 'Class1');
-        $this->assertEquals(TypeInterface::TYPE_PARAMETER, $type->getType());
-
-        $type = new CastHint(Types::T_OBJECT, 'Class2', TypeInterface::TYPE_ANNOTATION);
-        $this->assertEquals(TypeInterface::TYPE_ANNOTATION, $type->getType());
-
-        $type = new CastHint(Types::T_OBJECT, 'Class3', 'return-type-custom');
-        $this->assertEquals('return-type-custom', $type->getType());
-    }
-
-    public function testShouldReturnDataType(): void
-    {
-        $type = new CastHint(Types::T_OBJECT, 'Class1');
-        $this->assertEquals(Types::T_OBJECT, $type->getDataType());
-
-        $type = new CastHint(Types::T_UNDEFINED, 'Class2');
-        $this->assertEquals(Types::T_UNDEFINED, $type->getDataType());
-    }
-
-    public function testShouldReturnValue(): void
-    {
-        $type = new CastHint(Types::T_OBJECT, 'Class1');
-        $this->assertEquals('Class1', $type->getValue());
-
-        $type = new CastHint(Types::T_OBJECT, '\A\Namespaced\Class\Foo');
-        $this->assertEquals('\A\Namespaced\Class\Foo', $type->getValue());
-    }
-
-    public function testShouldAlwaysBeNotMandatory(): void
-    {
-        $type = new CastHint(Types::T_OBJECT, 'Class1');
-        $this->assertFalse($type->isMandatory());
-
-        $type = new CastHint(Types::T_OBJECT, 'Class2', TypeInterface::TYPE_ANNOTATION);
-        $this->assertFalse($type->isMandatory());
-    }
-
-    public function testShouldDetectCollectionNature(): void
-    {
-        $type = new CastHint(Types::T_OBJECT, 'Class1');
-        $this->assertFalse($type->isCollection());
-
-        $type = new CastHint(Types::T_OBJECT, 'Class1', TypeInterface::TYPE_ANNOTATION, true);
-        $this->assertTrue($type->isCollection());
-
-        $type = new CastHint(Types::T_OBJECT, 'Class1', TypeInterface::TYPE_PARAMETER, true);
-        $this->assertTrue($type->isCollection());
-
-        $type = new CastHint(Types::T_OBJECT, 'Class1', TypeInterface::TYPE_PARAMETER, false);
-        $this->assertFalse($type->isCollection());
-    }
-
-    public function testShouldAlwaysBeRealType(): void
-    {
-        $type = new CastHint(Types::T_OBJECT, 'Class1');
-        $this->assertFalse($type->isRealType());
-    }
-}
diff --git a/tests/Zephir/FunctionLike/ReturnType/CollectionTest.php b/tests/Zephir/FunctionLike/ReturnType/CollectionTest.php
deleted file mode 100644
index f68247d3a8..0000000000
--- a/tests/Zephir/FunctionLike/ReturnType/CollectionTest.php
+++ /dev/null
@@ -1,567 +0,0 @@
-
- *
- * For the full copyright and license information, please view
- * the LICENSE file that was distributed with this source code.
- */
-
-namespace Zephir\Test\FunctionLike\ReturnType;
-
-use PHPUnit\Framework\TestCase;
-use Zephir\Exception\InvalidArgumentException;
-use Zephir\FunctionLike\ReturnType\CastHint;
-use Zephir\FunctionLike\ReturnType\Collection;
-use Zephir\FunctionLike\ReturnType\RealType;
-use Zephir\Types;
-
-final class CollectionTest extends TestCase
-{
-    public function testShouldThrowExceptionOnInvalidAttachedObject(): void
-    {
-        $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage(
-            'Expecting an instance of Zephir\FunctionLike\ReturnType\TypeInterface, got instance of stdClass'
-        );
-
-        $collection = new Collection();
-        $collection->attach(new \stdClass());
-    }
-
-    public function testShouldThrowExceptionOnInvalidAttachedValue(): void
-    {
-        $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage(
-            'Expecting an instance of Zephir\FunctionLike\ReturnType\TypeInterface, got array'
-        );
-
-        $collection = new Collection();
-        $collection->attach([]);
-    }
-
-    public function testShouldAttachTypes(): void
-    {
-        $collection = new Collection();
-
-        $collection->attach(new RealType(Types::T_INT));
-        $this->assertCount(1, $collection);
-
-        $collection->attach(new RealType(Types::T_INT));
-        $this->assertCount(1, $collection);
-
-        $collection->attach(new RealType(Types::T_STRING));
-        $this->assertCount(2, $collection);
-
-        $collection->attach(new RealType(Types::T_VOID));
-        $this->assertCount(3, $collection);
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertCount(4, $collection);
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class2'));
-        $this->assertCount(4, $collection);
-    }
-
-    public function testShouldDetectOnlyVoid(): void
-    {
-        $collection = new Collection();
-
-        $this->assertFalse($collection->onlyVoid());
-
-        $collection->attach(new RealType(Types::T_VOID));
-        $this->assertTrue($collection->onlyVoid());
-
-        $collection->attach(new RealType(Types::T_INT));
-        $this->assertFalse($collection->onlyVoid());
-    }
-
-    public function testShouldCheckIfTheCollectionHasRealTypeOrCastHints(): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->hasReturnTypes());
-
-        $collection->attach(new RealType(Types::T_VOID));
-        $this->assertFalse($collection->hasReturnTypes());
-
-        $collection->attach(new RealType(Types::T_INT));
-        $this->assertTrue($collection->hasReturnTypes());
-
-        $collection = new Collection();
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertTrue($collection->hasReturnTypes());
-    }
-
-    public function testShouldDetectWhetherReturnTypesAreNullCompatible(): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->areReturnTypesNullCompatible());
-
-        $collection->attach(new RealType(Types::T_VOID));
-        $this->assertFalse($collection->areReturnTypesNullCompatible());
-
-        $collection->attach(new RealType(Types::T_NULL));
-        $this->assertTrue($collection->areReturnTypesNullCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new RealType(Types::T_NULL));
-        $this->assertTrue($collection->areReturnTypesNullCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertFalse($collection->areReturnTypesNullCompatible());
-    }
-
-    public function testShouldDetectWhetherReturnTypesAreSpecial(): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->onlySpecial());
-
-        $collection->attach(new RealType(Types::T_VOID));
-        $this->assertFalse($collection->onlySpecial());
-
-        $collection->attach(new CastHint(Types::T_NUMBER, null));
-        $this->assertFalse($collection->onlySpecial());
-
-        $collection = new Collection();
-        $collection->attach(new CastHint(Types::T_NUMBER, null));
-        $this->assertTrue($collection->onlySpecial());
-
-        $collection->attach(new CastHint(Types::T_RESOURCE, null));
-        $collection->attach(new CastHint(Types::T_VARIABLE, null));
-        $collection->attach(new CastHint(Types::T_CALLABLE, null));
-        $collection->attach(new CastHint(Types::T_ITERABLE, null));
-        $this->assertTrue($collection->onlySpecial());
-
-        $collection->attach(new CastHint(Types::T_OBJECT, null));
-        $this->assertFalse($collection->onlySpecial());
-    }
-
-    /**
-     * @dataProvider intCompatibleProvider
-     *
-     * @param string $type
-     * @param bool   $expected
-     */
-    public function testShouldDetectWhetherReturnTypesAreIntCompatible(string $type, bool $expected): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->areReturnTypesIntCompatible());
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertFalse($collection->areReturnTypesIntCompatible());
-
-        $collection->attach(new RealType($type));
-        $this->assertSame($expected, $collection->areReturnTypesIntCompatible());
-    }
-
-    public function testShouldDetectWhetherReturnTypesAreDoubleCompatible(): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->areReturnTypesDoubleCompatible());
-
-        $collection->attach(new RealType(Types::T_VOID));
-        $this->assertFalse($collection->areReturnTypesDoubleCompatible());
-
-        $collection->attach(new RealType(Types::T_DOUBLE));
-        $this->assertTrue($collection->areReturnTypesDoubleCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new RealType(Types::T_DOUBLE));
-        $this->assertTrue($collection->areReturnTypesDoubleCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertFalse($collection->areReturnTypesDoubleCompatible());
-    }
-
-    public function testShouldDetectWhetherReturnTypesAreBoolCompatible(): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->areReturnTypesBoolCompatible());
-
-        $collection->attach(new RealType(Types::T_VOID));
-        $this->assertFalse($collection->areReturnTypesBoolCompatible());
-
-        $collection->attach(new RealType(Types::T_BOOL));
-        $this->assertTrue($collection->areReturnTypesBoolCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new RealType(Types::T_BOOL));
-        $this->assertTrue($collection->areReturnTypesBoolCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertFalse($collection->areReturnTypesBoolCompatible());
-    }
-
-    /**
-     * @dataProvider stringCompatibleProvider
-     *
-     * @param string $type
-     * @param bool   $expected
-     */
-    public function testShouldDetectWhetherReturnTypesAreStringCompatible(string $type, bool $expected): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->areReturnTypesStringCompatible());
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertFalse($collection->areReturnTypesStringCompatible());
-
-        $collection->attach(new RealType($type));
-        $this->assertSame($expected, $collection->areReturnTypesStringCompatible());
-    }
-
-    public function testShouldDetectWhetherReturnTypesAreArrayCompatible(): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->areReturnTypesArrayCompatible());
-
-        $collection->attach(new RealType(Types::T_VOID));
-        $this->assertFalse($collection->areReturnTypesArrayCompatible());
-
-        $collection->attach(new RealType(Types::T_ARRAY));
-        $this->assertTrue($collection->areReturnTypesArrayCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new RealType(Types::T_ARRAY));
-        $this->assertTrue($collection->areReturnTypesArrayCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1', null, true));
-        $this->assertTrue($collection->areReturnTypesArrayCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertFalse($collection->areReturnTypesArrayCompatible());
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1', null, true));
-        $this->assertFalse($collection->areReturnTypesArrayCompatible());
-
-        $collection->attach(new CastHint(Types::T_UNDEFINED, 'Class2', null, false));
-        $this->assertFalse($collection->areReturnTypesArrayCompatible());
-
-        $collection->attach(new CastHint(Types::T_UNDEFINED, 'Class3', null, true));
-        $this->assertFalse($collection->areReturnTypesArrayCompatible());
-    }
-
-    public function testShouldDetectWhetherReturnTypesAreObjectCompatible(): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->areReturnTypesObjectCompatible());
-
-        $collection->attach(new CastHint(Types::T_UNDEFINED, 'Class1'));
-        $this->assertFalse($collection->areReturnTypesObjectCompatible());
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class2'));
-        $this->assertTrue($collection->areReturnTypesObjectCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertTrue($collection->areReturnTypesObjectCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1', null, true));
-        $this->assertFalse($collection->areReturnTypesObjectCompatible());
-
-        $collection = new Collection();
-        $collection->attach(new RealType(Types::T_VOID));
-        $this->assertFalse($collection->areReturnTypesObjectCompatible());
-    }
-
-    public function testShouldDetectWellKnownTypes(): void
-    {
-        $collection = new Collection();
-        $this->assertFalse($collection->areReturnTypesWellKnown());
-
-        $wellKnown = [
-            Types::T_INT,
-            Types::T_UINT,
-            Types::T_CHAR,
-            Types::T_UCHAR,
-            Types::T_LONG,
-            Types::T_ULONG,
-            Types::T_DOUBLE,
-            Types::T_NULL,
-            Types::T_BOOL,
-            Types::T_STRING,
-            Types::T_ISTRING,
-            Types::T_VOID,
-            Types::T_ARRAY,
-        ];
-
-        foreach ($wellKnown as $type) {
-            $collection->attach(new RealType($type));
-        }
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertTrue($collection->areReturnTypesWellKnown());
-
-        $collection->attach(new RealType(Types::T_FLOAT));
-        $this->assertFalse($collection->areReturnTypesWellKnown());
-
-        $otherTypes = [
-            Types::T_FLOAT,
-            Types::T_NUMBER,
-            Types::T_VARIABLE,
-            Types::T_MIXED,
-            Types::T_CALLABLE,
-            Types::T_ITERABLE,
-            Types::T_RESOURCE,
-            Types::T_UNDEFINED,
-        ];
-
-        $collection = new Collection();
-
-        foreach ($otherTypes as $type) {
-            $collection->attach(new RealType($type));
-        }
-
-        $this->assertFalse($collection->areReturnTypesWellKnown());
-
-        foreach ($wellKnown as $type) {
-            $collection->attach(new RealType($type));
-        }
-
-        $this->assertFalse($collection->areReturnTypesWellKnown());
-    }
-
-    /**
-     * @dataProvider compatibleTypesProvider
-     *
-     * @param string $type
-     */
-    public function testShouldDetectCompatibleTypesForTrivialCases(string $type): void
-    {
-        $collection = new Collection();
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new RealType($type));
-        $this->assertTrue($collection->areReturnTypesCompatible());
-    }
-
-    public function intCompatibleProvider(): array
-    {
-        $expected = [
-            true, true, true, true, true, true,
-            false, false, false, false, false,
-            false, false, false, false, false,
-            false, false, false, false, false, false,
-        ];
-
-        return array_map(
-            function ($type, $expected) {
-                return [$type[0], $expected];
-            },
-            $this->compatibleTypesProvider(),
-            $expected
-        );
-    }
-
-    public function stringCompatibleProvider(): array
-    {
-        $expected = [
-            false, false, false, false, false,
-            false, false, false, false, false, false,
-            true, true,
-            false, false, false, false, false,
-            false, false, false, false,
-        ];
-
-        return array_map(
-            function ($type, $expected) {
-                return [$type[0], $expected];
-            },
-            $this->compatibleTypesProvider(),
-            $expected
-        );
-    }
-
-    public function compatibleTypesProvider(): array
-    {
-        return [
-            'int' => [Types::T_INT],
-            'iunt' => [Types::T_UINT],
-            'char' => [Types::T_CHAR],
-            'uchar' => [Types::T_UCHAR],
-            'long' => [Types::T_LONG],
-            'ulong' => [Types::T_ULONG],
-            'double' => [Types::T_DOUBLE],
-            'float' => [Types::T_FLOAT],
-            'null' => [Types::T_NULL],
-            'number' => [Types::T_NUMBER],
-            'bool' => [Types::T_BOOL],
-            'string' => [Types::T_STRING],
-            'istring' => [Types::T_ISTRING],
-            'void' => [Types::T_VOID],
-            'variable' => [Types::T_VARIABLE],
-            'mixed' => [Types::T_MIXED],
-            'array' => [Types::T_ARRAY],
-            'object' => [Types::T_OBJECT],
-            'callable' => [Types::T_CALLABLE],
-            'iterable' => [Types::T_ITERABLE],
-            'resource' => [Types::T_RESOURCE],
-            'undefined' => [Types::T_UNDEFINED],
-        ];
-    }
-
-    public function testShouldDetectCompatibleTypesForObjectLike(): void
-    {
-        $collection = new Collection();
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new CastHint(Types::T_RESOURCE, null, null, true));
-        $this->assertFalse($collection->areReturnTypesCompatible());
-    }
-
-    public function testShouldDetectCompatibleTypesForCollections(): void
-    {
-        $collection = new Collection();
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1', null, true));
-        $collection->attach(new RealType(Types::T_ARRAY));
-
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection = new Collection();
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $collection->attach(new RealType(Types::T_ARRAY));
-
-        $this->assertFalse($collection->areReturnTypesCompatible());
-    }
-
-    public function testShouldDetectCompatibleTypesForIntegers(): void
-    {
-        $collection = new Collection();
-
-        $collection->attach(new RealType(Types::T_CHAR));
-        $collection->attach(new RealType(Types::T_UCHAR));
-        $collection->attach(new RealType(Types::T_INT));
-        $collection->attach(new RealType(Types::T_UINT));
-        $collection->attach(new RealType(Types::T_LONG));
-        $collection->attach(new RealType(Types::T_ULONG));
-
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new RealType(Types::T_ARRAY));
-        $this->assertFalse($collection->areReturnTypesCompatible());
-    }
-
-    public function testShouldDetectCompatibleTypesForBool(): void
-    {
-        $collection = new Collection();
-
-        $collection->attach(new RealType(Types::T_BOOL));
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new RealType(Types::T_CHAR));
-        $this->assertFalse($collection->areReturnTypesCompatible());
-    }
-
-    public function testShouldDetectCompatibleTypesForString(): void
-    {
-        $collection = new Collection();
-
-        $collection->attach(new RealType(Types::T_STRING));
-        $collection->attach(new RealType(Types::T_ISTRING));
-
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new RealType(Types::T_BOOL));
-        $this->assertFalse($collection->areReturnTypesCompatible());
-    }
-
-    public function testShouldDetectCompatibleTypesForDouble(): void
-    {
-        $collection = new Collection();
-
-        $collection->attach(new RealType(Types::T_DOUBLE));
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new RealType(Types::T_STRING));
-        $this->assertFalse($collection->areReturnTypesCompatible());
-    }
-
-    public function testShouldDetectCompatibleTypesForKnownTypes(): void
-    {
-        $collection = new Collection();
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new RealType(Types::T_NULL));
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new RealType(Types::T_ARRAY));
-        $this->assertFalse($collection->areReturnTypesCompatible());
-
-        $collection = new Collection();
-
-        $collection->attach(new RealType(Types::T_ARRAY));
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new RealType(Types::T_CHAR));
-        $collection->attach(new RealType(Types::T_BOOL));
-        $collection->attach(new RealType(Types::T_STRING));
-        $collection->attach(new RealType(Types::T_DOUBLE));
-
-        $this->assertFalse($collection->areReturnTypesCompatible());
-
-        $collection = new Collection();
-
-        $collection->attach(new RealType(Types::T_ISTRING));
-        $collection->attach(new RealType(Types::T_NULL));
-
-        $this->assertTrue($collection->areReturnTypesCompatible());
-
-        $collection->attach(new CastHint(Types::T_RESOURCE, null));
-        $this->assertFalse($collection->areReturnTypesCompatible());
-
-        $collection = new Collection();
-
-        $collection->attach(new RealType(Types::T_NULL));
-        $this->assertTrue($collection->areReturnTypesCompatible());
-    }
-
-    public function testShouldGetOnlyRealTypes(): void
-    {
-        $collection = new Collection();
-        $this->assertCount(0, $collection->getRealReturnTypes());
-
-        $collection->attach(new RealType(Types::T_ARRAY));
-        $this->assertCount(1, $collection->getRealReturnTypes());
-
-        $collection->attach(new RealType(Types::T_CHAR));
-        $collection->attach(new RealType(Types::T_BOOL));
-        $collection->attach(new RealType(Types::T_STRING));
-        $collection->attach(new RealType(Types::T_DOUBLE));
-        $this->assertCount(5, $collection->getRealReturnTypes());
-
-        $collection->attach(new CastHint(Types::T_RESOURCE, null));
-        $this->assertCount(5, $collection->getRealReturnTypes());
-    }
-
-    public function testShouldGetOnlyCastHint(): void
-    {
-        $collection = new Collection();
-        $this->assertCount(0, $collection->getCastHintedReturnTypes());
-
-        $collection->attach(new CastHint(Types::T_RESOURCE, null));
-        $this->assertCount(1, $collection->getCastHintedReturnTypes());
-
-        $collection->attach(new RealType(Types::T_ARRAY));
-        $this->assertCount(1, $collection->getCastHintedReturnTypes());
-
-        $collection->attach(new CastHint(Types::T_OBJECT, 'Class1'));
-        $collection->attach(new CastHint(Types::T_CALLABLE, null, null, true));
-        $this->assertCount(3, $collection->getCastHintedReturnTypes());
-    }
-}
diff --git a/tests/Zephir/FunctionLike/ReturnType/FactoryTest.php b/tests/Zephir/FunctionLike/ReturnType/FactoryTest.php
deleted file mode 100644
index 86fe79124d..0000000000
--- a/tests/Zephir/FunctionLike/ReturnType/FactoryTest.php
+++ /dev/null
@@ -1,122 +0,0 @@
-
- *
- * For the full copyright and license information, please view
- * the LICENSE file that was distributed with this source code.
- */
-
-namespace Zephir\Test\FunctionLike\ReturnType;
-
-use PHPUnit\Framework\TestCase;
-use Zephir\FunctionLike\ReturnType\CastHint;
-use Zephir\FunctionLike\ReturnType\Factory;
-use Zephir\FunctionLike\ReturnType\RealType;
-use Zephir\FunctionLike\ReturnType\TypeInterface;
-use Zephir\Types;
-
-final class FactoryTest extends TestCase
-{
-    /**
-     * @dataProvider realTypeDataProvider
-     *
-     * @param array $ir
-     */
-    public function testShouldCreateRealType(array $ir): void
-    {
-        $factory = new Factory();
-        $this->assertInstanceOf(RealType::class, $factory->create($ir));
-    }
-
-    public function realTypeDataProvider(): array
-    {
-        return [
-            [
-                [
-                    'data-type' => Types::T_STRING,
-                    'mandatory' => 0,
-                    'type' => TypeInterface::TYPE_PARAMETER,
-                ],
-            ],
-            [
-                [
-                    'data-type' => Types::T_DOUBLE,
-                    'mandatory' => 1,
-                    'type' => TypeInterface::TYPE_ANNOTATION,
-                ],
-            ],
-            [
-                [
-                    Types::T_INT,
-                ],
-            ],
-            [
-                [
-                    Types::T_UNDEFINED,
-                ],
-            ],
-        ];
-    }
-
-    /**
-     * @dataProvider castHintDataProvider
-     *
-     * @param array $ir
-     */
-    public function testShouldCreateCastHint(array $ir): void
-    {
-        $factory = new Factory();
-        $this->assertInstanceOf(CastHint::class, $factory->create($ir));
-    }
-
-    public function castHintDataProvider(): array
-    {
-        return [
-            [
-                [
-                    'cast' => [
-                        'type' => Types::T_VARIABLE,
-                        'mandatory' => 0,
-                    ],
-                    'type' => TypeInterface::TYPE_PARAMETER,
-                ],
-            ],
-            [
-                [
-                    'cast' => [
-                        'type' => Types::T_VARIABLE,
-                        'value' => 'Class1',
-                    ],
-                    'type' => TypeInterface::TYPE_ANNOTATION,
-                    'collection' => 0,
-                ],
-            ],
-            [
-                [
-                    'cast' => [
-                        'value' => 'Class1',
-                    ],
-                    'collection' => 1,
-                ],
-            ],
-            [
-                [
-                    'cast' => [
-                        'value' => null,
-                    ],
-                    'type' => Types::T_INT,
-                ],
-            ],
-            [
-                [
-                    'cast' => [],
-                ],
-            ],
-        ];
-    }
-}
diff --git a/tests/Zephir/FunctionLike/ReturnType/RealTypeTest.php b/tests/Zephir/FunctionLike/ReturnType/RealTypeTest.php
deleted file mode 100644
index f2dc8275c6..0000000000
--- a/tests/Zephir/FunctionLike/ReturnType/RealTypeTest.php
+++ /dev/null
@@ -1,79 +0,0 @@
-
- *
- * For the full copyright and license information, please view
- * the LICENSE file that was distributed with this source code.
- */
-
-namespace Zephir\Test\FunctionLike\ReturnType;
-
-use PHPUnit\Framework\TestCase;
-use Zephir\FunctionLike\ReturnType\RealType;
-use Zephir\FunctionLike\ReturnType\TypeInterface;
-use Zephir\Types;
-
-final class RealTypeTest extends TestCase
-{
-    public function testShouldReturnType(): void
-    {
-        $type = new RealType(Types::T_STRING);
-        $this->assertEquals(TypeInterface::TYPE_PARAMETER, $type->getType());
-
-        $type = new RealType(Types::T_STRING, false, TypeInterface::TYPE_ANNOTATION);
-        $this->assertEquals(TypeInterface::TYPE_ANNOTATION, $type->getType());
-
-        $type = new RealType(Types::T_STRING, false, 'return-type-custom');
-        $this->assertEquals('return-type-custom', $type->getType());
-    }
-
-    public function testShouldReturnMandatoryStatus(): void
-    {
-        $type = new RealType(Types::T_STRING);
-        $this->assertFalse($type->isMandatory());
-
-        $type = new RealType(Types::T_STRING, false);
-        $this->assertFalse($type->isMandatory());
-
-        $type = new RealType(Types::T_STRING, true);
-        $this->assertTrue($type->isMandatory());
-    }
-
-    public function testShouldAlwaysHaveNullableValue(): void
-    {
-        $type = new RealType(Types::T_STRING);
-        $this->assertNull($type->getValue());
-    }
-
-    public function testShouldAlwaysBeNotACollection(): void
-    {
-        $type = new RealType(Types::T_STRING);
-        $this->assertFalse($type->isCollection());
-
-        $type = new RealType(Types::T_ARRAY);
-        $this->assertFalse($type->isCollection());
-    }
-
-    public function testShouldReturnDataType(): void
-    {
-        $type = new RealType(Types::T_STRING);
-        $this->assertEquals(Types::T_STRING, $type->getDataType());
-
-        $type = new RealType(Types::T_INT, false, TypeInterface::TYPE_ANNOTATION);
-        $this->assertEquals(Types::T_INT, $type->getDataType());
-
-        $type = new RealType(Types::T_VOID, true, 'return-type-custom');
-        $this->assertEquals(Types::T_VOID, $type->getDataType());
-    }
-
-    public function testShouldAlwaysBeRealType(): void
-    {
-        $type = new RealType(Types::T_STRING);
-        $this->assertTrue($type->isRealType());
-    }
-}
diff --git a/tests/Zephir/Logger/Formatter/CompilerFormatterTest.php b/tests/Zephir/Logger/Formatter/CompilerFormatterTest.php
index 15def00c33..3a3fc11d09 100644
--- a/tests/Zephir/Logger/Formatter/CompilerFormatterTest.php
+++ b/tests/Zephir/Logger/Formatter/CompilerFormatterTest.php
@@ -16,8 +16,7 @@
 use PHPUnit\Framework\TestCase;
 use Zephir\Config;
 use Zephir\Logger\Formatter\CompilerFormatter;
-
-use function Zephir\is_windows;
+use Zephir\Os;
 
 final class CompilerFormatterTest extends TestCase
 {
@@ -73,7 +72,7 @@ public function testShouldBeQuietForDisabledWarning(): void
 
     public function testShouldFormatWarningForCategory(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
diff --git a/tests/Zephir/HelpersTest.php b/tests/Zephir/NameTest.php
similarity index 74%
rename from tests/Zephir/HelpersTest.php
rename to tests/Zephir/NameTest.php
index 376d81467d..9a7b072533 100644
--- a/tests/Zephir/HelpersTest.php
+++ b/tests/Zephir/NameTest.php
@@ -1,7 +1,5 @@
 assertSame(
-            escape_class($classname),
-            '\\\\Bar\\\\Foo'
-        );
-    }
-
-    public function testShouldCamelizeClassName(): void
+    public function testCamelize(): void
     {
         $name = 'foo_Bar_Foo_bar';
-        $this->assertSame(
-            camelize($name),
-            'FooBarFooBar'
-        );
+        $this->assertSame(Name::camelize($name), 'FooBarFooBar');
     }
 
     public function cStringProvider(): array
@@ -70,12 +55,9 @@ public function cStringProvider(): array
 
     /**
      * @dataProvider cStringProvider
-     *
-     * @param string $testString
-     * @param string $expected
      */
-    public function testShouldPrepareStringAsCString(string $testString, string $expected): void
+    public function testAddSlashes(string $testString, string $expected): void
     {
-        $this->assertSame($expected, add_slashes($testString));
+        $this->assertSame($expected, Name::addSlashes($testString));
     }
 }
diff --git a/tests/Zephir/Optimizers/FunctionCall/PregMatchOptimizerTest.php b/tests/Zephir/Optimizers/FunctionCall/PregMatchOptimizerTest.php
index cda80e7caf..7b0cadb0cf 100644
--- a/tests/Zephir/Optimizers/FunctionCall/PregMatchOptimizerTest.php
+++ b/tests/Zephir/Optimizers/FunctionCall/PregMatchOptimizerTest.php
@@ -20,7 +20,7 @@
 use Zephir\Exception\CompilerException;
 use Zephir\Optimizers\FunctionCall\PregMatchOptimizer;
 use Zephir\SymbolTable;
-use Zephir\Variable;
+use Zephir\Variable\Variable;
 
 final class PregMatchOptimizerTest extends TestCase
 {
diff --git a/tests/Zephir/Statements/Let/VariableTest.php b/tests/Zephir/Statements/Let/VariableTest.php
index d8b773b796..d9b7700bb5 100644
--- a/tests/Zephir/Statements/Let/VariableTest.php
+++ b/tests/Zephir/Statements/Let/VariableTest.php
@@ -20,7 +20,7 @@
 use Zephir\Detectors\ReadDetector;
 use Zephir\Exception\CompilerException;
 use Zephir\Statements\Let\Variable;
-use Zephir\Variable as ZephirVariable;
+use Zephir\Variable\Variable as ZephirVariable;
 
 final class VariableTest extends TestCase
 {
@@ -44,21 +44,19 @@ public function exceptionTestProvider(): array
             'immutable variable' => [
                 [],
                 'Cannot mutate variable \'foo\' because it is read only',
-                function (ZephirVariable $var) {
+                function (ZephirVariable $var): void {
                     $var->setReadOnly(true);
                 },
             ],
             'not initialized variable' => [
                 ['operator' => 'concat'],
                 'Cannot mutate variable \'foo\' because it is not initialized',
-                function (ZephirVariable $var) {
-                    return;
-                },
+                fn (ZephirVariable $var) => null,
             ],
             'unknown variable type' => [
                 ['operator' => 'assign'],
                 'Unknown type: prototype',
-                function (ZephirVariable $var) {
+                function (ZephirVariable $var): void {
                     $var->setType('prototype');
                 },
             ],
diff --git a/tests/Zephir/Stubs/DocBlockTest.php b/tests/Zephir/Stubs/DocBlockTest.php
index ac94554824..0e0d43be86 100644
--- a/tests/Zephir/Stubs/DocBlockTest.php
+++ b/tests/Zephir/Stubs/DocBlockTest.php
@@ -14,10 +14,9 @@
 namespace Zephir\Test\Stubs;
 
 use PHPUnit\Framework\TestCase;
+use Zephir\Os;
 use Zephir\Stubs\DocBlock;
 
-use function Zephir\is_windows;
-
 final class DocBlockTest extends TestCase
 {
     public function testInitialState(): void
@@ -29,22 +28,22 @@ public function testInitialState(): void
 
     public function testDescription(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
         $doc = <<markTestSkipped('Warning: Strings contain different line endings!');
         }
 
         $doc = <<assertSame($expected, (string) $docBlock);
@@ -76,23 +75,23 @@ public function testPhpDocs(): void
 
     public function testPhpDocWithDescription(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
         $doc = <<markTestSkipped('Warning: Strings contain different line endings!');
         }
 
         $doc = <<
- * if (\$foo !== \$bar) {
- *     // Some comment
- *
- *     // Another comment
- *
- *     while (true) {
- *         // Some staff
- *     }
- * }
- * 
- *
- * @return string
- */
-DOC;
+            /**
+             * Some method.
+             *
+             * 
+             * if (\$foo !== \$bar) {
+             *     // Some comment
+             *
+             *     // Another comment
+             *
+             *     while (true) {
+             *         // Some staff
+             *     }
+             * }
+             * 
+             *
+             * @return string
+             */
+            DOC;
 
         $expected = <<
-     * if (\$foo !== \$bar) {
-     *     // Some comment
-     *
-     *     // Another comment
-     *
-     *     while (true) {
-     *         // Some staff
-     *     }
-     * }
-     * 
-     *
-     * @return string
-     */
-DOC;
+                /**
+                 * Some method.
+                 *
+                 * 
+                 * if (\$foo !== \$bar) {
+                 *     // Some comment
+                 *
+                 *     // Another comment
+                 *
+                 *     while (true) {
+                 *         // Some staff
+                 *     }
+                 * }
+                 * 
+                 *
+                 * @return string
+                 */
+            DOC;
 
         $docBlock = new DocBlock($doc);
 
@@ -152,57 +151,57 @@ public function testPhpDocWithCodeBloc(): void
 
     public function testPhpDocWithScalarParams(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
         $doc = <<assertSame($expected, (string) $docBlock);
@@ -210,42 +209,42 @@ public function testPhpDocWithScalarParams(): void
 
     public function testPhpDocWithVariousDocBlockTags(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
         $doc = <<
-     * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/)
-     * @license MIT https://docs.zephir-lang.com/0.12/en/license
-     * @link https://github.com/zephir-lang/zephir
-     * @since 1.0.0
-     * @todo Something
-     * @uses MyClass::function doSmthName
-     * @version 1.0.0
-     * @api Some Api Description
-     * @wrongTag - \$somethingStrange
-     */
-DOC;
+                /**
+                 * Method with various tags
+                 * @author Phalcon Team 
+                 * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/)
+                 * @license MIT https://docs.zephir-lang.com/0.12/en/license
+                 * @link https://github.com/zephir-lang/zephir
+                 * @since 1.0.0
+                 * @todo Something
+                 * @uses MyClass::function doSmthName
+                 * @version 1.0.0
+                 * @api Some Api Description
+                 * @wrongTag - \$somethingStrange
+                 */
+            DOC;
 
         $expected = <<
-     * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/)
-     * @license MIT https://docs.zephir-lang.com/0.12/en/license
-     * @link https://github.com/zephir-lang/zephir
-     * @since 1.0.0
-     * @todo Something
-     * @uses MyClass::function doSmthName
-     * @version 1.0.0
-     * @api Some Api Description
-     * @wrongTag - \$somethingStrange
-     */
-DOC;
+                /**
+                 * Method with various tags
+                 *
+                 * @author Phalcon Team 
+                 * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/)
+                 * @license MIT https://docs.zephir-lang.com/0.12/en/license
+                 * @link https://github.com/zephir-lang/zephir
+                 * @since 1.0.0
+                 * @todo Something
+                 * @uses MyClass::function doSmthName
+                 * @version 1.0.0
+                 * @api Some Api Description
+                 * @wrongTag - \$somethingStrange
+                 */
+            DOC;
         $docBlock = new DocBlock($doc);
 
         $this->assertSame($expected, (string) $docBlock);
@@ -253,21 +252,21 @@ public function testPhpDocWithVariousDocBlockTags(): void
 
     public function testPhpDocWithDoubleDollarSymbols(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
         $doc = <<assertSame($expected, (string) $docBlock);
diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php
index e8e6326b02..fa0f2558f3 100644
--- a/tests/Zephir/Stubs/GeneratorTest.php
+++ b/tests/Zephir/Stubs/GeneratorTest.php
@@ -14,17 +14,15 @@
 namespace Zephir\Test\Stubs;
 
 use PHPUnit\Framework\TestCase;
-use ReflectionException;
 use Zephir\AliasManager;
-use Zephir\ClassConstant;
-use Zephir\ClassDefinition;
-use Zephir\ClassMethod;
-use Zephir\ClassMethodParameters;
-use Zephir\ClassProperty;
+use Zephir\Class\Constant;
+use Zephir\Class\Definition\Definition;
+use Zephir\Class\Method\Method;
+use Zephir\Class\Method\Parameters;
+use Zephir\Class\Property;
+use Zephir\Os;
 use Zephir\Stubs\Generator;
 
-use function Zephir\is_windows;
-
 class GeneratorTest extends TestCase
 {
     /**
@@ -32,13 +30,13 @@ class GeneratorTest extends TestCase
      */
     private $generatorClass;
     private Generator $testClass;
-    private ClassDefinition $classDefinition;
+    private Definition $classDefinition;
 
     protected function setUp(): void
     {
         $this->generatorClass = new \ReflectionClass(Generator::class);
         $this->testClass = new Generator([]);
-        $this->classDefinition = new ClassDefinition('Stub\Stubs', 'StubsBuildClass');
+        $this->classDefinition = new Definition('Stub\Stubs', 'StubsBuildClass');
     }
 
     /**
@@ -48,7 +46,7 @@ protected function setUp(): void
      *
      * @return mixed
      *
-     * @throws ReflectionException
+     * @throws \ReflectionException
      */
     private function getMethod(string $name)
     {
@@ -60,50 +58,50 @@ private function getMethod(string $name)
 
     public function testShouldBuildClass(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
         $expected = <<getMethod('buildClass');
 
-        $extendsClassDefinition = new ClassDefinition('Stub\Extendable', 'BaseTestClass');
-        $implementClassDefinition = new ClassDefinition('Stub\Events', 'EventsManagerInterface');
+        $extendsClassDefinition = new Definition('Stub\Extendable', 'BaseTestClass');
+        $implementClassDefinition = new Definition('Stub\Events', 'EventsManagerInterface');
         $aliasManager = new AliasManager();
 
         // Definitions
@@ -129,14 +127,14 @@ public static function init(string \$key, int \$priority = 1)
             ],
         ];
 
-        $classMethod = new ClassMethod(
+        $classMethod = new Method(
             $this->classDefinition,
             ['public', 'static'],
             'init',
-            new ClassMethodParameters($methodParamsDefinition)
+            new Parameters($methodParamsDefinition)
         );
 
-        $constantsDefinition = new ClassConstant(
+        $constantsDefinition = new Constant(
             'DEFAULT_PATH_DELIMITER',
             [
                 'type' => 'string',
@@ -145,7 +143,7 @@ public static function init(string \$key, int \$priority = 1)
             'Default path delimiter'
         );
 
-        $propertyDefinition = new ClassProperty(
+        $propertyDefinition = new Property(
             $this->classDefinition,
             ['public', 'static'],
             'defaultPathDelimiter',
@@ -239,18 +237,19 @@ public function propertyProvider(): array
 
     /**
      * @dataProvider propertyProvider
+     *
      * @covers       \Zephir\Stubs\Generator::buildProperty
      *
      * @param array  $visibility
      * @param string $type
-     * @param $value
+     * @param        $value
      * @param string $expected
      *
-     * @throws ReflectionException
+     * @throws \ReflectionException
      */
     public function testShouldBuildProperty(array $visibility, string $type, $value, string $expected): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
@@ -264,7 +263,7 @@ public function testShouldBuildProperty(array $visibility, string $type, $value,
         // Test requirements initialization
 
         $buildClass = $this->getMethod('buildProperty');
-        $classProperty = new ClassProperty(
+        $classProperty = new Property(
             $this->classDefinition,
             $visibility,
             'testProperty',
@@ -331,14 +330,14 @@ public function constantProvider(): array
      * @dataProvider constantProvider
      *
      * @param string $type
-     * @param $value
+     * @param        $value
      * @param string $expected
      *
-     * @throws ReflectionException
+     * @throws \ReflectionException
      */
     public function testShouldBuildConstant(string $type, $value, string $expected): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
@@ -360,7 +359,7 @@ public function testShouldBuildConstant(string $type, $value, string $expected):
             $extended = $value;
         }
 
-        $classConstant = new ClassConstant(
+        $classConstant = new Constant(
             'TEST',
             [
                 'type' => $type,
@@ -383,7 +382,7 @@ public function testShouldBuildConstant(string $type, $value, string $expected):
 
     public function testShouldBuildMethod(): void
     {
-        if (is_windows()) {
+        if (Os::isWindows()) {
             $this->markTestSkipped('Warning: Strings contain different line endings!');
         }
 
@@ -409,7 +408,7 @@ public function testShouldBuildMethod(): void
                 ],
             ],
         ];
-        $methodParams = new ClassMethodParameters($methodParamsDefinition);
+        $methodParams = new Parameters($methodParamsDefinition);
 
         $returnType = [
             'type' => 'return-type',
@@ -425,7 +424,7 @@ public function testShouldBuildMethod(): void
 
         $this->classDefinition->setAliasManager(new AliasManager());
 
-        $classMethod = new ClassMethod(
+        $classMethod = new Method(
             $this->classDefinition,
             ['public', 'static'],
             'testName',
@@ -436,17 +435,17 @@ public function testShouldBuildMethod(): void
         );
 
         $expected = <<invokeArgs(
diff --git a/tests/Zephir/Stubs/MethodDocBlockTest.php b/tests/Zephir/Stubs/MethodDocBlockTest.php
index 8ae56cb46f..794b68f90b 100644
--- a/tests/Zephir/Stubs/MethodDocBlockTest.php
+++ b/tests/Zephir/Stubs/MethodDocBlockTest.php
@@ -15,9 +15,9 @@
 
 use PHPUnit\Framework\TestCase;
 use Zephir\AliasManager;
-use Zephir\ClassDefinition;
-use Zephir\ClassMethod;
-use Zephir\ClassMethodParameters;
+use Zephir\Class\Definition\Definition;
+use Zephir\Class\Method\Method;
+use Zephir\Class\Method\Parameters;
 use Zephir\StatementsBlock;
 use Zephir\Stubs\MethodDocBlock;
 
@@ -36,7 +36,7 @@ public function prepareMethod(array $params): MethodDocBlock
         $className = $params['class']['className'];
         $classShortName = $params['class']['classShortName'];
 
-        $classDefinition = new ClassDefinition(
+        $classDefinition = new Definition(
             $classNamespace,
             $className,
             $classShortName
@@ -45,14 +45,14 @@ public function prepareMethod(array $params): MethodDocBlock
         /**
          * ClassMethod constructor.
          *
-         * @param ClassDefinition            $classDefinition
-         * @param array                      $visibility
-         * @param string                     $name
-         * @param ClassMethodParameters|null $parameters
-         * @param StatementsBlock|null       $statements
-         * @param string|null                $docblock
-         * @param array|null                 $returnType
-         * @param array|null                 $original
+         * @param Definition           $classDefinition
+         * @param array                $visibility
+         * @param string               $name
+         * @param Parameters|null      $parameters
+         * @param StatementsBlock|null $statements
+         * @param string|null          $docblock
+         * @param array|null           $returnType
+         * @param array|null           $original
          */
         $methodVisibility = $params['method']['visibility'];
         $methodName = $params['method']['name'];
@@ -62,11 +62,11 @@ public function prepareMethod(array $params): MethodDocBlock
         $methodReturnType = $params['method']['returnType'];
         $methodExpression = $params['method']['expression'];
 
-        $classMethod = new ClassMethod(
+        $classMethod = new Method(
             $classDefinition,
             $methodVisibility,
             $methodName,
-            $methodParams ? new ClassMethodParameters($methodParams) : null,
+            $methodParams ? new Parameters($methodParams) : null,
             new StatementsBlock($methodStBlock),
             $methodDocBlock,
             $methodReturnType,
@@ -250,8 +250,8 @@ public function docBlockProvider(): array
      */
     public function testShouldParseDocBlock(string $zephirDocBlock, string $phpDocBlock): void
     {
-        $classMethod = new ClassMethod(
-            new ClassDefinition('Zephir', 'testMethod'),
+        $classMethod = new Method(
+            new Definition('Zephir', 'testMethod'),
             ['public'],
             'exampleMethodName',
             null,
diff --git a/tests/Zephir/TypesTest.php b/tests/Zephir/TypesTest.php
index a2bccd38d1..0729181637 100644
--- a/tests/Zephir/TypesTest.php
+++ b/tests/Zephir/TypesTest.php
@@ -14,9 +14,9 @@
 namespace Zephir\Test;
 
 use PHPUnit\Framework\TestCase;
-use Zephir\ClassDefinition;
-use Zephir\ClassMethod;
-use Zephir\Types;
+use Zephir\Class\Definition\Definition;
+use Zephir\Class\Method\Method;
+use Zephir\Types\Types;
 
 final class TypesTest extends TestCase
 {
@@ -101,10 +101,10 @@ function ($type) use ($collection) {
      * @param array $testData   - dataProvider data set
      * @param int   $definition - (optional) one of mandatory/collection flag
      */
-    private function buildMethod(array $testData, int $definition = 0): ClassMethod
+    private function buildMethod(array $testData, int $definition = 0): Method
     {
-        return new ClassMethod(
-            new ClassDefinition('Zephir', 'testMethod'),
+        return new Method(
+            new Definition('Zephir', 'testMethod'),
             ['public'],
             'exampleMethodName',
             null,
@@ -285,7 +285,7 @@ public function testShouldResolveCompatibleTypeForCollections(array $returnTypes
         $typesList = [];
         $collections = [];
         foreach ($returnTypes as $type) {
-            if (false !== strpos($type, '[]')) {
+            if (str_contains($type, '[]')) {
                 $typesList[] = $this->variableReturnTypeDefinition([$type], 1)[0];
                 $collectionType = trim($type, '<>');
                 $collections[$collectionType] = $collectionType;
diff --git a/tests/Zephir/Variable/GlobalsTest.php b/tests/Zephir/Variable/GlobalsTest.php
new file mode 100644
index 0000000000..62d5ac1836
--- /dev/null
+++ b/tests/Zephir/Variable/GlobalsTest.php
@@ -0,0 +1,34 @@
+
+ *
+ * For the full copyright and license information, please view
+ * the LICENSE file that was distributed with this source code.
+ */
+
+declare(strict_types=1);
+
+namespace Zephir\Test\Variable;
+
+use PHPUnit\Framework\TestCase;
+use Zephir\Variable\Globals;
+
+final class GlobalsTest extends TestCase
+{
+    public function testIsSuperGlobal(): void
+    {
+        $globals = new Globals();
+
+        $this->assertTrue($globals->isSuperGlobal('_GET'));
+        $this->assertTrue($globals->isSuperGlobal('_POST'));
+        $this->assertTrue($globals->isSuperGlobal('_COOKIE'));
+        $this->assertTrue($globals->isSuperGlobal('_SERVER'));
+        $this->assertTrue($globals->isSuperGlobal('_ENV'));
+        $this->assertTrue($globals->isSuperGlobal('_FILES'));
+        $this->assertTrue($globals->isSuperGlobal('_REQUEST'));
+        $this->assertFalse($globals->isSuperGlobal('foo'));
+    }
+}
diff --git a/tests/Zephir/VariableTest.php b/tests/Zephir/Variable/VariableTest.php
similarity index 96%
rename from tests/Zephir/VariableTest.php
rename to tests/Zephir/Variable/VariableTest.php
index 7e2b4ff9f4..65171f15e3 100644
--- a/tests/Zephir/VariableTest.php
+++ b/tests/Zephir/Variable/VariableTest.php
@@ -11,16 +11,16 @@
  * the LICENSE file that was distributed with this source code.
  */
 
-namespace Zephir\Test;
+namespace Zephir\Test\Variable;
 
 use PHPUnit\Framework\TestCase;
 use Zephir\Branch;
 use Zephir\BranchManager;
-use Zephir\ClassDefinition;
+use Zephir\Class\Definition\Definition;
 use Zephir\CompilationContext;
 use Zephir\CompiledExpression;
 use Zephir\Exception\CompilerException;
-use Zephir\Variable;
+use Zephir\Variable\Variable;
 
 final class VariableTest extends TestCase
 {
@@ -48,7 +48,7 @@ public function testShouldSetProperties(): void
         $this->assertFalse($this->zephirVar->isTemporal());
         $this->assertTrue($this->zephirVar->isReusable());
         $this->assertFalse($this->zephirVar->isIdle());
-        $this->assertTrue($this->zephirVar->isUsed());
+        $this->assertFalse($this->zephirVar->isUsed());
         $this->assertFalse($this->zephirVar->isDoublePointer());
         $this->assertTrue($this->zephirVar->isMemoryTracked());
         $this->assertSame('UnitTest', $this->zephirVar->getRealName());
@@ -74,7 +74,6 @@ public function testShouldSetProperties(): void
         $this->assertTrue($this->zephirVar->isVariable());
         $this->assertFalse($this->zephirVar->isLocalStatic());
         $this->assertFalse($this->zephirVar->isSuperGlobal());
-        $this->assertTrue($this->zephirVar->isComplex());
         $this->assertFalse($this->zephirVar->isBoolean());
         $this->assertFalse($this->zephirVar->isString());
         $this->assertFalse($this->zephirVar->isInt());
@@ -129,7 +128,7 @@ public function testShouldSetProperties(): void
         $this->zephirVar->setClassTypes('class1');
         $this->assertSame(['class1', 'class2', 'class3'], $this->zephirVar->getClassTypes());
 
-        $classDefinition = new ClassDefinition('Zephir\Test', 'VariableTest');
+        $classDefinition = new Definition('Zephir\Test', 'VariableTest');
         $this->zephirVar->setAssociatedClass($classDefinition);
         $this->assertSame($classDefinition, $this->zephirVar->getAssociatedClass());
 
@@ -175,9 +174,6 @@ public function testShouldSetProperties(): void
         $superglobalVar->setIsExternal(true);
         $this->assertTrue($superglobalVar->isSuperGlobal());
 
-        $this->zephirVar->setType('int');
-        $this->assertFalse($this->zephirVar->isComplex());
-
         $this->zephirVar->setType('bool');
         $this->assertTrue($this->zephirVar->isBoolean());
 
@@ -215,7 +211,7 @@ public function testShouldEnableDefaultAutoInitValue(): void
             'variable', 'string', 'array',
         ];
 
-        $delegate = function (Variable $zephirVar, string $type) {
+        $delegate = function (Variable $zephirVar, string $type): void {
             $zephirVar->setDefaultInitValue('default');
             $zephirVar->setType($type);
             $zephirVar->enableDefaultAutoInitValue();
diff --git a/tests/fixtures/exit.php b/tests/fixtures/exit.php
index 22bec8f9e5..58fd7d9493 100644
--- a/tests/fixtures/exit.php
+++ b/tests/fixtures/exit.php
@@ -8,6 +8,7 @@
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
  */
+
 use Stub\ExitDie;
 
 if (!extension_loaded('stub')) {
diff --git a/tests/fixtures/stubs/issues/expected/Issue_1778.php b/tests/fixtures/stubs/issues/expected/Issue_1778.php
index 6ed24c84f9..8f6f2bde96 100644
--- a/tests/fixtures/stubs/issues/expected/Issue_1778.php
+++ b/tests/fixtures/stubs/issues/expected/Issue_1778.php
@@ -44,7 +44,7 @@ public function __construct(\Psr\Http\Message\RequestInterface $request, array $
      * @return mixed|null
      * @param string $key
      */
-    public function getVar(string $key)
+    public function getVar(string $key): mixed
     {
     }
 }
diff --git a/tests/fixtures/stubs/issues/expected/Issue_1922.php b/tests/fixtures/stubs/issues/expected/Issue_1922.php
index 1f7cb564ba..d81aee1799 100644
--- a/tests/fixtures/stubs/issues/expected/Issue_1922.php
+++ b/tests/fixtures/stubs/issues/expected/Issue_1922.php
@@ -10,7 +10,7 @@ class Issue_1922
      * @param string $key
      * @return mixed|null
      */
-    public function getVar(string $key)
+    public function getVar(string $key): mixed
     {
     }
 }
diff --git a/tests/fixtures/stubs/issues/expected/Issue_2026.php b/tests/fixtures/stubs/issues/expected/Issue_2026.php
index e095174297..295601152f 100644
--- a/tests/fixtures/stubs/issues/expected/Issue_2026.php
+++ b/tests/fixtures/stubs/issues/expected/Issue_2026.php
@@ -13,9 +13,9 @@ class Issue_2026
 
     /**
      * Expects:
-     *  return array|\StdClass[]
+     *  return array|\stdClass[]
      *
-     * @return array|\StdClass[]
+     * @return array|\stdClass[]
      */
     public function getClassCollection(): array
     {
@@ -23,11 +23,11 @@ public function getClassCollection(): array
 
     /**
      * Expects:
-     *  return array|bool|\StdClass[]
+     *  return array|bool|\stdClass[]
      *
-     * @return array|bool|\StdClass[]
+     * @return array|bool|\stdClass[]
      */
-    public function getClassCollectionOrBool()
+    public function getClassCollectionOrBool(): bool|array
     {
     }
 
@@ -37,7 +37,7 @@ public function getClassCollectionOrBool()
      *
      * @return array|bool|\Stubs\Events\EventManager[]
      */
-    public function getInterfaceCollectionOrBool()
+    public function getInterfaceCollectionOrBool(): bool|array
     {
     }
 
@@ -53,9 +53,9 @@ public function getInterfaceCollectionOrArray(): array
 
     /**
      * Expects:
-     *  return array|\Stubs\Events\EventManager[]|\StdClass[]
+     *  return array|\Stubs\Events\EventManager[]|\stdClass[]
      *
-     * @return array|\Stubs\Events\EventManager[]|\StdClass[]
+     * @return array|\Stubs\Events\EventManager[]|\stdClass[]
      */
     public function getMixedCollectionOrArray(): array
     {
diff --git a/tests/fixtures/stubs/issues/expected/Issue_2092.php b/tests/fixtures/stubs/issues/expected/Issue_2092.php
index 95aa9e1589..3f8c0cc74b 100644
--- a/tests/fixtures/stubs/issues/expected/Issue_2092.php
+++ b/tests/fixtures/stubs/issues/expected/Issue_2092.php
@@ -18,7 +18,7 @@ class Issue_2092
      *
      * @return ManagerInterface|null
      */
-    public function getInternalEventsManager(): ?ManagerInterface
+    public function getInternalEventsManager(): ManagerInterface|null
     {
     }
 }
diff --git a/tests/fixtures/stubs/issues/stubs/issue_2026.zep b/tests/fixtures/stubs/issues/stubs/issue_2026.zep
index 609ea592bb..82ec6b344d 100644
--- a/tests/fixtures/stubs/issues/stubs/issue_2026.zep
+++ b/tests/fixtures/stubs/issues/stubs/issue_2026.zep
@@ -9,9 +9,9 @@ class Issue_2026
 {
     /**
      * Expects:
-     *  return array|\StdClass[]
+     *  return array|\stdClass[]
      */
-    public function getClassCollection() -> <\StdClass[]>
+    public function getClassCollection() -> <\stdClass[]>
     {
         return [
             new \StdClass()
@@ -20,9 +20,9 @@ class Issue_2026
 
     /**
      * Expects:
-     *  return array|bool|\StdClass[]
+     *  return array|bool|\stdClass[]
      */
-    public function getClassCollectionOrBool() -> <\StdClass[]> | bool
+    public function getClassCollectionOrBool() -> <\stdClass[]> | bool
     {
         return [
             new \StdClass()
@@ -53,9 +53,9 @@ class Issue_2026
 
     /**
      * Expects:
-     *  return array|\Stubs\Events\EventManager[]|\StdClass[]
+     *  return array|\Stubs\Events\EventManager[]|\stdClass[]
      */
-    public function getMixedCollectionOrArray() ->  | <\StdClass[]> | array
+    public function getMixedCollectionOrArray() ->  | <\stdClass[]> | array
     {
         return [
             new EventManager()
diff --git a/tests/sharness/t0002-generate.sh b/tests/sharness/t0002-generate.sh
index 651f4ccb2a..16b0e5e283 100755
--- a/tests/sharness/t0002-generate.sh
+++ b/tests/sharness/t0002-generate.sh
@@ -6,29 +6,11 @@ test_description="Test generate commands"
 # shellcheck disable=SC1091
 source ./setup.sh
 
-test_expect_success "Should correctly specify ARGINFO" "
-  cd $FIXTURESDIR/typehints &&
-  zephirc fullclean 2>&1 >/dev/null &&
-  zephirc generate --backend=ZendEngine3 2>&1 >/dev/null &&
-  test_cmp ext/typehints.c expected3.c &&
-  test_cmp ext/typehints/args.zep.h expected_args3.h &&
-  test_cmp ext/typehints/retval.zep.h expected_retval3.h &&
-  test_cmp ext/typehints/both.zep.h expected_both3.h
-"
-
 test_expect_success "Life Cycle Test" "
   cd $FIXTURESDIR/lifecycle &&
   zephirc fullclean 2>&1 >/dev/null &&
-  zephirc generate --backend=ZendEngine3 2>&1 >/dev/null &&
+  zephirc generate 2>&1 >/dev/null &&
   test_cmp ext/lifecycle.c expected3.c
 "
 
-# See: https://github.com/zephir-lang/zephir/issues/1758
-test_expect_success "Should generate valid code with inheritance of prototype interfaces" "
-  cd $FIXTURESDIR/protodir &&
-  zephirc fullclean 2>&1 >/dev/null &&
-  zephirc generate --backend=ZendEngine3 2>&1 >/dev/null &&
-  test_cmp ext/protodir/connectionexception.zep.h connectionexception.h
-"
-
 test_done
diff --git a/zephir b/zephir
index 22e654a3db..8928747d67 100755
--- a/zephir
+++ b/zephir
@@ -14,7 +14,7 @@ declare(strict_types=1);
 
 use Monolog\Handler\StreamHandler;
 use Monolog\Logger;
-use Zephir\Backends\BackendFactory;
+use Zephir\Backend\Backend;
 use Zephir\Compiler;
 use Zephir\Config;
 use Zephir\Console\Application;
@@ -107,12 +107,11 @@ $logger = new Logger('zephir', [
     $consoleStdOutHandler,
 ]);
 $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger);
-$backend = (new BackendFactory($config, $rootPath.'/kernels', $rootPath.'/templates'))
-    ->createBackend();
+$backend = new Backend($config, $rootPath.'/kernel', $rootPath.'/templates');
 
 $compiler = new Compiler($config, $backend, new Manager($parser), $disk, $compilerFactory);
 $compiler->setPrototypesPath($rootPath.'/prototypes');
-$compiler->setOptimizersPath($rootPath.'/Library/Optimizers');
+$compiler->setOptimizersPath($rootPath.'/src/Optimizers');
 $compiler->setTemplatesPath($rootPath.'/templates');
 $compiler->setLogger($logger);