diff --git a/.editorconfig b/.editorconfig index 3f7a94244a..197c662f97 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# EditorConfig is awesome: http://EditorConfig.org +# EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true diff --git a/.github/workflows/build-linux-ext/action.yml b/.github/workflows/build-linux-ext/action.yml index 68c66ca96c..638288a375 100644 --- a/.github/workflows/build-linux-ext/action.yml +++ b/.github/workflows/build-linux-ext/action.yml @@ -1,14 +1,17 @@ name: 'Zephir Stub PHP Extension Build' description: 'Build Stub extension for Linux according to various php versions.' + inputs: compiler: description: 'compiler name' required: false default: 'gcc' + cflags: description: 'CFLAGS for GCC compiler' required: false default: '' + ldflags: description: 'LDFLAGS for Linker' required: false @@ -35,16 +38,12 @@ runs: - name: Compile Stub Extension shell: bash + env: + CC: ${{ inputs.compiler }} + CFLAGS: ${{ inputs.cflags }} + CXXFLAGS: ${{ inputs.cflags }} + LDFLAGS: ${{ inputs.ldflags }} run: | - echo "::group::Configure compiler" - CC=${{ inputs.compiler }} - CFLAGS="${{ inputs.cflags }}" - CXXFLAGS="${{ inputs.cflags }}" - LDFLAGS="${{ inputs.ldflags }}" - - export CC CFLAGS CXXFLAGS LDFLAGS - echo "::endgroup::" - echo "::group::Init stage" php zephir fullclean echo "::endgroup::" @@ -56,6 +55,13 @@ runs: echo "::group::Compile stage" cd ./ext phpize - ./configure --enable-stub CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}" - make + ./configure --enable-stub + make -j$(getconf _NPROCESSORS_ONLN) echo "::endgroup::" + + - name: Enable Stub Extension + shell: bash + run: | + sudo cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so" + echo "extension=stub.so" > ./ext-stub.ini + sudo cp ./ext-stub.ini /etc/php/${{ matrix.php }}/cli/conf.d/99-stub.ini diff --git a/.github/workflows/build-macos-ext/action.yml b/.github/workflows/build-macos-ext/action.yml index c530e117b4..f379ed0fe8 100644 --- a/.github/workflows/build-macos-ext/action.yml +++ b/.github/workflows/build-macos-ext/action.yml @@ -1,14 +1,17 @@ name: 'Zephir Stub PHP Extension Build' description: 'Build Stub extension for macOS according to various php versions.' + inputs: compiler: description: 'compiler name' required: false default: 'clang' + cflags: description: 'CFLAGS for GCC compiler' required: false default: '' + ldflags: description: 'LDFLAGS for Linker' required: false @@ -28,15 +31,12 @@ runs: - name: Compile Stub Extension shell: bash + env: + CC: ${{ inputs.compiler }} + CFLAGS: ${{ inputs.cflags }} + CXXFLAGS: ${{ inputs.cflags }} + LDFLAGS: ${{ inputs.ldflags }} run: | - echo "::group::Configure compiler" - CFLAGS="${{ inputs.cflags }}" - CXXFLAGS="${{ inputs.cflags }}" - LDFLAGS="${{ inputs.ldflags }}" - - export CFLAGS CXXFLAGS LDFLAGS - echo "::endgroup::" - echo "::group::Init stage" php zephir fullclean echo "::endgroup::" @@ -48,6 +48,12 @@ runs: echo "::group::Compile stage" cd ./ext phpize - ./configure --enable-stub CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}" - make + ./configure --enable-stub + make -j$(getconf _NPROCESSORS_ONLN) echo "::endgroup::" + + - name: Enable Stub Extension + 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 diff --git a/.github/workflows/build-win-ext/action.yml b/.github/workflows/build-win-ext/action.yml index bb8601d409..113c334a48 100644 --- a/.github/workflows/build-win-ext/action.yml +++ b/.github/workflows/build-win-ext/action.yml @@ -58,7 +58,7 @@ runs: } Write-Output "::endgroup::" - - name: Setup PHP SDK tool kit + - name: Setup PHP SDK Tool Kit uses: zephir-lang/setup-php-sdk@v1 with: php_version: ${{ inputs.php_version }} @@ -73,6 +73,16 @@ runs: with: arch: ${{ inputs.arch }} + # Workaround for Windows-2019 and PHP 7.4 with old msvc version + # PHP Warning: PHP Startup: Can't load module 'C:\tools\php\ext\php_stub.dll' + # as it's linked with 14.29, but the core is linked with 14.16 in Unknown on line 0 + - name: Configure Developer Command Prompt for MSVC compiler + if: inputs.php_version == '7.4' + uses: ilammy/msvc-dev-cmd@v1.10.0 + with: + arch: ${{ inputs.arch }} + toolset: 14.16 + - name: Generate C code shell: powershell run: | @@ -88,10 +98,13 @@ runs: - name: Configure shell: powershell working-directory: ext + env: + CFLAGS: ${{ inputs.cflags }} + CXXFLAGS: ${{ inputs.cflags }} + LDFLAGS: ${{ inputs.ldflags }} run: | Write-Output "::group::Configure" - .\configure.bat --enable-stub --with-prefix=${{ env.PHP_ROOT }} ` - CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}" + .\configure.bat --enable-stub --with-prefix=${{ env.PHP_ROOT }} Write-Output "::endgroup::" - name: Zephir compile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f0ea57a358..eb3ed37390 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,14 +8,17 @@ on: - '**.md' - '**.txt' - '**/nightly.yml' + - '**/release.yml' + - '**/FUNDING.yml' pull_request: branches: - master - - develoment + - development env: RE2C_VERSION: 2.2 - ZEPHIR_PARSER_VERSION: 1.4.1 + ZEPHIR_PARSER_VERSION: 1.5.0 + PSR_VERSION: 1.2.0 CACHE_DIR: .cache jobs: @@ -52,55 +55,34 @@ jobs: run: shellcheck .ci/*.sh build-and-test: - # To prevent build a particular commit use - # git commit -m "......... [ci skip]" - if: "!contains(github.event.head_commit.message, '[ci skip]')" + name: "PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }}" - name: "PHP-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.arch }}" runs-on: ${{ matrix.os }} - strategy: fail-fast: false - matrix: - php: ['7.4', '8.0'] - build_type: ['ts', 'nts'] - arch: ['x64'] + php: [ '7.4', '8.0' , '8.1' ] + ts: [ 'ts', 'nts' ] + arch: [ 'x64' ] name: - ubuntu-gcc - macos-clang - - win2016-vc15 - - win2019-vs16 # matrix names should be in next format: # {php}-{ts}-{os.name}-{compiler}-{arch} include: # Linux - - name: ubuntu-gcc - os: ubuntu-18.04 - compiler: gcc - + - { name: ubuntu-gcc, os: ubuntu-18.04, compiler: gcc } # macOS - - name: macos-clang - os: macos-10.15 - compiler: clang - + - { name: macos-clang, os: macos-10.15, compiler: clang } # Windows - - name: win2016-vc15 - os: windows-2016 - compiler: vc15 - - - name: win2019-vs16 - os: windows-2019 - compiler: vs16 - - exclude: - - name: win2019-vs16 - php: '7.4' - - - name: win2016-vc15 - php: '8.0' + - { 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' } steps: - uses: actions/checkout@v2 @@ -111,7 +93,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '${{ matrix.php }}' - extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} + extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-${{ env.PSR_VERSION }}, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} tools: phpize, php-config coverage: xdebug # variables_order: https://github.com/zephir-lang/zephir/pull/1537 @@ -127,7 +109,7 @@ jobs: date.timezone=UTC, xdebug.max_nesting_level=256 env: - PHPTS: ${{ matrix.build_type }} + PHPTS: ${{ matrix.ts }} COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get composer cache directory @@ -170,9 +152,11 @@ jobs: uses: ./.github/workflows/build-win-ext with: php_version: ${{ matrix.php }} - ts: ${{ matrix.build_type }} + ts: ${{ matrix.ts }} msvc: ${{ matrix.compiler }} arch: ${{ matrix.arch }} + cflags: '/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL' + ldflags: '/LTCG' env: CACHE_DIR: 'C:\Downloads' PHP_ROOT: 'C:\tools\php' @@ -180,11 +164,8 @@ jobs: - name: Stub Extension Info shell: pwsh run: | - if ("${{ runner.os }}" -eq "Windows") { - php --ri stub - } else { - php -d extension=./ext/modules/stub.so --ri stub - } + php --ini + php --ri stub - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" @@ -192,15 +173,11 @@ jobs: - name: Unit Tests (Stub Extension) shell: pwsh run: | - if ("${{ runner.os }}" -eq "Windows") { - php vendor/bin/phpunit -c phpunit.ext.xml - } else { - php -d extension=./ext/modules/stub.so vendor/bin/phpunit -c phpunit.ext.xml - } + php vendor/bin/phpunit -c phpunit.ext.xml - name: Unit Tests (Zephir) if: always() - run: vendor/bin/phpunit --testsuite Zephir + run: php vendor/bin/phpunit --testsuite Zephir env: XDEBUG_MODE: coverage @@ -216,14 +193,14 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: ./tests/output/clover.xml - flags: unittests,${{ matrix.name }},php-${{ matrix.php }} + flags: unittests,${{ runner.os }},php-${{ matrix.php }} name: codecov-umbrella - name: Upload build artifacts after Failure if: failure() uses: actions/upload-artifact@v2 with: - name: debug-${{ matrix.name }}-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.compiler }}-${{ matrix.arch }} + name: debug-PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }} path: | ${{ github.workspace }}/*.log ${{ github.workspace }}/ext/ @@ -231,4 +208,5 @@ jobs: !${{ github.workspace }}/ext/stub/ !${{ github.workspace }}/ext/Release/ !${{ github.workspace }}/ext/x64/Release/ - retention-days: 1 + ${{ github.workspace }}/tests/output/ + retention-days: 7 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4a1577d53a..12255e73a3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -7,29 +7,28 @@ on: env: RE2C_VERSION: 2.2 - ZEPHIR_PARSER_VERSION: 1.4.1 + ZEPHIR_PARSER_VERSION: 1.5.0 + PSR_VERSION: 1.2.0 CACHE_DIR: .cache jobs: nightly: - name: "PHP-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.arch }}" - runs-on: ${{ matrix.os }} + name: "PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }}" + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - php: [ '8.1', '8.2' ] - build_type: [ 'ts', 'nts' ] + php: [ '8.2' ] + ts: [ 'ts', 'nts' ] arch: [ 'x64' ] # matrix names should be in next format: # {php}-{ts}-{os.name}-{compiler}-{arch} include: # Linux - - name: ubuntu-gcc - os: ubuntu-20.04 - compiler: gcc + - { name: ubuntu-gcc, os: ubuntu-20.04, compiler: gcc } steps: - name: Checkout Code @@ -41,7 +40,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '${{ matrix.php }}' - extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} + extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-${{ env.PSR_VERSION }}, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} tools: phpize, php-config coverage: xdebug # variables_order: https://github.com/zephir-lang/zephir/pull/1537 @@ -57,7 +56,7 @@ jobs: date.timezone=UTC, xdebug.max_nesting_level=256 env: - PHPTS: ${{ matrix.build_type }} + PHPTS: ${{ matrix.ts }} COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get composer cache directory @@ -74,7 +73,7 @@ jobs: - name: Install Project Dependencies run: | echo "::group::Install composer dependencies" - composer install --prefer-dist --no-interaction --no-ansi --no-progress + composer install --prefer-dist --no-interaction --no-ansi --no-progress --ignore-platform-reqs echo "::endgroup::" - name: Fast Commands Test @@ -89,14 +88,14 @@ jobs: - name: Stub Extension Info run: | - php -d extension=./ext/modules/stub.so --ri stub + php --ri stub - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Unit Tests (Stub Extension) run: | - php -d extension=./ext/modules/stub.so vendor/bin/phpunit -c phpunit.ext.xml + php vendor/bin/phpunit -c phpunit.ext.xml - name: Unit Tests (Zephir) run: vendor/bin/phpunit --testsuite Zephir @@ -112,7 +111,7 @@ jobs: if: failure() uses: actions/upload-artifact@v2 with: - name: debug-${{ matrix.name }}-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.compiler }}-${{ matrix.arch }} + name: debug-PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }} path: | ${{ github.workspace }}/*.log ${{ github.workspace }}/ext/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a8adc41b4..4bf729af17 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Upload Release Asset +name: Upload Release Assets on: push: @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 env: - BOX_VERSION: 3.12.2 + BOX_VERSION: 3.15.0 steps: - name: Checkout Code diff --git a/.gitignore b/.gitignore index 47b158cc97..826d92a25a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ doc vendor # Compilation artifacts. +*.dep *.gch *.lo *.la @@ -37,6 +38,7 @@ phpunit.xml # Build artefact zephir.phar box.phar +php-cs-fixer.phar # Ignore codecoverage stuff. *.profraw @@ -44,6 +46,9 @@ box.phar *.gcno *.gcda +# Ignore CI autogenerated release-notes.md +release-notes.md + # Use this as your own wish list or a temporary buffer LATER php-zephir-parser/ diff --git a/CHANGELOG.md b/CHANGELOG.md index d9db343b05..d43b4c719f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,22 @@ # Change Log All notable changes to this project will be documented in this file. -The format based on [Keep a Changelog](http://keepachangelog.com) -and this project adheres to [Semantic Versioning](http://semver.org). +The format based on [Keep a Changelog](https://keepachangelog.com) +and this project adheres to [Semantic Versioning](https://semver.org). ## [Unreleased] +## [0.16.0] - 2022-03-20 +### Added +- Added custom list of arg info definition (Phalcon only) [#2341](https://github.com/zephir-lang/zephir/issues/2341) +- Added support for `int|false` return type (PHP >= 8.0 only) [#2338](https://github.com/zephir-lang/zephir/issues/2338) +- Added support of PHP `8.1` [#2255](https://github.com/zephir-lang/zephir/issues/2255) + +### Fixed +- Fixed left `null` with `string` condition [#2299](https://github.com/zephir-lang/zephir/issues/2299) +- Improved support of `mixed` type [#2330](https://github.com/zephir-lang/zephir/issues/2330) +- Fixed Interfaces Breaking Child Projects Of Same Root Level Namespace [#2334](https://github.com/zephir-lang/zephir/issues/2334) + ## [0.15.2] - 2021-10-24 ### Fixed - Fixed output of `string` type INI in globals [#2312](https://github.com/zephir-lang/zephir/issues/2312) @@ -561,7 +572,8 @@ and this project adheres to [Semantic Versioning](http://semver.org). [#1524](https://github.com/zephir-lang/zephir/issues/1524) -[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.15.2...HEAD +[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.16.0...HEAD +[0.16.0]: https://github.com/zephir-lang/zephir/compare/0.15.2...0.16.0 [0.15.2]: https://github.com/zephir-lang/zephir/compare/0.15.1...0.15.2 [0.15.1]: https://github.com/zephir-lang/zephir/compare/0.15.0...0.15.1 [0.15.0]: https://github.com/zephir-lang/zephir/compare/0.14.0...0.15.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4360a464bb..11d5411f2c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,5 +82,5 @@ Phalcon Team [team]: https://phalcon.io/en-us/team [issues]: https://github.com/zephir-lang/zephir/issues [docs]: https://docs.zephir-lang.com -[git rebase]: http://git-scm.com/book/en/Git-Branching-Rebasing +[git rebase]: https://git-scm.com/book/en/Git-Branching-Rebasing [psr-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 1531074818..43889ca010 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -13,6 +13,9 @@ namespace Zephir; +use function array_key_exists; +use function count; + class ArgInfoDefinition { /** @@ -96,17 +99,23 @@ public function setRichFormat(bool $flag): void */ public function render(): void { + if ($this->renderPhalconCompatible()) { + $this->codePrinter->outputBlankLine(); + + return; + } + if ($this->richFormat && $this->functionLike->isReturnTypesHintDetermined() && $this->functionLike->areReturnTypesCompatible() ) { $this->richRenderStart(); - if (false == $this->hasParameters() && false == $this->functionLike->isVoid()) { + if (!$this->hasParameters() && !$this->functionLike->isVoid()) { $this->codePrinter->output('ZEND_END_ARG_INFO()'); $this->codePrinter->outputBlankLine(); } - } elseif (true == $this->hasParameters()) { + } elseif ($this->hasParameters()) { $this->codePrinter->output( sprintf( 'ZEND_BEGIN_ARG_INFO_EX(%s, 0, %d, %d)', @@ -129,7 +138,6 @@ public function render(): void ); $this->codePrinter->output('#else'); - $this->codePrinter->output( sprintf( 'ZEND_BEGIN_ARG_INFO_EX(%s, 0, %d, %d)', @@ -138,7 +146,6 @@ public function render(): void $this->functionLike->getNumberOfRequiredParameters() ) ); - $this->codePrinter->output('#endif'); } else { $this->codePrinter->output( @@ -150,7 +157,7 @@ public function render(): void $this->codePrinter->outputBlankLine(); } - if (true == $this->hasParameters()) { + if ($this->hasParameters()) { $this->renderEnd(); $this->codePrinter->output('ZEND_END_ARG_INFO()'); @@ -160,10 +167,10 @@ public function render(): void private function richRenderStart(): void { - if (\array_key_exists('object', $this->functionLike->getReturnTypes())) { + if (array_key_exists('object', $this->functionLike->getReturnTypes())) { $class = 'NULL'; - if (1 == \count($this->functionLike->getReturnClassTypes())) { + if (1 === count($this->functionLike->getReturnClassTypes())) { $class = key($this->functionLike->getReturnClassTypes()); $class = escape_class($this->compilationContext->getFullName($class)); } @@ -194,7 +201,7 @@ private function richRenderStart(): void ) ); - if (false == $this->hasParameters()) { + if (!$this->hasParameters()) { $this->codePrinter->output('ZEND_END_ARG_INFO()'); } @@ -226,18 +233,59 @@ private function richRenderStart(): void ) ); $this->codePrinter->output('#endif'); - } 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() - ) - ); + + 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('#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; + } + } + + $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 renderEnd(): void @@ -374,7 +422,7 @@ private function renderEnd(): void private function hasParameters(): bool { - return null !== $this->parameters && \count($this->parameters->getParameters()) > 0; + return null !== $this->parameters && count($this->parameters->getParameters()) > 0; } private function defaultArrayValue(array $parameter): string @@ -441,10 +489,59 @@ private function getReturnType(): string return 'IS_VOID'; } - if (\array_key_exists('array', $this->functionLike->getReturnTypes())) { + 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 + * conditions. + * + * This is temporary solution designed specifically for Phalcon project. + * + * @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(); + $implementedInterfaces = $classDefinition !== null ? $classDefinition->getImplementedInterfaces() : []; + $extendsClass = $classDefinition !== null ? $classDefinition->getExtendsClass() : null; + + if (empty($implementedInterfaces) && $extendsClass === null) { + return false; + } + + $methodName = $this->functionLike->getName(); + + if ($extendsClass !== null) { + $implementedInterfaces = array_merge($implementedInterfaces, [$extendsClass]); + } + + $found = false; + foreach ($implementedInterfaces as $implementedInterface) { + if (isset($compatibilityClasses[$implementedInterface][$methodName])) { + foreach ($compatibilityClasses[$implementedInterface][$methodName] as $condition => $args) { + $this->codePrinter->output($condition); + foreach ($args as $arg) { + $this->codePrinter->output( + str_replace(['__ce__'], [$this->name], $arg) + ); + } + } + + $this->codePrinter->output('#endif'); + + $found = true; + } + } + + return $found; + } } diff --git a/Library/Backends/BackendFactory.php b/Library/Backends/BackendFactory.php index ed3e9ccbf7..837481a1bb 100644 --- a/Library/Backends/BackendFactory.php +++ b/Library/Backends/BackendFactory.php @@ -9,9 +9,10 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Backends; -use Psr\Container\ContainerInterface; use Symfony\Component\Console\Input\ArgvInput; use Zephir\BaseBackend; use Zephir\Config; @@ -19,13 +20,13 @@ final class BackendFactory { - private $container; - private $kernelsPath; - private $templatesPath; + private Config $config; + private string $kernelsPath; + private string $templatesPath; - public function __construct(ContainerInterface $container, $kernelsPath, $templatesPath) + public function __construct(Config $config, string $kernelsPath, string $templatesPath) { - $this->container = $container; + $this->config = $config; $this->kernelsPath = $kernelsPath; $this->templatesPath = $templatesPath; } @@ -35,7 +36,7 @@ public function createBackend() $backendClassName = $this->resolveBackendClass(); return new $backendClassName( - $this->container->get(Config::class), + $this->config, $this->kernelsPath, $this->templatesPath ); @@ -48,7 +49,7 @@ public function createBackend() * * @return string */ - private function resolveBackendClass() + private function resolveBackendClass(): string { $parser = new ArgvInput(); $backend = $parser->getParameterOption('--backend', null); @@ -59,9 +60,7 @@ private function resolveBackendClass() // testing purposes and may be removed in the future. // You SHOULD NOT rely on this possibility. if (getenv('ZEPHIR_BACKEND')) { - $backend = $backend = getenv('ZEPHIR_BACKEND'); - } elseif ($this->container->has('ZEPHIR_BACKEND')) { - $backend = $this->container->get('ZEPHIR_BACKEND'); + $backend = getenv('ZEPHIR_BACKEND'); } } @@ -71,8 +70,8 @@ private function resolveBackendClass() $className = "Zephir\\Backends\\{$backend}\\Backend"; - if (!class_exists($className) || 'ZendEngine2' == $backend) { - throw new IllegalStateException(sprintf('Backend class "%s" doesn\'t exist.', $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 index 1612743bf3..e317542532 100644 --- a/Library/Backends/ZendEngine2/Backend.php +++ b/Library/Backends/ZendEngine2/Backend.php @@ -21,9 +21,9 @@ use Zephir\GlobalConstant; use Zephir\Variable; +use function in_array; + /** - * Zephir\Backends\ZendEngine2\Backend. - * * NOTE: ZendEngine2 backend is no longer supported * and this class will be removed in the future. */ @@ -300,7 +300,7 @@ public function addArrayEntry(Variable $variable, $key, $value, CompilationConte $var = $context->symbolTable->getVariableForRead($key->getCode(), $context); $typeKey = $var->getType(); } - if (\in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { + if (in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { $keyType = 'index'; } } @@ -444,6 +444,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA /* Types which map to the same */ case 'variable': + case 'mixed': case 'string': $type = $index->getType(); break; @@ -454,7 +455,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA $arrayAccess['right'] ); } - if ($isVariable && \in_array($index->getType(), ['variable', 'string'])) { + 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) { @@ -487,7 +488,7 @@ public function arrayIsset(Variable $var, $resolvedExpr, $expression, Compilatio 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()) { + } elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType() || 'mixed' === $resolvedExpr->getType()) { return new CompiledExpression('bool', 'zephir_array_isset('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression); } @@ -499,20 +500,21 @@ public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, $code = $this->getVariableCodePointer($target).', '.$this->getVariableCode($var); if (!($resolvedExpr instanceof Variable)) { - if ('string' == $resolvedExpr->getType()) { + 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'])) { + } 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 ('int' == $resolvedExpr->getType() || 'long' == $resolvedExpr->getType()) { + if (in_array($resolvedExpr->getType(), ['int', 'long'])) { return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); - } elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType()) { + } 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); } @@ -550,6 +552,7 @@ public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationCo case 'string': case 'variable': + case 'mixed': $context->codePrinter->output('zephir_array_unset('.$variableCode.', '.$indexCode.', '.$flags.');'); break; @@ -1045,6 +1048,7 @@ public function checkStrictType($type, $var, CompilationContext $context) case 'object': case 'resource': case 'callable': + case 'mixed': break; default: throw new CompilerException('Unknown type: '.$type); diff --git a/Library/BaseBackend.php b/Library/BaseBackend.php index d9a8b72b21..cebe1eba59 100644 --- a/Library/BaseBackend.php +++ b/Library/BaseBackend.php @@ -66,7 +66,7 @@ public function getName() * * @return string */ - public function getInternalKernelPath() + public function getInternalKernelPath(): string { return "$this->kernelsPath/{$this->name}"; } @@ -76,7 +76,7 @@ public function getInternalKernelPath() * * @return string */ - public function getInternalTemplatePath() + public function getInternalTemplatePath(): string { return "$this->templatesPath/{$this->name}"; } @@ -88,16 +88,14 @@ public function getInternalTemplatePath() * * @return string */ - public function getTemplateFileContents($filename) + public function getTemplateFileContents(string $filename): string { - $templatePath = rtrim($this->config->get('templatepath', 'backend'), '\\/'); + $templatePath = rtrim((string) $this->config->get('templatepath', 'backend'), '\\/'); if (empty($templatepath)) { $templatePath = $this->templatesPath; } - return file_get_contents( - "{$templatePath}/{$this->name}/{$filename}" - ); + return file_get_contents("{$templatePath}/{$this->name}/{$filename}"); } /** diff --git a/Library/Builder/FunctionCallBuilder.php b/Library/Builder/FunctionCallBuilder.php index 7fdf053a52..a06def7b3a 100644 --- a/Library/Builder/FunctionCallBuilder.php +++ b/Library/Builder/FunctionCallBuilder.php @@ -9,38 +9,36 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder; /** - * FunctionCallBuilder. - * * Allows to manually build a function call AST node */ class FunctionCallBuilder { - protected $name; + protected string $name; - protected $parameters; + protected array $parameters; - protected $type; + protected int $type; - protected $file; + protected ?string $file; - protected $line; + protected int $line = 0; - protected $char; + protected int $char = 0; /** - * FunctionCallBuilder construct. - * - * @param string $name - * @param array $parameters - * @param int $type - * @param string $file - * @param int $line - * @param int $char + * @param string $name + * @param array $parameters + * @param int $type + * @param string|null $file + * @param int $line + * @param int $char */ - public function __construct($name, $parameters, $type = 1, $file = null, $line = 0, $char = 0) + 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; @@ -53,7 +51,7 @@ public function __construct($name, $parameters, $type = 1, $file = null, $line = /** * @return array */ - public function get() + public function get(): array { return [ 'type' => 'fcall', diff --git a/Library/Builder/LiteralBuilder.php b/Library/Builder/LiteralBuilder.php deleted file mode 100644 index d10c8a50f3..0000000000 --- a/Library/Builder/LiteralBuilder.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\Builder; - -/** - * LiteralBuilder. - * - * Allows to manually build a literal expressions AST nodes - */ -class LiteralBuilder -{ - protected $type; - - protected $value; - - public function __construct($type, $value) - { - $this->type = $type; - $this->value = $value; - } - - public function get() - { - return [ - 'type' => $this->type, - 'value' => $this->value, - ]; - } -} diff --git a/Library/Builder/Operators/AbstractOperatorBuilder.php b/Library/Builder/Operators/AbstractOperatorBuilder.php index 28fc7a208a..4fad1c2726 100644 --- a/Library/Builder/Operators/AbstractOperatorBuilder.php +++ b/Library/Builder/Operators/AbstractOperatorBuilder.php @@ -9,12 +9,25 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Operators; /** - * Abstract class for builders. + * Abstract class for builders */ abstract class AbstractOperatorBuilder { - abstract public function get(); + 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/Library/Builder/Operators/BinaryOperatorBuilder.php b/Library/Builder/Operators/BinaryOperatorBuilder.php deleted file mode 100644 index 8bb9bc497c..0000000000 --- a/Library/Builder/Operators/BinaryOperatorBuilder.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder\Operators; - -/** - * BinaryOperatorBuilder. - * - * Allows to manually build a binary operator AST node - */ -class BinaryOperatorBuilder extends AbstractOperatorBuilder -{ - protected $operator; - - protected $file; - - protected $line; - - protected $char; - - /** - * BinaryOperatorBuilder constructor. - * - * @param string $operator - * @param Builder $leftExpression - * @param Builder $rightExpression - * @param string $file - * @param int $line - * @param string $char - */ - public function __construct($operator, $leftExpression, $rightExpression, $file = null, $line = 0, $char = 0) - { - $this->operator = $operator; - $this->leftExpression = $leftExpression; - $this->rightExpression = $rightExpression; - $this->file = $file; - $this->line = $line; - $this->char = $char; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - return [ - 'type' => $this->operator, - 'left' => $this->leftExpression->get(), - 'right' => $this->rightExpression->get(), - 'file' => $this->file, - 'line' => $this->line, - 'char' => $this->char, - ]; - } -} diff --git a/Library/Builder/Operators/CastOperatorBuilder.php b/Library/Builder/Operators/CastOperatorBuilder.php index 064e5586bc..714d089497 100644 --- a/Library/Builder/Operators/CastOperatorBuilder.php +++ b/Library/Builder/Operators/CastOperatorBuilder.php @@ -9,27 +9,29 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Operators; +use Zephir\Builder\FunctionCallBuilder; + /** - * CastOperatorBuilder. - * * Allows to manually build a 'cast' operator AST node */ class CastOperatorBuilder extends AbstractOperatorBuilder { - protected $leftOperand; + protected string $leftOperand; - protected $rightOperand; + protected FunctionCallBuilder $rightOperand; /** - * @param $left - * @param $right - * @param null $file - * @param int $line - * @param int $char + * @param string $left + * @param FunctionCallBuilder $right + * @param string|null $file + * @param int $line + * @param int $char */ - public function __construct($left, $right, $file = null, $line = 0, $char = 0) + public function __construct(string $left, FunctionCallBuilder $right, ?string $file = null, int $line = 0, int $char = 0) { $this->leftOperand = $left; $this->rightOperand = $right; @@ -43,7 +45,7 @@ public function __construct($left, $right, $file = null, $line = 0, $char = 0) * * @return array */ - public function get() + public function get(): array { return [ 'type' => 'cast', diff --git a/Library/Builder/Operators/NewInstanceOperatorBuilder.php b/Library/Builder/Operators/NewInstanceOperatorBuilder.php deleted file mode 100644 index 5efcc1f903..0000000000 --- a/Library/Builder/Operators/NewInstanceOperatorBuilder.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder\Operators; - -/** - * NewInstanceOperatorBuilder. - * - * Allows to manually build a 'new instance' operator AST node - */ -class NewInstanceOperatorBuilder extends AbstractOperatorBuilder -{ - protected $type; - - protected $className; - - protected $dynamic; - - protected $file; - - protected $line; - - protected $char; - - public function __construct($className, array $parameters, $dynamic = false, $file = null, $line = 0, $char = 0) - { - $this->className = $className; - $this->parameters = $parameters; - $this->dynamic = $dynamic; - $this->file = $file; - $this->line = $line; - $this->char = $char; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - $parameters = []; - foreach ($this->parameters as $parameter) { - $parameters[] = $parameter->get(); - } - - return [ - 'type' => 'new', - 'class' => $this->className, - 'parameters' => $parameters, - 'dynamic' => $this->dynamic, - 'file' => $this->file, - 'line' => $this->line, - 'char' => $this->char, - ]; - } -} diff --git a/Library/Builder/Operators/TypeOfOperatorBuilder.php b/Library/Builder/Operators/TypeOfOperatorBuilder.php deleted file mode 100644 index c73fc8a180..0000000000 --- a/Library/Builder/Operators/TypeOfOperatorBuilder.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\Builder\Operators; - -/** - * TypeOfOperatorBuilder. - * - * Allows to manually build a 'typeof' operator AST node - */ -class TypeOfOperatorBuilder extends AbstractOperatorBuilder -{ - protected $leftOperand; - - /** - * @param $left - * @param null $file - * @param int $line - * @param int $char - */ - public function __construct($left, $file = null, $line = 0, $char = 0) - { - $this->leftOperand = $left; - $this->file = $file; - $this->line = $line; - $this->char = $char; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - return [ - 'type' => 'typeof', - 'left' => $this->leftOperand->get(), - 'file' => $this->file, - 'line' => $this->line, - 'char' => $this->char, - ]; - } -} diff --git a/Library/Builder/Operators/UnaryOperatorBuilder.php b/Library/Builder/Operators/UnaryOperatorBuilder.php index 21f46e35dd..b893e9904f 100644 --- a/Library/Builder/Operators/UnaryOperatorBuilder.php +++ b/Library/Builder/Operators/UnaryOperatorBuilder.php @@ -9,26 +9,32 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Operators; +use function is_object; + /** - * UnaryOperatorBuilder. - * * Allows to manually build a unary operator AST node */ class UnaryOperatorBuilder extends AbstractOperatorBuilder { - protected $operator; + /** + * Operator name + * + * @var string + */ + protected string $operator; + /** + * Left Expression + * + * @var mixed + */ protected $leftExpression; - protected $file; - - protected $line; - - protected $char; - - public function __construct($operator, $leftExpression, $file = null, $line = 0, $char = 0) + public function __construct(string $operator, $leftExpression, ?string $file = null, int $line = 0, int $char = 0) { $this->operator = $operator; $this->leftExpression = $leftExpression; @@ -42,9 +48,9 @@ public function __construct($operator, $leftExpression, $file = null, $line = 0, * * @return array */ - public function get() + public function get(): array { - if (\is_object($this->leftExpression) && method_exists($this->leftExpression, 'get')) { + if (is_object($this->leftExpression) && method_exists($this->leftExpression, 'get')) { $expr = $this->leftExpression->get(); } else { $expr = $this->leftExpression; diff --git a/Library/Builder/ParameterBuilder.php b/Library/Builder/ParameterBuilder.php deleted file mode 100644 index 3a594a0778..0000000000 --- a/Library/Builder/ParameterBuilder.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\Builder; - -/** - * ParameterBuilder. - * - * Allows to manually build a call parameters AST nodes - */ -class ParameterBuilder -{ - protected $value; - - public function __construct($value) - { - $this->value = $value; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - return [ - 'parameter' => $this->value->get(), - ]; - } -} diff --git a/Library/Builder/RawExpressionBuilder.php b/Library/Builder/RawExpressionBuilder.php deleted file mode 100644 index c906e6cffd..0000000000 --- a/Library/Builder/RawExpressionBuilder.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\Builder; - -/** - * RawExpressionBuilder. - * - * Allows to use a raw expression in a builder - */ -class RawExpressionBuilder -{ - protected $expr; - - public function __construct($expr) - { - $this->expr = $expr; - } - - public function get() - { - return $this->expr; - } -} diff --git a/Library/Builder/Statements/AbstractStatementBuilder.php b/Library/Builder/Statements/AbstractStatementBuilder.php index 1cc9073658..a788fbc70e 100644 --- a/Library/Builder/Statements/AbstractStatementBuilder.php +++ b/Library/Builder/Statements/AbstractStatementBuilder.php @@ -9,15 +9,16 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Statements; -/** - * Class AbstractStatementBuilder. - */ abstract class AbstractStatementBuilder { /** + * Returns a builder definition. + * * @return array */ - abstract public function get(); + abstract public function get(): array; } diff --git a/Library/Builder/Statements/IfStatementBuilder.php b/Library/Builder/Statements/IfStatementBuilder.php index 6864f67e0c..ae469a1291 100644 --- a/Library/Builder/Statements/IfStatementBuilder.php +++ b/Library/Builder/Statements/IfStatementBuilder.php @@ -9,30 +9,28 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Statements; use Zephir\Builder\Operators\AbstractOperatorBuilder; use Zephir\Builder\StatementsBlockBuilder; /** - * IfStatementBuilder. - * * Allows to manually build a 'if' statement AST node */ class IfStatementBuilder extends AbstractStatementBuilder { - private $evalExpr; + private AbstractOperatorBuilder $evalExpr; - private $ifBlock; + private StatementsBlockBuilder $ifBlock; - private $elseBlock; + private ?StatementsBlockBuilder $elseBlock; /** - * IfStatementBuilder constructor. - * - * @param AbstractOperatorBuilder $evalExpr - * @param StatementsBlockBuilder $ifBlock - * @param StatementsBlockBuilder $elseBlock + * @param AbstractOperatorBuilder $evalExpr + * @param StatementsBlockBuilder $ifBlock + * @param StatementsBlockBuilder|null $elseBlock */ public function __construct(AbstractOperatorBuilder $evalExpr, StatementsBlockBuilder $ifBlock, StatementsBlockBuilder $elseBlock = null) { @@ -42,9 +40,11 @@ public function __construct(AbstractOperatorBuilder $evalExpr, StatementsBlockBu } /** - * {@inheritdoc} + * Returns a builder definition. + * + * @return array */ - public function get() + public function get(): array { $expression = [ 'type' => 'if', diff --git a/Library/Builder/Statements/LetStatementBuilder.php b/Library/Builder/Statements/LetStatementBuilder.php index 718e906cb0..9be3905c97 100644 --- a/Library/Builder/Statements/LetStatementBuilder.php +++ b/Library/Builder/Statements/LetStatementBuilder.php @@ -12,26 +12,36 @@ namespace Zephir\Builder\Statements; /** - * IfStatementBuilder. - * * Allows to manually build a 'let' statement AST node */ class LetStatementBuilder extends AbstractStatementBuilder { - private $expr; + /** + * List of assignments + * + * @var array + */ + private array $assignments; - private $assignments; + /** + * Expression + * + * @var mixed + */ + private $expr; - public function __construct($assignments, $expr) + public function __construct(array $assignments, $expr) { $this->assignments = $assignments; $this->expr = $expr; } /** - * {@inheritdoc} + * Returns a builder definition. + * + * @return array */ - public function get() + public function get(): array { return [ 'type' => 'let', diff --git a/Library/Builder/Statements/ReturnStatementBuilder.php b/Library/Builder/Statements/ReturnStatementBuilder.php deleted file mode 100644 index 6d14635027..0000000000 --- a/Library/Builder/Statements/ReturnStatementBuilder.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder\Statements; - -/** - * ReturnStatementBuilder. - * - * Allows to manually build a 'return' statement AST node - */ -class ReturnStatementBuilder extends AbstractStatementBuilder -{ - private $expr; - - /** - * ReturnStatementBuilder constructor. - * - * @param mixed $expr - */ - public function __construct($expr) - { - $this->expr = $expr; - } - - /** - * {@inheritdoc} - */ - public function get() - { - return [ - 'type' => 'return', - 'expr' => $this->expr->get(), - ]; - } -} diff --git a/Library/Builder/Statements/ThrowStatementBuilder.php b/Library/Builder/Statements/ThrowStatementBuilder.php deleted file mode 100644 index 8007dbbee1..0000000000 --- a/Library/Builder/Statements/ThrowStatementBuilder.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder\Statements; - -/** - * ThrowStatementBuilder. - * - * Allows to manually build a 'throw' statement AST node - */ -class ThrowStatementBuilder extends AbstractStatementBuilder -{ - private $expr; - - /** - * ThrowStatementBuilder constructor. - * - * @param mixed $expr - */ - public function __construct($expr) - { - $this->expr = $expr; - } - - /** - * {@inheritdoc} - */ - public function get() - { - return [ - 'type' => 'throw', - 'expr' => $this->expr->get(), - ]; - } -} diff --git a/Library/Builder/StatementsBlockBuilder.php b/Library/Builder/StatementsBlockBuilder.php index 886a5ea61e..b0a02bfb44 100644 --- a/Library/Builder/StatementsBlockBuilder.php +++ b/Library/Builder/StatementsBlockBuilder.php @@ -9,20 +9,20 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder; /** - * StatementsBlockBuilder. - * * Allows to manually build a statements block AST node */ class StatementsBlockBuilder { - protected $statements; + protected array $statements; - protected $raw; + protected bool $raw; - public function __construct(array $statements, $raw = false) + public function __construct(array $statements, bool $raw = false) { $this->statements = $statements; $this->raw = $raw; @@ -33,18 +33,17 @@ public function __construct(array $statements, $raw = false) * * @return array */ - public function get() + public function get(): array { - if (!$this->raw) { - $statements = []; - - foreach ($this->statements as $statement) { - $statements[] = $statement->get(); - } + if ($this->raw) { + return $this->statements; + } - return $statements; + $statements = []; + foreach ($this->statements as $statement) { + $statements[] = $statement->get(); } - return $this->statements; + return $statements; } } diff --git a/Library/Builder/VariableBuilder.php b/Library/Builder/VariableBuilder.php deleted file mode 100644 index 33e0b8c282..0000000000 --- a/Library/Builder/VariableBuilder.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\Builder; - -/** - * VariableBuilder. - * - * Allows to manually build a variable AST node - */ -class VariableBuilder -{ - protected $name; - - public function __construct($name) - { - $this->name = $name; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - return [ - 'type' => 'variable', - 'value' => $this->name, - ]; - } -} diff --git a/Library/Call.php b/Library/Call.php index ba5aff04f5..3e03402521 100644 --- a/Library/Call.php +++ b/Library/Call.php @@ -454,6 +454,7 @@ public function getResolvedParams(array $parameters, CompilationContext $compila break; case 'variable': + case 'mixed': $params[] = $compilationContext->backend->getVariableCode($parameterVariable); $types[] = $parameterVariable->getType(); $dynamicTypes = array_merge( @@ -636,6 +637,7 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext case 'string': case 'variable': + case 'mixed': case 'array': $params[] = $compilationContext->backend->getVariableCode($parameterVariable); $dynamicTypes[] = $parameterVariable->getType(); diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index 3204a2ae82..52a24656f6 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -157,14 +157,6 @@ final class ClassDefinition extends AbstractClassDefinition */ protected ?AliasManager $aliasManager = null; - /** - * Whether the constructor was generated by Zephir - * (-> no constructor existed previously). - * - * @var bool - */ - protected bool $isGeneratedConstructor = false; - /** * @var Compiler */ @@ -206,26 +198,6 @@ public function isBundled(): bool return $this->isBundled; } - /** - * Sets if the class constructor was generated by zephir. - * - * @param bool $isGeneratedConstructor - */ - public function setIsGeneratedConstructor(bool $isGeneratedConstructor): void - { - $this->isGeneratedConstructor = $isGeneratedConstructor; - } - - /** - * Returns whether the constructor was generated by zephir. - * - * @return bool - */ - public function isGeneratedConstructor(): bool - { - return $this->isGeneratedConstructor; - } - /** * Sets whether the class is external or not. * @@ -580,11 +552,8 @@ public function hasProperty(string $name): bool } $extendsClassDefinition = $this->getExtendsClassDefinition(); - if ($extendsClassDefinition instanceof self && $extendsClassDefinition->hasProperty($name)) { - return true; - } - return false; + return $extendsClassDefinition instanceof self && $extendsClassDefinition->hasProperty($name); } /** diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 4724ba8a42..8c1ec47486 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -77,6 +77,16 @@ class ClassMethod */ protected array $returnTypes = []; + /** + * Zend MAY_BE_* types. + * + * @var array|string[] + */ + protected array $mayBeArgTypes = [ + 'int' => 'MAY_BE_LONG', + 'false' => 'MAY_BE_FALSE', + ]; + /** * Raw-types returned by the method. * @@ -673,7 +683,7 @@ public function areReturnTypesDoubleCompatible(): bool } /** - * Checks whether at least one return type hint is integer compatible. + * Checks whether at least one return type hint is bool compatible. * * @return bool */ @@ -683,7 +693,17 @@ public function areReturnTypesBoolCompatible(): bool } /** - * Checks whether at least one return type hint is integer compatible. + * Checks whether at least one return type hint is false compatible. + * + * @return bool + */ + public function areReturnTypesFalseCompatible(): bool + { + return isset($this->returnTypes['false']); + } + + /** + * Checks whether at least one return type hint is string compatible. * * @return bool */ @@ -997,6 +1017,14 @@ 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. * @@ -2294,6 +2322,7 @@ public function isReturnTypesHintDetermined(): bool $this->areReturnTypesIntCompatible() || $this->areReturnTypesNullCompatible() || $this->areReturnTypesStringCompatible() || + $this->areReturnTypesFalseCompatible() || \array_key_exists('array', $this->getReturnTypes()) ) { continue; @@ -2323,13 +2352,23 @@ public function areReturnTypesCompatible(): bool return true; } - // null | T1 | T2 - if (count($this->returnTypes) > 2) { - return false; + $totalTypes = count($this->returnTypes); + + // union types + if ($totalTypes > 1) { + $diff = array_diff(array_keys($this->returnTypes), array_keys($this->mayBeArgTypes)); + if (count($diff) === 0) { + return true; + } } // T1 | T2 - if (2 === count($this->returnTypes) && !isset($this->returnTypes['null'])) { + if (2 === $totalTypes && !isset($this->returnTypes['null'])) { + return false; + } + + // null | T1 | T2 + if ($totalTypes > 2) { return false; } diff --git a/Library/ClassMethodParameters.php b/Library/ClassMethodParameters.php index 13e54efb5d..9337d68128 100644 --- a/Library/ClassMethodParameters.php +++ b/Library/ClassMethodParameters.php @@ -142,46 +142,55 @@ public function count(): int return count($this->parameters); } + #[\ReturnTypeWillChange] public function rewind() { $this->position = 0; } + #[\ReturnTypeWillChange] public function key() { return $this->position; } + #[\ReturnTypeWillChange] public function valid() { return isset($this->parameters[$this->position]); } + #[\ReturnTypeWillChange] public function current() { return $this->parameters[$this->position]; } + #[\ReturnTypeWillChange] public function next() { ++$this->position; } + #[\ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->parameters[$offset]); } + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->parameters[$offset]; } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->parameters[$offset] = $value; } + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->parameters[$offset]); diff --git a/Library/Classes/Entry.php b/Library/Classes/Entry.php index 31ae696ac7..400592fc95 100644 --- a/Library/Classes/Entry.php +++ b/Library/Classes/Entry.php @@ -98,7 +98,7 @@ public function get(): string return $this->classEntries[$className][0]; } - if (class_exists($this->classname)) { + if (class_exists($this->classname) || interface_exists($this->classname)) { $reflection = new ReflectionClass($this->classname); $className = $reflection->getName(); @@ -121,7 +121,7 @@ public function get(): string /** * External class, we don't know its ClassEntry in C world. */ - if (!$this->isInternalClass($classNamespace[0])) { + if ($classNamespace[0] === '' || !$this->isInternalClass($classNamespace[0])) { $className = str_replace(self::NAMESPACE_SEPARATOR, self::NAMESPACE_SEPARATOR.self::NAMESPACE_SEPARATOR, strtolower($className)); return sprintf( diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 9364c2d0f2..e634da6fd8 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use Psr\Log\LoggerAwareTrait; @@ -24,8 +26,6 @@ use function is_array; /** - * Zephir\CompilerFile. - * * This class represents every file compiled in a project. * Every file may contain a class or an interface. */ @@ -364,11 +364,11 @@ public function preCompileClass(CompilationContext $compilationContext, $namespa } if (isset($topStatement['abstract'])) { - $classDefinition->setIsAbstract($topStatement['abstract']); + $classDefinition->setIsAbstract((bool) $topStatement['abstract']); } if (isset($topStatement['final'])) { - $classDefinition->setIsFinal($topStatement['final']); + $classDefinition->setIsFinal((bool) $topStatement['final']); } if (is_array($docblock)) { diff --git a/Library/Config.php b/Library/Config.php index d7f278630a..73aeaf59b0 100644 --- a/Library/Config.php +++ b/Library/Config.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use ArrayAccess; @@ -124,15 +126,13 @@ public function __toString() /** * Factory method to create a Config instance from the $_SERVER['argv']. * - * @throws Exception - * * @return Config */ public static function fromServer(): self { $config = new self(); - /* + /** * Change configurations flags */ if ($_SERVER['argc'] >= 2) { @@ -224,25 +224,26 @@ public function offsetExists($key): bool /** * Gets a $key from the internal container. * - * @param mixed $key + * @param mixed $offset * * @return mixed|null */ - public function offsetGet($key) + #[\ReturnTypeWillChange] + public function offsetGet($offset) { - if (!\is_array($key)) { - return $this->offsetExists($key) ? $this->container[$key] : null; + if (!\is_array($offset)) { + return $this->offsetExists($offset) ? $this->container[$offset] : null; } - $namespace = key($key); - $key = current($key); + $namespace = key($offset); + $offset = current($offset); if (!$this->offsetExists($namespace) || !\is_array($this->container[$namespace])) { return null; } - if (isset($this->container[$namespace][$key]) || \array_key_exists($key, $this->container[$namespace])) { - return $this->container[$namespace][$key]; + if (isset($this->container[$namespace][$offset]) || \array_key_exists($offset, $this->container[$namespace])) { + return $this->container[$namespace][$offset]; } return null; @@ -254,6 +255,7 @@ public function offsetGet($key) * @param mixed $key * @param mixed $value */ + #[\ReturnTypeWillChange] public function offsetSet($key, $value) { if (!\is_array($key)) { @@ -279,6 +281,7 @@ public function offsetSet($key, $value) * * @param mixed $key */ + #[\ReturnTypeWillChange] public function offsetUnset($key) { unset($this->container[$key]); diff --git a/Library/ConfigException.php b/Library/ConfigException.php index 4287e6b69d..ab1ad6229a 100644 --- a/Library/ConfigException.php +++ b/Library/ConfigException.php @@ -17,7 +17,7 @@ class ConfigException extends Exception { public function __construct($message = '', $code = 0, Exception $previous = null) { - $message .= PHP_EOL.'Please see http://zephir-lang.com/config.html 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/Library/Console/Application.php index d8674b38db..32cfa2d96d 100644 --- a/Library/Console/Application.php +++ b/Library/Console/Application.php @@ -39,18 +39,8 @@ public function __construct() { parent::__construct('Zephir', Zephir::VERSION); - $this->setupEventDispatcher(); - } - - protected function setupEventDispatcher(): void - { $dispatcher = new EventDispatcher(); - $consoleErrorListener = new ConsoleErrorListener(); - - $dispatcher->addListener( - ConsoleEvents::ERROR, - [$consoleErrorListener, 'onCommandError'] - ); + $dispatcher->addListener(ConsoleEvents::ERROR, [new ConsoleErrorListener(), 'onCommandError']); $this->setDispatcher($dispatcher); } diff --git a/Library/Console/Command/ApiCommand.php b/Library/Console/Command/ApiCommand.php index ebe32e9d0c..e19477ac6b 100644 --- a/Library/Console/Command/ApiCommand.php +++ b/Library/Console/Command/ApiCommand.php @@ -24,9 +24,7 @@ use function in_array; /** - * API Command - * - * Generates a HTML API based on the classes exposed in the extension. + * Generates an HTML API based on the classes exposed in the extension. */ final class ApiCommand extends AbstractCommand { diff --git a/Library/Console/Command/GenerateCommand.php b/Library/Console/Command/GenerateCommand.php index c08c863245..8ca92df7e3 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/Library/Console/Command/GenerateCommand.php @@ -22,6 +22,7 @@ use Zephir\Exception; use Zephir\Exception\ExceptionInterface; use Zephir\Exception\InvalidArgumentException; + use function extension_loaded; /** @@ -48,6 +49,7 @@ protected function configure() ->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()); } @@ -55,6 +57,8 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); + $trace = $input->getOption('trace'); + if (extension_loaded('timecop') && 1 == ini_get('timecop.func_override')) { $io->getErrorStyle()->warning( <<getErrorStyle()->error($e->getMessage()); - - return 1; - } catch (Exception $e) { - $io->getErrorStyle()->error($e->getMessage()); + } 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->getTraceAsString()); + } else { + $io->getErrorStyle()->error($e->getMessage()); + } return 1; } diff --git a/Library/DependencyInjection/CompilerPass/CollectCommandsToApplicationCompilerPass.php b/Library/DependencyInjection/CompilerPass/CollectCommandsToApplicationCompilerPass.php deleted file mode 100644 index c70f721fa8..0000000000 --- a/Library/DependencyInjection/CompilerPass/CollectCommandsToApplicationCompilerPass.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\DependencyInjection\CompilerPass; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; -use Zephir\Console\Application; - -final class CollectCommandsToApplicationCompilerPass implements CompilerPassInterface -{ - public function process(ContainerBuilder $containerBuilder) - { - $applicationDefinition = $containerBuilder->getDefinition(Application::class); - - foreach ($containerBuilder->getDefinitions() as $name => $definition) { - if (null === $definition->getClass()) { - continue; - } - - /* - * TODO: Deal with SelfUpdateCommand. - * - * if (\substr(__FILE__, 0, 5) === 'phar:') { - * // ... - * } - */ - if (is_a($definition->getClass(), Command::class, true)) { - $applicationDefinition->addMethodCall('add', [new Reference($name)]); - } - } - } -} diff --git a/Library/DependencyInjection/ContainerFactory.php b/Library/DependencyInjection/ContainerFactory.php deleted file mode 100644 index 20fe40ff0a..0000000000 --- a/Library/DependencyInjection/ContainerFactory.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\DependencyInjection; - -final class ContainerFactory -{ - private $environment = '$kernel-environment$'; - private $debug = false; - - public function __construct() - { - /* - * Please do not concatenate the string bellow. - * The final version of this string is used to prepare release PHAR file. - * For more see box.json.dist file at the project root. - */ - if ('$'.'kernel-environment'.'$' === $this->environment) { - $this->environment = 'dev'; - } - - if ('dev' === $this->environment) { - $this->debug = true; - } - } - - public function createWithConfigs(array $configs) - { - $kernel = new ZephirKernel($this->environment, $this->debug, $configs); - $kernel->boot(); - - return $kernel->getContainer(); - } - - public function create() - { - $kernel = new ZephirKernel($this->environment, $this->debug); - $kernel->boot(); - - return $kernel->getContainer(); - } -} diff --git a/Library/DependencyInjection/ZephirKernel.php b/Library/DependencyInjection/ZephirKernel.php deleted file mode 100644 index 62ea6851e1..0000000000 --- a/Library/DependencyInjection/ZephirKernel.php +++ /dev/null @@ -1,211 +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\DependencyInjection; - -use Exception; -use RuntimeException; -use Symfony\Bundle\MonologBundle\MonologBundle; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\Kernel; -use Throwable; -use Zephir\DependencyInjection\CompilerPass\CollectCommandsToApplicationCompilerPass; -use Zephir\Zephir; - -use function dirname; -use function Zephir\is_macos; -use function Zephir\is_windows; - -use const DIRECTORY_SEPARATOR; - -final class ZephirKernel extends Kernel -{ - private array $extraConfigFiles; - private $startedDir; - - /** - * AppKernel constructor. - * - * @param string $environment The environment - * @param bool $debug Whether to enable debugging or not - * @param string[] $configFiles Optional Zephir configuration files - */ - public function __construct(string $environment, bool $debug, array $configFiles = []) - { - $this->startedDir = getcwd(); - $this->extraConfigFiles = $configFiles; - - parent::__construct($environment, $debug); - } - - /** - * @return array - */ - public function registerBundles(): array - { - return [ - new MonologBundle(), - ]; - } - - /** - * {@inheritdoc} - * - * @param LoaderInterface $loader - * - * @throws Exception|Throwable - */ - public function registerContainerConfiguration(LoaderInterface $loader) - { - $loader->load(__DIR__.'/../config/config.yml'); - - foreach ($this->extraConfigFiles as $configFile) { - $loader->load($configFile); - } - } - - /** - * @return string - */ - public function getCacheDir(): string - { - $home = getenv('HOME') ?: (getenv('HOMEDRIVE').DIRECTORY_SEPARATOR.getenv('HOMEPATH')); - - if (is_macos()) { - $cacheDir = getenv('XDG_CACHE_HOME') ?: $home.'/Library/Caches'; - $cacheDir .= '/Zephir'; - } elseif (is_windows()) { - $cacheDir = getenv('LOCALAPPDATA') ?: $home; - $cacheDir .= '\\Zephir\\Cache'; - } else { - $cacheDir = getenv('XDG_CACHE_HOME') ?: $home.'/.cache'; - $cacheDir .= '/zephir'; - } - - $path = $cacheDir.DIRECTORY_SEPARATOR.$this->getPathSalt(); - if (!is_dir($path) && !mkdir($path, 0755, true) && !is_dir($path)) { - throw new RuntimeException( - sprintf('Unable to create cache directory: "%s"', $path) - ); - } - - return $path; - } - - /** - * Allows container rebuild when config or version changes. - * This also used to get unique path to kernel logs. - * - * @return string - */ - private function getPathSalt(): string - { - $prefix = - Zephir::VERSION. - $this->environment. - serialize($this->extraConfigFiles); - - $localConfig = $this->startedDir.DIRECTORY_SEPARATOR.'config.json'; - $suffix = $this->startedDir; - if (file_exists($localConfig)) { - $suffix = md5_file($localConfig); - } - - return substr(md5("{$prefix}{$suffix}"), 0, 16); - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getLogDir(): string - { - $home = getenv('HOME') ?: (getenv('HOMEDRIVE').DIRECTORY_SEPARATOR.getenv('HOMEPATH')); - - if (is_macos()) { - $stateDir = getenv('XDG_STATE_HOME') ?: $home.'/Library'; - $stateDir .= '/Zephir/State'; - } elseif (is_windows()) { - $stateDir = getenv('LOCALAPPDATA') ?: $home; - $stateDir .= '\\Zephir\\State'; - } else { - // See: https://stackoverflow.com/a/27965014/1661465 - $stateDir = getenv('XDG_STATE_HOME') ?: $home.'/.local/state'; - $stateDir .= '/zephir'; - } - - $path = $stateDir.DIRECTORY_SEPARATOR.$this->getPathSalt(); - if (!is_dir($path) && !mkdir($path, 0755, true) && !is_dir($path)) { - throw new RuntimeException( - sprintf('Unable to create logs directory: "%s"', $path) - ); - } - - return $path; - } - - /** - * {@inheritdoc} - * - * @return string The project root dir - */ - public function getProjectDir(): string - { - return dirname(__DIR__, 2); - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getRootDir(): string - { - return dirname(__DIR__); - } - - /** - * Gets the local cache directory used internally by zephir. - * - * @return string The local cache dir - */ - public function getStartedDir(): string - { - return $this->startedDir.'/.zephir'; - } - - /** - * {@inheritdoc} - * - * @param ContainerBuilder $container - */ - protected function build(ContainerBuilder $container) - { - $container->addCompilerPass(new CollectCommandsToApplicationCompilerPass()); - } - - /** - * {@inheritdoc} - * - * @return array An array of kernel parameters - */ - protected function getKernelParameters(): array - { - $parameters = parent::getKernelParameters(); - $parameters['kernel.local_cache_dir'] = $this->getStartedDir(); - - return $parameters; - } -} diff --git a/Library/Documentation/Theme.php b/Library/Documentation/Theme.php index 797ecc1b21..4e6ee9c633 100644 --- a/Library/Documentation/Theme.php +++ b/Library/Documentation/Theme.php @@ -83,7 +83,7 @@ private function __namespaceTreeHelper(NamespaceHelper $ns) } /** - * from : http://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php. + * from : https://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php. * * @param $src * @param $dst diff --git a/Library/Expression/Constants.php b/Library/Expression/Constants.php index 1bed77c32d..3ce948fddc 100644 --- a/Library/Expression/Constants.php +++ b/Library/Expression/Constants.php @@ -38,7 +38,7 @@ class Constants /** * Reserved ENV Constants. * - * @see http://www.php.net/manual/ru/reserved.constants.php + * @see https://www.php.net/manual/ru/reserved.constants.php * * @var array */ @@ -66,7 +66,7 @@ class Constants /** * Magic constants. * - * @see http://php.net/manual/en/language.constants.predefined.php + * @see https://php.net/manual/en/language.constants.predefined.php * * @var array */ diff --git a/Library/FunctionLike/ReturnType/Collection.php b/Library/FunctionLike/ReturnType/Collection.php index 943b2ff268..b1198d1e6e 100644 --- a/Library/FunctionLike/ReturnType/Collection.php +++ b/Library/FunctionLike/ReturnType/Collection.php @@ -9,11 +9,15 @@ * 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 { /** @@ -23,6 +27,7 @@ final class Collection extends SplObjectStorage * * @return string */ + #[\ReturnTypeWillChange] public function getHash($returnType) { return $returnType->getDataType(); @@ -38,6 +43,7 @@ public function getHash($returnType) * * @throws InvalidArgumentException */ + #[\ReturnTypeWillChange] public function attach($returnType, $definition = null) { if (!$returnType instanceof TypeInterface) { @@ -58,13 +64,9 @@ public function attach($returnType, $definition = null) * * @return bool */ - public function hasReturnTypes() + public function hasReturnTypes(): bool { - if (0 == $this->count()) { - return false; - } - - if ($this->onlyVoid()) { + if (0 === $this->count() || $this->onlyVoid()) { return false; } @@ -78,7 +80,7 @@ public function hasReturnTypes() * * @return TypeInterface[] */ - public function getTypesBySpecification(SpecificationInterface $spec) + public function getTypesBySpecification(SpecificationInterface $spec): array { $types = []; @@ -97,7 +99,7 @@ public function getTypesBySpecification(SpecificationInterface $spec) * * @return bool */ - public function areReturnTypesNullCompatible() + public function areReturnTypesNullCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\IsNull()); } @@ -107,7 +109,7 @@ public function areReturnTypesNullCompatible() * * @return bool */ - public function areReturnTypesIntCompatible() + public function areReturnTypesIntCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\IntCompatible()); } @@ -117,7 +119,7 @@ public function areReturnTypesIntCompatible() * * @return bool */ - public function areReturnTypesDoubleCompatible() + public function areReturnTypesDoubleCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\IsDouble()); } @@ -127,7 +129,7 @@ public function areReturnTypesDoubleCompatible() * * @return bool */ - public function areReturnTypesBoolCompatible() + public function areReturnTypesBoolCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\IsBool()); } @@ -137,7 +139,7 @@ public function areReturnTypesBoolCompatible() * * @return bool */ - public function areReturnTypesStringCompatible() + public function areReturnTypesStringCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\StringCompatible()); } @@ -147,7 +149,7 @@ public function areReturnTypesStringCompatible() * * @return bool */ - public function areReturnTypesArrayCompatible() + public function areReturnTypesArrayCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\ArrayCompatible()); } @@ -157,9 +159,9 @@ public function areReturnTypesArrayCompatible() * * @return bool */ - public function areReturnTypesObjectCompatible() + public function areReturnTypesObjectCompatible(): bool { - return \count($this->getObjectLikeReturnTypes()) > 0; + return count($this->getObjectLikeReturnTypes()) > 0; } /** @@ -191,7 +193,7 @@ public function onlySpecial() $found = $this->getTypesBySpecification(new Specification\IsSpecial()); - return \count($found) == $this->count(); + return count($found) == $this->count(); } /** @@ -199,9 +201,9 @@ public function onlySpecial() * * @return bool */ - public function areReturnTypesWellKnown() + public function areReturnTypesWellKnown(): bool { - if (0 == $this->count() || $this->isSatisfiedByTypeSpec(new Specification\IsSpecial())) { + if (0 === $this->count() || $this->isSatisfiedByTypeSpec(new Specification\IsSpecial())) { return false; } @@ -218,7 +220,7 @@ public function areReturnTypesWellKnown() $found = $this->getTypesBySpecification($spec); - return \count($found) == $this->count(); + return count($found) == $this->count(); } /** @@ -226,7 +228,7 @@ public function areReturnTypesWellKnown() * * @return bool */ - public function areReturnTypesCompatible() + public function areReturnTypesCompatible(): bool { $numberOfReturnTypes = $this->count(); @@ -239,7 +241,7 @@ public function areReturnTypesCompatible() // | | | ... | $collections = $this->getTypesBySpecification(new Specification\IsCollection()); - if (\count($collections) > 0 && $this->areReturnTypesObjectCompatible()) { + if (count($collections) > 0 && $this->areReturnTypesObjectCompatible()) { return false; } @@ -292,7 +294,7 @@ public function areReturnTypesCompatible() * * @return TypeInterface[] */ - public function getCastHintedReturnTypes() + public function getCastHintedReturnTypes(): array { return $this->getTypesBySpecification(new Not(new Specification\IsReal())); } @@ -302,19 +304,19 @@ public function getCastHintedReturnTypes() * * @return TypeInterface[] */ - public function getRealReturnTypes() + public function getRealReturnTypes(): array { return $this->getTypesBySpecification(new Specification\IsReal()); } - private function isSatisfiedByTypeSpec(SpecificationInterface $spec) + private function isSatisfiedByTypeSpec(SpecificationInterface $spec): bool { - if (0 == $this->count()) { + if (0 === $this->count()) { return false; } $found = $this->getTypesBySpecification($spec); - return \count($found) > 0; + return count($found) > 0; } } diff --git a/Library/Operators/BaseOperator.php b/Library/Operators/AbstractOperator.php similarity index 88% rename from Library/Operators/BaseOperator.php rename to Library/Operators/AbstractOperator.php index 0616ddba9e..50e49f3c5b 100644 --- a/Library/Operators/BaseOperator.php +++ b/Library/Operators/AbstractOperator.php @@ -16,10 +16,7 @@ use Zephir\CompilationContext; use Zephir\Variable; -/** - * TODO: Make it abstract - */ -class BaseOperator +abstract class AbstractOperator { protected string $operator; @@ -52,26 +49,28 @@ public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = * @param array $expression * @param bool $init * - * @return Variable + * @return Variable|null */ public function getExpectedNonLiteral(CompilationContext $compilationContext, array $expression, bool $init = true): ?Variable { - $isExpecting = $this->expecting; $symbolVariable = $this->expectingVariable; - if ($isExpecting) { - if (\is_object($symbolVariable)) { - if ('variable' == $symbolVariable->getType() && !$symbolVariable->isLocalOnly()) { - if (!$init) { - return $symbolVariable; - } - $symbolVariable->initVariant($compilationContext); - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); + if (!$this->expecting) { + return $symbolVariable; + } + + if ($symbolVariable !== null) { + if ('variable' === $symbolVariable->getType() && !$symbolVariable->isLocalOnly()) { + if (!$init) { + return $symbolVariable; } + + $symbolVariable->initVariant($compilationContext); } else { $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); } return $symbolVariable; @@ -89,10 +88,9 @@ public function getExpectedNonLiteral(CompilationContext $compilationContext, ar */ public function getExpected(CompilationContext $compilationContext, array $expression, bool $init = true): ?Variable { - $isExpecting = $this->expecting; $symbolVariable = $this->expectingVariable; - if ($isExpecting) { + if ($this->expecting) { if (\is_object($symbolVariable)) { if ('variable' === $symbolVariable->getType()) { if (!$init) { @@ -138,10 +136,9 @@ public function getExpected(CompilationContext $compilationContext, array $expre */ public function getExpectedComplexLiteral(CompilationContext $compilationContext, string $type = 'variable'): ?Variable { - $isExpecting = $this->expecting; $symbolVariable = $this->expectingVariable; - if ($isExpecting) { + if ($this->expecting) { if (\is_object($symbolVariable)) { if ($symbolVariable->getType() === $type || 'return_value' === $symbolVariable->getName()) { $symbolVariable->initVariant($compilationContext); diff --git a/Library/Operators/Arithmetical/AddOperator.php b/Library/Operators/Arithmetical/AddOperator.php index 36c293c8bb..5fadff453d 100644 --- a/Library/Operators/Arithmetical/AddOperator.php +++ b/Library/Operators/Arithmetical/AddOperator.php @@ -12,8 +12,6 @@ namespace Zephir\Operators\Arithmetical; /** - * AddOperator. - * * Generates an arithmetical operation according to the operands */ class AddOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php index d8f52ed1ce..c490503d83 100644 --- a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php +++ b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php @@ -16,16 +16,14 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Variable; /** - * BaseOperator. - * * This is the base operator for commutative, associative and distributive * arithmetic operators */ -class ArithmeticalBaseOperator extends BaseOperator +class ArithmeticalBaseOperator extends AbstractOperator { protected bool $literalOnly = true; @@ -34,7 +32,7 @@ class ArithmeticalBaseOperator extends BaseOperator * * Probably gcc/clang will optimize them without this optimization * - * @see http://en.wikipedia.org/wiki/Constant_folding + * @see https://en.wikipedia.org/wiki/Constant_folding * * @param array $expression * @param CompilationContext $compilationContext diff --git a/Library/Operators/Arithmetical/DivOperator.php b/Library/Operators/Arithmetical/DivOperator.php index 7c1be697fe..bdb56058f6 100644 --- a/Library/Operators/Arithmetical/DivOperator.php +++ b/Library/Operators/Arithmetical/DivOperator.php @@ -17,8 +17,6 @@ use Zephir\Expression; /** - * DivOperator. - * * Generates an arithmetical operation according to the operands */ class DivOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Arithmetical/ModOperator.php b/Library/Operators/Arithmetical/ModOperator.php index 5a1f25ce50..a82bb4718a 100644 --- a/Library/Operators/Arithmetical/ModOperator.php +++ b/Library/Operators/Arithmetical/ModOperator.php @@ -17,8 +17,6 @@ use Zephir\Expression; /** - * ModOperator. - * * Generates an arithmetical operation according to the operands */ class ModOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Arithmetical/MulOperator.php b/Library/Operators/Arithmetical/MulOperator.php index f7a4fe7547..7e96db1a69 100644 --- a/Library/Operators/Arithmetical/MulOperator.php +++ b/Library/Operators/Arithmetical/MulOperator.php @@ -12,8 +12,6 @@ namespace Zephir\Operators\Arithmetical; /** - * MulOperator. - * * Generates an arithmetical operation according to the operands */ class MulOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Arithmetical/SubOperator.php b/Library/Operators/Arithmetical/SubOperator.php index 91cd3baa40..413f5a2990 100644 --- a/Library/Operators/Arithmetical/SubOperator.php +++ b/Library/Operators/Arithmetical/SubOperator.php @@ -12,8 +12,6 @@ namespace Zephir\Operators\Arithmetical; /** - * SubOperator. - * * Generates an arithmetical operation according to the operands */ class SubOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Bitwise/BitwiseBaseOperator.php b/Library/Operators/Bitwise/BitwiseBaseOperator.php index 864c616a7f..3d27040aee 100644 --- a/Library/Operators/Bitwise/BitwiseBaseOperator.php +++ b/Library/Operators/Bitwise/BitwiseBaseOperator.php @@ -15,15 +15,13 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * BaseOperator. - * * This is the base operator for commutative, associative and distributive * arithmetic operators */ -class BitwiseBaseOperator extends BaseOperator +class BitwiseBaseOperator extends AbstractOperator { protected bool $literalOnly = true; @@ -31,7 +29,7 @@ class BitwiseBaseOperator extends BaseOperator * This tries to perform arithmetical operations * Probably gcc/clang will optimize them without this optimization. * - * @see http://en.wikipedia.org/wiki/Constant_folding + * @see https://en.wikipedia.org/wiki/Constant_folding * * @param array $expression * @param CompilationContext $compilationContext diff --git a/Library/Operators/Bitwise/BitwiseNotOperator.php b/Library/Operators/Bitwise/BitwiseNotOperator.php index a4920aa017..b40be4dc06 100644 --- a/Library/Operators/Bitwise/BitwiseNotOperator.php +++ b/Library/Operators/Bitwise/BitwiseNotOperator.php @@ -15,9 +15,9 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; -class BitwiseNotOperator extends BaseOperator +class BitwiseNotOperator extends AbstractOperator { /** * @param $expression @@ -55,6 +55,7 @@ public function compile($expression, CompilationContext $compilationContext) 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); diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/Library/Operators/Comparison/ComparisonBaseOperator.php index 0fadf8073b..d9c49f3113 100644 --- a/Library/Operators/Comparison/ComparisonBaseOperator.php +++ b/Library/Operators/Comparison/ComparisonBaseOperator.php @@ -13,157 +13,153 @@ 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\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * BaseOperator. - * * This is the base operator for comparison operators */ -class ComparisonBaseOperator extends BaseOperator +class ComparisonBaseOperator extends AbstractOperator { - protected bool $literalOnly = true; - protected bool $commutative = false; /** - * @param $expr + * @param array $expr * @param CompilationContext $compilationContext * - * @throws CompilerException + * @return CompiledExpression|null * - * @return bool|CompiledExpression + * @throws Exception + * @throws ReflectionException */ - public function optimizeTypeOf($expr, CompilationContext $compilationContext) + public function optimizeTypeOf(array $expr, CompilationContext $compilationContext): ?CompiledExpression { if (!isset($expr['left'])) { - return false; + return null; } if (!isset($expr['right']) && !isset($expr['right']['value'])) { - return false; + return null; } - if ('typeof' == $expr['left']['type']) { - if ('string' != $expr['right']['type']) { - $compilationContext->logger->warning( - "Possible invalid comparison for 'typeof' operator with non-string", - ['invalid-typeof-comparison', $expr['right']] - ); + 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; - return false; - } + case 'not-identical': + case 'not-equals': + $operator = '!='; + break; - if (isset($expr['type'])) { - switch ($expr['type']) { - case 'identical': - case 'equals': - $operator = '=='; + 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; - case 'not-identical': - case 'not-equals': - $operator = '!='; + 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: - return false; + $condition = '1 '.$operator.' 0'; + break; } - } - - $expression = new Expression($expr['left']['left']); - $condition = $expression->compile($compilationContext); - $variableVariable = $compilationContext->symbolTable->getVariableForRead($condition->getCode(), $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 false; - } - - return new CompiledExpression('bool', $condition, $expr); + 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 false; + return new CompiledExpression('bool', $condition, $expr); } /** @@ -171,11 +167,16 @@ public function optimizeTypeOf($expr, CompilationContext $compilationContext) * * @param array $expression * @param CompilationContext $compilationContext + * + * @return CompiledExpression + * + * @throws ReflectionException + * @throws Exception */ - public function compile($expression, CompilationContext $compilationContext) + public function compile(array $expression, CompilationContext $compilationContext) { $conditions = $this->optimizeTypeOf($expression, $compilationContext); - if (false !== $conditions) { + if (null !== $conditions) { return $conditions; } @@ -227,6 +228,8 @@ public function compile($expression, CompilationContext $compilationContext) 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); @@ -279,6 +282,7 @@ public function compile($expression, CompilationContext $compilationContext) 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); @@ -328,6 +332,7 @@ public function compile($expression, CompilationContext $compilationContext) 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); @@ -368,6 +373,7 @@ public function compile($expression, CompilationContext $compilationContext) switch ($variableRight->getType()) { case 'string': case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $variableRight = $compilationContext->backend->getVariableCode($variableRight); @@ -422,6 +428,7 @@ public function compile($expression, CompilationContext $compilationContext) 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); @@ -466,6 +473,7 @@ public function compile($expression, CompilationContext $compilationContext) 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); @@ -506,6 +514,7 @@ public function compile($expression, CompilationContext $compilationContext) 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); @@ -532,6 +541,7 @@ public function compile($expression, CompilationContext $compilationContext) switch ($variableRight->getType()) { case 'string': case 'variable': + case 'mixed': case 'array': $compilationContext->headersManager->add('kernel/operators'); $variableRight = $compilationContext->backend->getVariableCode($variableRight); @@ -549,23 +559,22 @@ public function compile($expression, CompilationContext $compilationContext) break; case 'string': + $compilationContext->headersManager->add('kernel/operators'); + switch ($right->getType()) { case 'null': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalNullOperator.'('.$variableCode.')', $expression['left']); case 'string': - $compilationContext->headersManager->add('kernel/operators'); - 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': - $compilationContext->headersManager->add('kernel/operators'); + case 'mixed': $variableRight = $compilationContext->backend->getVariableCode($variableRight); return new CompiledExpression('bool', $this->zvalOperator.'('.$variableCode.', '.$variableRight.')', $expression); @@ -581,9 +590,11 @@ public function compile($expression, CompilationContext $compilationContext) break; case 'variable': + case 'mixed': + $compilationContext->headersManager->add('kernel/operators'); + switch ($right->getType()) { case 'null': - $compilationContext->headersManager->add('kernel/operators'); $condition = $compilationContext->backend->getTypeofCondition($variable, $this->operator, 'null', $compilationContext); return new CompiledExpression('bool', $condition, $expression['left']); @@ -593,25 +604,18 @@ public function compile($expression, CompilationContext $compilationContext) case 'long': case 'ulong': case 'double': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalLongOperator.'('.$variableCode.', '.$right->getCode().')', $expression['left']); case 'char': case 'uchar': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalLongOperator.'('.$variableCode.', \''.$right->getCode().'\')', $expression['left']); case 'bool': - $compilationContext->headersManager->add('kernel/operators'); - $zvalBoolOperator = 'true' == $right->getCode() ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; + $zvalBoolOperator = 'true' === $right->getCode() ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; return new CompiledExpression('bool', $zvalBoolOperator.'('.$variableCode.')', $expression['left']); case 'string': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalStringOperator.'('.$variableCode.', "'.$right->getCode().'")', $expression['left']); case 'variable': @@ -621,24 +625,18 @@ public function compile($expression, CompilationContext $compilationContext) case 'uint': case 'long': case 'ulong': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalLongOperator.'('.$variableCode.', '.$variableRight->getName().')', $expression); case 'double': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalDoubleOperator.'('.$variableCode.', '.$variableRight->getName().')', $expression); case 'bool': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalBoolOperator.'('.$variableCode.', '.$variableRight->getName().')', $expression); 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); diff --git a/Library/Operators/Logical/LogicalBaseOperator.php b/Library/Operators/Logical/LogicalBaseOperator.php index f01bcb80ae..b6d91e9879 100644 --- a/Library/Operators/Logical/LogicalBaseOperator.php +++ b/Library/Operators/Logical/LogicalBaseOperator.php @@ -17,12 +17,12 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** * This is the base operator for logical operators */ -class LogicalBaseOperator extends BaseOperator +class LogicalBaseOperator extends AbstractOperator { public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/CastOperator.php b/Library/Operators/Other/CastOperator.php index c38ab4def1..26b8ac9724 100644 --- a/Library/Operators/Other/CastOperator.php +++ b/Library/Operators/Other/CastOperator.php @@ -13,22 +13,21 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Detectors\ReadDetector; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Statements\Let\Variable as LetVariable; use Zephir\Types; /** - * Cast operator - * * Converts a value into another of a different type */ -class CastOperator extends BaseOperator +class CastOperator extends AbstractOperator { /** * Compiles a type cast operation. @@ -36,9 +35,9 @@ class CastOperator extends BaseOperator * @param array $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { @@ -81,9 +80,11 @@ public function compile(array $expression, CompilationContext $compilationContex 'string', $compilationContext ); - $let = new LetVariable(); + $original = $resolved->getOriginal(); $original['operator'] = 'assign'; + + $let = new LetVariable(); $let->assign( $symbolVariable->getName(), $symbolVariable, @@ -134,6 +135,7 @@ public function compile(array $expression, CompilationContext $compilationContex case Types::T_ARRAY: case Types::T_VARIABLE: + case Types::T_MIXED: case Types::T_STRING: $symbol = $compilationContext->backend->getVariableCode($symbolVariable); @@ -158,11 +160,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -222,6 +220,7 @@ public function compile(array $expression, CompilationContext $compilationContex ); case Types::T_VARIABLE: + case Types::T_MIXED: $symbol = $compilationContext->backend->getVariableCode($symbolVariable); return new CompiledExpression( @@ -245,11 +244,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -319,6 +314,7 @@ public function compile(array $expression, CompilationContext $compilationContex case Types::T_ARRAY: case Types::T_VARIABLE: + case Types::T_MIXED: $symbol = $compilationContext->backend->getVariableCode($symbolVariable); return new CompiledExpression( @@ -342,11 +338,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -395,6 +387,7 @@ public function compile(array $expression, CompilationContext $compilationContex ); case Types::T_VARIABLE: + case Types::T_MIXED: return new CompiledExpression( 'bool', sprintf('zephir_get_boolval(%s)', $symbol), @@ -416,11 +409,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -435,6 +424,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('char', "'{$resolved->getCode()}'", $expression); case Types::T_VARIABLE: + case Types::T_MIXED: $compilationContext->headersManager->add('kernel/operators'); $symbolVariable = $compilationContext->symbolTable->getVariableForRead( $resolved->getCode(), @@ -468,11 +458,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('variable', $tempVariable->getName(), $expression); default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -485,6 +471,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('string', $resolved->getCode(), $expression); case Types::T_VARIABLE: + case Types::T_MIXED: $compilationContext->headersManager->add('kernel/operators'); $compilationContext->symbolTable->mustGrownStack(true); @@ -546,11 +533,7 @@ public function compile(array $expression, CompilationContext $compilationContex break; default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -559,6 +542,7 @@ public function compile(array $expression, CompilationContext $compilationContex case Types::T_ARRAY: switch ($resolved->getType()) { case Types::T_VARIABLE: + case Types::T_MIXED: $compilationContext->headersManager->add('kernel/operators'); $compilationContext->symbolTable->mustGrownStack(true); @@ -589,11 +573,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -636,6 +616,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('variable', $symbolVariable->getName(), $expression); case Types::T_VARIABLE: + case Types::T_MIXED: $compilationContext->headersManager->add('kernel/operators'); $symbolVariable = $compilationContext->symbolTable->getVariableForRead( $resolved->getCode(), @@ -653,11 +634,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -665,11 +642,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } diff --git a/Library/Operators/Other/CloneOperator.php b/Library/Operators/Other/CloneOperator.php index 97011cd5bb..742430d903 100644 --- a/Library/Operators/Other/CloneOperator.php +++ b/Library/Operators/Other/CloneOperator.php @@ -18,14 +18,12 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Clone. - * * Clones an object into another one */ -class CloneOperator extends BaseOperator +class CloneOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/ConcatOperator.php b/Library/Operators/Other/ConcatOperator.php index 11bf3ec7ec..3f5ab4b7b5 100644 --- a/Library/Operators/Other/ConcatOperator.php +++ b/Library/Operators/Other/ConcatOperator.php @@ -18,15 +18,13 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use function Zephir\add_slashes; /** - * ConcatOperator. - * * Perform concatenations and optimizations */ -class ConcatOperator extends BaseOperator +class ConcatOperator extends AbstractOperator { /** * Performs concat compilation. diff --git a/Library/Operators/Other/EmptyOperator.php b/Library/Operators/Other/EmptyOperator.php index 6dcb7aad23..a2499d599a 100644 --- a/Library/Operators/Other/EmptyOperator.php +++ b/Library/Operators/Other/EmptyOperator.php @@ -18,14 +18,12 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Empty. - * * Checks if a variable is empty string or null */ -class EmptyOperator extends BaseOperator +class EmptyOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/FetchOperator.php b/Library/Operators/Other/FetchOperator.php index 656862e368..4bb93c1f57 100644 --- a/Library/Operators/Other/FetchOperator.php +++ b/Library/Operators/Other/FetchOperator.php @@ -18,7 +18,7 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** * FetchOperator. @@ -26,7 +26,7 @@ * Fetch is a special operator that checks if an expression 'isset' and then obtain the value * without calculating the hash key twice */ -class FetchOperator extends BaseOperator +class FetchOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/InstanceOfOperator.php b/Library/Operators/Other/InstanceOfOperator.php index 3da4177c58..1a7bc683e0 100644 --- a/Library/Operators/Other/InstanceOfOperator.php +++ b/Library/Operators/Other/InstanceOfOperator.php @@ -20,16 +20,14 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use function Zephir\escape_class; /** - * InstanceOf. - * * Checks if a variable is an instance of a class */ -class InstanceOfOperator extends BaseOperator +class InstanceOfOperator extends AbstractOperator { /** * @param $expression diff --git a/Library/Operators/Other/IssetOperator.php b/Library/Operators/Other/IssetOperator.php index 39017b1334..061ce042a4 100644 --- a/Library/Operators/Other/IssetOperator.php +++ b/Library/Operators/Other/IssetOperator.php @@ -13,19 +13,18 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * IssetOperator. - * - * Checks if a array offset or a property is defined on a polymorphic variable + * Checks if an array offset or a property is defined on a polymorphic variable */ -class IssetOperator extends BaseOperator +class IssetOperator extends AbstractOperator { /** * Compiles an 'isset' operator. @@ -36,14 +35,11 @@ class IssetOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { - if ('list' === $expression['left']['type']) { - $left = $expression['left']['left']; - } else { - $left = $expression['left']; - } + $left = 'list' === $expression['left']['type'] ? $expression['left']['left'] : $expression['left']; switch ($left['type']) { case 'array-access': @@ -54,7 +50,7 @@ public function compile(array $expression, CompilationContext $compilationContex $exprVariable->setNoisy(false); $exprCompiledVariable = $exprVariable->compile($compilationContext); - if ('variable' != $exprCompiledVariable->getType() && 'array' != $exprCompiledVariable->getType()) { + if (!in_array($exprCompiledVariable->getType(), ['variable', 'array'], true)) { throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as array', $left['left']); } @@ -69,7 +65,7 @@ public function compile(array $expression, CompilationContext $compilationContex break; } - if ('variable' == $variable->getType()) { + if ('variable' === $variable->getType()) { if ($variable->hasDifferentDynamicType(['undefined', 'array', 'null'])) { $compilationContext->logger->warning( 'Possible attempt to use non array in isset operator', @@ -90,6 +86,7 @@ public function compile(array $expression, CompilationContext $compilationContex return $compilationContext->backend->arrayIsset($variable, $resolvedExpr, $left['right'], $compilationContext); case 'variable': + case 'mixed': $indexVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $left['right']); return $compilationContext->backend->arrayIsset($variable, $indexVariable, $left['right'], $compilationContext); @@ -108,12 +105,12 @@ public function compile(array $expression, CompilationContext $compilationContex $exprVariable->setReadOnly(true); $exprCompiledVariable = $exprVariable->compile($compilationContext); - if ('variable' != $exprCompiledVariable->getType()) { + if ('variable' !== $exprCompiledVariable->getType()) { throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as object', $left['left']); } $variable = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariable->getCode(), $compilationContext, $left['left']); - if ('variable' != $variable->getType()) { + if ('variable' !== $variable->getType()) { throw new CompilerException('Variable type: '.$variable->getType().' cannot be used as object', $left['left']); } @@ -125,7 +122,7 @@ public function compile(array $expression, CompilationContext $compilationContex } $variableCode = $compilationContext->backend->getVariableCode($variable); - if ('property-access' == $left['type']) { + if ('property-access' === $left['type']) { return $compilationContext->backend->propertyIsset($variable, $left['right']['value'], $compilationContext); } @@ -139,6 +136,7 @@ public function compile(array $expression, CompilationContext $compilationContex $indexVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $left['right']); switch ($indexVariable->getType()) { case 'variable': + case 'mixed': case 'string': $indexVariableCode = $compilationContext->backend->getVariableCode($indexVariable); diff --git a/Library/Operators/Other/LikelyOperator.php b/Library/Operators/Other/LikelyOperator.php index b691ef3266..25412ecc13 100644 --- a/Library/Operators/Other/LikelyOperator.php +++ b/Library/Operators/Other/LikelyOperator.php @@ -18,14 +18,12 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Likely. - * * Adds a branch prediction hint when evaluating an expression */ -class LikelyOperator extends BaseOperator +class LikelyOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/NewInstanceOperator.php b/Library/Operators/Other/NewInstanceOperator.php index d1f189ca0b..f459fbab66 100644 --- a/Library/Operators/Other/NewInstanceOperator.php +++ b/Library/Operators/Other/NewInstanceOperator.php @@ -22,16 +22,14 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\MethodCall; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use function Zephir\escape_class; /** - * NewInstance. - * * Creates a new instance of a class */ -class NewInstanceOperator extends BaseOperator +class NewInstanceOperator extends AbstractOperator { protected bool $literalOnly = false; diff --git a/Library/Operators/Other/NewInstanceTypeOperator.php b/Library/Operators/Other/NewInstanceTypeOperator.php index 47be886329..3583042c3c 100644 --- a/Library/Operators/Other/NewInstanceTypeOperator.php +++ b/Library/Operators/Other/NewInstanceTypeOperator.php @@ -20,14 +20,12 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * NewTypeInstance. - * * Creates a value of the specified type with parameters */ -class NewInstanceTypeOperator extends BaseOperator +class NewInstanceTypeOperator extends AbstractOperator { protected bool $literalOnly = false; diff --git a/Library/Operators/Other/RangeExclusiveOperator.php b/Library/Operators/Other/RangeExclusiveOperator.php index c22617dd44..c98ec91d09 100644 --- a/Library/Operators/Other/RangeExclusiveOperator.php +++ b/Library/Operators/Other/RangeExclusiveOperator.php @@ -19,14 +19,12 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * RangeExclusive. - * * Exclusive range operator */ -class RangeExclusiveOperator extends BaseOperator +class RangeExclusiveOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/RangeInclusiveOperator.php b/Library/Operators/Other/RangeInclusiveOperator.php index 5e41a30422..e8a1815260 100644 --- a/Library/Operators/Other/RangeInclusiveOperator.php +++ b/Library/Operators/Other/RangeInclusiveOperator.php @@ -18,15 +18,13 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Types; /** - * RangeInclusive. - * * Inclusive range operator */ -class RangeInclusiveOperator extends BaseOperator +class RangeInclusiveOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/RequireOnceOperator.php b/Library/Operators/Other/RequireOnceOperator.php index c459b6e8eb..d68f38b7d2 100644 --- a/Library/Operators/Other/RequireOnceOperator.php +++ b/Library/Operators/Other/RequireOnceOperator.php @@ -17,14 +17,12 @@ use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Require once. - * * Includes once a plain PHP file */ -class RequireOnceOperator extends BaseOperator +class RequireOnceOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/RequireOperator.php b/Library/Operators/Other/RequireOperator.php index bf8139a012..29ce296d2c 100644 --- a/Library/Operators/Other/RequireOperator.php +++ b/Library/Operators/Other/RequireOperator.php @@ -17,14 +17,12 @@ use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Require. - * * Includes a plain PHP file */ -class RequireOperator extends BaseOperator +class RequireOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/ShortTernaryOperator.php b/Library/Operators/Other/ShortTernaryOperator.php index 9714649691..2efa139671 100644 --- a/Library/Operators/Other/ShortTernaryOperator.php +++ b/Library/Operators/Other/ShortTernaryOperator.php @@ -19,17 +19,15 @@ use Zephir\Builder\StatementsBlockBuilder; use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Statements\IfStatement; /** - * ShortTernary. - * * a ?: b * * Compiles short ternary expressions */ -class ShortTernaryOperator extends BaseOperator +class ShortTernaryOperator extends AbstractOperator { /** * Compile ternary operator. diff --git a/Library/Operators/Other/TernaryOperator.php b/Library/Operators/Other/TernaryOperator.php index 561492aac6..e3d0054aae 100644 --- a/Library/Operators/Other/TernaryOperator.php +++ b/Library/Operators/Other/TernaryOperator.php @@ -15,16 +15,14 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Optimizers\EvalExpression; use Zephir\Statements\LetStatement; /** - * Ternary. - * * Compiles ternary expressions */ -class TernaryOperator extends BaseOperator +class TernaryOperator extends AbstractOperator { /** * Compile ternary operator. diff --git a/Library/Operators/Other/TypeHintOperator.php b/Library/Operators/Other/TypeHintOperator.php index 6b472b2abc..a9ffeb9cd7 100644 --- a/Library/Operators/Other/TypeHintOperator.php +++ b/Library/Operators/Other/TypeHintOperator.php @@ -18,12 +18,9 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; -/** - * Zephir\Operators\Other\TypeHintOperator. - */ -class TypeHintOperator extends BaseOperator +class TypeHintOperator extends AbstractOperator { private bool $strict = false; diff --git a/Library/Operators/Other/TypeOfOperator.php b/Library/Operators/Other/TypeOfOperator.php index 0d64644184..6ac240678e 100644 --- a/Library/Operators/Other/TypeOfOperator.php +++ b/Library/Operators/Other/TypeOfOperator.php @@ -13,20 +13,19 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * TypeOf. - * - * Obtains the type of a dynamic variable + * Obtains the type of dynamic variable. */ -class TypeOfOperator extends BaseOperator +class TypeOfOperator extends AbstractOperator { /** * @param $expression @@ -35,6 +34,7 @@ class TypeOfOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/UnlikelyOperator.php b/Library/Operators/Other/UnlikelyOperator.php index 27854b74dc..587d0b060f 100644 --- a/Library/Operators/Other/UnlikelyOperator.php +++ b/Library/Operators/Other/UnlikelyOperator.php @@ -13,19 +13,18 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Unlikely. - * * Adds a branch prediction hint when evaluating an expression */ -class UnlikelyOperator extends BaseOperator +class UnlikelyOperator extends AbstractOperator { /** * Compile unlikely operator @@ -36,6 +35,7 @@ class UnlikelyOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Unary/MinusOperator.php b/Library/Operators/Unary/MinusOperator.php index e9deb251a6..5532bba95c 100644 --- a/Library/Operators/Unary/MinusOperator.php +++ b/Library/Operators/Unary/MinusOperator.php @@ -13,14 +13,15 @@ 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\BaseOperator; +use Zephir\Operators\AbstractOperator; -class MinusOperator extends BaseOperator +class MinusOperator extends AbstractOperator { /** * Compile expression. @@ -31,6 +32,7 @@ class MinusOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Unary/NotOperator.php b/Library/Operators/Unary/NotOperator.php index c701f4ec6d..2d5eee5b57 100644 --- a/Library/Operators/Unary/NotOperator.php +++ b/Library/Operators/Unary/NotOperator.php @@ -13,14 +13,15 @@ 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\BaseOperator; +use Zephir\Operators\AbstractOperator; -class NotOperator extends BaseOperator +class NotOperator extends AbstractOperator { /** * @param $expression @@ -29,6 +30,7 @@ class NotOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { @@ -58,6 +60,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', '!'.$variable->getName(), $expression); case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $symbol = $compilationContext->backend->getVariableCode($variable); diff --git a/Library/Operators/Unary/PlusOperator.php b/Library/Operators/Unary/PlusOperator.php index 2b5a077027..134d058e9e 100644 --- a/Library/Operators/Unary/PlusOperator.php +++ b/Library/Operators/Unary/PlusOperator.php @@ -13,14 +13,15 @@ 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\BaseOperator; +use Zephir\Operators\AbstractOperator; -class PlusOperator extends BaseOperator +class PlusOperator extends AbstractOperator { /** * Compile expression. @@ -31,6 +32,7 @@ class PlusOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Optimizers/FunctionCall/IsScalarOptimizer.php b/Library/Optimizers/FunctionCall/IsScalarOptimizer.php index 17f570a77d..3795da2ff9 100644 --- a/Library/Optimizers/FunctionCall/IsScalarOptimizer.php +++ b/Library/Optimizers/FunctionCall/IsScalarOptimizer.php @@ -21,7 +21,7 @@ * * Optimizes calls to 'is_scalar' using internal function * - * @see http://php.net/manual/en/function.is-scalar.php + * @see https://php.net/manual/en/function.is-scalar.php */ class IsScalarOptimizer extends OptimizerAbstract { diff --git a/Library/Optimizers/FunctionCall/JoinOptimizer.php b/Library/Optimizers/FunctionCall/JoinOptimizer.php index 61c754a377..1d6354b0bd 100644 --- a/Library/Optimizers/FunctionCall/JoinOptimizer.php +++ b/Library/Optimizers/FunctionCall/JoinOptimizer.php @@ -12,7 +12,7 @@ namespace Zephir\Optimizers\FunctionCall; /** - * @see http://php.net/manual/en/function.join.php + * @see https://php.net/manual/en/function.join.php * * Optimizes calls to 'join' using ImplodeOptimizer via it is an alias */ diff --git a/Library/Parser/Manager.php b/Library/Parser/Manager.php index 7a096ce84a..8d746db18a 100644 --- a/Library/Parser/Manager.php +++ b/Library/Parser/Manager.php @@ -13,8 +13,8 @@ class Manager { - const MINIMUM_PARSER_VERSION = '1.3.0'; - const PARSER_HOME_PAGE = 'https://github.com/phalcon/php-zephir-parser'; + const MINIMUM_PARSER_VERSION = '1.5.0'; + const PARSER_HOME_PAGE = 'https://github.com/zephir-lang/php-zephir-parser'; /** * Zephir Parser. diff --git a/Library/Passes/LocalContextPass.php b/Library/Passes/LocalContextPass.php index 46fde8523c..206c4e3d18 100644 --- a/Library/Passes/LocalContextPass.php +++ b/Library/Passes/LocalContextPass.php @@ -24,7 +24,7 @@ * mutations is relative, since assignments inside cycles/loops may perform a n-number of * mutations * - * @see http://en.wikipedia.org/wiki/Escape_analysis + * @see https://en.wikipedia.org/wiki/Escape_analysis */ class LocalContextPass { diff --git a/Library/Passes/StaticTypeInference.php b/Library/Passes/StaticTypeInference.php index 1861012de6..0b58a7ba90 100644 --- a/Library/Passes/StaticTypeInference.php +++ b/Library/Passes/StaticTypeInference.php @@ -14,16 +14,14 @@ use Zephir\StatementsBlock; /** - * StaticTypeInference. - * * This pass try to infer typing on dynamic variables so the compiler * can replace them by low level types automatically */ class StaticTypeInference { - protected $variables = []; + protected array $variables = []; - protected $infered = []; + protected array $infered = []; /** * Do the compilation pass. @@ -156,10 +154,8 @@ public function markVariable($variable, $type) break; case 'variable': - $this->variables[$variable] = 'undefined'; - break; - case 'array': + case 'mixed': $this->variables[$variable] = 'undefined'; break; @@ -243,11 +239,7 @@ public function passCall(array $expression) { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { - if ('variable' == $parameter['parameter']['type']) { - //$this->markVariable($parameter['value']); - } else { - $this->passExpression($parameter['parameter']); - } + $this->passExpression($parameter['parameter']); } } } @@ -255,11 +247,7 @@ public function passCall(array $expression) public function passArray(array $expression) { foreach ($expression['left'] as $item) { - if ('variable' == $item['value']['type']) { - //$this->markVariable($item['value']['value'], 'dynamical'); - } else { - $this->passExpression($item['value']); - } + $this->passExpression($item['value']); } } @@ -267,11 +255,7 @@ public function passNew(array $expression) { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { - if ('variable' == $parameter['parameter']['type']) { - //$this->markVariable($parameter['value'], 'dynamical'); - } else { - $this->passExpression($parameter['parameter']); - } + $this->passExpression($parameter['parameter']); } } } @@ -561,30 +545,20 @@ public function passStatementBlock(array $statements) } break; + case 'throw': case 'return': if (isset($statement['expr'])) { $this->passExpression($statement['expr']); } break; - case 'loop': - if (isset($statement['statements'])) { - $this->passStatementBlock($statement['statements']); - } - break; - case 'try-catch': + case 'loop': if (isset($statement['statements'])) { $this->passStatementBlock($statement['statements']); } break; - case 'throw': - if (isset($statement['expr'])) { - $this->passExpression($statement['expr']); - } - break; - case 'fetch': $this->passExpression($statement['expr']); break; diff --git a/Library/Statements/EchoStatement.php b/Library/Statements/EchoStatement.php index 4beaf8a75d..216efe6032 100644 --- a/Library/Statements/EchoStatement.php +++ b/Library/Statements/EchoStatement.php @@ -93,6 +93,7 @@ public function compile(CompilationContext $compilationContext) case 'string': case 'variable': + case 'mixed': $compilationContext->codePrinter->output('zend_print_zval('.$compilationContext->backend->getVariableCode($variable).', 0);'); break; diff --git a/Library/Statements/Let/ObjectDynamicProperty.php b/Library/Statements/Let/ObjectDynamicProperty.php index e5f4aed7c1..b691089380 100644 --- a/Library/Statements/Let/ObjectDynamicProperty.php +++ b/Library/Statements/Let/ObjectDynamicProperty.php @@ -9,16 +9,17 @@ * 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; /** - * ObjectDynamicProperty. - * * Updates object properties dynamically */ class ObjectDynamicProperty @@ -33,9 +34,9 @@ class ObjectDynamicProperty * @param array $statement * * @throws CompilerException - * @throws \Exception + * @throws Exception */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + 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); @@ -48,7 +49,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres $propertyName = $statement['property']; $propertyVariable = $compilationContext->symbolTable->getVariableForRead($propertyName, $compilationContext, $statement); - if ($propertyVariable->isNotVariableAndString()) { + if ($propertyVariable->isNotVariableAndMixedAndString()) { throw new CompilerException("Cannot use variable type '".$propertyVariable->getType()."' to update object property", $statement); } @@ -64,7 +65,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres 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'])) { @@ -98,14 +99,14 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres break; case 'bool': - $value = null; if ('1' == $resolvedExpr->getBooleanCode()) { $value = 'true'; } elseif ('0' == $resolvedExpr->getBooleanCode()) { $value = 'false'; } else { - throw new \Exception('?'); + throw new Exception('?'); } + $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $value, $compilationContext); break; @@ -143,6 +144,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres case 'string': case 'variable': case 'array': + case 'mixed': $compilationContext->backend->updateProperty($symbolVariable, $propertyVariable, $resolvedExpr, $compilationContext); if ($symbolVariable->isTemporal()) { $symbolVariable->setIdle(true); diff --git a/Library/Statements/Let/ObjectDynamicStringProperty.php b/Library/Statements/Let/ObjectDynamicStringProperty.php index f7b36b8064..7d54d71dcb 100644 --- a/Library/Statements/Let/ObjectDynamicStringProperty.php +++ b/Library/Statements/Let/ObjectDynamicStringProperty.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; use Zephir\CompilationContext; @@ -17,8 +19,6 @@ use Zephir\Variable as ZephirVariable; /** - * ObjectDynamicProperty. - * * Updates object properties dynamically */ class ObjectDynamicStringProperty @@ -35,13 +35,13 @@ class ObjectDynamicStringProperty * @throws CompilerException * @throws \Exception */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + 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()) { + if ('variable' !== $symbolVariable->getType()) { throw new CompilerException("Variable type '".$symbolVariable->getType()."' cannot be used as object", $statement); } @@ -63,7 +63,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres 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'])) { diff --git a/Library/Statements/Let/ObjectProperty.php b/Library/Statements/Let/ObjectProperty.php index 60de74e51d..e7e8dc9e8c 100644 --- a/Library/Statements/Let/ObjectProperty.php +++ b/Library/Statements/Let/ObjectProperty.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; use Zephir\CompilationContext as Context; @@ -17,8 +19,6 @@ use Zephir\Variable as ZephirVariable; /** - * ObjectProperty. - * * Adds/Updates an array index */ class ObjectProperty @@ -285,6 +285,7 @@ public function assign( case 'array': case 'string': case 'variable': + case 'mixed': $context->backend->updateProperty($symbolVariable, $propertyName, $variableVariable, $context); if ($symbolVariable->isTemporal()) { $symbolVariable->setIdle(true); diff --git a/Library/Statements/Let/ObjectPropertyAppend.php b/Library/Statements/Let/ObjectPropertyAppend.php index 80e85557f7..8c11838ee2 100644 --- a/Library/Statements/Let/ObjectPropertyAppend.php +++ b/Library/Statements/Let/ObjectPropertyAppend.php @@ -175,6 +175,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres break; case 'variable': + case 'mixed': case 'string': case 'array': case 'resource': diff --git a/Library/Statements/Let/ObjectPropertyArrayIndex.php b/Library/Statements/Let/ObjectPropertyArrayIndex.php index b572f17d88..9c221543b1 100644 --- a/Library/Statements/Let/ObjectPropertyArrayIndex.php +++ b/Library/Statements/Let/ObjectPropertyArrayIndex.php @@ -98,6 +98,7 @@ protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $sy case 'ulong': case 'long': case 'variable': + case 'mixed': break; default: throw new CompilerException('Variable: '.$indexVariable->getType().' cannot be used as index without cast', $statement); @@ -171,6 +172,7 @@ protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $sy switch ($indexVariable->getType()) { case 'variable': + case 'mixed': case 'string': switch ($resolvedExpr->getType()) { case 'null': @@ -238,6 +240,7 @@ protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $sy break; case 'variable': + case 'mixed': case 'string': case 'array': $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $variableExpr, $compilationContext); diff --git a/Library/Statements/Let/Variable.php b/Library/Statements/Let/Variable.php index 00c0b67ce0..479446029f 100644 --- a/Library/Statements/Let/Variable.php +++ b/Library/Statements/Let/Variable.php @@ -100,6 +100,7 @@ public function assign( break; case 'variable': + case 'mixed': $this->doVariableAssignment($codePrinter, $resolvedExpr, $symbolVariable, $variable, $statement, $compilationContext, $readDetector); break; @@ -311,6 +312,7 @@ private function doNumericAssignment( break; case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $exprVariable = $compilationContext->symbolTable->getVariableForWrite($resolvedExpr->resolve(null, $compilationContext), $compilationContext); $exprVariableCode = $compilationContext->backend->getVariableCode($exprVariable); @@ -502,6 +504,7 @@ private function doDoubleAssignment( break; case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $exprVariableCode = $compilationContext->backend->getVariableCode($itemVariable); switch ($statement['operator']) { @@ -690,6 +693,7 @@ private function doStringAssignment( break; case 'variable': + case 'mixed': switch ($statement['operator']) { case 'assign': $symbolVariable->setMustInitNull(true); @@ -878,6 +882,7 @@ private function doBoolAssignment( break; case 'variable': + case 'mixed': case 'string': case 'array': switch ($statement['operator']) { diff --git a/Library/Statements/Let/VariableAppend.php b/Library/Statements/Let/VariableAppend.php index 157b913dcd..42595d41c7 100644 --- a/Library/Statements/Let/VariableAppend.php +++ b/Library/Statements/Let/VariableAppend.php @@ -70,6 +70,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres switch ($type) { case 'array': case 'variable': + case 'mixed': switch ($resolvedExpr->getType()) { case 'null': $compilationContext->backend->addArrayEntry($symbolVariable, null, 'null', $compilationContext, $statement); @@ -112,6 +113,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres break; case 'variable': + case 'mixed': $exprVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); switch ($exprVariable->getType()) { case 'int': @@ -138,6 +140,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres break; case 'variable': + case 'mixed': case 'string': case 'array': $compilationContext->backend->addArrayEntry($symbolVariable, null, $exprVariable, $compilationContext, $statement); diff --git a/Library/Statements/ReturnStatement.php b/Library/Statements/ReturnStatement.php index 5ffc637dec..a411c5816d 100644 --- a/Library/Statements/ReturnStatement.php +++ b/Library/Statements/ReturnStatement.php @@ -119,7 +119,13 @@ public function compile(CompilationContext $compilationContext): void break; case Types::T_BOOL: - if (!$currentMethod->areReturnTypesBoolCompatible() && !$currentMethod->isMixed()) { + if (!$currentMethod->areReturnTypesBoolCompatible() && !$currentMethod->isMixed() && !$currentMethod->areReturnTypesFalseCompatible()) { + throw new InvalidTypeException($resolvedExpr->getType(), $statement['expr']); + } + break; + + case Types::T_FALSE: + if (!$currentMethod->areReturnTypesFalseCompatible() && !$currentMethod->isMixed()) { throw new InvalidTypeException($resolvedExpr->getType(), $statement['expr']); } break; diff --git a/Library/Statements/UnsetStatement.php b/Library/Statements/UnsetStatement.php index 3dd7e4bc7d..e8eda65fcd 100644 --- a/Library/Statements/UnsetStatement.php +++ b/Library/Statements/UnsetStatement.php @@ -13,6 +13,7 @@ namespace Zephir\Statements; +use ReflectionException; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Exception\CompilerException; @@ -29,6 +30,7 @@ class UnsetStatement extends StatementAbstract * @param CompilationContext $compilationContext * * @throws Exception + * @throws ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -61,6 +63,7 @@ public function compile(CompilationContext $compilationContext): void break; case 'property-access': + case 'property-dinamic-access': $expr = new Expression($expression['left']); $expr->setReadOnly(true); $exprVar = $expr->compile($compilationContext); @@ -72,9 +75,6 @@ public function compile(CompilationContext $compilationContext): void return; - case 'property-dynamic-access': - //TODO: fix it - default: throw new CompilerException('Cannot use expression type: '.$expression['type'].' in "unset"', $expression); } @@ -100,6 +100,7 @@ public function compile(CompilationContext $compilationContext): void * @return CompilationContext * * @throws Exception + * @throws ReflectionException */ private function generateUnsetPropertyFromObject(array $expression, CompilationContext $compilationContext): CompilationContext { diff --git a/Library/Types.php b/Library/Types.php index 7ac86b67c8..ffb1eff3f7 100644 --- a/Library/Types.php +++ b/Library/Types.php @@ -24,6 +24,7 @@ final class Types 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'; diff --git a/Library/Types/ArrayType.php b/Library/Types/ArrayType.php index 8e64d2cc00..4b2882bff8 100644 --- a/Library/Types/ArrayType.php +++ b/Library/Types/ArrayType.php @@ -18,8 +18,6 @@ use Zephir\Types; /** - * ArrayType. - * * Defines methods of the built-in array type */ class ArrayType extends AbstractType diff --git a/Library/Types/DoubleType.php b/Library/Types/DoubleType.php index 85d3b55b99..b9c0003027 100644 --- a/Library/Types/DoubleType.php +++ b/Library/Types/DoubleType.php @@ -14,8 +14,6 @@ use Zephir\Types; /** - * DoubleType. - * * Defines methods of the built-in double type */ class DoubleType extends AbstractType diff --git a/Library/Types/IntType.php b/Library/Types/IntType.php index c8dcb8ee3c..6feb53d059 100644 --- a/Library/Types/IntType.php +++ b/Library/Types/IntType.php @@ -14,8 +14,6 @@ use Zephir\Types; /** - * IntType. - * * Defines methods of the built-in int type */ class IntType extends AbstractType diff --git a/Library/Types/IstringType.php b/Library/Types/IstringType.php index 9ec29efe29..ad4ad03c32 100644 --- a/Library/Types/IstringType.php +++ b/Library/Types/IstringType.php @@ -14,8 +14,6 @@ use Zephir\Types; /** - * IstringType. - * * Encapsulates built-in methods for the "istring" type */ class IstringType extends StringType diff --git a/Library/Types/StringType.php b/Library/Types/StringType.php index e7a70f3f82..bd2cd40ecb 100644 --- a/Library/Types/StringType.php +++ b/Library/Types/StringType.php @@ -14,8 +14,6 @@ use Zephir\Types; /** - * StringType. - * * Encapsulates built-in methods for the "string" type * * TODO: explode, join, replace diff --git a/Library/Variable.php b/Library/Variable.php index 77d2370e94..f0abe51c91 100644 --- a/Library/Variable.php +++ b/Library/Variable.php @@ -1072,6 +1072,16 @@ public function isVariable() return 'variable' == $this->type; } + /** + * Shortcut is type mixed? + * + * @return bool + */ + public function isMixed(): bool + { + return 'mixed' === $this->type; + } + /** * Shortcut is type bool? * @@ -1142,6 +1152,16 @@ public function isNotVariableAndString() return !$this->isVariable() && !$this->isString(); } + /** + * Shortcut is type variable or mixed or string? + * + * @return bool + */ + public function isNotVariableAndMixedAndString() + { + return !$this->isVariable() && !$this->isMixed() && !$this->isString(); + } + /** * Shortcut is type variable or array? * diff --git a/Library/Zephir.php b/Library/Zephir.php index 45c76411b2..52ae64c3d8 100644 --- a/Library/Zephir.php +++ b/Library/Zephir.php @@ -16,7 +16,7 @@ */ final class Zephir { - public const VERSION = '0.15.2-$Id$'; + public const VERSION = '0.16.0-$Id$'; public const LOGO = <<<'ASCII' _____ __ _ diff --git a/Library/autoload.php b/Library/autoload.php deleted file mode 100644 index 3308474f55..0000000000 --- a/Library/autoload.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -use const PHP_BINARY; -use const PHP_EOL; -use const PHP_SAPI; -use const PHP_VERSION; -use const STDERR; - -if (version_compare('7.0.0', PHP_VERSION, '>')) { - fprintf( - STDERR, - 'This Zephir version is supported on PHP >= 7.0.0.'.PHP_EOL. - 'You are using PHP %s (%s).'.PHP_EOL, - PHP_VERSION, - PHP_BINARY - ); - - exit(1); -} - -if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { - fprintf( - STDERR, - 'Zephir should be invoked via the CLI version of PHP, not the %s SAPI.'.PHP_EOL, - PHP_SAPI - ); - - exit(1); -} - -$autoloaders = [ - __DIR__.'/../vendor/autoload.php', // Is installed locally - __DIR__.'/../../../autoload.php', // Is installed via Composer -]; - -foreach ($autoloaders as $file) { - if (file_exists($file)) { - include_once $file; - break; - } -} - -if (false == class_exists('Composer\Autoload\ClassLoader', false)) { - fwrite(STDERR, 'Unable to find the Composer autoloader.'.PHP_EOL); - - exit(1); -} diff --git a/Library/bootstrap.php b/Library/bootstrap.php deleted file mode 100644 index af05b775f9..0000000000 --- a/Library/bootstrap.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; - -set_error_handler( - static function ($code, $message, $file = '', $line = -1) { - if (error_reporting() & $code) { - throw new \ErrorException($message, 0, $code, (string) $file, $line); - } - } -); - -if (filter_var(getenv('ZEPHIR_DEBUG'), \FILTER_VALIDATE_BOOLEAN)) { - set_exception_handler( - static function (\Throwable $t) { - fwrite(\STDERR, "[ERROR] {$t->getMessage()}".\PHP_EOL); - - exit(1); - } - ); -} diff --git a/Library/config/config.yml b/Library/config/config.yml deleted file mode 100644 index e94b79e591..0000000000 --- a/Library/config/config.yml +++ /dev/null @@ -1,27 +0,0 @@ -imports: - - { resource: 'services.yml' } - -parameters: - prototypes_path: "%kernel.project_dir%/prototypes" - optimizers_path: "%kernel.project_dir%/Library/Optimizers" - kernels_path: "%kernel.project_dir%/kernels" - templates_path: "%kernel.project_dir%/templates" - local_cache_path: "%kernel.local_cache_dir%" - -monolog: - handlers: - console_stderr: - type: stream - path: 'php://stderr' - process_psr_3_messages: true - bubble: false - level: WARNING - formatter: compiler_log_formatter - console_stdout: - type: stream - path: 'php://stdout' - process_psr_3_messages: true - bubble: false - level: INFO - formatter: compiler_log_formatter - diff --git a/Library/config/services.yml b/Library/config/services.yml deleted file mode 100644 index c9a09b8ae6..0000000000 --- a/Library/config/services.yml +++ /dev/null @@ -1,55 +0,0 @@ -services: - _defaults: - autowire: true - autoconfigure: true - public: false - tags: - - { name: monolog.logger, channel: zephir } - - Zephir\: - resource: '..' - exclude: '../{autoload.php,bootstrap.php,functions.php}' - - Zephir\Console\Application: - public: true - - Zephir\FileSystem\FileSystemInterface: - class: Zephir\FileSystem\HardDisk - public: true - lazy: true - arguments: - $basePath: '%local_cache_path%' - - Zephir\Config: - factory: 'Zephir\Config::fromServer' - class: Zephir\Config - public: true - - Zephir\Backends\BackendFactory: - public: true - arguments: - $kernelsPath: '%kernels_path%' - $templatesPath: '%templates_path%' - - Zephir\BaseBackend: - factory: ['@Zephir\Backends\BackendFactory', 'createBackend'] - public: true - - Zephir\Compiler: - public: true - calls: - - method: setPrototypesPath - arguments: - - '%prototypes_path%' - - method: setOptimizersPath - arguments: - - '%optimizers_path%' - - method: setTemplatesPath - arguments: - - '%templates_path%' - - method: setLogger - arguments: - - '@monolog.logger' - - compiler_log_formatter: - class: Zephir\Logger\Formatter\CompilerFormatter diff --git a/README.md b/README.md index cce56c3c5b..267f5cf880 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Functionality is exposed to the PHP language. ## Community * Follow us on [GitHub][zephir] and [Facebook][facebook] -* Get Zephir support on [Discord][discord] +* Get Zephir support on [Discord][discord] and [Github discussions][discussions] * Read our [Code of Conduct](./CODE_OF_CONDUCT.md) ## Contributing @@ -50,6 +50,7 @@ Zephir licensed under the MIT License. See the [LICENSE](./LICENSE) file for mor [zephir]: https://github.com/zephir-lang/zephir [facebook]: https://www.facebook.com/groups/zephir.language [discord]: https://phalcon.link/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 diff --git a/WINDOWS.md b/WINDOWS.md index 885b964680..1f83831283 100644 --- a/WINDOWS.md +++ b/WINDOWS.md @@ -7,24 +7,24 @@ PHP-Version requirements are marked using `[ ]` ## Software Requirements [PHP 5.5 or later] -- [Install Visual Studio 2012 Express](http://www.microsoft.com/en-US/download/details.aspx?id=34673) +- [Install Visual Studio 2012 Express](https://www.microsoft.com/en-US/download/details.aspx?id=34673) (You should start it and activate it) ## Software Requirements General -- [Install PHP (NTS)](http://windows.php.net/download/) +- [Install PHP (NTS)](https://windows.php.net/download/) - Download and extract it - Make sure it is in the PATH, as for example below: ```cmd setx path "%path%;c:\path-to-php\" ``` -- [Install PHP SDK for PHP 5.6](http://windows.php.net/downloads/php-sdk/)(Currently `php-sdk-binary-tools-20110915.zip` is the newest) +- [Install PHP SDK for PHP 5.6](https://windows.php.net/downloads/php-sdk/)(Currently `php-sdk-binary-tools-20110915.zip` is the newest) - [Install PHP SDK for PHP 7.0+](https://github.com/Microsoft/php-sdk-binary-tools/releases) ```cmd setx php_sdk "c:\path-to-php-sdk" ``` -- [Download PHP Developer Pack(NTS!):***php-devel-pack-?.?.?-Win??-VC??-x??.zip***](http://windows.php.net/downloads/releases/) +- [Download PHP Developer Pack(NTS!):***php-devel-pack-?.?.?-Win??-VC??-x??.zip***](https://windows.php.net/downloads/releases/) (or build it yourself with `--enable-debug --disable-zts` and `nmake build-devel` or just `nmake snap` by using the PHP-SDK) ```cmd setx php_devpack "c:\path-to-extracted-devpack" diff --git a/composer.json b/composer.json index a74c92dc83..86ed1142e4 100644 --- a/composer.json +++ b/composer.json @@ -29,11 +29,9 @@ "ext-pcre": "*", "ext-xml": "*", "ext-zlib": "*", + "monolog/monolog": "^2.3", "symfony/console": "^5.2", - "symfony/framework-bundle": "^5.2", - "symfony/monolog-bridge": "^5.2", - "symfony/monolog-bundle": "^3.7", - "symfony/yaml": "^5.2" + "symfony/event-dispatcher": "^5.3" }, "require-dev": { "ext-gmp": "*", diff --git a/composer.lock b/composer.lock index ad1c1436cb..45579a7075 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": "c88e23f00ee31cde884e4ffb1331ddbc", + "content-hash": "df940a5a2884459b1dc66d8212fbcd85", "packages": [ { "name": "monolog/monolog", - "version": "2.3.5", + "version": "2.4.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd4380d6fc37626e2f799f29d91195040137eba9" + "reference": "d7fd7450628561ba697b7097d86db72662f54aef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9", - "reference": "fd4380d6fc37626e2f799f29d91195040137eba9", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7fd7450628561ba697b7097d86db72662f54aef", + "reference": "d7fd7450628561ba697b7097d86db72662f54aef", "shasum": "" }, "require": { @@ -39,7 +39,7 @@ "phpstan/phpstan": "^0.12.91", "phpunit/phpunit": "^8.5", "predis/predis": "^1.1", - "rollbar/rollbar": "^1.3", + "rollbar/rollbar": "^1.3 || ^2 || ^3", "ruflin/elastica": ">=0.90@dev", "swiftmailer/swiftmailer": "^5.3|^6.0" }, @@ -91,7 +91,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.3.5" + "source": "https://github.com/Seldaek/monolog/tree/2.4.0" }, "funding": [ { @@ -103,73 +103,24 @@ "type": "tidelift" } ], - "time": "2021-10-01T21:08:31+00:00" - }, - { - "name": "psr/cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "support": { - "source": "https://github.com/php-fig/cache/tree/master" - }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2022-03-14T12:44:37+00:00" }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -198,9 +149,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/event-dispatcher", @@ -303,58 +254,58 @@ "time": "2021-05-03T11:20:27+00:00" }, { - "name": "symfony/cache", - "version": "v5.3.8", + "name": "symfony/console", + "version": "v5.4.5", "source": { "type": "git", - "url": "https://github.com/symfony/cache.git", - "reference": "945bcebfef0aeef105de61843dd14105633ae38f" + "url": "https://github.com/symfony/console.git", + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/945bcebfef0aeef105de61843dd14105633ae38f", - "reference": "945bcebfef0aeef105de61843dd14105633ae38f", + "url": "https://api.github.com/repos/symfony/console/zipball/d8111acc99876953f52fe16d4c50eb60940d49ad", + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0", - "psr/log": "^1.1|^2|^3", - "symfony/cache-contracts": "^1.1.7|^2", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { - "doctrine/dbal": "<2.10", + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", - "symfony/http-kernel": "<4.4", - "symfony/var-dumper": "<4.4" + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" }, "provide": { - "psr/cache-implementation": "1.0|2.0", - "psr/simple-cache-implementation": "1.0", - "symfony/cache-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/cache": "^1.6|^2.0", - "doctrine/dbal": "^2.10|^3.0", - "predis/predis": "^1.1", - "psr/simple-cache": "^1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/filesystem": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Cache\\": "" + "Symfony\\Component\\Console\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -366,22 +317,24 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Provides an extended PSR-6, PSR-16 (and tags) implementation", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "keywords": [ - "caching", - "psr6" + "cli", + "command line", + "console", + "terminal" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.3.8" + "source": "https://github.com/symfony/console/tree/v5.4.5" }, "funding": [ { @@ -397,33 +350,29 @@ "type": "tidelift" } ], - "time": "2021-09-26T18:29:18+00:00" + "time": "2022-02-24T12:45:35+00:00" }, { - "name": "symfony/cache-contracts", - "version": "v2.4.0", + "name": "symfony/deprecation-contracts", + "version": "v2.5.0", "source": { "type": "git", - "url": "https://github.com/symfony/cache-contracts.git", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/c0446463729b89dd4fa62e9aeecc80287323615d", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0|^3.0" - }, - "suggest": { - "symfony/cache-implementation": "" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -431,9 +380,9 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Contracts\\Cache\\": "" - } + "files": [ + "function.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -449,18 +398,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Generic abstractions related to caching", + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], "support": { - "source": "https://github.com/symfony/cache-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" }, "funding": [ { @@ -476,47 +417,53 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { - "name": "symfony/config", - "version": "v5.3.4", + "name": "symfony/event-dispatcher", + "version": "v5.4.3", "source": { "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "4268f3059c904c61636275182707f81645517a37" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4268f3059c904c61636275182707f81645517a37", - "reference": "4268f3059c904c61636275182707f81645517a37", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/dec8a9f58d20df252b9cd89f1c6c1530f747685d", + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/filesystem": "^4.4|^5.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/polyfill-php81": "^1.22" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" }, "conflict": { - "symfony/finder": "<4.4" + "symfony/dependency-injection": "<4.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" }, "suggest": { - "symfony/yaml": "To use the yaml reference dumper" + "symfony/dependency-injection": "", + "symfony/http-kernel": "" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Config\\": "" + "Symfony\\Component\\EventDispatcher\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -536,10 +483,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", + "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/config/tree/v5.3.4" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.3" }, "funding": [ { @@ -555,65 +502,43 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { - "name": "symfony/console", - "version": "v5.3.7", + "name": "symfony/event-dispatcher-contracts", + "version": "v2.5.0", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", + "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" - }, - "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/event-dispatcher": "^1" }, "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "symfony/event-dispatcher-implementation": "" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, "autoload": { "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Symfony\\Contracts\\EventDispatcher\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -621,24 +546,26 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Eases the creation of beautiful and testable command line interfaces", + "description": "Generic abstractions related to dispatching event", "homepage": "https://symfony.com", "keywords": [ - "cli", - "command line", - "console", - "terminal" + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.7" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.0" }, "funding": [ { @@ -654,127 +581,48 @@ "type": "tidelift" } ], - "time": "2021-08-25T20:02:16+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { - "name": "symfony/dependency-injection", - "version": "v5.3.8", + "name": "symfony/polyfill-ctype", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "e39c344e06a3ceab531ebeb6c077e6652c4a0829" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e39c344e06a3ceab531ebeb6c077e6652c4a0829", - "reference": "e39c344e06a3ceab531ebeb6c077e6652c4a0829", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1.1", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1.6|^2" - }, - "conflict": { - "ext-psr": "<1.1|>=2", - "symfony/config": "<5.3", - "symfony/finder": "<4.4", - "symfony/proxy-manager-bridge": "<4.4", - "symfony/yaml": "<4.4" + "php": ">=7.1" }, "provide": { - "psr/container-implementation": "1.0", - "symfony/service-implementation": "1.0|2.0" - }, - "require-dev": { - "symfony/config": "^5.3", - "symfony/expression-language": "^4.4|^5.0", - "symfony/yaml": "^4.4|^5.0" + "ext-ctype": "*" }, "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Allows you to standardize and centralize the way objects are constructed in your application", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v5.3.8" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-21T20:52:44+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "shasum": "" - }, - "require": { - "php": ">=7.1" + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "1.23-dev" }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { "files": [ - "function.php" - ] + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -782,18 +630,24 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "A generic function and convention to trigger deprecation notices", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, "funding": [ { @@ -809,1447 +663,28 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { - "name": "symfony/error-handler", - "version": "v5.3.7", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/error-handler.git", - "reference": "3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321", - "reference": "3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/log": "^1|^2|^3", - "symfony/var-dumper": "^4.4|^5.0" - }, - "require-dev": { - "symfony/deprecation-contracts": "^2.1", - "symfony/http-kernel": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\ErrorHandler\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools to manage errors and ease debugging PHP code", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-28T15:07:08+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v5.3.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "ce7b20d69c66a20939d8952b617506a44d102130" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ce7b20d69c66a20939d8952b617506a44d102130", - "reference": "ce7b20d69c66a20939d8952b617506a44d102130", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/event-dispatcher-contracts": "^2", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "symfony/dependency-injection": "<4.4" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "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.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-04T21:20:46+00:00" - }, - { - "name": "symfony/event-dispatcher-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/event-dispatcher": "^1" - }, - "suggest": { - "symfony/event-dispatcher-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to dispatching event", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-03-23T23:28:01+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/343f4fe324383ca46792cae728a3b6e2f708fb32", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides basic utilities for the filesystem", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-21T12:40:44+00:00" - }, - { - "name": "symfony/finder", - "version": "v5.3.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/a10000ada1e600d109a6c7632e9ac42e8bf2fb93", - "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Finds files and directories via an intuitive fluent interface", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/finder/tree/v5.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-04T21:20:46+00:00" - }, - { - "name": "symfony/framework-bundle", - "version": "v5.3.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/framework-bundle.git", - "reference": "ea6e30a8c9534d87187375ef4ee39d48ee40dd2d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/ea6e30a8c9534d87187375ef4ee39d48ee40dd2d", - "reference": "ea6e30a8c9534d87187375ef4ee39d48ee40dd2d", - "shasum": "" - }, - "require": { - "ext-xml": "*", - "php": ">=7.2.5", - "symfony/cache": "^5.2", - "symfony/config": "^5.3", - "symfony/dependency-injection": "^5.3", - "symfony/deprecation-contracts": "^2.1", - "symfony/error-handler": "^4.4.1|^5.0.1", - "symfony/event-dispatcher": "^5.1", - "symfony/filesystem": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/http-foundation": "^5.3", - "symfony/http-kernel": "^5.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/routing": "^5.3" - }, - "conflict": { - "doctrine/persistence": "<1.3", - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "phpunit/phpunit": "<5.4.3", - "symfony/asset": "<5.3", - "symfony/browser-kit": "<4.4", - "symfony/console": "<5.2.5", - "symfony/dom-crawler": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/form": "<5.2", - "symfony/http-client": "<4.4", - "symfony/lock": "<4.4", - "symfony/mailer": "<5.2", - "symfony/messenger": "<4.4", - "symfony/mime": "<4.4", - "symfony/property-access": "<5.3", - "symfony/property-info": "<4.4", - "symfony/security-core": "<5.3", - "symfony/security-csrf": "<5.3", - "symfony/serializer": "<5.2", - "symfony/stopwatch": "<4.4", - "symfony/translation": "<5.3", - "symfony/twig-bridge": "<4.4", - "symfony/twig-bundle": "<4.4", - "symfony/validator": "<5.2", - "symfony/web-profiler-bundle": "<4.4", - "symfony/workflow": "<5.2" - }, - "require-dev": { - "doctrine/annotations": "^1.10.4", - "doctrine/cache": "^1.0|^2.0", - "doctrine/persistence": "^1.3|^2.0", - "paragonie/sodium_compat": "^1.8", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/asset": "^5.3", - "symfony/browser-kit": "^4.4|^5.0", - "symfony/console": "^5.2", - "symfony/css-selector": "^4.4|^5.0", - "symfony/dom-crawler": "^4.4.30|^5.3.7", - "symfony/dotenv": "^5.1", - "symfony/expression-language": "^4.4|^5.0", - "symfony/form": "^5.2", - "symfony/http-client": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/mailer": "^5.2", - "symfony/messenger": "^5.2", - "symfony/mime": "^4.4|^5.0", - "symfony/notifier": "^5.3", - "symfony/phpunit-bridge": "^5.3", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/process": "^4.4|^5.0", - "symfony/property-info": "^4.4|^5.0", - "symfony/rate-limiter": "^5.2", - "symfony/security-bundle": "^5.3", - "symfony/serializer": "^5.2", - "symfony/stopwatch": "^4.4|^5.0", - "symfony/string": "^5.0", - "symfony/translation": "^5.3", - "symfony/twig-bundle": "^4.4|^5.0", - "symfony/validator": "^5.2", - "symfony/web-link": "^4.4|^5.0", - "symfony/workflow": "^5.2", - "symfony/yaml": "^4.4|^5.0", - "twig/twig": "^2.10|^3.0" - }, - "suggest": { - "ext-apcu": "For best performance of the system caches", - "symfony/console": "For using the console commands", - "symfony/form": "For using forms", - "symfony/property-info": "For using the property_info service", - "symfony/serializer": "For using the serializer service", - "symfony/validator": "For using validation", - "symfony/web-link": "For using web links, features such as preloading, prefetching or prerendering", - "symfony/yaml": "For using the debug:config and lint:yaml commands" - }, - "type": "symfony-bundle", - "autoload": { - "psr-4": { - "Symfony\\Bundle\\FrameworkBundle\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v5.3.8" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-28T07:17:01+00:00" - }, - { - "name": "symfony/http-client-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/7e82f6084d7cae521a75ef2cb5c9457bbda785f4", - "reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4", - "shasum": "" - }, - "require": { - "php": ">=7.2.5" - }, - "suggest": { - "symfony/http-client-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\HttpClient\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to HTTP clients", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-04-11T23:07:08+00:00" - }, - { - "name": "symfony/http-foundation", - "version": "v5.3.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", - "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "predis/predis": "~1.0", - "symfony/cache": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/mime": "^4.4|^5.0" - }, - "suggest": { - "symfony/mime": "To use the file extension guesser" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Defines an object-oriented layer for the HTTP specification", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-27T11:20:35+00:00" - }, - { - "name": "symfony/http-kernel", - "version": "v5.3.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "ceaf46a992f60e90645e7279825a830f733a17c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ceaf46a992f60e90645e7279825a830f733a17c5", - "reference": "ceaf46a992f60e90645e7279825a830f733a17c5", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/log": "^1|^2", - "symfony/deprecation-contracts": "^2.1", - "symfony/error-handler": "^4.4|^5.0", - "symfony/event-dispatcher": "^5.0", - "symfony/http-client-contracts": "^1.1|^2", - "symfony/http-foundation": "^5.3.7", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "symfony/browser-kit": "<4.4", - "symfony/cache": "<5.0", - "symfony/config": "<5.0", - "symfony/console": "<4.4", - "symfony/dependency-injection": "<5.3", - "symfony/doctrine-bridge": "<5.0", - "symfony/form": "<5.0", - "symfony/http-client": "<5.0", - "symfony/mailer": "<5.0", - "symfony/messenger": "<5.0", - "symfony/translation": "<5.0", - "symfony/twig-bridge": "<5.0", - "symfony/validator": "<5.0", - "twig/twig": "<2.13" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/cache": "^1.0|^2.0|^3.0", - "symfony/browser-kit": "^4.4|^5.0", - "symfony/config": "^5.0", - "symfony/console": "^4.4|^5.0", - "symfony/css-selector": "^4.4|^5.0", - "symfony/dependency-injection": "^5.3", - "symfony/dom-crawler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/routing": "^4.4|^5.0", - "symfony/stopwatch": "^4.4|^5.0", - "symfony/translation": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "twig/twig": "^2.13|^3.0.4" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides a structured process for converting a Request into a Response", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.3.9" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-28T10:25:11+00:00" - }, - { - "name": "symfony/monolog-bridge", - "version": "v5.3.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "4ace41087254f099b6743333155071438bfb12c3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/4ace41087254f099b6743333155071438bfb12c3", - "reference": "4ace41087254f099b6743333155071438bfb12c3", - "shasum": "" - }, - "require": { - "monolog/monolog": "^1.25.1|^2", - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/http-kernel": "^5.3", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2" - }, - "conflict": { - "symfony/console": "<4.4", - "symfony/http-foundation": "<5.3" - }, - "require-dev": { - "symfony/console": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/mailer": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/mime": "^4.4|^5.0", - "symfony/security-core": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" - }, - "suggest": { - "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings.", - "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", - "symfony/var-dumper": "For using the debugging handlers like the console handler or the log server handler." - }, - "type": "symfony-bridge", - "autoload": { - "psr-4": { - "Symfony\\Bridge\\Monolog\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides integration for Monolog with various Symfony components", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v5.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-13T15:54:02+00:00" - }, - { - "name": "symfony/monolog-bundle", - "version": "v3.7.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "4054b2e940a25195ae15f0a49ab0c51718922eb4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/4054b2e940a25195ae15f0a49ab0c51718922eb4", - "reference": "4054b2e940a25195ae15f0a49ab0c51718922eb4", - "shasum": "" - }, - "require": { - "monolog/monolog": "~1.22 || ~2.0", - "php": ">=7.1.3", - "symfony/config": "~4.4 || ^5.0", - "symfony/dependency-injection": "^4.4 || ^5.0", - "symfony/http-kernel": "~4.4 || ^5.0", - "symfony/monolog-bridge": "~4.4 || ^5.0" - }, - "require-dev": { - "symfony/console": "~4.4 || ^5.0", - "symfony/phpunit-bridge": "^5.1", - "symfony/yaml": "~4.4 || ^5.0" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Bundle\\MonologBundle\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony MonologBundle", - "homepage": "https://symfony.com", - "keywords": [ - "log", - "logging" - ], - "support": { - "issues": "https://github.com/symfony/monolog-bundle/issues", - "source": "https://github.com/symfony/monolog-bundle/tree/v3.7.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-03-31T07:20:47+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-05-27T12:26:48+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-05-27T12:26:48+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.23.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-28T13:41:28+00:00" - }, - { - "name": "symfony/polyfill-php81", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "e66119f3de95efc359483f810c4c3e6436279436" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/e66119f3de95efc359483f810c4c3e6436279436", - "reference": "e66119f3de95efc359483f810c4c3e6436279436", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { "php": ">=7.1" }, + "suggest": { + "ext-intl": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -2261,15 +696,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, "files": [ "bootstrap.php" ], - "classmap": [ - "Resources/stubs" - ] + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2285,16 +717,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "grapheme", + "intl", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" }, "funding": [ { @@ -2310,55 +744,47 @@ "type": "tidelift" } ], - "time": "2021-05-21T13:25:03+00:00" + "time": "2021-11-23T21:10:46+00:00" }, { - "name": "symfony/routing", - "version": "v5.3.7", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "be865017746fe869007d94220ad3f5297951811b" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/be865017746fe869007d94220ad3f5297951811b", - "reference": "be865017746fe869007d94220ad3f5297951811b", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "doctrine/annotations": "<1.12", - "symfony/config": "<5.3", - "symfony/dependency-injection": "<4.4", - "symfony/yaml": "<4.4" - }, - "require-dev": { - "doctrine/annotations": "^1.12", - "psr/log": "^1|^2|^3", - "symfony/config": "^5.3", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/yaml": "^4.4|^5.0" + "php": ">=7.1" }, "suggest": { - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" + "ext-intl": "For best performance" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Symfony\\Component\\Routing\\": "" + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2367,24 +793,26 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Maps an HTTP request to a set of configuration variables", + "description": "Symfony polyfill for intl's Normalizer class and related functions", "homepage": "https://symfony.com", "keywords": [ - "router", - "routing", - "uri", - "url" + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.3.7" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" }, "funding": [ { @@ -2400,42 +828,47 @@ "type": "tidelift" } ], - "time": "2021-08-04T21:42:42+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { - "name": "symfony/service-contracts", - "version": "v2.4.0", + "name": "symfony/polyfill-mbstring", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1" + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" }, "suggest": { - "symfony/service-implementation": "" + "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "1.23-dev" }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Symfony\\Contracts\\Service\\": "" + "Symfony\\Polyfill\\Mbstring\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -2452,18 +885,17 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Generic abstractions related to writing services", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { @@ -2479,46 +911,44 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { - "name": "symfony/string", - "version": "v5.3.7", + "name": "symfony/polyfill-php73", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { - "php": ">=7.2.5", - "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" - }, - "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "php": ">=7.1" }, "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { "files": [ - "Resources/functions.php" + "bootstrap.php" ], - "exclude-from-classmap": [ - "/Tests/" + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2535,18 +965,16 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" + "compatibility", + "polyfill", + "portable", + "shim" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" }, "funding": [ { @@ -2562,55 +990,44 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { - "name": "symfony/var-dumper", - "version": "v5.3.8", + "name": "symfony/polyfill-php80", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/eaaea4098be1c90c8285543e1356a09c8aa5c8da", - "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "phpunit/phpunit": "<5.4.3", - "symfony/console": "<4.4" - }, - "require-dev": { - "ext-iconv": "*", - "symfony/console": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "twig/twig": "^2.13|^3.0.4" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + "php": ">=7.1" }, - "bin": [ - "Resources/bin/var-dump-server" - ], "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, "autoload": { "files": [ - "Resources/functions/dump.php" + "bootstrap.php" ], "psr-4": { - "Symfony\\Component\\VarDumper\\": "" + "Symfony\\Polyfill\\Php80\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2618,6 +1035,10 @@ "MIT" ], "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -2627,14 +1048,16 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides mechanisms for walking through any arbitrary PHP variable", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ - "debug", - "dump" + "compatibility", + "polyfill", + "portable", + "shim" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.3.8" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" }, "funding": [ { @@ -2650,37 +1073,47 @@ "type": "tidelift" } ], - "time": "2021-09-24T15:59:58+00:00" + "time": "2022-03-04T08:16:47+00:00" }, { - "name": "symfony/var-exporter", - "version": "v5.3.8", + "name": "symfony/service-contracts", + "version": "v2.5.0", "source": { "type": "git", - "url": "https://github.com/symfony/var-exporter.git", - "reference": "a7604de14bcf472fe8e33f758e9e5b7bf07d3b91" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/a7604de14bcf472fe8e33f758e9e5b7bf07d3b91", - "reference": "a7604de14bcf472fe8e33f758e9e5b7bf07d3b91", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1" }, - "require-dev": { - "symfony/var-dumper": "^4.4.9|^5.0.9" + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, "autoload": { "psr-4": { - "Symfony\\Component\\VarExporter\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Symfony\\Contracts\\Service\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2696,18 +1129,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Allows exporting any serializable PHP data structure to plain PHP code", + "description": "Generic abstractions related to writing services", "homepage": "https://symfony.com", "keywords": [ - "clone", - "construct", - "export", - "hydrate", - "instantiate", - "serialize" + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.3.8" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.0" }, "funding": [ { @@ -2723,43 +1156,46 @@ "type": "tidelift" } ], - "time": "2021-08-31T12:49:16+00:00" + "time": "2021-11-04T16:48:04+00:00" }, { - "name": "symfony/yaml", - "version": "v5.3.6", + "name": "symfony/string", + "version": "v5.4.3", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7" + "url": "https://github.com/symfony/string.git", + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", + "url": "https://api.github.com/repos/symfony/string/zipball/92043b7d8383e48104e411bc9434b260dbeb5a10", + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-ctype": "~1.8" + "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" }, "conflict": { - "symfony/console": "<4.4" + "symfony/translation-contracts": ">=3.0" }, "require-dev": { - "symfony/console": "^4.4|^5.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "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" }, - "bin": [ - "Resources/bin/yaml-lint" - ], "type": "library", "autoload": { + "files": [ + "Resources/functions.php" + ], "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Symfony\\Component\\String\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -2771,18 +1207,26 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Loads and dumps YAML files", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], "support": { - "source": "https://github.com/symfony/yaml/tree/v5.3.6" + "source": "https://github.com/symfony/string/tree/v5.4.3" }, "funding": [ { @@ -2798,35 +1242,36 @@ "type": "tidelift" } ], - "time": "2021-07-29T06:20:01+00:00" + "time": "2022-01-02T09:53:40+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -2853,7 +1298,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -2869,41 +1314,42 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2919,7 +1365,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -2927,20 +1373,20 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", - "version": "v4.13.0", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -2981,9 +1427,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2021-09-20T12:20:58+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "phar-io/manifest", @@ -3047,16 +1493,16 @@ }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -3092,9 +1538,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -3151,16 +1597,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -3171,7 +1617,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -3201,22 +1648,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { @@ -3251,22 +1698,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" }, - "time": "2021-10-02T14:08:47+00:00" + "time": "2022-01-04T19:58:01+00:00" }, { "name": "phpspec/prophecy", - "version": "1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { @@ -3318,29 +1765,29 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.14.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-09-10T09:02:12+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.7", + "version": "9.2.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.12.0", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -3389,7 +1836,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" }, "funding": [ { @@ -3397,20 +1844,20 @@ "type": "github" } ], - "time": "2021-09-17T05:39:03+00:00" + "time": "2022-03-07T09:28:20+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -3449,7 +1896,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -3457,7 +1904,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -3642,16 +2089,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.10", + "version": "9.5.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807", + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807", "shasum": "" }, "require": { @@ -3667,7 +2114,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -3681,7 +2128,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -3702,11 +2149,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3729,11 +2176,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -3741,7 +2188,7 @@ "type": "github" } ], - "time": "2021-09-25T07:38:51+00:00" + "time": "2022-03-15T09:57:31+00:00" }, { "name": "sebastian/cli-parser", @@ -4172,16 +2619,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -4230,14 +2677,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -4245,20 +2692,20 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -4301,7 +2748,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -4309,7 +2756,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -4600,28 +3047,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -4644,7 +3091,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" }, "funding": [ { @@ -4652,7 +3099,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-03-15T09:54:48+00:00" }, { "name": "sebastian/version", @@ -4837,5 +3284,5 @@ "ext-pdo_sqlite": "*", "ext-zip": "*" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/config/phalcon-compatibility-headers.php b/config/phalcon-compatibility-headers.php new file mode 100644 index 0000000000..e11cb21e09 --- /dev/null +++ b/config/phalcon-compatibility-headers.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +/** + * Custom ArgInfo definitions for cross PHP versions support. + * These code blocks will be used inside `.zep.h` files. + */ +return [ + 'Serializable' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 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(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + + 'Phalcon\Storage\Serializer\AbstractSerializer' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 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(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + + 'SessionHandlerInterface' => [ + 'gc' => [ + '#if PHP_VERSION_ID >= 80100' => [ + 'ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(__ce__, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)', + ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#elif PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', + ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', + ' ZEND_ARG_INFO(0, maxlifetime)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + + 'Phalcon\Session\Adapter\Noop' => [ + 'gc' => [ + '#if PHP_VERSION_ID >= 80100' => [ + 'ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(__ce__, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)', + ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#elif PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', + ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', + ' ZEND_ARG_INFO(0, maxlifetime)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], +]; diff --git a/docker-compose.yml b/docker-compose.yml index 8e766f3026..65be0b1d4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,3 +22,13 @@ services: - "USER=Zephir" volumes: - .:/srv + + zephir-8.1: + container_name: phalcon-zephir-8.1 + hostname: zephir-81 + build: docker/8.1 + working_dir: /srv + environment: + - "USER=Zephir" + volumes: + - .:/srv diff --git a/docker/8.1/.bashrc b/docker/8.1/.bashrc new file mode 100644 index 0000000000..fd3a636e58 --- /dev/null +++ b/docker/8.1/.bashrc @@ -0,0 +1,5 @@ +#!/bin/bash + +alias test-ext='php -d extension=ext/modules/stub.so vendor/bin/phpunit --bootstrap tests/ext-bootstrap.php --testsuite Extension' +alias test-zephir='php vendor/bin/phpunit --colors=always --testsuite Zephir' +alias test-all='test-ext; test-zephir' diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile new file mode 100644 index 0000000000..9761962773 --- /dev/null +++ b/docker/8.1/Dockerfile @@ -0,0 +1,25 @@ +FROM composer:latest as composer +FROM php:8.1.0-fpm + +RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; +ENV MAKEFLAGS="-j${CPU_CORES}" + +RUN apt update -y && apt install -y \ + wget \ + zip \ + git \ + apt-utils \ + sudo \ + libicu-dev \ + libgmp-dev \ + libzip-dev && \ + pecl install psr zephir_parser + +RUN docker-php-ext-install zip gmp intl mysqli && \ + docker-php-ext-enable psr zephir_parser + +COPY --from=composer /usr/bin/composer /usr/local/bin/composer +# Bash script with helper aliases +COPY ./.bashrc /root/.bashrc + +CMD ["php-fpm"] diff --git a/ext/config.m4 b/ext/config.m4 index 8552cc50ac..f654c649f3 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -31,6 +31,7 @@ if test "$PHP_STUB" = "yes"; then stub/ooimpl/zbeginning.zep.c stub/properties/publicproperties.zep.c stub/arithmetic.zep.c + stub/arrayaccessarr.zep.c stub/arrayaccessobj.zep.c stub/arrayaccesstest.zep.c stub/arrayiterator.zep.c @@ -212,6 +213,7 @@ if test "$PHP_STUB" = "yes"; then stub/typehinting/testabstract.zep.c stub/typeinstances.zep.c stub/typeoff.zep.c + stub/types/maybe.zep.c stub/types/mixedtype.zep.c stub/unknownclass.zep.c stub/unsettest.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index 7cc2da4067..cea2bd118b 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 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 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"); @@ -38,7 +38,7 @@ if (PHP_STUB != "no") { ADD_SOURCES(configure_module_dirname + "/stub/requires", "external3.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/router", "exception.zep.c route.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/typehinting", "testabstract.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/types", "mixedtype.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/types", "maybe.zep.c mixedtype.zep.c", "stub"); ADD_FLAG("CFLAGS_STUB", "/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL"); ADD_FLAG("CFLAGS", "/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL"); ADD_FLAG("LDFLAGS", "/LTCG"); diff --git a/ext/kernel/file.c b/ext/kernel/file.c index a0540f7d83..83237c4fae 100644 --- a/ext/kernel/file.c +++ b/ext/kernel/file.c @@ -65,7 +65,13 @@ int zephir_file_exists(zval *filename) return FAILURE; } +#if PHP_VERSION_ID >= 80100 + zend_string *file = zend_string_init(Z_STRVAL_P(filename), Z_STRLEN_P(filename), 0); + php_stat(file, FS_EXISTS, &return_value); + zval_ptr_dtor(file); +#else php_stat(Z_STRVAL_P(filename), (php_stat_len) Z_STRLEN_P(filename), FS_EXISTS, &return_value); +#endif if (Z_TYPE(return_value) != IS_TRUE) { return FAILURE; @@ -288,7 +294,13 @@ void zephir_file_put_contents(zval *return_value, zval *filename, zval *data) void zephir_filemtime(zval *return_value, zval *path) { if (EXPECTED(Z_TYPE_P(path) == IS_STRING)) { +#if PHP_VERSION_ID >= 80100 + zend_string *file = zend_string_init(Z_STRVAL_P(path), Z_STRLEN_P(path), 0); + php_stat(file, FS_MTIME, return_value); + zval_ptr_dtor(file); +#else php_stat(Z_STRVAL_P(path), (php_stat_len)(Z_STRLEN_P(path)), FS_MTIME, return_value); +#endif } else { ZVAL_FALSE(return_value); } diff --git a/ext/kernel/main.c b/ext/kernel/main.c index 8014a65145..95eba881d1 100644 --- a/ext/kernel/main.c +++ b/ext/kernel/main.c @@ -151,7 +151,7 @@ void zephir_fast_count(zval *result, zval *value) } } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + 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 @@ -201,7 +201,7 @@ int zephir_fast_count_ev(zval *value) return (int) count > 0; } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + 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 @@ -249,7 +249,7 @@ int zephir_fast_count_int(zval *value) return (int) count; } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + 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 diff --git a/ext/kernel/require.c b/ext/kernel/require.c index 96160ba4ef..98125c9384 100644 --- a/ext/kernel/require.c +++ b/ext/kernel/require.c @@ -45,14 +45,22 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path) } #endif - ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#if PHP_VERSION_ID >= 80100 + zend_string *zend_string_path = zend_string_init(require_path, strlen(require_path), 0); + + zend_stream_init_filename_ex(&file_handle, zend_string_path); + ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + + zval_ptr_dtor(zend_string_path); +#else + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#endif if (ret != SUCCESS) { return FAILURE; } new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); if (new_op_array) { - if (file_handle.handle.stream.handle) { ZVAL_NULL(&dummy); if (!file_handle.opened_path) { @@ -110,7 +118,16 @@ int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) } #endif - ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#if PHP_VERSION_ID >= 80100 + zend_string *zend_string_path = zend_string_init(require_path, strlen(require_path), 0); + + zend_stream_init_filename_ex(&file_handle, zend_string_path); + ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + + zval_ptr_dtor(zend_string_path); +#else + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#endif if (ret != SUCCESS) { return FAILURE; } diff --git a/ext/php_stub.h b/ext/php_stub.h index f77c451e76..1b5391c9f1 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.15.2-$Id$" +#define PHP_STUB_ZEPVERSION "0.16.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 7fd9c1cdff..aa6294f0a7 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -64,6 +64,7 @@ zend_class_entry *stub_7__closure_ce; zend_class_entry *stub_8__closure_ce; zend_class_entry *stub_9__closure_ce; zend_class_entry *stub_arithmetic_ce; +zend_class_entry *stub_arrayaccessarr_ce; zend_class_entry *stub_arrayaccessobj_ce; zend_class_entry *stub_arrayaccesstest_ce; zend_class_entry *stub_arrayiterator_ce; @@ -240,6 +241,7 @@ zend_class_entry *stub_trytest_ce; zend_class_entry *stub_typehinting_testabstract_ce; zend_class_entry *stub_typeinstances_ce; zend_class_entry *stub_typeoff_ce; +zend_class_entry *stub_types_maybe_ce; zend_class_entry *stub_types_mixedtype_ce; zend_class_entry *stub_unknownclass_ce; zend_class_entry *stub_unsettest_ce; @@ -292,6 +294,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_Oo_Scopes_HasPrivateMethod); ZEPHIR_INIT(Stub_Properties_PublicProperties); ZEPHIR_INIT(Stub_Arithmetic); + ZEPHIR_INIT(Stub_ArrayAccessArr); ZEPHIR_INIT(Stub_ArrayAccessObj); ZEPHIR_INIT(Stub_ArrayAccessTest); ZEPHIR_INIT(Stub_ArrayIterator); @@ -468,6 +471,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_TypeHinting_TestAbstract); ZEPHIR_INIT(Stub_TypeInstances); ZEPHIR_INIT(Stub_Typeoff); + ZEPHIR_INIT(Stub_Types_MayBe); ZEPHIR_INIT(Stub_Types_MixedType); ZEPHIR_INIT(Stub_UnknownClass); ZEPHIR_INIT(Stub_Unsettest); @@ -580,7 +584,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 cf7b456b20..942bbaba88 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -26,6 +26,7 @@ #include "stub/ooimpl/zbeginning.zep.h" #include "stub/properties/publicproperties.zep.h" #include "stub/arithmetic.zep.h" +#include "stub/arrayaccessarr.zep.h" #include "stub/arrayaccessobj.zep.h" #include "stub/arrayaccesstest.zep.h" #include "stub/arrayiterator.zep.h" @@ -207,6 +208,7 @@ #include "stub/typehinting/testabstract.zep.h" #include "stub/typeinstances.zep.h" #include "stub/typeoff.zep.h" +#include "stub/types/maybe.zep.h" #include "stub/types/mixedtype.zep.h" #include "stub/unknownclass.zep.h" #include "stub/unsettest.zep.h" diff --git a/ext/stub/arrayaccessarr.zep.c b/ext/stub/arrayaccessarr.zep.c new file mode 100644 index 0000000000..e498d4e969 --- /dev/null +++ b/ext/stub/arrayaccessarr.zep.c @@ -0,0 +1,156 @@ + +#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/array.h" +#include "kernel/object.h" + + +ZEPHIR_INIT_CLASS(Stub_ArrayAccessArr) +{ + ZEPHIR_REGISTER_CLASS(Stub, ArrayAccessArr, stub, arrayaccessarr, stub_arrayaccessarr_method_entry, 0); + + zend_declare_property_null(stub_arrayaccessarr_ce, SL("test"), ZEND_ACC_PROTECTED); + zend_class_implements(stub_arrayaccessarr_ce, 1, zend_ce_arrayaccess); + return SUCCESS; +} + +PHP_METHOD(Stub_ArrayAccessArr, __construct) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0); + add_assoc_long_ex(&_0, SL("one"), 1); + add_assoc_long_ex(&_0, SL("two"), 2); + add_assoc_long_ex(&_0, SL("three"), 3); + zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &_0); + ZEPHIR_MM_RESTORE(); +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetSet) +{ + zval offset_sub, value_sub; + zval *offset, *value; + 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); + + + if (Z_TYPE_P(offset) == IS_NULL) { + zephir_update_property_array_append(this_ptr, SL("test"), value); + } else { + zephir_update_property_array(this_ptr, SL("test"), offset, value); + } +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetExists) +{ + zval offset_sub, _0; + zval *offset; + zval *this_ptr = getThis(); + + 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)); +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetUnset) +{ + zval offset_sub, _0; + zval *offset; + zval *this_ptr = getThis(); + + 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); +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetGet) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval offset_sub, _0, _1, _2; + zval *offset; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); + 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_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_array_fetch(&_0, &_2, offset, PH_NOISY, "stub/arrayaccessarr.zep", 37); + } else { + ZVAL_NULL(&_0); + } + RETURN_CCTOR(&_0); +} + diff --git a/ext/stub/arrayaccessarr.zep.h b/ext/stub/arrayaccessarr.zep.h new file mode 100644 index 0000000000..0a5755c1a1 --- /dev/null +++ b/ext/stub/arrayaccessarr.zep.h @@ -0,0 +1,49 @@ + +extern zend_class_entry *stub_arrayaccessarr_ce; + +ZEPHIR_INIT_CLASS(Stub_ArrayAccessArr); + +PHP_METHOD(Stub_ArrayAccessArr, __construct); +PHP_METHOD(Stub_ArrayAccessArr, offsetSet); +PHP_METHOD(Stub_ArrayAccessArr, offsetExists); +PHP_METHOD(Stub_ArrayAccessArr, offsetUnset); +PHP_METHOD(Stub_ArrayAccessArr, offsetGet); + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessarr___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetset, 0, 2, IS_VOID, 0) + + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetexists, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetunset, 0, 1, IS_VOID, 0) + + 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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetget, 0, 1, IS_NULL, 0) +#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, 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) + PHP_ME(Stub_ArrayAccessArr, offsetGet, arginfo_stub_arrayaccessarr_offsetget, ZEND_ACC_PUBLIC) + PHP_FE_END +}; diff --git a/ext/stub/arrayaccessobj.zep.c b/ext/stub/arrayaccessobj.zep.c index 9c6ea823ca..5c7fa4dd25 100644 --- a/ext/stub/arrayaccessobj.zep.c +++ b/ext/stub/arrayaccessobj.zep.c @@ -13,8 +13,9 @@ #include "kernel/main.h" #include "kernel/memory.h" -#include "kernel/array.h" #include "kernel/object.h" +#include "kernel/operators.h" +#include "kernel/array.h" ZEPHIR_INIT_CLASS(Stub_ArrayAccessObj) @@ -28,31 +29,42 @@ ZEPHIR_INIT_CLASS(Stub_ArrayAccessObj) PHP_METHOD(Stub_ArrayAccessObj, __construct) { - zval _0; + zval obj, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); + ZVAL_UNDEF(&obj); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); + ZEPHIR_INIT_VAR(&obj); + object_init(&obj); ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 3, 0); - add_assoc_long_ex(&_0, SL("one"), 1); - add_assoc_long_ex(&_0, SL("two"), 2); - add_assoc_long_ex(&_0, SL("three"), 3); - zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &_0); + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "val1"); + zephir_update_property_zval(&obj, ZEND_STRL("key1"), &_0); + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "val2"); + zephir_update_property_zval(&obj, ZEND_STRL("key2"), &_0); + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "val3"); + zephir_update_property_zval(&obj, ZEND_STRL("key3"), &_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &obj); ZEPHIR_MM_RESTORE(); } PHP_METHOD(Stub_ArrayAccessObj, offsetSet) { - zval *offset, offset_sub, *value, value_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval offset_sub, value_sub, obj; + zval *offset, *value; zval *this_ptr = getThis(); 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) @@ -62,23 +74,28 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetSet) #endif - zephir_fetch_params_without_memory_grow(2, 0, &offset, &value); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &offset, &value); - if (Z_TYPE_P(offset) == IS_NULL) { - zephir_update_property_array_append(this_ptr, SL("test"), value); - } else { - zephir_update_property_array(this_ptr, SL("test"), offset, value); + ZEPHIR_OBS_VAR(&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); } + zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &obj); + ZEPHIR_MM_RESTORE(); } PHP_METHOD(Stub_ArrayAccessObj, offsetExists) { - zval *offset, offset_sub, _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval offset_sub, obj; + zval *offset; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&obj); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -87,19 +104,25 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetExists) #endif - zephir_fetch_params_without_memory_grow(1, 0, &offset); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &offset); - zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - RETURN_BOOL(zephir_array_isset(&_0, offset)); + ZEPHIR_OBS_VAR(&obj); + zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); + RETURN_MM_BOOL(zephir_isset_property_zval(&obj, offset)); } PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) { - zval *offset, offset_sub, _0; + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval offset_sub, obj; + zval *offset; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&obj); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; @@ -109,18 +132,25 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) #endif - zephir_fetch_params_without_memory_grow(1, 0, &offset); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 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); + ZEPHIR_OBS_VAR(&obj); + zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); + zephir_get_arrval(&_0, &obj); + ZEPHIR_CPY_WRT(&obj, &_0); + zephir_array_unset(&obj, offset, PH_SEPARATE); + zephir_convert_to_object(&obj); + zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &obj); + ZEPHIR_MM_RESTORE(); } PHP_METHOD(Stub_ArrayAccessObj, offsetGet) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *offset, offset_sub, _0, _1, _2; + zval offset_sub, _0, _1, _2; + zval *offset; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); @@ -141,9 +171,10 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetGet) 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_array_fetch(&_0, &_2, offset, PH_NOISY, "stub/arrayaccessobj.zep", 37); + if (zephir_isset_property_zval(&_1, offset)) { + ZEPHIR_OBS_VAR(&_2); + zephir_read_property(&_2, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); + zephir_read_property_zval(&_0, &_2, offset, PH_NOISY_CC); } else { ZVAL_NULL(&_0); } diff --git a/ext/stub/arrayaccessobj.zep.h b/ext/stub/arrayaccessobj.zep.h index 874fa613ef..7dae75e741 100644 --- a/ext/stub/arrayaccessobj.zep.h +++ b/ext/stub/arrayaccessobj.zep.h @@ -12,20 +12,26 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetGet); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj___construct, 0, 0, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetset, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetset, 0, 2, IS_VOID, 0) + ZEND_ARG_INFO(0, offset) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetexists, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetexists, 0, 1, _IS_BOOL, 0) ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetunset, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetunset, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetget, 0, 0, 1) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetget, 0, 1, IS_NULL, 0) +#endif ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index db6e536e27..c1df0c7072 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -46,7 +46,7 @@ PHP_METHOD(Stub_ArrayAccessTest, exits) ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&arr); - object_init_ex(&arr, stub_arrayaccessobj_ce); + object_init_ex(&arr, stub_arrayaccessarr_ce); ZEPHIR_CALL_METHOD(NULL, &arr, "__construct", NULL, 3); zephir_check_call_status(); RETURN_MM_BOOL(zephir_array_isset_string(&arr, SL("one"))); @@ -66,7 +66,7 @@ PHP_METHOD(Stub_ArrayAccessTest, get) ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&arr); - object_init_ex(&arr, stub_arrayaccessobj_ce); + object_init_ex(&arr, stub_arrayaccessarr_ce); ZEPHIR_CALL_METHOD(NULL, &arr, "__construct", NULL, 3); zephir_check_call_status(); zephir_array_fetch_string(&_0, &arr, SL("two"), PH_NOISY | PH_READONLY, "stub/arrayaccesstest.zep", 29); diff --git a/ext/stub/arrayiterator.zep.c b/ext/stub/arrayiterator.zep.c index 4becbeabd5..6845cdb52f 100644 --- a/ext/stub/arrayiterator.zep.c +++ b/ext/stub/arrayiterator.zep.c @@ -89,7 +89,7 @@ PHP_METHOD(Stub_ArrayIterator, current) zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); ZEPHIR_OBS_VAR(&_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", 22); + zephir_array_fetch(&_1, &_0, &_2, PH_NOISY | PH_READONLY, "stub/arrayiterator.zep", 25); RETURN_CTOR(&_1); } diff --git a/ext/stub/arrayiterator.zep.h b/ext/stub/arrayiterator.zep.h index ff88eff86f..9ca6da0926 100644 --- a/ext/stub/arrayiterator.zep.h +++ b/ext/stub/arrayiterator.zep.h @@ -13,19 +13,27 @@ PHP_METHOD(Stub_ArrayIterator, valid); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator___construct, 0, 0, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_rewind, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_rewind, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_current, 0, 0, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_current, 0, 0, IS_NULL, 0) +#endif ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_key, 0, 0, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_key, 0, 0, IS_NULL, 0) +#endif ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_next, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_next, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_valid, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_valid, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayiterator_method_entry) { @@ -34,30 +42,10 @@ ZEPHIR_INIT_FUNCS(stub_arrayiterator_method_entry) { #else PHP_ME(Stub_ArrayIterator, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) #endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, rewind, arginfo_stub_arrayiterator_rewind, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, rewind, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, current, arginfo_stub_arrayiterator_current, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, current, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, key, arginfo_stub_arrayiterator_key, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, key, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, next, arginfo_stub_arrayiterator_next, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, next, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, valid, arginfo_stub_arrayiterator_valid, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, valid, NULL, ZEND_ACC_PUBLIC) -#endif PHP_FE_END }; diff --git a/ext/stub/emptytest.zep.c b/ext/stub/emptytest.zep.c index aa846e4d90..86489b35f7 100644 --- a/ext/stub/emptytest.zep.c +++ b/ext/stub/emptytest.zep.c @@ -22,7 +22,7 @@ * Control Flow */ /** - * @link http://ru2.php.net/empty + * @link https://ru2.php.net/empty */ ZEPHIR_INIT_CLASS(Stub_EmptyTest) { diff --git a/ext/stub/integration/psr/extendexternal.zep.c b/ext/stub/integration/psr/extendexternal.zep.c index 4c078f95ee..4087ddd029 100644 --- a/ext/stub/integration/psr/extendexternal.zep.c +++ b/ext/stub/integration/psr/extendexternal.zep.c @@ -16,7 +16,7 @@ ZEPHIR_INIT_CLASS(Stub_Integration_Psr_ExtendExternal) { - ZEPHIR_REGISTER_CLASS_EX(Stub\\Integration\\Psr, ExtendExternal, stub, integration_psr_extendexternal, zephir_get_internal_ce(SL("psr\\log\\abstractlogger")), NULL, 0); + ZEPHIR_REGISTER_CLASS_EX(Stub\\Integration\\Psr, ExtendExternal, stub, integration_psr_extendexternal, zephir_get_internal_ce(SL("psrext\\log\\abstractlogger")), NULL, 0); return SUCCESS; } diff --git a/ext/stub/integration/psr/http/message/messageinterfaceex.zep.c b/ext/stub/integration/psr/http/message/messageinterfaceex.zep.c index 5efbdf1672..151f9c67d2 100644 --- a/ext/stub/integration/psr/http/message/messageinterfaceex.zep.c +++ b/ext/stub/integration/psr/http/message/messageinterfaceex.zep.c @@ -16,7 +16,7 @@ ZEPHIR_INIT_CLASS(Stub_Integration_Psr_Http_Message_MessageInterfaceEx) { ZEPHIR_REGISTER_INTERFACE(Stub\\Integration\\Psr\\Http\\Message, MessageInterfaceEx, stub, integration_psr_http_message_messageinterfaceex, NULL); - zend_class_implements(stub_integration_psr_http_message_messageinterfaceex_ce, 1, zephir_get_internal_ce(SL("psr\\http\\message\\messageinterface"))); + zend_class_implements(stub_integration_psr_http_message_messageinterfaceex_ce, 1, zephir_get_internal_ce(SL("psrext\\http\\message\\messageinterface"))); return SUCCESS; } diff --git a/ext/stub/internalinterfaces.zep.c b/ext/stub/internalinterfaces.zep.c index 38cb313888..807b0cab46 100644 --- a/ext/stub/internalinterfaces.zep.c +++ b/ext/stub/internalinterfaces.zep.c @@ -29,5 +29,6 @@ PHP_METHOD(Stub_InternalInterfaces, count) + RETURN_LONG(0); } diff --git a/ext/stub/internalinterfaces.zep.h b/ext/stub/internalinterfaces.zep.h index 3083366114..3084946afb 100644 --- a/ext/stub/internalinterfaces.zep.h +++ b/ext/stub/internalinterfaces.zep.h @@ -5,14 +5,10 @@ ZEPHIR_INIT_CLASS(Stub_InternalInterfaces); PHP_METHOD(Stub_InternalInterfaces, count); -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_internalinterfaces_count, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_internalinterfaces_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_internalinterfaces_method_entry) { -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_InternalInterfaces, count, arginfo_stub_internalinterfaces_count, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_InternalInterfaces, count, NULL, ZEND_ACC_PUBLIC) -#endif PHP_FE_END }; diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index bc706450cc..4c277c33e6 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -1208,11 +1208,8 @@ PHP_METHOD(Stub_Mcall, issue1136) if (zephir_is_true(&_3)) { ZEPHIR_INIT_VAR(&_finfo); object_init_ex(&_finfo, zephir_get_internal_ce(SL("finfo"))); - if (zephir_has_constructor(&_finfo)) { - ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); - zephir_check_call_status(); - } - + ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); + zephir_check_call_status(); } else { ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 59); zephir_check_call_status(); diff --git a/ext/stub/oo/oonativeimplements.zep.c b/ext/stub/oo/oonativeimplements.zep.c index c41012bc71..ca47fe0c27 100644 --- a/ext/stub/oo/oonativeimplements.zep.c +++ b/ext/stub/oo/oonativeimplements.zep.c @@ -14,8 +14,8 @@ #include "kernel/main.h" #include "ext/spl/spl_iterators.h" #include "kernel/object.h" -#include "kernel/memory.h" #include "kernel/operators.h" +#include "kernel/memory.h" /** @@ -30,6 +30,7 @@ ZEPHIR_INIT_CLASS(Stub_Oo_OoNativeImplements) zend_class_implements(stub_oo_oonativeimplements_ce, 1, spl_ce_OuterIterator); zend_class_implements(stub_oo_oonativeimplements_ce, 1, spl_ce_RecursiveIterator); zend_class_implements(stub_oo_oonativeimplements_ce, 1, spl_ce_SeekableIterator); + zend_class_implements(stub_oo_oonativeimplements_ce, 1, zend_ce_serializable); return SUCCESS; } @@ -107,19 +108,20 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, hasChildren) PHP_METHOD(Stub_Oo_OoNativeImplements, seek) { - zval *position, position_sub; + zval *position_param = NULL; + zend_long position; zval *this_ptr = getThis(); - ZVAL_UNDEF(&position_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(position) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &position); + zephir_fetch_params_without_memory_grow(1, 0, &position_param); + position = zephir_get_intval(position_param); } @@ -241,3 +243,36 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, unserialize) } +PHP_METHOD(Stub_Oo_OoNativeImplements, __serialize) +{ + zval *this_ptr = getThis(); + + + + array_init(return_value); + return; +} + +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_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 0c454ba069..8ab4351a97 100644 --- a/ext/stub/oo/oonativeimplements.zep.h +++ b/ext/stub/oo/oonativeimplements.zep.h @@ -20,26 +20,36 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, offsetSet); PHP_METHOD(Stub_Oo_OoNativeImplements, offsetUnset); PHP_METHOD(Stub_Oo_OoNativeImplements, serialize); PHP_METHOD(Stub_Oo_OoNativeImplements, unserialize); +PHP_METHOD(Stub_Oo_OoNativeImplements, __serialize); +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() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_current, 0, 0, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_current, 0, 0, IS_NULL, 0) +#endif ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_key, 0, 0, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_key, 0, 0, IS_NULL, 0) +#endif ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_next, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_next, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_rewind, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_rewind, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_valid, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_getinneriterator, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_oo_oonativeimplements_getinneriterator, 0, 0, Iterator, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_oo_oonativeimplements_getchildren, 0, 0, RecursiveIterator, 0) @@ -48,8 +58,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_haschildren, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_seek, 0, 0, 1) - ZEND_ARG_INFO(0, position) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_seek, 0, 1, IS_VOID, 0) + + ZEND_ARG_TYPE_INFO(0, position, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_oo_oonativeimplements_getiterator, 0, 0, Traversable, 0) @@ -75,38 +86,32 @@ 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() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_unserialize, 0, 0, 1) - ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0) +#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_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() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements___unserialize, 0, 1, IS_VOID, 0) + + ZEND_ARG_ARRAY_INFO(0, data, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_oonativeimplements_method_entry) { PHP_ME(Stub_Oo_OoNativeImplements, count, arginfo_stub_oo_oonativeimplements_count, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, current, arginfo_stub_oo_oonativeimplements_current, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, current, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, key, arginfo_stub_oo_oonativeimplements_key, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, key, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, next, arginfo_stub_oo_oonativeimplements_next, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, next, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, rewind, arginfo_stub_oo_oonativeimplements_rewind, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, rewind, NULL, ZEND_ACC_PUBLIC) -#endif PHP_ME(Stub_Oo_OoNativeImplements, valid, arginfo_stub_oo_oonativeimplements_valid, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, getInnerIterator, arginfo_stub_oo_oonativeimplements_getinneriterator, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, getInnerIterator, NULL, ZEND_ACC_PUBLIC) -#endif PHP_ME(Stub_Oo_OoNativeImplements, getChildren, arginfo_stub_oo_oonativeimplements_getchildren, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoNativeImplements, hasChildren, arginfo_stub_oo_oonativeimplements_haschildren, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoNativeImplements, seek, arginfo_stub_oo_oonativeimplements_seek, ZEND_ACC_PUBLIC) @@ -117,5 +122,7 @@ ZEPHIR_INIT_FUNCS(stub_oo_oonativeimplements_method_entry) { PHP_ME(Stub_Oo_OoNativeImplements, offsetUnset, arginfo_stub_oo_oonativeimplements_offsetunset, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoNativeImplements, serialize, arginfo_stub_oo_oonativeimplements_serialize, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoNativeImplements, unserialize, arginfo_stub_oo_oonativeimplements_unserialize, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Oo_OoNativeImplements, __serialize, arginfo_stub_oo_oonativeimplements___serialize, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Oo_OoNativeImplements, __unserialize, arginfo_stub_oo_oonativeimplements___unserialize, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/regexdna.zep.c b/ext/stub/regexdna.zep.c index 8c4dba80ac..050f60ff0b 100644 --- a/ext/stub/regexdna.zep.c +++ b/ext/stub/regexdna.zep.c @@ -24,7 +24,7 @@ /** * RegexDNA * - * @see http://www.haskell.org/haskellwiki/Shootout/Regex_DNA + * @see https://www.haskell.org/haskellwiki/Shootout/Regex_DNA */ ZEPHIR_INIT_CLASS(Stub_RegexDNA) { diff --git a/ext/stub/spectralnorm.zep.c b/ext/stub/spectralnorm.zep.c index 7f7de5c42c..69fde255be 100644 --- a/ext/stub/spectralnorm.zep.c +++ b/ext/stub/spectralnorm.zep.c @@ -23,7 +23,7 @@ /** * SpectralNorm * - * @see http://mathworld.wolfram.com/SpectralNorm.html + * @see https://mathworld.wolfram.com/SpectralNorm.html */ ZEPHIR_INIT_CLASS(Stub_SpectralNorm) { diff --git a/ext/stub/strings.zep.c b/ext/stub/strings.zep.c index eb862bf39e..618ab6c205 100644 --- a/ext/stub/strings.zep.c +++ b/ext/stub/strings.zep.c @@ -736,7 +736,7 @@ PHP_METHOD(Stub_Strings, issue1267) ZVAL_STRING(&_2, ""); zephir_fast_str_replace(&_0, &_1, &_2, value); ZEPHIR_CPY_WRT(value, &_0); - ZVAL_LONG(&_3, 513); + ZVAL_LONG(&_3, 516); ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 42, value, &_3); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_4); @@ -1083,3 +1083,38 @@ PHP_METHOD(Stub_Strings, nullableStringReturnType) RETURN_MM_NULL(); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/2299 + */ +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_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); + } + RETURN_MM_NULL(); +} + diff --git a/ext/stub/strings.zep.h b/ext/stub/strings.zep.h index 8b665b3b10..7c4fb6c8ed 100644 --- a/ext/stub/strings.zep.h +++ b/ext/stub/strings.zep.h @@ -42,6 +42,7 @@ PHP_METHOD(Stub_Strings, issue2234Strict); PHP_METHOD(Stub_Strings, issue2234StrictParent); PHP_METHOD(Stub_Strings, issue2234StrictChild); PHP_METHOD(Stub_Strings, nullableStringReturnType); +PHP_METHOD(Stub_Strings, issue2299NullableStringCondition); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_strings_camelize, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) @@ -208,6 +209,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_strings_nullablestringretur ZEND_ARG_TYPE_INFO(0, val, IS_STRING, 1) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_strings_issue2299nullablestringcondition, 0, 0, IS_STRING, 1) + ZEND_ARG_TYPE_INFO(0, roleName, IS_STRING, 1) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_strings_method_entry) { PHP_ME(Stub_Strings, camelize, arginfo_stub_strings_camelize, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, uncamelize, arginfo_stub_strings_uncamelize, ZEND_ACC_PUBLIC) @@ -272,5 +277,6 @@ ZEPHIR_INIT_FUNCS(stub_strings_method_entry) { PHP_ME(Stub_Strings, issue2234StrictParent, arginfo_stub_strings_issue2234strictparent, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, issue2234StrictChild, arginfo_stub_strings_issue2234strictchild, ZEND_ACC_PROTECTED) PHP_ME(Stub_Strings, nullableStringReturnType, arginfo_stub_strings_nullablestringreturntype, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Strings, issue2299NullableStringCondition, arginfo_stub_strings_issue2299nullablestringcondition, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/types/maybe.zep.c b/ext/stub/types/maybe.zep.c new file mode 100644 index 0000000000..559628295d --- /dev/null +++ b/ext/stub/types/maybe.zep.c @@ -0,0 +1,56 @@ + +#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/operators.h" +#include "kernel/memory.h" +#include "kernel/object.h" + + +ZEPHIR_INIT_CLASS(Stub_Types_MayBe) +{ + ZEPHIR_REGISTER_CLASS(Stub\\Types, MayBe, stub, types_maybe, stub_types_maybe_method_entry, 0); + + return SUCCESS; +} + +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 new file mode 100644 index 0000000000..3730deddc8 --- /dev/null +++ b/ext/stub/types/maybe.zep.h @@ -0,0 +1,28 @@ + +extern zend_class_entry *stub_types_maybe_ce; + +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) { + PHP_ME(Stub_Types_MayBe, gc, arginfo_stub_types_maybe_gc, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MayBe, gcFalse, arginfo_stub_types_maybe_gcfalse, ZEND_ACC_PUBLIC) + PHP_FE_END +}; diff --git a/ext/stub/types/mixedtype.zep.c b/ext/stub/types/mixedtype.zep.c index 7ec1a3d8ee..c7d26b7c01 100644 --- a/ext/stub/types/mixedtype.zep.c +++ b/ext/stub/types/mixedtype.zep.c @@ -245,3 +245,234 @@ PHP_METHOD(Stub_Types_MixedType, paramAndReturnMixed) return; } +PHP_METHOD(Stub_Types_MixedType, castToStringMixedAndReturnMixed) +{ + zval _0; + 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_fetch_params(1, 1, 0, &val); + + + zephir_cast_to_string(&_0, val); + RETURN_CTOR(&_0); +} + +PHP_METHOD(Stub_Types_MixedType, castToStringInternallyMixedAndReturnMixed) +{ + zval _0; + 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_fetch_params(1, 1, 0, &val); + + + zephir_cast_to_string(&_0, val); + ZEPHIR_CPY_WRT(val, &_0); + RETVAL_ZVAL(val, 1, 0); + RETURN_MM(); +} + +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)); +} + +PHP_METHOD(Stub_Types_MixedType, castToIntInternallyMixedAndReturnMixed) +{ + zend_long _0; + 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_fetch_params(1, 1, 0, &val); + + + _0 = zephir_get_intval(val); + ZEPHIR_INIT_NVAR(val); + ZVAL_LONG(val, _0); + RETVAL_ZVAL(val, 1, 0); + RETURN_MM(); +} + +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)); +} + +PHP_METHOD(Stub_Types_MixedType, castToBoolInternallyMixedAndReturnMixed) +{ + double _0; + 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_fetch_params(1, 1, 0, &val); + + + _0 = zephir_get_boolval(val); + ZEPHIR_INIT_NVAR(val); + ZVAL_BOOL(val, _0); + RETVAL_ZVAL(val, 1, 0); + RETURN_MM(); +} + +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)); +} + +PHP_METHOD(Stub_Types_MixedType, castToFloatInternallyMixedAndReturnMixed) +{ + double _0; + 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_fetch_params(1, 1, 0, &val); + + + _0 = zephir_get_doubleval(val); + ZEPHIR_INIT_NVAR(val); + ZVAL_DOUBLE(val, _0); + RETVAL_ZVAL(val, 1, 0); + RETURN_MM(); +} + +/** + * Only used during generation + */ +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)) { + } + if (ZEPHIR_IS_LONG_IDENTICAL(val, 1)) { + } + zend_print_zval(val, 0); +} + diff --git a/ext/stub/types/mixedtype.zep.h b/ext/stub/types/mixedtype.zep.h index 641da1d00f..afd003e4b2 100644 --- a/ext/stub/types/mixedtype.zep.h +++ b/ext/stub/types/mixedtype.zep.h @@ -16,6 +16,15 @@ PHP_METHOD(Stub_Types_MixedType, paramMixed); PHP_METHOD(Stub_Types_MixedType, paramMixedTwo); PHP_METHOD(Stub_Types_MixedType, paramMixedWithMulti); PHP_METHOD(Stub_Types_MixedType, paramAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToStringMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToStringInternallyMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToIntMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToIntInternallyMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToBoolMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToBoolInternallyMixedAndReturnMixed); +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) @@ -100,6 +109,75 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_paramandret 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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringmixedandreturnmixed, 0, 1, IS_NULL, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringinternallymixedandreturnmixed, 0, 1, IS_NULL, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointmixedandreturnmixed, 0, 1, IS_NULL, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointinternallymixedandreturnmixed, 0, 1, IS_NULL, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolmixedandreturnmixed, 0, 1, IS_NULL, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolinternallymixedandreturnmixed, 0, 1, IS_NULL, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatmixedandreturnmixed, 0, 1, IS_NULL, 0) +#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_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatinternallymixedandreturnmixed, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_mixedincondition, 0, 1, IS_VOID, 0) + + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_types_mixedtype_method_entry) { PHP_ME(Stub_Types_MixedType, returnMixedObject, arginfo_stub_types_mixedtype_returnmixedobject, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, returnMixedArray, arginfo_stub_types_mixedtype_returnmixedarray, ZEND_ACC_PUBLIC) @@ -118,5 +196,14 @@ ZEPHIR_INIT_FUNCS(stub_types_mixedtype_method_entry) { 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) PHP_ME(Stub_Types_MixedType, paramAndReturnMixed, arginfo_stub_types_mixedtype_paramandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToStringMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttostringmixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToStringInternallyMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttostringinternallymixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToIntMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttointmixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToIntInternallyMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttointinternallymixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToBoolMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttoboolmixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToBoolInternallyMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttoboolinternallymixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToFloatMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttofloatmixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToFloatInternallyMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttofloatinternallymixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, mixedInCondition, arginfo_stub_types_mixedtype_mixedincondition, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/usetest.zep.c b/ext/stub/usetest.zep.c index 9fed7d6939..880dd6aedc 100644 --- a/ext/stub/usetest.zep.c +++ b/ext/stub/usetest.zep.c @@ -41,6 +41,7 @@ PHP_METHOD(Stub_UseTest, count) + RETURN_LONG(0); } PHP_METHOD(Stub_UseTest, testUseClass1) diff --git a/ext/stub/usetest.zep.h b/ext/stub/usetest.zep.h index d0a0d0fa0e..6c32b08e57 100644 --- a/ext/stub/usetest.zep.h +++ b/ext/stub/usetest.zep.h @@ -12,7 +12,7 @@ PHP_METHOD(Stub_UseTest, testUseNamespaceAlias); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_usetest_createinstance, 0, 0, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_usetest_count, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_usetest_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_usetest_testuseclass1, 0, 0, 0) @@ -30,11 +30,7 @@ ZEPHIR_INIT_FUNCS(stub_usetest_method_entry) { #else PHP_ME(Stub_UseTest, createInstance, NULL, ZEND_ACC_PUBLIC) #endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_UseTest, count, arginfo_stub_usetest_count, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, count, NULL, ZEND_ACC_PUBLIC) -#endif #if PHP_VERSION_ID >= 80000 PHP_ME(Stub_UseTest, testUseClass1, arginfo_stub_usetest_testuseclass1, ZEND_ACC_PUBLIC) #else diff --git a/kernels/ZendEngine3/file.c b/kernels/ZendEngine3/file.c index a0540f7d83..83237c4fae 100755 --- a/kernels/ZendEngine3/file.c +++ b/kernels/ZendEngine3/file.c @@ -65,7 +65,13 @@ int zephir_file_exists(zval *filename) return FAILURE; } +#if PHP_VERSION_ID >= 80100 + zend_string *file = zend_string_init(Z_STRVAL_P(filename), Z_STRLEN_P(filename), 0); + php_stat(file, FS_EXISTS, &return_value); + zval_ptr_dtor(file); +#else php_stat(Z_STRVAL_P(filename), (php_stat_len) Z_STRLEN_P(filename), FS_EXISTS, &return_value); +#endif if (Z_TYPE(return_value) != IS_TRUE) { return FAILURE; @@ -288,7 +294,13 @@ void zephir_file_put_contents(zval *return_value, zval *filename, zval *data) void zephir_filemtime(zval *return_value, zval *path) { if (EXPECTED(Z_TYPE_P(path) == IS_STRING)) { +#if PHP_VERSION_ID >= 80100 + zend_string *file = zend_string_init(Z_STRVAL_P(path), Z_STRLEN_P(path), 0); + php_stat(file, FS_MTIME, return_value); + zval_ptr_dtor(file); +#else php_stat(Z_STRVAL_P(path), (php_stat_len)(Z_STRLEN_P(path)), FS_MTIME, return_value); +#endif } else { ZVAL_FALSE(return_value); } diff --git a/kernels/ZendEngine3/main.c b/kernels/ZendEngine3/main.c index 8014a65145..95eba881d1 100755 --- a/kernels/ZendEngine3/main.c +++ b/kernels/ZendEngine3/main.c @@ -151,7 +151,7 @@ void zephir_fast_count(zval *result, zval *value) } } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + 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 @@ -201,7 +201,7 @@ int zephir_fast_count_ev(zval *value) return (int) count > 0; } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + 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 @@ -249,7 +249,7 @@ int zephir_fast_count_int(zval *value) return (int) count; } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + 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 diff --git a/kernels/ZendEngine3/require.c b/kernels/ZendEngine3/require.c index 96160ba4ef..98125c9384 100755 --- a/kernels/ZendEngine3/require.c +++ b/kernels/ZendEngine3/require.c @@ -45,14 +45,22 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path) } #endif - ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#if PHP_VERSION_ID >= 80100 + zend_string *zend_string_path = zend_string_init(require_path, strlen(require_path), 0); + + zend_stream_init_filename_ex(&file_handle, zend_string_path); + ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + + zval_ptr_dtor(zend_string_path); +#else + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#endif if (ret != SUCCESS) { return FAILURE; } new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); if (new_op_array) { - if (file_handle.handle.stream.handle) { ZVAL_NULL(&dummy); if (!file_handle.opened_path) { @@ -110,7 +118,16 @@ int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) } #endif - ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#if PHP_VERSION_ID >= 80100 + zend_string *zend_string_path = zend_string_init(require_path, strlen(require_path), 0); + + zend_stream_init_filename_ex(&file_handle, zend_string_path); + ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + + zval_ptr_dtor(zend_string_path); +#else + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#endif if (ret != SUCCESS) { return FAILURE; } diff --git a/phpunit.ext.xml b/phpunit.ext.xml index b31dadeedc..72f9e1aa8c 100644 --- a/phpunit.ext.xml +++ b/phpunit.ext.xml @@ -14,8 +14,6 @@ - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist index fcdc56b0d6..22bdcbfddf 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ @@ -22,7 +22,6 @@ tests/Zephir - tests/Zephir/KernelTestCase.php @@ -34,11 +33,8 @@ - - - diff --git a/prototypes/apc.php b/prototypes/apc.php index 03f32c0404..d488269dcc 100644 --- a/prototypes/apc.php +++ b/prototypes/apc.php @@ -38,7 +38,7 @@ /** * Class APCIterator. * - * @see http://www.php.net/manual/en/class.apciterator.php + * @see https://www.php.net/manual/en/class.apciterator.php */ class APCIterator implements Iterator { @@ -46,23 +46,27 @@ public function __construct($cache, $search = null, $format = APC_ITER_ALL, $chu { } + #[\ReturnTypeWillChange] public function rewind() { } + #[\ReturnTypeWillChange] public function valid() { } + #[\ReturnTypeWillChange] public function current() { } + #[\ReturnTypeWillChange] public function key() { } - #[ReturnTypeWillChange] + #[\ReturnTypeWillChange] public function next() { } @@ -86,7 +90,7 @@ public function getTotalCount() } /** - * @see http://www.php.net/manual/en/function.apc-cache-info.php + * @see https://www.php.net/manual/en/function.apc-cache-info.php * * @param string $type * @param bool $limited @@ -96,7 +100,7 @@ function apc_cache_info($type = '', $limited = false) } /** - * @see http://www.php.net/manual/en/function.apc-clear-cache.php + * @see https://www.php.net/manual/en/function.apc-clear-cache.php * * @param string $cache_type */ @@ -105,7 +109,7 @@ function apc_clear_cache($cache_type = '') } /** - * @see http://www.php.net/manual/en/function.apc-sma-info.php + * @see https://www.php.net/manual/en/function.apc-sma-info.php * * @param bool $limited */ @@ -114,7 +118,7 @@ function apc_sma_info($limited = false) } /** - * @see http://www.php.net/manual/en/function.apc-store.php + * @see https://www.php.net/manual/en/function.apc-store.php * * @param $key * @param $var @@ -125,7 +129,7 @@ function apc_store($key, $var, $ttl = 0) } /** - * @see http://www.php.net/manual/en/function.apc-fetch.php + * @see https://www.php.net/manual/en/function.apc-fetch.php * * @param $key * @param null $success @@ -137,7 +141,7 @@ function apc_fetch($key, &$success = null) } /** - * @see http://www.php.net/manual/en/function.apc-delete.php + * @see https://www.php.net/manual/en/function.apc-delete.php * * @param $key */ @@ -146,7 +150,7 @@ function apc_delete($key) } /** - * @see http://www.php.net/manual/en/function.apc-define-constants.php + * @see https://www.php.net/manual/en/function.apc-define-constants.php * * @param $key * @param array $constants @@ -157,7 +161,7 @@ function apc_define_constants($key, array $constants, $case_sensitive = true) } /** - * @see http://www.php.net/manual/en/function.apc-add.php + * @see https://www.php.net/manual/en/function.apc-add.php * * @param $key * @param $var @@ -168,7 +172,7 @@ function apc_add($key, $var, $ttl = 0) } /** - * @see http://www.php.net/manual/en/function.apc-compile-file.php + * @see https://www.php.net/manual/en/function.apc-compile-file.php * * @param $filename * @param bool $atomic @@ -178,7 +182,7 @@ function apc_compile_file($filename, $atomic = true) } /** - * @see http://www.php.net/manual/en/function.apc-load-constants.php + * @see https://www.php.net/manual/en/function.apc-load-constants.php * * @param $key * @param bool $case_sensitive @@ -188,7 +192,7 @@ function apc_load_constants($key, $case_sensitive = true) } /** - * @see http://www.php.net/manual/en/function.apc-exists.php + * @see https://www.php.net/manual/en/function.apc-exists.php * * @param $keys */ @@ -197,7 +201,7 @@ function apc_exists($keys) } /** - * @see http://www.php.net/manual/en/function.apc-delete-file.php + * @see https://www.php.net/manual/en/function.apc-delete-file.php * * @param $keys */ @@ -206,7 +210,7 @@ function apc_delete_file($keys) } /** - * @see http://www.php.net/manual/en/function.apc-inc.php + * @see https://www.php.net/manual/en/function.apc-inc.php * * @param $key * @param int $step @@ -217,7 +221,7 @@ function apc_inc($key, $step = 1, &$success = null) } /** - * @see http://www.php.net/manual/en/function.apc-dec.php + * @see https://www.php.net/manual/en/function.apc-dec.php * * @param $key * @param int $step @@ -228,7 +232,7 @@ function apc_dec($key, $step = 1, &$success = null) } /** - * @see http://php.net/manual/en/function.apc-cas.php + * @see https://php.net/manual/en/function.apc-cas.php * * @param $key * @param $old @@ -239,7 +243,7 @@ function apc_cas($key, $old, $new) } /** - * @see http://php.net/manual/en/function.apc-bin-dump.php + * @see https://php.net/manual/en/function.apc-bin-dump.php * * @param null $files * @param null $user_vars @@ -249,7 +253,7 @@ function apc_bin_dump($files = null, $user_vars = null) } /** - * @see http://php.net/manual/en/function.apc-bin-dumpfile.php + * @see https://php.net/manual/en/function.apc-bin-dumpfile.php * * @param $files * @param $user_vars @@ -262,7 +266,7 @@ function apc_bin_dumpfile($files, $user_vars, $filename, $flags = 0, $context = } /** - * @see http://php.net/manual/en/function.apc-bin-load.php + * @see https://php.net/manual/en/function.apc-bin-load.php * * @param $data * @param int $flags @@ -272,7 +276,7 @@ function apc_bin_load($data, $flags = 0) } /** - * @see http://php.net/manual/en/function.apc-bin-loadfile.php + * @see https://php.net/manual/en/function.apc-bin-loadfile.php * * @param $filename * @param null $context diff --git a/prototypes/gd.php b/prototypes/gd.php index ec7bc0236b..058bfbdf39 100644 --- a/prototypes/gd.php +++ b/prototypes/gd.php @@ -13,7 +13,7 @@ /** * Retrieve information about the currently installed GD library. * - * @see http://www.php.net/manual/en/function.gd-info.php + * @see https://www.php.net/manual/en/function.gd-info.php * * @return array */ @@ -170,7 +170,7 @@ function imageantialias($image, $enabled) /** * Draws an arc. * - * @see http://www.php.net/manual/ru/function.imagearc.php + * @see https://www.php.net/manual/ru/function.imagearc.php * * @param resource $image * @param int $cx @@ -357,7 +357,7 @@ function imagecolordeallocate($image, $color) /** * Get the index of the specified color. * - * @see http://www.php.net/manual/ru/function.imagecolorexact.php + * @see https://www.php.net/manual/ru/function.imagecolorexact.php * * @param resource $image * @param int $red @@ -394,7 +394,7 @@ function imagecolorexactalpha($image, $red, $green, $blue, $alpha) /** * Makes the colors of the palette version of an image more closely match the true color version. * - * @see http://www.php.net/manual/ru/function.imagecolormatch.php + * @see https://www.php.net/manual/ru/function.imagecolormatch.php * * @param resource $image1 * @param resource $image2 @@ -410,7 +410,7 @@ function imagecolormatch($image1, $image2) /** * Get the index of the specified color or its closest possible alternative. * - * @see http://www.php.net/manual/ru/function.imagecolorresolve.php + * @see https://www.php.net/manual/ru/function.imagecolorresolve.php * * @param resource $image * @param int $red diff --git a/prototypes/memcache.php b/prototypes/memcache.php index 62c5c0793e..ad0dae9ea9 100644 --- a/prototypes/memcache.php +++ b/prototypes/memcache.php @@ -15,7 +15,7 @@ /** * Class Memcache. * - * @see http://se2.php.net/manual/en/class.memcache.php + * @see https://se2.php.net/manual/en/class.memcache.php */ class memcache { diff --git a/prototypes/memcached.php b/prototypes/memcached.php index 527e35cb1c..a46c5dbe9f 100644 --- a/prototypes/memcached.php +++ b/prototypes/memcached.php @@ -108,7 +108,7 @@ class Memcached const GET_ERROR_RETURN_VALUE = false; /** - * @see http://php.net/manual/en/memcached.construct.php + * @see https://php.net/manual/en/memcached.construct.php * * @param string $persistent_id */ @@ -117,7 +117,7 @@ public function __construct($persistent_id) } /** - * @see http://php.net/manual/en/memcached.getresultcode.php + * @see https://php.net/manual/en/memcached.getresultcode.php * * @return int */ @@ -126,7 +126,7 @@ public function getResultCode() } /** - * @see http://php.net/manual/en/memcached.getresultmessage.php + * @see https://php.net/manual/en/memcached.getresultmessage.php * * @return string */ @@ -135,7 +135,7 @@ public function getResultMessage() } /** - * @see http://php.net/manual/en/memcached.get.php + * @see https://php.net/manual/en/memcached.get.php * * @param string $key * @param callable $cache_cb @@ -148,7 +148,7 @@ public function get($key, callable $cache_cb = null, &$cas_token = null) } /** - * @see http://php.net/manual/en/memcached.getbykey.php + * @see https://php.net/manual/en/memcached.getbykey.php * * @param string $server_key * @param string $key @@ -162,7 +162,7 @@ public function getByKey($server_key, $key, callable $cache_cb = null, &$cas_tok } /** - * @see http://php.net/manual/en/memcached.getmulti.php + * @see https://php.net/manual/en/memcached.getmulti.php * * @param array $keys * @param array $cas_tokens @@ -175,7 +175,7 @@ public function getMulti(array $keys, array &$cas_tokens = null, $flags = null) } /** - * @see http://php.net/manual/en/memcached.getmultibykey.php + * @see https://php.net/manual/en/memcached.getmultibykey.php * * @param string $server_key * @param array $keys @@ -189,7 +189,7 @@ public function getMultiByKey($server_key, array $keys, &$cas_tokens = null, $fl } /** - * @see http://php.net/manual/en/memcached.getdelayed.php + * @see https://php.net/manual/en/memcached.getdelayed.php * * @param array $keys * @param bool $with_cas @@ -202,7 +202,7 @@ public function getDelayed(array $keys, $with_cas = null, callable $value_cb = n } /** - * @see http://php.net/manual/en/memcached.getdelayedbykey.php + * @see https://php.net/manual/en/memcached.getdelayedbykey.php * * @param string $server_key * @param array $keys @@ -216,7 +216,7 @@ public function getDelayedByKey($server_key, array $keys, $with_cas = null, call } /** - * @see http://php.net/manual/en/memcached.fetch.php + * @see https://php.net/manual/en/memcached.fetch.php * * @return array */ @@ -225,7 +225,7 @@ public function fetch() } /** - * @see http://php.net/manual/en/memcached.fetchall.php + * @see https://php.net/manual/en/memcached.fetchall.php * * @return array */ @@ -234,7 +234,7 @@ public function fetchAll() } /** - * @see http://php.net/manual/en/memcached.set.php + * @see https://php.net/manual/en/memcached.set.php * * @param string $key * @param mixed $value @@ -247,7 +247,7 @@ public function set($key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.setbykey.php + * @see https://php.net/manual/en/memcached.setbykey.php * * @param string $server_key * @param string $key @@ -261,7 +261,7 @@ public function setByKey($server_key, $key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.touch.php + * @see https://php.net/manual/en/memcached.touch.php * * @param string $key * @param int $expiration @@ -273,7 +273,7 @@ public function touch($key, $expiration) } /** - * @see http://php.net/manual/en/memcached.touchbykey.php + * @see https://php.net/manual/en/memcached.touchbykey.php * * @param string $server_key * @param string $key @@ -286,7 +286,7 @@ public function touchByKey($server_key, $key, $expiration) } /** - * @see http://php.net/manual/en/memcached.setmulti.php + * @see https://php.net/manual/en/memcached.setmulti.php * * @param array $items * @param int $expiration @@ -298,7 +298,7 @@ public function setMulti(array $items, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.setmultibykey.php + * @see https://php.net/manual/en/memcached.setmultibykey.php * * @param string $server_key * @param array $items @@ -311,7 +311,7 @@ public function setMultiByKey($server_key, array $items, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.cas.php + * @see https://php.net/manual/en/memcached.cas.php * * @param float $cas_token * @param string $key @@ -325,7 +325,7 @@ public function cas($cas_token, $key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.casbykey.php + * @see https://php.net/manual/en/memcached.casbykey.php * * @param float $cas_token * @param string $server_key @@ -340,7 +340,7 @@ public function casByKey($cas_token, $server_key, $key, $value, $expiration = nu } /** - * @see http://php.net/manual/en/memcached.add.php + * @see https://php.net/manual/en/memcached.add.php * * @param string $key * @param mixed $value @@ -353,7 +353,7 @@ public function add($key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.addbykey.php + * @see https://php.net/manual/en/memcached.addbykey.php * * @param string $server_key * @param string $key @@ -367,7 +367,7 @@ public function addByKey($server_key, $key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.append.php + * @see https://php.net/manual/en/memcached.append.php * * @param string $key * @param string $value @@ -379,7 +379,7 @@ public function append($key, $value) } /** - * @see http://php.net/manual/en/memcached.appendbykey.php + * @see https://php.net/manual/en/memcached.appendbykey.php * * @param string $server_key * @param string $key @@ -392,7 +392,7 @@ public function appendByKey($server_key, $key, $value) } /** - * @see http://php.net/manual/en/memcached.prepend.php + * @see https://php.net/manual/en/memcached.prepend.php * * @param string $key * @param string $value @@ -404,7 +404,7 @@ public function prepend($key, $value) } /** - * @see http://php.net/manual/en/memcached.prependbykey.php + * @see https://php.net/manual/en/memcached.prependbykey.php * * @param string $server_key * @param string $key @@ -417,7 +417,7 @@ public function prependByKey($server_key, $key, $value) } /** - * @see http://php.net/manual/en/memcached.replace.php + * @see https://php.net/manual/en/memcached.replace.php * * @param string $key * @param mixed $value @@ -430,7 +430,7 @@ public function replace($key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.replacebykey.php + * @see https://php.net/manual/en/memcached.replacebykey.php * * @param string $server_key * @param string $key @@ -444,7 +444,7 @@ public function replaceByKey($server_key, $key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.delete.php + * @see https://php.net/manual/en/memcached.delete.php * * @param string $key * @param int $time @@ -456,7 +456,7 @@ public function delete($key, $time = 0) } /** - * @see http://php.net/manual/en/memcached.deletemulti.php + * @see https://php.net/manual/en/memcached.deletemulti.php * * @param array $keys * @param int $time @@ -468,7 +468,7 @@ public function deleteMulti(array $keys, $time = 0) } /** - * @see http://php.net/manual/en/memcached.deletebykey.php + * @see https://php.net/manual/en/memcached.deletebykey.php * * @param string $server_key * @param string $key @@ -481,7 +481,7 @@ public function deleteByKey($server_key, $key, $time = 0) } /** - * @see http://php.net/manual/en/memcached.deletemultibykey.php + * @see https://php.net/manual/en/memcached.deletemultibykey.php * * @param string $server_key * @param array $keys @@ -494,7 +494,7 @@ public function deleteMultiByKey($server_key, array $keys, $time = 0) } /** - * @see http://php.net/manual/en/memcached.increment.php + * @see https://php.net/manual/en/memcached.increment.php * * @param string $key * @param int $offset @@ -508,7 +508,7 @@ public function increment($key, $offset = 1, $initial_value = 0, $expiry = 0) } /** - * @see http://php.net/manual/en/memcached.decrement.php + * @see https://php.net/manual/en/memcached.decrement.php * * @param string $key * @param int $offset @@ -522,7 +522,7 @@ public function decrement($key, $offset = 1, $initial_value = 0, $expiry = 0) } /** - * @see http://php.net/manual/en/memcached.incrementbykey.php + * @see https://php.net/manual/en/memcached.incrementbykey.php * * @param string $server_key * @param string $key @@ -537,7 +537,7 @@ public function incrementByKey($server_key, $key, $offset = 1, $initial_value = } /** - * @see http://php.net/manual/en/memcached.decrementbykey.php + * @see https://php.net/manual/en/memcached.decrementbykey.php * * @param string $server_key * @param string $key @@ -552,7 +552,7 @@ public function decrementByKey($server_key, $key, $offset = 1, $initial_value = } /** - * @see http://php.net/manual/en/memcached.addserver.php + * @see https://php.net/manual/en/memcached.addserver.php * * @param string $host * @param int $port @@ -565,7 +565,7 @@ public function addServer($host, $port, $weight = 0) } /** - * @see http://php.net/manual/en/memcached.addservers.php + * @see https://php.net/manual/en/memcached.addservers.php * * @param array $servers * @@ -576,7 +576,7 @@ public function addServers(array $servers) } /** - * @see http://php.net/manual/en/memcached.getserverlist.php + * @see https://php.net/manual/en/memcached.getserverlist.php * * @return array */ @@ -585,7 +585,7 @@ public function getServerList() } /** - * @see http://php.net/manual/en/memcached.getserverbykey.php + * @see https://php.net/manual/en/memcached.getserverbykey.php * * @param string $server_key * @@ -596,7 +596,7 @@ public function getServerByKey($server_key) } /** - * @see http://php.net/manual/en/memcached.resetserverlist.php + * @see https://php.net/manual/en/memcached.resetserverlist.php * * @return bool */ @@ -605,7 +605,7 @@ public function resetServerList() } /** - * @see http://php.net/manual/en/memcached.quit.php + * @see https://php.net/manual/en/memcached.quit.php * * @return bool */ @@ -614,7 +614,7 @@ public function quit() } /** - * @see http://php.net/manual/en/memcached.getstats.php + * @see https://php.net/manual/en/memcached.getstats.php * * @return array */ @@ -623,7 +623,7 @@ public function getStats() } /** - * @see http://php.net/manual/en/memcached.getversion.php + * @see https://php.net/manual/en/memcached.getversion.php * * @return array */ @@ -632,7 +632,7 @@ public function getVersion() } /** - * @see http://php.net/manual/en/memcached.getallkeys.php + * @see https://php.net/manual/en/memcached.getallkeys.php * * @return array */ @@ -641,7 +641,7 @@ public function getAllKeys() } /** - * @see http://php.net/manual/en/memcached.flush.php + * @see https://php.net/manual/en/memcached.flush.php * * @param int $delay * @@ -652,7 +652,7 @@ public function flush($delay = 0) } /** - * @see http://php.net/manual/en/memcached.getoption.php + * @see https://php.net/manual/en/memcached.getoption.php * * @param int $option * @@ -663,7 +663,7 @@ public function getOption($option) } /** - * @see http://php.net/manual/en/memcached.setoption.php + * @see https://php.net/manual/en/memcached.setoption.php * * @param int $option * @param mixed $value @@ -675,7 +675,7 @@ public function setOption($option, $value) } /** - * @see http://php.net/manual/en/memcached.setoptions.php + * @see https://php.net/manual/en/memcached.setoptions.php * * @param array $options * @@ -686,7 +686,7 @@ public function setOptions(array $options) } /** - * @see http://php.net/manual/en/memcached.ispersistent.php + * @see https://php.net/manual/en/memcached.ispersistent.php * * @return bool */ @@ -695,7 +695,7 @@ public function isPersistent() } /** - * @see http://php.net/manual/en/memcached.ispristine.php + * @see https://php.net/manual/en/memcached.ispristine.php * * @return bool */ diff --git a/release-notes.md b/release-notes.md deleted file mode 100644 index 86fb4d259f..0000000000 --- a/release-notes.md +++ /dev/null @@ -1,13 +0,0 @@ -### Fixed -- Fixed multiple return types in stubs [#2283](https://github.com/zephir-lang/zephir/issues/2283) -- Fixed `bool` return type in stubs [#2272](https://github.com/zephir-lang/zephir/issues/2272) - -### Changed -- Removed `.zep` from stubs filenames [#2273](https://github.com/zephir-lang/zephir/issues/2273) - -## [0.14.0] - 2021-09-18 -### Added -- Added support for `require_once` [#2253](https://github.com/zephir-lang/zephir/issues/2253) - -### Changed -- Bumped minimal version of Zephir Parser to `1.4.1`. [#2284](https://github.com/zephir-lang/zephir/issues/2284) diff --git a/stub/arrayaccessarr.zep b/stub/arrayaccessarr.zep new file mode 100644 index 0000000000..ca4946972a --- /dev/null +++ b/stub/arrayaccessarr.zep @@ -0,0 +1,39 @@ +namespace Stub; + +class ArrayAccessArr implements \ArrayAccess +{ + protected test; + + public function __construct() + { + let this->test = [ + "one":1, + "two":2, + "three":3 + ]; + } + + public function offsetSet(mixed offset, mixed value) -> void + { + if is_null(offset) { + let this->test[] = value; + } else { + let this->test[offset] = value; + } + } + + public function offsetExists(mixed offset) -> bool + { + return isset this->test[offset]; + } + + public function offsetUnset(mixed offset) -> void + { + unset this->test[offset]; + } + + public function offsetGet(mixed offset) -> mixed + { + return isset this->test[offset] ? this->test[offset] : null; + } +} diff --git a/stub/arrayaccessobj.zep b/stub/arrayaccessobj.zep index 99535addf5..0245c3b6b1 100644 --- a/stub/arrayaccessobj.zep +++ b/stub/arrayaccessobj.zep @@ -6,34 +6,48 @@ class ArrayAccessObj implements \ArrayAccess public function __construct() { - let this->test = [ - "one":1, - "two":2, - "three":3 - ]; + var obj; + + let obj = new \stdClass(); + let obj->key1 = "val1"; + let obj->key2 = "val2"; + let obj->key3 = "val3"; + + let this->test = obj; } - - public function offsetSet(offset, value) + + public function offsetSet(mixed offset, mixed value) -> void { - if is_null(offset) { - let this->test[] = value; - } else { - let this->test[offset] = value; - } + var obj = this->test; + + if !is_null(offset) { + let obj->{offset} = value; + } + + let this->test = obj; } - - public function offsetExists(offset) + + public function offsetExists(mixed offset) -> bool { - return isset this->test[offset]; + var obj = this->test; + + return isset obj->{offset}; } - - public function offsetUnset(offset) + + public function offsetUnset(mixed offset) -> void { - unset this->test[offset]; + var obj = this->test; + + // It is not possible to unset dynamic property via Zend API. + let obj = (array)obj; + + unset obj[offset]; + + let this->test = (object)obj; } - - public function offsetGet(offset) + + public function offsetGet(mixed offset) -> mixed { - return isset this->test[offset] ? this->test[offset] : null; + return isset this->test->{offset} ? this->test->{offset} : null; } } diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index 4ddc9ab1bf..8efd0eef8a 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -17,7 +17,7 @@ class ArrayAccessTest { var arr; - let arr = new ArrayAccessObj(); + let arr = new ArrayAccessArr(); return isset arr["one"]; } @@ -25,7 +25,7 @@ class ArrayAccessTest { var arr; - let arr = new ArrayAccessObj(); + let arr = new ArrayAccessArr(); return arr["two"]; } diff --git a/stub/arrayiterator.zep b/stub/arrayiterator.zep index e741a0a0bd..d6d9998df7 100644 --- a/stub/arrayiterator.zep +++ b/stub/arrayiterator.zep @@ -5,7 +5,8 @@ class ArrayIterator implements \Iterator protected position = 0; protected test; - public function __construct() { + public function __construct() + { let this->test = [ "one", "two", @@ -14,23 +15,28 @@ class ArrayIterator implements \Iterator let this->position = 0; } - public function rewind() { + public function rewind() -> void + { let this->position = 0; } - public function current() { + public function current() -> mixed + { return this->test[this->position]; } - public function key() { + public function key() -> mixed + { return this->position; } - public function next() { + public function next() -> void + { let this->position++; } - public function valid() { + public function valid() -> bool + { return isset this->test[this->position]; } } diff --git a/stub/emptytest.zep b/stub/emptytest.zep index 66e3daeeff..d9f7fc72a3 100644 --- a/stub/emptytest.zep +++ b/stub/emptytest.zep @@ -6,7 +6,7 @@ namespace Stub; /** - * @link http://ru2.php.net/empty + * @link https://ru2.php.net/empty */ class EmptyTest { diff --git a/stub/internalinterfaces.zep b/stub/internalinterfaces.zep index 50542a18f3..a3c60e2ea9 100644 --- a/stub/internalinterfaces.zep +++ b/stub/internalinterfaces.zep @@ -3,8 +3,8 @@ namespace Stub; class InternalInterfaces implements \Countable { - public function count() + public function count() -> int { - + return 0; } } diff --git a/stub/oo/oonativeimplements.zep b/stub/oo/oonativeimplements.zep index 47f51b7602..c65e2c99cc 100644 --- a/stub/oo/oonativeimplements.zep +++ b/stub/oo/oonativeimplements.zep @@ -10,7 +10,8 @@ class OoNativeImplements implements \Iterator, \OuterIterator, \RecursiveIterator, - \SeekableIterator + \SeekableIterator, + \Serializable // \IteratorAggregate { @@ -22,19 +23,19 @@ class OoNativeImplements implements /* Iterator */ - public function current() + public function current() -> mixed { } - public function key() + public function key() -> mixed { } - public function next() + public function next() -> void { } - public function rewind() + public function rewind() -> void { } @@ -44,7 +45,7 @@ class OoNativeImplements implements /* OuterIterator */ - public function getInnerIterator() + public function getInnerIterator() -> <\Iterator>|null { } @@ -59,7 +60,7 @@ class OoNativeImplements implements /* SeekableIterator */ - public function seek (position) + public function seek(int position) -> void { } @@ -90,7 +91,16 @@ class OoNativeImplements implements { } - public function unserialize(string serialized) + public function unserialize(string serialized) -> void + { + } + + public function __serialize() -> array + { + return []; + } + + public function __unserialize(array data) -> void { } } diff --git a/stub/regexdna.zep b/stub/regexdna.zep index 342af0e1e3..893355a3a8 100644 --- a/stub/regexdna.zep +++ b/stub/regexdna.zep @@ -4,7 +4,7 @@ namespace Stub; /** * RegexDNA * - * @see http://www.haskell.org/haskellwiki/Shootout/Regex_DNA + * @see https://www.haskell.org/haskellwiki/Shootout/Regex_DNA */ class RegexDNA { diff --git a/stub/spectralnorm.zep b/stub/spectralnorm.zep index 90b482df6f..fdbc332742 100644 --- a/stub/spectralnorm.zep +++ b/stub/spectralnorm.zep @@ -4,7 +4,7 @@ namespace Stub; /** * SpectralNorm * - * @see http://mathworld.wolfram.com/SpectralNorm.html + * @see https://mathworld.wolfram.com/SpectralNorm.html */ class SpectralNorm { diff --git a/stub/strings.zep b/stub/strings.zep index 59ddae79e2..51f03e8e78 100644 --- a/stub/strings.zep +++ b/stub/strings.zep @@ -166,7 +166,7 @@ class Strings { var x; let value = str_replace(["\\", "\"", "'"], "", value); - let value = filter_var(value, FILTER_SANITIZE_STRING); + let value = filter_var(value, FILTER_UNSAFE_RAW); let x = trim(stripslashes(strip_tags(value))); return trim(stripcslashes(strip_tags(value))); } @@ -241,4 +241,16 @@ class Strings return null; } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/2299 + */ + public function issue2299NullableStringCondition(string roleName = null) -> string | null + { + if null !== roleName { + return roleName; + } + + return null; + } } diff --git a/stub/types/maybe.zep b/stub/types/maybe.zep new file mode 100644 index 0000000000..e3364d6c64 --- /dev/null +++ b/stub/types/maybe.zep @@ -0,0 +1,15 @@ + +namespace Stub\Types; + +class MayBe +{ + public function gc(int maxlifetime) -> int | false + { + return 1; + } + + public function gcFalse() -> int | false + { + return false; + } +} diff --git a/stub/types/mixedtype.zep b/stub/types/mixedtype.zep index 182e3d8f41..059953560e 100644 --- a/stub/types/mixedtype.zep +++ b/stub/types/mixedtype.zep @@ -84,4 +84,72 @@ class MixedType { return val; } + + public function castToStringMixedAndReturnMixed(mixed val) -> mixed + { + return (string)val; + } + + public function castToStringInternallyMixedAndReturnMixed(mixed val) -> mixed + { + let val = (string)val; + + return val; + } + + public function castToIntMixedAndReturnMixed(mixed val) -> mixed + { + return (int)val; + } + + public function castToIntInternallyMixedAndReturnMixed(mixed val) -> mixed + { + let val = (int)val; + + return val; + } + + public function castToBoolMixedAndReturnMixed(mixed val) -> mixed + { + return (bool)val; + } + + public function castToBoolInternallyMixedAndReturnMixed(mixed val) -> mixed + { + let val = (bool)val; + + return val; + } + + public function castToFloatMixedAndReturnMixed(mixed val) -> mixed + { + return (float)val; + } + + public function castToFloatInternallyMixedAndReturnMixed(mixed val) -> mixed + { + let val = (float)val; + + return val; + } + + /** + * Only used during generation + */ + public function mixedInCondition(mixed val) -> void + { + if unlikely val { + // OK + } + + if val === 1 { + // OK + } + + if 1 === val { + + } + + echo val; + } } diff --git a/stub/usetest.zep b/stub/usetest.zep index 6cc7841ca4..8567f139cd 100644 --- a/stub/usetest.zep +++ b/stub/usetest.zep @@ -16,9 +16,9 @@ class UseTest implements Countable return new StandardClass(); } - public function count() + public function count() -> int { - + return 0; } public function testUseClass1() diff --git a/templates/Api/themes/zephir/static/zephir-theme.css b/templates/Api/themes/zephir/static/zephir-theme.css index b0dd04af66..e40281edc0 100644 --- a/templates/Api/themes/zephir/static/zephir-theme.css +++ b/templates/Api/themes/zephir/static/zephir-theme.css @@ -1,4 +1,4 @@ -/* http://meyerweb.com/eric/tools/css/reset/ +/* https://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */ diff --git a/tests/Extension/ArrayAccessObjTest.php b/tests/Extension/ArrayAccessObjTest.php new file mode 100644 index 0000000000..40a08367ce --- /dev/null +++ b/tests/Extension/ArrayAccessObjTest.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 Extension; + +use PHPUnit\Framework\TestCase; +use Stub\ArrayAccessObj; + +final class ArrayAccessObjTest extends TestCase +{ + public function testOffsetSetAndOffsetExists(): void + { + $class = new ArrayAccessObj(); + + $class->offsetSet('newKey', 'new value'); + $this->assertTrue($class->offsetExists('newKey')); + } + + public function testOffsetGet(): void + { + $class = new ArrayAccessObj(); + + $class->offsetSet('newKey', 'new value'); + $this->assertSame('new value', $class->offsetGet('newKey')); + + $class->offsetSet('newKey', 1); + $this->assertSame(1, $class->offsetGet('newKey')); + + $class->offsetSet('boolean', true); + $this->assertTrue($class->offsetGet('boolean')); + } + + public function testOffsetUnset(): void + { + $class = new ArrayAccessObj(); + + $class->offsetSet('newKey', 'new value'); + $this->assertTrue($class->offsetExists('newKey')); + $class->offsetUnset('newKey'); + $this->assertFalse($class->offsetExists('newKey')); + } +} diff --git a/tests/Extension/ExitDieTest.php b/tests/Extension/ExitDieTest.php index 0ebb1ff900..c704df77fc 100644 --- a/tests/Extension/ExitDieTest.php +++ b/tests/Extension/ExitDieTest.php @@ -33,13 +33,6 @@ protected function setUp(): void $this->phpBinary .= ' -qrr'; } - $this->phpBinary .= " -d 'enable_dl=true'"; - $extension = realpath(__DIR__.'/../../ext/modules/stub.so'); - - if ($extension !== false && file_exists($extension)) { - $this->phpBinary .= sprintf(" -d 'extension=%s'", $extension); - } - parent::setUp(); } diff --git a/tests/Extension/NewInstanceOperatorTest.php b/tests/Extension/NewInstanceOperatorTest.php index 2c1f44c89b..f35793aa3d 100644 --- a/tests/Extension/NewInstanceOperatorTest.php +++ b/tests/Extension/NewInstanceOperatorTest.php @@ -21,8 +21,8 @@ final class NewInstanceOperatorTest extends TestCase public Operator $test; protected array $autoloadMap = [ - 'Fixture\ThrowException' => ZEPHIRPATH.'/tests/fixtures/throw-exception.php', - 'Fixture\EmptyClass' => ZEPHIRPATH.'/tests/fixtures/class-empty.php', + 'Fixture\ThrowException' => 'tests/fixtures/throw-exception.php', + 'Fixture\EmptyClass' => 'tests/fixtures/class-empty.php', ]; protected function setUp(): void @@ -38,15 +38,29 @@ protected function tearDown(): void public function autoload(string $className): void { - if (isset($this->autoloadMap[$className])) { - include $this->autoloadMap[$className]; + if (version_compare(PHP_VERSION, '8.1.0', '>=')) { + try { + if (isset($this->autoloadMap[$className])) { + include $this->autoloadMap[$className]; + } + } catch (\Throwable $exception) { + // Ignore, as since PHP8.1 all exceptions are thrown during file include. + } + } else { + if (isset($this->autoloadMap[$className])) { + include $this->autoloadMap[$className]; + } } } public function testException(): void { - $this->expectException(\Exception::class); - $this->test->testNewInstanceOperator('Fixture\ThrowException'); + if (version_compare(PHP_VERSION, '8.1.0', '<')) { + $this->expectException(\Exception::class); + $this->test->testNewInstanceOperator('Fixture\ThrowException'); + } else { + $this->markTestSkipped('spl_autoload_register() now can only register with valid class inside included file.'); + } } public function testNewInstance(): void diff --git a/tests/Extension/Optimizers/IsPhpVersionTest.php b/tests/Extension/Optimizers/IsPhpVersionTest.php index 32d87b0a0d..2cb88d0090 100644 --- a/tests/Extension/Optimizers/IsPhpVersionTest.php +++ b/tests/Extension/Optimizers/IsPhpVersionTest.php @@ -86,12 +86,15 @@ public function testOptimizerExceptionNegativeNumber(): void $this->isPhpVersion(-7); } - public function testOptimizerExceptionNull(): void + public function testOptimizerExceptionEmpty(): void { $this->expectException(Exception::class); $this->expectExceptionMessage('Could not parse PHP version'); - $this->isPhpVersion(null); + /** + * After PHP8.1 it is impossible to pass null value to preg_match() + */ + $this->isPhpVersion(''); } public function testZephirUsingInteger70000(): void diff --git a/tests/Extension/StringTest.php b/tests/Extension/StringTest.php index 580bc40aba..c5ae82f92a 100644 --- a/tests/Extension/StringTest.php +++ b/tests/Extension/StringTest.php @@ -330,6 +330,16 @@ public function testNullableStringReturnType(): void $this->assertSame('string', $this->test->nullableStringReturnType('string')); } + /** + * @issue https://github.com/zephir-lang/zephir/issues/2299 + */ + public function testIssue2299NullableStringCondition(): void + { + $this->assertSame(null, $this->test->issue2299NullableStringCondition()); + $this->assertSame('not-null', $this->test->issue2299NullableStringCondition('not-null')); + $this->assertSame('test', $this->test->issue2299NullableStringCondition('test')); + } + public function providerHashEquals(): array { return [ diff --git a/tests/Extension/Types/MixedTypeTest.php b/tests/Extension/Types/MixedTypeTest.php index fc198c5b69..162edba89c 100644 --- a/tests/Extension/Types/MixedTypeTest.php +++ b/tests/Extension/Types/MixedTypeTest.php @@ -83,4 +83,68 @@ public function testParamsAndReturnsOfMixedType(): void $this->assertTrue($returns->paramAndReturnMixed(true)); $this->assertNull($returns->paramAndReturnMixed(null)); } + + public function testReturnCastedMixedType(): void + { + $returns = new MixedType(); + + /** + * string + */ + $this->assertSame('123', $returns->castToStringMixedAndReturnMixed(123)); + $this->assertSame('123', $returns->castToStringMixedAndReturnMixed('123')); + $this->assertSame('string', $returns->castToStringMixedAndReturnMixed('string')); + $this->assertSame('', $returns->castToStringMixedAndReturnMixed(false)); + $this->assertSame('1', $returns->castToStringMixedAndReturnMixed(true)); + + /** + * int + */ + $this->assertSame(123, $returns->castToIntMixedAndReturnMixed('123')); + $this->assertSame(1, $returns->castToIntMixedAndReturnMixed(1.5)); + + /** + * bool + */ + $this->assertTrue($returns->castToBoolMixedAndReturnMixed(1)); + $this->assertFalse($returns->castToBoolMixedAndReturnMixed(0)); + + /** + * float + */ + $this->assertSame(1.0, $returns->castToFloatMixedAndReturnMixed(1)); + $this->assertSame(1.5, $returns->castToFloatMixedAndReturnMixed(1.5)); + } + + public function testReturnInternallyCastedCastMixedType(): void + { + $returns = new MixedType(); + + /** + * string + */ + $this->assertSame('123', $returns->castToStringInternallyMixedAndReturnMixed(123)); + $this->assertSame('123', $returns->castToStringInternallyMixedAndReturnMixed('123')); + $this->assertSame('string', $returns->castToStringInternallyMixedAndReturnMixed('string')); + $this->assertSame('', $returns->castToStringInternallyMixedAndReturnMixed(false)); + $this->assertSame('1', $returns->castToStringInternallyMixedAndReturnMixed(true)); + + /** + * int + */ + $this->assertSame(123, $returns->castToIntInternallyMixedAndReturnMixed('123')); + $this->assertSame(1, $returns->castToIntInternallyMixedAndReturnMixed(1.5)); + + /** + * bool + */ + $this->assertTrue($returns->castToBoolInternallyMixedAndReturnMixed(1)); + $this->assertFalse($returns->castToBoolInternallyMixedAndReturnMixed(0)); + + /** + * float + */ + $this->assertSame(1.0, $returns->castToFloatInternallyMixedAndReturnMixed(1)); + $this->assertSame(1.5, $returns->castToFloatInternallyMixedAndReturnMixed(1.5)); + } } diff --git a/tests/Extension/Types/UnionTypesTest.php b/tests/Extension/Types/UnionTypesTest.php new file mode 100644 index 0000000000..e740f7d397 --- /dev/null +++ b/tests/Extension/Types/UnionTypesTest.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Extension\Types; + +use PHPUnit\Framework\TestCase; +use Stub\Types\MayBe; + +final class UnionTypesTest extends TestCase +{ + public function testIntFalse(): void + { + $class = new MayBe(); + + $this->assertSame(1, $class->gc(123)); + $this->assertFalse($class->gcFalse()); + } +} diff --git a/tests/Zephir/CompilerFile/CheckDependenciesTest.php b/tests/Zephir/CompilerFile/CheckDependenciesTest.php index 5b3ed38953..1201582e70 100644 --- a/tests/Zephir/CompilerFile/CheckDependenciesTest.php +++ b/tests/Zephir/CompilerFile/CheckDependenciesTest.php @@ -1,7 +1,5 @@ [__DIR__.'/../../config.yml']]); - $logger = new TestLogger(); + $config = new Config(); + $backend = new Backend($config, 'kernels', 'templates'); + $disk = new HardDisk(realpath('..').'/tests/output'); + $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); - /** - * @var Compiler - * @var Config $config - * @var FileSystemInterface $fs - */ - $compiler = self::$kernel->getContainer()->get(Compiler::class); - $config = self::$kernel->getContainer()->get(Config::class); - $fs = self::$kernel->getContainer()->get(FileSystemInterface::class); - - $compilerFile = new CompilerFile($config, new AliasManager(), $fs); + $compiler = new Compiler($config, $backend, new Manager(new Parser()), $disk, $compilerFactory); + $compilerFile = new CompilerFile($config, new AliasManager(), $disk); $compilerFile->setClassName('myClass'); $compilerFile->setFilePath('myClass.zep'); $compilerFile->setLogger($logger); diff --git a/tests/Zephir/KernelTestCase.php b/tests/Zephir/KernelTestCase.php deleted file mode 100644 index 8e06d606bc..0000000000 --- a/tests/Zephir/KernelTestCase.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Test; - -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase as BaseTestCase; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -use Symfony\Component\HttpKernel\KernelInterface; -use Zephir\Config; -use Zephir\DependencyInjection\ZephirKernel; - -class KernelTestCase extends BaseTestCase -{ - /** - * Creates a Kernel. - * - * Available options: - * - * * environment - * * debug - * * config_files - * - * @param array $options Kernel configuration - * - * @return KernelInterface A KernelInterface instance - * - * @throws \RuntimeException - */ - protected static function createKernel(array $options = []): KernelInterface - { - if (null === static::$class) { - static::$class = static::getKernelClass(); - } - - if (isset($options['environment'])) { - $env = $options['environment']; - } elseif (isset($_ENV['APP_ENV'])) { - $env = $_ENV['APP_ENV']; - } elseif (isset($_SERVER['APP_ENV'])) { - $env = $_SERVER['APP_ENV']; - } else { - $env = 'test'; - } - - if (isset($options['debug'])) { - $debug = $options['debug']; - } elseif (isset($_ENV['APP_DEBUG'])) { - $debug = $_ENV['APP_DEBUG']; - } elseif (isset($_SERVER['APP_DEBUG'])) { - $debug = $_SERVER['APP_DEBUG']; - } else { - $debug = true; - } - - if (ZephirKernel::class === static::$class) { - $configFiles = []; - if (isset($options['config_files']) && \is_array($options['config_files'])) { - $configFiles = $options['config_files']; - } - - return new static::$class($env, $debug, $configFiles); - } else { - return new static::$class($env, $debug); - } - } - - /** - * Do not output messages from the Zephir compiler. - * - * @param ContainerInterface $container - */ - protected function muteOutput(ContainerInterface $container): void - { - try { - $container->get(Config::class)->set('silent', true); - } catch (ServiceCircularReferenceException $e) { - $this->fail($e->getMessage()); - } catch (ServiceNotFoundException $e) { - $this->fail($e->getMessage()); - } - } -} diff --git a/tests/Zephir/Stubs/DocBlockTest.php b/tests/Zephir/Stubs/DocBlockTest.php index e3be3daa0c..ac94554824 100644 --- a/tests/Zephir/Stubs/DocBlockTest.php +++ b/tests/Zephir/Stubs/DocBlockTest.php @@ -219,7 +219,7 @@ public function testPhpDocWithVariousDocBlockTags(): void * Method with various tags * @author Phalcon Team * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/) - * @license MIT http://zephir-lang.com/license.html + * @license MIT https://docs.zephir-lang.com/0.12/en/license * @link https://github.com/zephir-lang/zephir * @since 1.0.0 * @todo Something @@ -236,7 +236,7 @@ public function testPhpDocWithVariousDocBlockTags(): void * * @author Phalcon Team * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/) - * @license MIT http://zephir-lang.com/license.html + * @license MIT https://docs.zephir-lang.com/0.12/en/license * @link https://github.com/zephir-lang/zephir * @since 1.0.0 * @todo Something diff --git a/tests/config.yml b/tests/config.yml deleted file mode 100644 index 72cd084301..0000000000 --- a/tests/config.yml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: 'services.yml' } diff --git a/tests/ext-bootstrap.php b/tests/ext-bootstrap.php index 9726282c91..ecdfacba0b 100644 --- a/tests/ext-bootstrap.php +++ b/tests/ext-bootstrap.php @@ -9,21 +9,34 @@ * the LICENSE file that was distributed with this source code. */ -require_once __DIR__.'/../Library/autoload.php'; +declare(strict_types=1); + +/** + * Draw message in the Box + */ +function messageBox(string $message): string { + $line = str_repeat('━', strlen($message) + 2); + $topline = "┏{$line}┓"; + $bottomline = "┗{$line}┛"; + + return sprintf("%s\n┃ %s ┃\n%s\n\n", $topline, $message, $bottomline); +} if (!extension_loaded('phalcon')) { include_once __DIR__.'/../prototypes/phalcon.php'; } +if (!extension_loaded('psr')) { + $message = messageBox("The 'psr' extension is not loaded; Cannot run tests without it."); + exit($message); +} + if (!extension_loaded('stub')) { if ('1' == ini_get('enable_dl')) { $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; dl($prefix.'stub.'.PHP_SHLIB_SUFFIX); } else { - $message = "The 'stub' extension not loaded; cannot run tests without it"; - $line = str_repeat('-', strlen($message) + 4); - - $message = sprintf("%s\n| %s |\n%s\n\n", $line, $message, $line); + $message = messageBox("The 'stub' extension is not loaded; Cannot run tests without it."); exit($message); } } diff --git a/tests/fixtures/lifecycle/.editorconfig b/tests/fixtures/lifecycle/.editorconfig index 059d88d4f2..5e311e5ede 100644 --- a/tests/fixtures/lifecycle/.editorconfig +++ b/tests/fixtures/lifecycle/.editorconfig @@ -1,4 +1,4 @@ -# EditorConfig is awesome: http://EditorConfig.org +# EditorConfig is awesome: https://EditorConfig.org [*.{c,h}] trim_trailing_whitespace = false diff --git a/tests/fixtures/typehints/.editorconfig b/tests/fixtures/typehints/.editorconfig index 059d88d4f2..5e311e5ede 100644 --- a/tests/fixtures/typehints/.editorconfig +++ b/tests/fixtures/typehints/.editorconfig @@ -1,4 +1,4 @@ -# EditorConfig is awesome: http://EditorConfig.org +# EditorConfig is awesome: https://EditorConfig.org [*.{c,h}] trim_trailing_whitespace = false diff --git a/tests/services.yml b/tests/services.yml deleted file mode 100644 index a2a3c3217c..0000000000 --- a/tests/services.yml +++ /dev/null @@ -1,8 +0,0 @@ -services: - - Zephir\CompilerFile: - public: true - arguments: - $config: '@Zephir\Config' - $aliasManager: '@Zephir\AliasManager' - $filesystem: '@Zephir\FileSystem\FileSystemInterface' diff --git a/tests/sharness/README.md b/tests/sharness/README.md index 13a7d7a356..0c9b7ad9fb 100644 --- a/tests/sharness/README.md +++ b/tests/sharness/README.md @@ -21,9 +21,9 @@ Here's an example of parallel testing powered by a recent version of [prove][:3: ```shell $ prove --jobs 15 ./t[0-9]*.sh -./t0003-init-errors.sh .. ok -./t0002-generate.sh ..... ok -./t0001-compile.sh ...... ok +./t0003-init-errors.sh .. ok +./t0002-generate.sh ..... ok +./t0001-compile.sh ...... ok All tests successful. Files=3, Tests=6, 30 wallclock secs ( 0.04 usr 0.01 sys + 33.47 cusr 9.56 csys = 43.08 CPU) Result: PASS @@ -55,5 +55,5 @@ $ ./t0001-compile.sh -v -i ``` [:1:]: https://github.com/mlafeldt/sharness/ -[:2:]: http://testanything.org +[:2:]: https://testanything.org [:3:]: https://linux.die.net/man/1/prove diff --git a/zephir b/zephir index a7ead4c04c..4c08cf25e9 100755 --- a/zephir +++ b/zephir @@ -10,13 +10,124 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + +use Monolog\Handler\StreamHandler; +use Monolog\Logger; +use Zephir\Backends\BackendFactory; +use Zephir\Compiler; +use Zephir\Config; use Zephir\Console\Application; -use Zephir\DependencyInjection\ContainerFactory; +use Zephir\Console\Command\ApiCommand; +use Zephir\Console\Command\BuildCommand; +use Zephir\Console\Command\CleanCommand; +use Zephir\Console\Command\CompileCommand; +use Zephir\Console\Command\FullCleanCommand; +use Zephir\Console\Command\GenerateCommand; +use Zephir\Console\Command\InitCommand; +use Zephir\Console\Command\InstallCommand; +use Zephir\Console\Command\ListCommand; +use Zephir\Console\Command\StubsCommand; +use Zephir\FileSystem\HardDisk; +use Zephir\Logger\Formatter\CompilerFormatter; +use Zephir\Parser\Manager; +use Zephir\Parser\Parser; + +if (version_compare('7.0.0', PHP_VERSION, '>')) { + fprintf( + STDERR, + 'This Zephir version is supported on PHP >= 7.0.0.'.PHP_EOL. + 'You are using PHP %s (%s).'.PHP_EOL, + PHP_VERSION, + PHP_BINARY + ); + + exit(1); +} + +if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { + fprintf( + STDERR, + 'Zephir should be invoked via the CLI version of PHP, not the %s SAPI.'.PHP_EOL, + PHP_SAPI + ); + + exit(1); +} + +foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) { + if (file_exists($file)) { + include_once $file; + break; + } +} + +if (!class_exists('Composer\Autoload\ClassLoader', false)) { + fwrite(STDERR, 'Unable to find the Composer autoloader.'.PHP_EOL); + + exit(1); +} + +set_error_handler(static function ($code, $message, $file = '', $line = -1) { + if (error_reporting() & $code) { + throw new ErrorException($message, 0, $code, (string) $file, $line); + } +}); + +if (filter_var(getenv('ZEPHIR_DEBUG'), FILTER_VALIDATE_BOOLEAN)) { + set_exception_handler(static function (Throwable $t) { + fwrite(STDERR, "[ERROR] {$t->getMessage()}". PHP_EOL); + + exit(1); + }); +} + +/** + * When it is executed inside .phar, realpath() will return `false`. + */ +$rootPath = Phar::running() ?: realpath(dirname(__FILE__)); +$config = Config::fromServer(); + +/** + * Logger + */ +$formatter = new CompilerFormatter($config); + +$consoleStdErrorHandler = new StreamHandler('php://stderr', Logger::WARNING, false); +$consoleStdErrorHandler->setFormatter($formatter); + +$consoleStdOutHandler = new StreamHandler('php://stdout', Logger::INFO, false); +$consoleStdOutHandler->setFormatter($formatter); + +$handlers = [ + $consoleStdErrorHandler, + $consoleStdOutHandler, +]; + +$disk = new HardDisk(getcwd().'/.zephir'); + +$parser = new Parser(); +$logger = new Logger('zephir', $handlers); +$compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); +$backend = (new BackendFactory($config, $rootPath.'/kernels', $rootPath.'/templates')) + ->createBackend(); -require __DIR__ . '/Library/autoload.php'; -require __DIR__ . '/Library/bootstrap.php'; +$compiler = new Compiler($config, $backend, new Manager($parser), $disk, $compilerFactory); +$compiler->setPrototypesPath($rootPath.'/prototypes'); +$compiler->setOptimizersPath($rootPath.'/Library/Optimizers'); +$compiler->setTemplatesPath($rootPath.'/templates'); +$compiler->setLogger($logger); -$container = (new ContainerFactory())->create(); +$application = new Application(); +$application->add(new ApiCommand($compiler, $config)); +$application->add(new BuildCommand()); +$application->add(new CleanCommand($disk)); +$application->add(new CompileCommand($compiler)); +$application->add(new FullCleanCommand()); +$application->add(new GenerateCommand($compiler)); +$application->add(new InitCommand($backend, $config, $logger)); +$application->add(new InstallCommand($compiler, $config)); +$application->add(new ListCommand()); +$application->add(new StubsCommand($compiler)); -$application = $container->get(Application::class); $application->run();